diff --git a/dist/xeokit-sdk.cjs.js b/dist/xeokit-sdk.cjs.js index 87240afac..16c333892 100644 --- a/dist/xeokit-sdk.cjs.js +++ b/dist/xeokit-sdk.cjs.js @@ -139302,6 +139302,7 @@ class Zone extends Component { this._zoneMesh.highlighted = this._highlighted; this._zoneMesh.zone = this; + this._volume = null; const min = idx => Math.min(...pos.map(p => p[idx])); @@ -139317,6 +139318,27 @@ class Zone extends Component { this._center = math.vec3([ (xmin + xmax) / 2, (ymin + ymax) / 2, (zmin + zmax) / 2 ]); } + get volume() { + if (this._volume === null) { + // Sum the volume of tetrahedrons formed by the origin and face triangles + let volume = 0; + const geo = this._zoneMesh.geometry; + const pts = [ math.vec3(), math.vec3(), math.vec3() ]; + for (let i = 0; i < geo.indices.length; i += 3) { + for (let off = 0; off < 3; ++off) { + const p = pts[off]; + const pIdx = 3 * geo.indices[i + off]; + for (let c = 0; c < 3; ++c) { + p[c] = geo.positions[pIdx + c]; + } + } + volume += math.dotVec3(pts[0], math.cross3Vec3(pts[1], pts[2], pts[1])); + } + this._volume = volume / 6; + } + return this._volume; + } + sectionedAverage(sectionPlanes) { const planeCoords = this._geometry.planeCoordinates.slice(); @@ -140473,6 +140495,7 @@ exports.DefaultLoadingManager = DefaultLoadingManager; exports.DepthFormat = DepthFormat; exports.DepthStencilFormat = DepthStencilFormat; exports.DirLight = DirLight; +exports.DistanceMeasurementEditControl = DistanceMeasurementEditControl; exports.DistanceMeasurementEditMouseControl = DistanceMeasurementEditMouseControl; exports.DistanceMeasurementEditTouchControl = DistanceMeasurementEditTouchControl; exports.DistanceMeasurementsControl = DistanceMeasurementsControl; diff --git a/dist/xeokit-sdk.es.js b/dist/xeokit-sdk.es.js index 715687362..eb792f73a 100644 --- a/dist/xeokit-sdk.es.js +++ b/dist/xeokit-sdk.es.js @@ -139298,6 +139298,7 @@ class Zone extends Component { this._zoneMesh.highlighted = this._highlighted; this._zoneMesh.zone = this; + this._volume = null; const min = idx => Math.min(...pos.map(p => p[idx])); @@ -139313,6 +139314,27 @@ class Zone extends Component { this._center = math.vec3([ (xmin + xmax) / 2, (ymin + ymax) / 2, (zmin + zmax) / 2 ]); } + get volume() { + if (this._volume === null) { + // Sum the volume of tetrahedrons formed by the origin and face triangles + let volume = 0; + const geo = this._zoneMesh.geometry; + const pts = [ math.vec3(), math.vec3(), math.vec3() ]; + for (let i = 0; i < geo.indices.length; i += 3) { + for (let off = 0; off < 3; ++off) { + const p = pts[off]; + const pIdx = 3 * geo.indices[i + off]; + for (let c = 0; c < 3; ++c) { + p[c] = geo.positions[pIdx + c]; + } + } + volume += math.dotVec3(pts[0], math.cross3Vec3(pts[1], pts[2], pts[1])); + } + this._volume = volume / 6; + } + return this._volume; + } + sectionedAverage(sectionPlanes) { const planeCoords = this._geometry.planeCoordinates.slice(); @@ -140441,4 +140463,4 @@ class ZoneTranslateTouchControl extends ZoneTranslateControl { } } -export { AlphaFormat, AmbientLight, AngleMeasurementEditMouseControl, AngleMeasurementEditTouchControl, AngleMeasurementsControl, AngleMeasurementsMouseControl, AngleMeasurementsPlugin, AngleMeasurementsTouchControl, AnnotationsPlugin, AxisGizmoPlugin, BCFViewpointsPlugin, Bitmap, ByteType, CameraMemento, CameraPath, CameraPathAnimation, CityJSONLoaderPlugin, ClampToEdgeWrapping, Component, CompressedMediaType, Configs, ContextMenu, CubicBezierCurve, Curve, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DirLight, DistanceMeasurementEditMouseControl, DistanceMeasurementEditTouchControl, DistanceMeasurementsControl, DistanceMeasurementsMouseControl, DistanceMeasurementsPlugin, DistanceMeasurementsTouchControl, DotBIMDefaultDataSource, DotBIMLoaderPlugin, EdgeMaterial, EmphasisMaterial, FaceAlignedSectionPlanesPlugin, FastNavPlugin, FloatType, Fresnel, Frustum$1 as Frustum, FrustumPlane, GIFMediaType, GLTFDefaultDataSource, GLTFLoaderPlugin, HalfFloatType, ImagePlane, IntType, JPEGMediaType, KTX2TextureTranscoder, LASLoaderPlugin, LambertMaterial, LightMap, LineSet, LinearEncoding, LinearFilter, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, Loader, LoadingManager, LocaleService, LuminanceAlphaFormat, LuminanceFormat, Map$1 as Map, Marker, MarqueePicker, MarqueePickerMouseControl, Mesh, MetallicMaterial, MirroredRepeatWrapping, ModelMemento, NavCubePlugin, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, Node$2 as Node, OBJLoaderPlugin, ObjectsKdTree3, ObjectsMemento, PNGMediaType, Path, PerformanceModel, PhongMaterial, PickResult, Plugin, PointLight, PointerCircle, PointerLens, QuadraticBezierCurve, Queue, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, ReadableGeometry, RedFormat, RedIntegerFormat, ReflectionMap, RepeatWrapping, STLDefaultDataSource, STLLoaderPlugin, SceneModel, SceneModelMesh, SceneModelTransform, SectionPlane, SectionPlanesPlugin, ShortType, Skybox, SkyboxesPlugin, SpecularMaterial, SplineCurve, SpriteMarker, StoreyViewsPlugin, Texture, TextureTranscoder, TreeViewPlugin, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VBOGeometry, ViewCullPlugin, Viewer, WebIFCLoaderPlugin, WorkerPool$1 as WorkerPool, XKTDefaultDataSource, XKTLoaderPlugin, XML3DLoaderPlugin, ZoneEditControl, ZoneEditMouseControl, ZoneEditTouchControl, ZoneTranslateControl, ZoneTranslateMouseControl, ZoneTranslateTouchControl, ZonesMouseControl, ZonesPlugin, ZonesPolysurfaceMouseControl, ZonesPolysurfaceTouchControl, ZonesTouchControl, buildBoxGeometry, buildBoxLinesGeometry, buildBoxLinesGeometryFromAABB, buildCylinderGeometry, buildGridGeometry, buildLineGeometry, buildPlaneGeometry, buildPolylineGeometry, buildPolylineGeometryFromCurve, buildSphereGeometry, buildTorusGeometry, buildVectorTextGeometry, createRTCViewMat, frustumIntersectsAABB3, getKTX2TextureTranscoder, getPlaneRTCPos, load3DSGeometry, loadOBJGeometry, math, rtcToWorldPos, sRGBEncoding, setFrustum, stats, utils, worldToRTCPos, worldToRTCPositions }; +export { AlphaFormat, AmbientLight, AngleMeasurementEditMouseControl, AngleMeasurementEditTouchControl, AngleMeasurementsControl, AngleMeasurementsMouseControl, AngleMeasurementsPlugin, AngleMeasurementsTouchControl, AnnotationsPlugin, AxisGizmoPlugin, BCFViewpointsPlugin, Bitmap, ByteType, CameraMemento, CameraPath, CameraPathAnimation, CityJSONLoaderPlugin, ClampToEdgeWrapping, Component, CompressedMediaType, Configs, ContextMenu, CubicBezierCurve, Curve, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DirLight, DistanceMeasurementEditControl, DistanceMeasurementEditMouseControl, DistanceMeasurementEditTouchControl, DistanceMeasurementsControl, DistanceMeasurementsMouseControl, DistanceMeasurementsPlugin, DistanceMeasurementsTouchControl, DotBIMDefaultDataSource, DotBIMLoaderPlugin, EdgeMaterial, EmphasisMaterial, FaceAlignedSectionPlanesPlugin, FastNavPlugin, FloatType, Fresnel, Frustum$1 as Frustum, FrustumPlane, GIFMediaType, GLTFDefaultDataSource, GLTFLoaderPlugin, HalfFloatType, ImagePlane, IntType, JPEGMediaType, KTX2TextureTranscoder, LASLoaderPlugin, LambertMaterial, LightMap, LineSet, LinearEncoding, LinearFilter, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, Loader, LoadingManager, LocaleService, LuminanceAlphaFormat, LuminanceFormat, Map$1 as Map, Marker, MarqueePicker, MarqueePickerMouseControl, Mesh, MetallicMaterial, MirroredRepeatWrapping, ModelMemento, NavCubePlugin, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, Node$2 as Node, OBJLoaderPlugin, ObjectsKdTree3, ObjectsMemento, PNGMediaType, Path, PerformanceModel, PhongMaterial, PickResult, Plugin, PointLight, PointerCircle, PointerLens, QuadraticBezierCurve, Queue, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, ReadableGeometry, RedFormat, RedIntegerFormat, ReflectionMap, RepeatWrapping, STLDefaultDataSource, STLLoaderPlugin, SceneModel, SceneModelMesh, SceneModelTransform, SectionPlane, SectionPlanesPlugin, ShortType, Skybox, SkyboxesPlugin, SpecularMaterial, SplineCurve, SpriteMarker, StoreyViewsPlugin, Texture, TextureTranscoder, TreeViewPlugin, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VBOGeometry, ViewCullPlugin, Viewer, WebIFCLoaderPlugin, WorkerPool$1 as WorkerPool, XKTDefaultDataSource, XKTLoaderPlugin, XML3DLoaderPlugin, ZoneEditControl, ZoneEditMouseControl, ZoneEditTouchControl, ZoneTranslateControl, ZoneTranslateMouseControl, ZoneTranslateTouchControl, ZonesMouseControl, ZonesPlugin, ZonesPolysurfaceMouseControl, ZonesPolysurfaceTouchControl, ZonesTouchControl, buildBoxGeometry, buildBoxLinesGeometry, buildBoxLinesGeometryFromAABB, buildCylinderGeometry, buildGridGeometry, buildLineGeometry, buildPlaneGeometry, buildPolylineGeometry, buildPolylineGeometryFromCurve, buildSphereGeometry, buildTorusGeometry, buildVectorTextGeometry, createRTCViewMat, frustumIntersectsAABB3, getKTX2TextureTranscoder, getPlaneRTCPos, load3DSGeometry, loadOBJGeometry, math, rtcToWorldPos, sRGBEncoding, setFrustum, stats, utils, worldToRTCPos, worldToRTCPositions }; diff --git a/dist/xeokit-sdk.es5.js b/dist/xeokit-sdk.es5.js index de277419a..ed0deb5fc 100644 --- a/dist/xeokit-sdk.es5.js +++ b/dist/xeokit-sdk.es5.js @@ -24920,7 +24920,7 @@ plugin=this._plugins[_i493];if(plugin.getContainerElement){containerElement=plug * */},{key:"endSnapshot",value:function endSnapshot(){if(!this._snapshotBegun){return;}this.scene._renderer.endSnapshot();this.scene._renderer.render({force:true});this._snapshotBegun=false;}/** Destroys this Viewer. */},{key:"destroy",value:function destroy(){var plugins=this._plugins.slice();// Array will modify as we delete plugins -for(var _i495=0,len=plugins.length;_i4951&&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&&_typeof(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$3?this._createBrowserWorker():this._createNodeWorker();}_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 _this116=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){_this116.onError(new Error('No data received'));}else{_this116.onMessage(event.data);}};worker.onerror=function(error){_this116.onError(_this116._getErrorFromErrorEvent(error));_this116.terminated=true;};worker.onmessageerror=function(event){return console.error(event);};return worker;}},{key:"_createNodeWorker",value:function _createNodeWorker(){var _this117=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){_this117.onMessage(data);});worker.on('error',function(error){_this117.onError(error);});worker.on('exit',function(code){});return worker;}}],[{key:"isSupported",value:function isSupported(){return typeof Worker!=='undefined'&&isBrowser$3||_typeof(Worker$1)!==undefined;}}]);return WorkerThread;}();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);}_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__*/_regeneratorRuntime().mark(function _callee2(name){var _this118=this;var onMessage,onError,startPromise,_args2=arguments;return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1){switch(_context3.prev=_context3.next){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){_this118.jobQueue.push({name:name,onMessage:onMessage,onError:onError,onStart:onStart});return _this118;});this._startQueuedJob();_context3.next=6;return startPromise;case 6:return _context3.abrupt("return",_context3.sent);case 7:case"end":return _context3.stop();}}},_callee2,this);}));function startJob(_x7){return _startJob.apply(this,arguments);}return startJob;}()},{key:"_startQueuedJob",value:function(){var _startQueuedJob2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(){var workerThread,queuedJob,job;return _regeneratorRuntime().wrap(function _callee3$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:if(this.jobQueue.length){_context4.next=2;break;}return _context4.abrupt("return");case 2:workerThread=this._getAvailableWorker();if(workerThread){_context4.next=5;break;}return _context4.abrupt("return");case 5:queuedJob=this.jobQueue.shift();if(!queuedJob){_context4.next=18;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.prev=12;_context4.next=15;return job.result;case 15:_context4.prev=15;this.returnWorkerToQueue(workerThread);return _context4.finish(15);case 18:case"end":return _context4.stop();}}},_callee3,this,[[12,,15,18]]);}));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.count0&&arguments[0]!==undefined?arguments[0]:{};WorkerFarm._workerFarm=WorkerFarm._workerFarm||new WorkerFarm({});WorkerFarm._workerFarm.setProps(props);return WorkerFarm._workerFarm;}}]);return 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$9;assert$4(worker,'no worker provided');var workerVersion=worker.version;if(!coreVersion||!workerVersion){return false;}return true;}var ChildProcessProxy={};var node=/*#__PURE__*/Object.freeze({__proto__:null,'default':ChildProcessProxy});var VERSION$8="3.2.6";var loadLibraryPromises={};function loadLibrary(_x8){return _loadLibrary.apply(this,arguments);}function _loadLibrary(){_loadLibrary=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(libraryUrl){var moduleName,options,_args4=arguments;return _regeneratorRuntime().wrap(function _callee7$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:moduleName=_args4.length>1&&_args4[1]!==undefined?_args4[1]:null;options=_args4.length>2&&_args4[2]!==undefined?_args4[2]:{};if(moduleName){libraryUrl=getLibraryUrl(libraryUrl,moduleName,options);}loadLibraryPromises[libraryUrl]=loadLibraryPromises[libraryUrl]||loadLibraryFromFile(libraryUrl);_context11.next=6;return loadLibraryPromises[libraryUrl];case 6:return _context11.abrupt("return",_context11.sent);case 7:case"end":return _context11.stop();}}},_callee7);}));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$3){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$8,"/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__*/_regeneratorRuntime().mark(function _callee8(libraryUrl){var _response,response,scriptSource;return _regeneratorRuntime().wrap(function _callee8$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:if(!libraryUrl.endsWith('wasm')){_context12.next=7;break;}_context12.next=3;return fetch(libraryUrl);case 3:_response=_context12.sent;_context12.next=6;return _response.arrayBuffer();case 6:return _context12.abrupt("return",_context12.sent);case 7:if(isBrowser$3){_context12.next=20;break;}_context12.prev=8;_context12.t0=node&&undefined;if(!_context12.t0){_context12.next=14;break;}_context12.next=13;return undefined(libraryUrl);case 13:_context12.t0=_context12.sent;case 14:return _context12.abrupt("return",_context12.t0);case 17:_context12.prev=17;_context12.t1=_context12["catch"](8);return _context12.abrupt("return",null);case 20:if(!isWorker){_context12.next=22;break;}return _context12.abrupt("return",importScripts(libraryUrl));case 22:_context12.next=24;return fetch(libraryUrl);case 24:response=_context12.sent;_context12.next=27;return response.text();case 27:scriptSource=_context12.sent;return _context12.abrupt("return",loadLibraryFromString(scriptSource,libraryUrl));case 29:case"end":return _context12.stop();}}},_callee8,null,[[8,17]]);}));return _loadLibraryFromFile.apply(this,arguments);}function loadLibraryFromString(scriptSource,id){if(!isBrowser$3){return undefined&&undefined(scriptSource,id);}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$3&&!(options!==null&&options!==void 0&&options._nodeWorkers)){return false;}return loader.worker&&(options===null||options===void 0?void 0:options.worker);}function parseWithWorker(_x10,_x11,_x12,_x13,_x14){return _parseWithWorker.apply(this,arguments);}function _parseWithWorker(){_parseWithWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(loader,data,options,context,parseOnMainThread){var name,url,workerFarm,workerPool,job,result;return _regeneratorRuntime().wrap(function _callee9$(_context13){while(1){switch(_context13.prev=_context13.next){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||{}));_context13.next=8;return workerPool.startJob('process-on-worker',onMessage.bind(null,parseOnMainThread));case 8:job=_context13.sent;job.postMessage('process',{input:data,options:options,context:context});_context13.next=12;return job.result;case 12:result=_context13.sent;_context13.next=15;return result.result;case 15:return _context13.abrupt("return",_context13.sent);case 16:case"end":return _context13.stop();}}},_callee9);}));return _parseWithWorker.apply(this,arguments);}function onMessage(_x15,_x16,_x17,_x18){return _onMessage2.apply(this,arguments);}function _onMessage2(){_onMessage2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(parseOnMainThread,job,type,payload){var id,input,options,result,message;return _regeneratorRuntime().wrap(function _callee10$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:_context14.t0=type;_context14.next=_context14.t0==='done'?3:_context14.t0==='error'?5:_context14.t0==='process'?7:20;break;case 3:job.done(payload);return _context14.abrupt("break",21);case 5:job.error(new Error(payload.error));return _context14.abrupt("break",21);case 7:id=payload.id,input=payload.input,options=payload.options;_context14.prev=8;_context14.next=11;return parseOnMainThread(input,options);case 11:result=_context14.sent;job.postMessage('done',{id:id,result:result});_context14.next=19;break;case 15:_context14.prev=15;_context14.t1=_context14["catch"](8);message=_context14.t1 instanceof Error?_context14.t1.message:'unknown error';job.postMessage('error',{id:id,error:message});case 19:return _context14.abrupt("break",21);case 20:console.warn("parse-with-worker unknown message ".concat(type));case 21:case"end":return _context14.stop();}}},_callee10,null,[[8,15]]);}));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 _i496=0;_i496=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(_x19){return _concatenateArrayBuffersAsync.apply(this,arguments);}function _concatenateArrayBuffersAsync(){_concatenateArrayBuffersAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(asyncIterator){var arrayBuffers,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,chunk;return _regeneratorRuntime().wrap(function _callee11$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:arrayBuffers=[];_iteratorAbruptCompletion=false;_didIteratorError=false;_context15.prev=3;_iterator=_asyncIterator(asyncIterator);case 5:_context15.next=7;return _iterator.next();case 7:if(!(_iteratorAbruptCompletion=!(_step=_context15.sent).done)){_context15.next=13;break;}chunk=_step.value;arrayBuffers.push(chunk);case 10:_iteratorAbruptCompletion=false;_context15.next=5;break;case 13:_context15.next=19;break;case 15:_context15.prev=15;_context15.t0=_context15["catch"](3);_didIteratorError=true;_iteratorError=_context15.t0;case 19:_context15.prev=19;_context15.prev=20;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context15.next=24;break;}_context15.next=24;return _iterator["return"]();case 24:_context15.prev=24;if(!_didIteratorError){_context15.next=27;break;}throw _iteratorError;case 27:return _context15.finish(24);case 28:return _context15.finish(19);case 29:return _context15.abrupt("return",concatenateArrayBuffers.apply(void 0,arrayBuffers));case 30:case"end":return _context15.stop();}}},_callee11,null,[[3,15,19,29],[20,,24,28]]);}));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 filename(url){var slashIndex=url&&url.lastIndexOf('/');return slashIndex>=0?url.substr(slashIndex+1):'';}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&&_typeof(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&&_typeof(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 getResourceUrlAndType(resource){if(isResponse(resource)){var url=stripQueryString(resource.url||'');var contentTypeHeader=resource.headers.get('content-type')||'';return{url:url,type:parseMIMEType(contentTypeHeader)||parseMIMETypeFromURL(url)};}if(isBlob(resource)){return{url:stripQueryString(resource.name||''),type:resource.type||''};}if(typeof resource==='string'){return{url:stripQueryString(resource),type:parseMIMETypeFromURL(resource)};}return{url:'',type:''};}function getResourceContentLength(resource){if(isResponse(resource)){return resource.headers['content-length']||-1;}if(isBlob(resource)){return resource.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 stripQueryString(url){return url.replace(QUERY_STRING_PATTERN,'');}function makeResponse(_x20){return _makeResponse.apply(this,arguments);}function _makeResponse(){_makeResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(resource){var headers,contentLength,_getResourceUrlAndTyp3,url,type,initialDataUrl,response;return _regeneratorRuntime().wrap(function _callee12$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:if(!isResponse(resource)){_context16.next=2;break;}return _context16.abrupt("return",resource);case 2:headers={};contentLength=getResourceContentLength(resource);if(contentLength>=0){headers['content-length']=String(contentLength);}_getResourceUrlAndTyp3=getResourceUrlAndType(resource),url=_getResourceUrlAndTyp3.url,type=_getResourceUrlAndTyp3.type;if(type){headers['content-type']=type;}_context16.next=9;return getInitialDataUrl(resource);case 9:initialDataUrl=_context16.sent;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 _context16.abrupt("return",response);case 15:case"end":return _context16.stop();}}},_callee12);}));return _makeResponse.apply(this,arguments);}function checkResponse(_x21){return _checkResponse.apply(this,arguments);}function _checkResponse(){_checkResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(response){var message;return _regeneratorRuntime().wrap(function _callee13$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:if(response.ok){_context17.next=5;break;}_context17.next=3;return getResponseError(response);case 3:message=_context17.sent;throw new Error(message);case 5:case"end":return _context17.stop();}}},_callee13);}));return _checkResponse.apply(this,arguments);}function getResponseError(_x22){return _getResponseError.apply(this,arguments);}function _getResponseError(){_getResponseError=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(response){var message,contentType,text;return _regeneratorRuntime().wrap(function _callee14$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:message="Failed to fetch resource ".concat(response.url," (").concat(response.status,"): ");_context18.prev=1;contentType=response.headers.get('Content-Type');text=response.statusText;if(!contentType.includes('application/json')){_context18.next=11;break;}_context18.t0=text;_context18.t1=" ";_context18.next=9;return response.text();case 9:_context18.t2=_context18.sent;text=_context18.t0+=_context18.t1.concat.call(_context18.t1,_context18.t2);case 11:message+=text;message=message.length>60?"".concat(message.slice(0,60),"..."):message;_context18.next=17;break;case 15:_context18.prev=15;_context18.t3=_context18["catch"](1);case 17:return _context18.abrupt("return",message);case 18:case"end":return _context18.stop();}}},_callee14,null,[[1,15]]);}));return _getResponseError.apply(this,arguments);}function getInitialDataUrl(_x23){return _getInitialDataUrl.apply(this,arguments);}function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(resource){var INITIAL_DATA_LENGTH,blobSlice,slice,_base;return _regeneratorRuntime().wrap(function _callee15$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:INITIAL_DATA_LENGTH=5;if(!(typeof resource==='string')){_context19.next=3;break;}return _context19.abrupt("return","data:,".concat(resource.slice(0,INITIAL_DATA_LENGTH)));case 3:if(!(resource instanceof Blob)){_context19.next=8;break;}blobSlice=resource.slice(0,5);_context19.next=7;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 7:return _context19.abrupt("return",_context19.sent);case 8:if(!(resource instanceof ArrayBuffer)){_context19.next=12;break;}slice=resource.slice(0,INITIAL_DATA_LENGTH);_base=arrayBufferToBase64(slice);return _context19.abrupt("return","data:base64,".concat(_base));case 12:return _context19.abrupt("return",null);case 13:case"end":return _context19.stop();}}},_callee15);}));return _getInitialDataUrl.apply(this,arguments);}function arrayBufferToBase64(buffer){var binary='';var bytes=new Uint8Array(buffer);for(var _i498=0;_i498=0){return true;}return false;}function isBrowser$2(){var isNode=(typeof process==="undefined"?"undefined":_typeof(process))==='object'&&String(process)==='[object process]'&&!process.browser;return!isNode||isElectron$1();}var globals$1={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof global!=='undefined'&&global,document:typeof document!=='undefined'&&document,process:(typeof process==="undefined"?"undefined":_typeof(process))==='object'&&process};var window_$1=globals$1.window||globals$1.self||globals$1.global;var process_$1=globals$1.process||{};var VERSION$7=typeof __VERSION__!=='undefined'?__VERSION__:'untranspiled source';var isBrowser$1=isBrowser$2();function getStorage$1(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$1=/*#__PURE__*/function(){function LocalStorage$1(id,defaultSettings){var type=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'sessionStorage';_classCallCheck(this,LocalStorage$1);this.storage=getStorage$1(type);this.id=id;this.config={};Object.assign(this.config,defaultSettings);this._loadConfiguration();}_createClass(LocalStorage$1,[{key:"getConfiguration",value:function getConfiguration(){return this.config;}},{key:"setConfiguration",value:function setConfiguration(configuration){this.config={};return this.updateConfiguration(configuration);}},{key:"updateConfiguration",value:function updateConfiguration(configuration){Object.assign(this.config,configuration);if(this.storage){var serialized=JSON.stringify(this.config);this.storage.setItem(this.id,serialized);}return this;}},{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;}}]);return LocalStorage$1;}();function formatTime$1(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$1(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$1(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$1={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function getColor$1(color){return typeof color==='string'?COLOR$1[color.toUpperCase()]||COLOR$1.WHITE:color;}function addColor$1(string,color,background){if(!isBrowser$1&&typeof string==='string'){if(color){color=getColor$1(color);string="\x1B[".concat(color,"m").concat(string,"\x1B[39m");}if(background){color=getColor$1(background);string="\x1B[".concat(background+10,"m").concat(string,"\x1B[49m");}}return string;}function autobind$1(obj){var predefined=arguments.length>1&&arguments[1]!==undefined?arguments[1]:['constructor'];var proto=Object.getPrototypeOf(obj);var propNames=Object.getOwnPropertyNames(proto);var _iterator7=_createForOfIteratorHelper(propNames),_step7;try{var _loop4=function _loop4(){var key=_step7.value;if(typeof obj[key]==='function'){if(!predefined.find(function(name){return key===name;})){obj[key]=obj[key].bind(obj);}}};for(_iterator7.s();!(_step7=_iterator7.n()).done;){_loop4();}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}function assert$3(condition,message){if(!condition){throw new Error(message||'Assertion failed');}}function getHiResTimestamp$1(){var timestamp;if(isBrowser$1&&window_$1.performance){timestamp=window_$1.performance.now();}else if(process_$1.hrtime){var timeParts=process_$1.hrtime();timestamp=timeParts[0]*1000+timeParts[1]/1e6;}else{timestamp=Date.now();}return timestamp;}var originalConsole$1={debug:isBrowser$1?console.debug||console.log:console.log,log:console.log,info:console.info,warn:console.warn,error:console.error};var DEFAULT_SETTINGS$1={enabled:true,level:0};function noop$1(){}var cache$1={};var ONCE$1={once:true};function getTableHeader$1(table){for(var key in table){for(var title in table[key]){return title||'untitled';}}return'empty';}var Log$1=/*#__PURE__*/function(){function Log$1(){var _ref16=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{id:''},id=_ref16.id;_classCallCheck(this,Log$1);this.id=id;this.VERSION=VERSION$7;this._startTs=getHiResTimestamp$1();this._deltaTs=getHiResTimestamp$1();this.LOG_THROTTLE_TIMEOUT=0;this._storage=new LocalStorage$1("__probe-".concat(this.id,"__"),DEFAULT_SETTINGS$1);this.userData={};this.timeStamp("".concat(this.id," started"));autobind$1(this);Object.seal(this);}_createClass(Log$1,[{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$1()-this._startTs).toPrecision(10));}},{key:"getDelta",value:function getDelta(){return Number((getHiResTimestamp$1()-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.updateConfiguration({enabled:enabled});return this;}},{key:"setLevel",value:function setLevel(level){this._storage.updateConfiguration({level:level});return this;}},{key:"assert",value:function assert(condition,message){assert$3(condition,message);}},{key:"warn",value:function warn(message){return this._getLogFunction(0,message,originalConsole$1.warn,arguments,ONCE$1);}},{key:"error",value:function error(message){return this._getLogFunction(0,message,originalConsole$1.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$1.log,arguments,{time:true,once:true});}},{key:"log",value:function log(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole$1.debug,arguments);}},{key:"info",value:function info(logLevel,message){return this._getLogFunction(logLevel,message,console.info,arguments);}},{key:"once",value:function once(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole$1.debug||originalConsole$1.info,arguments,ONCE$1);}},{key:"table",value:function table(logLevel,_table,columns){if(_table){return this._getLogFunction(logLevel,_table,console.table||noop$1,columns&&[columns],{tag:getTableHeader$1(_table)});}return noop$1;}},{key:"image",value:function(_image6){function image(_x26){return _image6.apply(this,arguments);}image.toString=function(){return _image6.toString();};return image;}(function(_ref17){var logLevel=_ref17.logLevel,priority=_ref17.priority,image=_ref17.image,_ref17$message=_ref17.message,message=_ref17$message===void 0?'':_ref17$message,_ref17$scale=_ref17.scale,scale=_ref17$scale===void 0?1:_ref17$scale;if(!this._shouldLog(logLevel||priority)){return noop$1;}return isBrowser$1?logImageInBrowser$1({image:image,message:message,scale:scale}):logImageInNode$1({image:image,message:message,scale:scale});})},{key:"settings",value:function settings(){if(console.table){console.table(this._storage.config);}else{console.log(this._storage.config);}}},{key:"get",value:function get(setting){return this._storage.config[setting];}},{key:"set",value:function set(setting,value){this._storage.updateConfiguration(_defineProperty2({},setting,value));}},{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$1);}},{key:"group",value:function group(logLevel,message){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{collapsed:false};opts=normalizeArguments$1({logLevel:logLevel,message:message,opts:opts});var _opts=opts,collapsed=_opts.collapsed;opts.method=(collapsed?console.groupCollapsed:console.group)||console.info;return this._getLogFunction(opts);}},{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$1);}},{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$1(logLevel);}},{key:"_getLogFunction",value:function _getLogFunction(logLevel,message,method){var args=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[];var opts=arguments.length>4?arguments[4]:undefined;if(this._shouldLog(logLevel)){var _method;opts=normalizeArguments$1({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$1();var tag=opts.tag||opts.message;if(opts.once){if(!cache$1[tag]){cache$1[tag]=getHiResTimestamp$1();}else{return noop$1;}}message=decorateMessage$1(this.id,opts.message,opts);return(_method=method).bind.apply(_method,[console,message].concat(_toConsumableArray(opts.args)));}return noop$1;}}]);return Log$1;}();Log$1.VERSION=VERSION$7;function normalizeLogLevel$1(logLevel){if(!logLevel){return 0;}var resolvedLevel;switch(_typeof(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$1(opts){var logLevel=opts.logLevel,message=opts.message;opts.logLevel=normalizeLogLevel$1(logLevel);var args=opts.args?Array.from(opts.args):[];while(args.length&&args.shift()!==message){}opts.args=args;switch(_typeof(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=_typeof(opts.message);assert$3(messageType==='string'||messageType==='object');return Object.assign(opts,opts.opts);}function decorateMessage$1(id,message,opts){if(typeof message==='string'){var _time=opts.time?leftPad$1(formatTime$1(opts.total)):'';message=opts.time?"".concat(id,": ").concat(_time," ").concat(message):"".concat(id,": ").concat(message);message=addColor$1(message,opts.color,opts.background);}return message;}function logImageInNode$1(_ref18){var image=_ref18.image,_ref18$message=_ref18.message,message=_ref18$message===void 0?'':_ref18$message,_ref18$scale=_ref18.scale,scale=_ref18$scale===void 0?1:_ref18$scale;var asciify=null;try{asciify=module.require('asciify-image');}catch(error){}if(asciify){return function(){return asciify(image,{fit:'box',width:"".concat(Math.round(80*scale),"%")}).then(function(data){return console.log(data);});};}return noop$1;}function logImageInBrowser$1(_ref19){var image=_ref19.image,_ref19$message=_ref19.message,message=_ref19$message===void 0?'':_ref19$message,_ref19$scale=_ref19.scale,scale=_ref19$scale===void 0?1:_ref19$scale;if(typeof image==='string'){var img=new Image();img.onload=function(){var _console;var args=formatImage$1(img,message,scale);(_console=console).log.apply(_console,_toConsumableArray(args));};img.src=image;return noop$1;}var element=image.nodeName||'';if(element.toLowerCase()==='img'){var _console2;(_console2=console).log.apply(_console2,_toConsumableArray(formatImage$1(image,message,scale)));return noop$1;}if(element.toLowerCase()==='canvas'){var _img=new Image();_img.onload=function(){var _console3;return(_console3=console).log.apply(_console3,_toConsumableArray(formatImage$1(_img,message,scale)));};_img.src=image.toDataURL();return noop$1;}return noop$1;}var probeLog=new Log$1({id:'loaders.gl'});var NullLog=/*#__PURE__*/function(){function NullLog(){_classCallCheck(this,NullLog);}_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(){};}}]);return NullLog;}();var ConsoleLog=/*#__PURE__*/function(){function ConsoleLog(){_classCallCheck(this,ConsoleLog);_defineProperty(this,"console",void 0);this.console=console;}_createClass(ConsoleLog,[{key:"log",value:function log(){var _this$console$log;for(var _len105=arguments.length,args=new Array(_len105),_key7=0;_key7<_len105;_key7++){args[_key7]=arguments[_key7];}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 _len106=arguments.length,args=new Array(_len106),_key8=0;_key8<_len106;_key8++){args[_key8]=arguments[_key8];}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 _len107=arguments.length,args=new Array(_len107),_key9=0;_key9<_len107;_key9++){args[_key9]=arguments[_key9];}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 _len108=arguments.length,args=new Array(_len108),_key10=0;_key10<_len108;_key10++){args[_key10]=arguments[_key10];}return(_this$console$error=this.console.error).bind.apply(_this$console$error,[this.console].concat(args));}}]);return ConsoleLog;}();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$4,_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 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 validateOptions(options,loaders){validateOptionsObject(options,null,DEFAULT_LOADER_OPTIONS,REMOVED_LOADER_OPTIONS,loaders);var _iterator8=_createForOfIteratorHelper(loaders),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var loader=_step8.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){_iterator8.e(err);}finally{_iterator8.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 _iterator9=_createForOfIteratorHelper(loaders),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var loader=_step9.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){_iterator9.e(err);}finally{_iterator9.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();}function isElectron(mockUserAgent){if(typeof window!=='undefined'&&_typeof(window.process)==='object'&&window.process.type==='renderer'){return true;}if(typeof process!=='undefined'&&_typeof(process.versions)==='object'&&Boolean(process.versions.electron)){return true;}var realUserAgent=(typeof navigator==="undefined"?"undefined":_typeof(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":_typeof(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 global!=='undefined'&&global,document:typeof document!=='undefined'&&document,process:(typeof process==="undefined"?"undefined":_typeof(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){_classCallCheck(this,LocalStorage);var defaultSettings=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var type=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'sessionStorage';_defineProperty(this,"storage",void 0);_defineProperty(this,"id",void 0);_defineProperty(this,"config",{});this.storage=getStorage(type);this.id=id;this.config={};Object.assign(this.config,defaultSettings);this._loadConfiguration();}_createClass(LocalStorage,[{key:"getConfiguration",value:function getConfiguration(){return this.config;}},{key:"setConfiguration",value:function setConfiguration(configuration){this.config={};return this.updateConfiguration(configuration);}},{key:"updateConfiguration",value:function updateConfiguration(configuration){Object.assign(this.config,configuration);if(this.storage){var serialized=JSON.stringify(this.config);this.storage.setItem(this.id,serialized);}return this;}},{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;}}]);return LocalStorage;}();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 _iterator10=_createForOfIteratorHelper(propNames),_step10;try{var _loop5=function _loop5(){var key=_step10.value;if(typeof obj[key]==='function'){if(!predefined.find(function(name){return key===name;})){obj[key]=obj[key].bind(obj);}}};for(_iterator10.s();!(_step10=_iterator10.n()).done;){_loop5();}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}function assert$2(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 _ref20=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{id:''},id=_ref20.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._storage=new LocalStorage("__probe-".concat(this.id,"__"),DEFAULT_SETTINGS);this.userData={};this.timeStamp("".concat(this.id," started"));autobind(this);Object.seal(this);}_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.updateConfiguration({enabled:enabled});return this;}},{key:"setLevel",value:function setLevel(level){this._storage.updateConfiguration({level:level});return this;}},{key:"get",value:function get(setting){return this._storage.config[setting];}},{key:"set",value:function set(setting,value){this._storage.updateConfiguration(_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$2(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,_table2,columns){if(_table2){return this._getLogFunction(logLevel,_table2,console.table||noop,columns&&[columns],{tag:getTableHeader(_table2)});}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({image:image,message:message,scale:scale});}},{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 _method2;opts=normalizeArguments({logLevel:logLevel,message:message,args:args,opts:opts});method=method||opts.method;assert$2(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(_method2=method).bind.apply(_method2,[console,message].concat(_toConsumableArray(opts.args)));}return noop;}}]);return Log;}();_defineProperty(Log,"VERSION",VERSION$6);function normalizeLogLevel(logLevel){if(!logLevel){return 0;}var resolvedLevel;switch(_typeof(logLevel)){case'number':resolvedLevel=logLevel;break;case'object':resolvedLevel=logLevel.logLevel||logLevel.priority||0;break;default:return 0;}assert$2(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(_typeof(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=_typeof(opts.message);assert$2(messageType==='string'||messageType==='object');return Object.assign(opts,{args:args},opts.opts);}function decorateMessage(id,message,opts){if(typeof message==='string'){var _time2=opts.time?leftPad(formatTime(opts.total)):'';message=opts.time?"".concat(id,": ").concat(_time2," ").concat(message):"".concat(id,": ").concat(message);message=addColor(message,opts.color,opts.background);}return message;}function logImageInNode(_ref2){var image=_ref2.image,_ref2$message=_ref2.message,message=_ref2$message===void 0?'':_ref2$message,_ref2$scale=_ref2.scale,scale=_ref2$scale===void 0?1:_ref2$scale;var asciify=null;try{asciify=module.require('asciify-image');}catch(error){}if(asciify){return function(){return asciify(image,{fit:'box',width:"".concat(Math.round(80*scale),"%")}).then(function(data){return console.log(data);});};}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 _console4;var args=formatImage(img,message,scale);(_console4=console).log.apply(_console4,_toConsumableArray(args));};img.src=image;return noop;}var element=image.nodeName||'';if(element.toLowerCase()==='img'){var _console5;(_console5=console).log.apply(_console5,_toConsumableArray(formatImage(image,message,scale)));return noop;}if(element.toLowerCase()==='canvas'){var _img2=new Image();_img2.onload=function(){var _console6;return(_console6=console).log.apply(_console6,_toConsumableArray(formatImage(_img2,message,scale)));};_img2.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 log=new Log({id:'loaders.gl'});var EXT_PATTERN=/\.([^.]+)$/;function selectLoader(_x27){return _selectLoader.apply(this,arguments);}function _selectLoader(){_selectLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(data){var loaders,options,context,loader,_args15=arguments;return _regeneratorRuntime().wrap(function _callee17$(_context21){while(1){switch(_context21.prev=_context21.next){case 0:loaders=_args15.length>1&&_args15[1]!==undefined?_args15[1]:[];options=_args15.length>2?_args15[2]:undefined;context=_args15.length>3?_args15[3]:undefined;if(validHTTPResponse(data)){_context21.next=5;break;}return _context21.abrupt("return",null);case 5:loader=selectLoaderSync(data,loaders,_objectSpread(_objectSpread({},options),{},{nothrow:true}),context);if(!loader){_context21.next=8;break;}return _context21.abrupt("return",loader);case 8:if(!isBlob(data)){_context21.next=13;break;}_context21.next=11;return data.slice(0,10).arrayBuffer();case 11:data=_context21.sent;loader=selectLoaderSync(data,loaders,options,context);case 13:if(!(!loader&&!(options!==null&&options!==void 0&&options.nothrow))){_context21.next=15;break;}throw new Error(getNoValidLoaderMessage(data));case 15:return _context21.abrupt("return",loader);case 16:case"end":return _context21.stop();}}},_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 _getResourceUrlAndTyp=getResourceUrlAndType(data),url=_getResourceUrlAndTyp.url,type=_getResourceUrlAndTyp.type;var testUrl=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 _getResourceUrlAndTyp2=getResourceUrlAndType(data),url=_getResourceUrlAndTyp2.url,type=_getResourceUrlAndTyp2.type;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(_typeof(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.byteLength1&&_args5[1]!==undefined?_args5[1]:{};_options$chunkSize=options.chunkSize,chunkSize=_options$chunkSize===void 0?DEFAULT_CHUNK_SIZE$1:_options$chunkSize;byteOffset=0;case 3:if(!(byteOffset2&&arguments[2]!==undefined?arguments[2]:null;if(previousContext){return previousContext;}var resolvedContext=_objectSpread({fetch:getFetchFunction(options,context)},context);if(!Array.isArray(resolvedContext.loaders)){resolvedContext.loaders=null;}return resolvedContext;}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$3(_x31,_x32,_x33,_x34){return _parse$.apply(this,arguments);}function _parse$(){_parse$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(data,loaders,options,context){var _getResourceUrlAndTyp4,url,typedLoaders,candidateLoaders,loader;return _regeneratorRuntime().wrap(function _callee19$(_context23){while(1){switch(_context23.prev=_context23.next){case 0:assert$4(!context||_typeof(context)==='object');if(loaders&&!Array.isArray(loaders)&&!isLoaderObject(loaders)){context=undefined;options=loaders;loaders=undefined;}_context23.next=4;return data;case 4:data=_context23.sent;options=options||{};_getResourceUrlAndTyp4=getResourceUrlAndType(data),url=_getResourceUrlAndTyp4.url;typedLoaders=loaders;candidateLoaders=getLoadersFromContext(typedLoaders,context);_context23.next=11;return selectLoader(data,candidateLoaders,options);case 11:loader=_context23.sent;if(loader){_context23.next=14;break;}return _context23.abrupt("return",null);case 14:options=normalizeOptions(options,loader,candidateLoaders,url);context=getLoaderContext({url:url,parse:parse$3,loaders:candidateLoaders},options,context);_context23.next=18;return parseWithLoader(loader,data,options,context);case 18:return _context23.abrupt("return",_context23.sent);case 19:case"end":return _context23.stop();}}},_callee19);}));return _parse$.apply(this,arguments);}function parseWithLoader(_x35,_x36,_x37,_x38){return _parseWithLoader.apply(this,arguments);}function _parseWithLoader(){_parseWithLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(loader,data,options,context){var response,ok,redirected,status,statusText,type,url,headers;return _regeneratorRuntime().wrap(function _callee20$(_context24){while(1){switch(_context24.prev=_context24.next){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};}_context24.next=4;return getArrayBufferOrStringFromData(data,loader,options);case 4:data=_context24.sent;if(!(loader.parseTextSync&&typeof data==='string')){_context24.next=8;break;}options.dataType='text';return _context24.abrupt("return",loader.parseTextSync(data,options,context,loader));case 8:if(!canParseWithWorker(loader,options)){_context24.next=12;break;}_context24.next=11;return parseWithWorker(loader,data,options,context,parse$3);case 11:return _context24.abrupt("return",_context24.sent);case 12:if(!(loader.parseText&&typeof data==='string')){_context24.next=16;break;}_context24.next=15;return loader.parseText(data,options,context,loader);case 15:return _context24.abrupt("return",_context24.sent);case 16:if(!loader.parse){_context24.next=20;break;}_context24.next=19;return loader.parse(data,options,context,loader);case 19:return _context24.abrupt("return",_context24.sent);case 20:assert$4(!loader.parseSync);throw new Error("".concat(loader.id," loader - no parser found and worker is disabled"));case 22:case"end":return _context24.stop();}}},_callee20);}));return _parseWithLoader.apply(this,arguments);}var VERSION$5="3.2.6";var VERSION$4="3.2.6";var VERSION$3="3.2.6";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(_x39){return _loadBasisTrascoderModule.apply(this,arguments);}function _loadBasisTrascoderModule(){_loadBasisTrascoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(options){var modules;return _regeneratorRuntime().wrap(function _callee21$(_context25){while(1){switch(_context25.prev=_context25.next){case 0:modules=options.modules||{};if(!modules.basis){_context25.next=3;break;}return _context25.abrupt("return",modules.basis);case 3:loadBasisTranscoderPromise=loadBasisTranscoderPromise||loadBasisTrascoder(options);_context25.next=6;return loadBasisTranscoderPromise;case 6:return _context25.abrupt("return",_context25.sent);case 7:case"end":return _context25.stop();}}},_callee21);}));return _loadBasisTrascoderModule.apply(this,arguments);}function loadBasisTrascoder(_x40){return _loadBasisTrascoder.apply(this,arguments);}function _loadBasisTrascoder(){_loadBasisTrascoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(options){var BASIS,wasmBinary,_yield$Promise$all,_yield$Promise$all2;return _regeneratorRuntime().wrap(function _callee22$(_context26){while(1){switch(_context26.prev=_context26.next){case 0:BASIS=null;wasmBinary=null;_context26.t0=Promise;_context26.next=5;return loadLibrary('basis_transcoder.js','textures',options);case 5:_context26.t1=_context26.sent;_context26.next=8;return loadLibrary('basis_transcoder.wasm','textures',options);case 8:_context26.t2=_context26.sent;_context26.t3=[_context26.t1,_context26.t2];_context26.next=12;return _context26.t0.all.call(_context26.t0,_context26.t3);case 12:_yield$Promise$all=_context26.sent;_yield$Promise$all2=_slicedToArray(_yield$Promise$all,2);BASIS=_yield$Promise$all2[0];wasmBinary=_yield$Promise$all2[1];BASIS=BASIS||globalThis.BASIS;_context26.next=19;return initializeBasisTrascoderModule(BASIS,wasmBinary);case 19:return _context26.abrupt("return",_context26.sent);case 20:case"end":return _context26.stop();}}},_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(_x41){return _loadBasisEncoderModule.apply(this,arguments);}function _loadBasisEncoderModule(){_loadBasisEncoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(options){var modules;return _regeneratorRuntime().wrap(function _callee23$(_context27){while(1){switch(_context27.prev=_context27.next){case 0:modules=options.modules||{};if(!modules.basisEncoder){_context27.next=3;break;}return _context27.abrupt("return",modules.basisEncoder);case 3:loadBasisEncoderPromise=loadBasisEncoderPromise||loadBasisEncoder(options);_context27.next=6;return loadBasisEncoderPromise;case 6:return _context27.abrupt("return",_context27.sent);case 7:case"end":return _context27.stop();}}},_callee23);}));return _loadBasisEncoderModule.apply(this,arguments);}function loadBasisEncoder(_x42){return _loadBasisEncoder.apply(this,arguments);}function _loadBasisEncoder(){_loadBasisEncoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(options){var BASIS_ENCODER,wasmBinary,_yield$Promise$all3,_yield$Promise$all4;return _regeneratorRuntime().wrap(function _callee24$(_context28){while(1){switch(_context28.prev=_context28.next){case 0:BASIS_ENCODER=null;wasmBinary=null;_context28.t0=Promise;_context28.next=5;return loadLibrary(BASIS_CDN_ENCODER_JS,'textures',options);case 5:_context28.t1=_context28.sent;_context28.next=8;return loadLibrary(BASIS_CDN_ENCODER_WASM,'textures',options);case 8:_context28.t2=_context28.sent;_context28.t3=[_context28.t1,_context28.t2];_context28.next=12;return _context28.t0.all.call(_context28.t0,_context28.t3);case 12:_yield$Promise$all3=_context28.sent;_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;_context28.next=19;return initializeBasisEncoderModule(BASIS_ENCODER,wasmBinary);case 19:return _context28.abrupt("return",_context28.sent);case 20:case"end":return _context28.stop();}}},_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 _canvas6=document.createElement('canvas');return _canvas6.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.byteLength1&&_args27[1]!==undefined?_args27[1]:null;if(isEmptyObject(imagebitmapOptions)||!imagebitmapOptionsSupported){imagebitmapOptions=null;}if(!imagebitmapOptions){_context33.next=13;break;}_context33.prev=3;_context33.next=6;return createImageBitmap(blob,imagebitmapOptions);case 6:return _context33.abrupt("return",_context33.sent);case 9:_context33.prev=9;_context33.t0=_context33["catch"](3);console.warn(_context33.t0);imagebitmapOptionsSupported=false;case 13:_context33.next=15;return createImageBitmap(blob);case 15:return _context33.abrupt("return",_context33.sent);case 16:case"end":return _context33.stop();}}},_callee29,null,[[3,9]]);}));return _safeCreateImageBitmap.apply(this,arguments);}function isEmptyObject(object){for(var key in object||EMPTY_OBJECT){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);}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=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]];}}_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:"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(_typeof(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$1(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$1(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$1(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.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];}}},{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$1(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.length5&&_args30[5]!==undefined?_args30[5]:'NONE';_context36.next=3;return loadWasmInstance();case 3:instance=_context36.sent;decode$5(instance,instance.exports[DECODERS[mode]],target,count,size,source,instance.exports[FILTERS[filter||'NONE']]);case 5:case"end":return _context36.stop();}}},_callee32);}));return _meshoptDecodeGltfBuffer.apply(this,arguments);}var wasmPromise;function loadWasmInstance(){return _loadWasmInstance.apply(this,arguments);}function _loadWasmInstance(){_loadWasmInstance=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(){return _regeneratorRuntime().wrap(function _callee33$(_context37){while(1){switch(_context37.prev=_context37.next){case 0:if(!wasmPromise){wasmPromise=loadWasmModule();}return _context37.abrupt("return",wasmPromise);case 2:case"end":return _context37.stop();}}},_callee33);}));return _loadWasmInstance.apply(this,arguments);}function loadWasmModule(){return _loadWasmModule.apply(this,arguments);}function _loadWasmModule(){_loadWasmModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34(){var wasm,result;return _regeneratorRuntime().wrap(function _callee34$(_context38){while(1){switch(_context38.prev=_context38.next){case 0:wasm=wasm_base;if(WebAssembly.validate(detector)){wasm=wasm_simd;console.log('Warning: meshopt_decoder is using experimental SIMD support');}_context38.next=4;return WebAssembly.instantiate(unpack(wasm),{});case 4:result=_context38.sent;_context38.next=7;return result.instance.exports.__wasm_call_ctors();case 7:return _context38.abrupt("return",result.instance);case 8:case"end":return _context38.stop();}}},_callee34);}));return _loadWasmModule.apply(this,arguments);}function unpack(data){var result=new Uint8Array(data.length);for(var _i501=0;_i50196?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i502=0;_i502maxX?x:maxX;maxY=y>maxY?y:maxY;maxZ=_z4>maxZ?_z4:maxZ;}return[[minX,minY,minZ],[maxX,maxY,maxZ]];}function assert(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(Array.isArray(fields));checkNames(fields);this.fields=fields;this.metadata=metadata||new Map();}_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 _i504=0;_i5042&&arguments[2]!==undefined?arguments[2]:false;var metadata=arguments.length>3&&arguments[3]!==undefined?arguments[3]:new Map();_classCallCheck(this,Field);_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;}_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):'');}}]);return Field;}();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";})(Type||(Type={}));var _Symbol$toStringTag,_Symbol$toStringTag2,_Symbol$toStringTag7;var DataType=/*#__PURE__*/function(){function DataType(){_classCallCheck(this,DataType);}_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;}}]);return DataType;}();_Symbol$toStringTag=Symbol.toStringTag;var Int=/*#__PURE__*/function(_DataType,_Symbol$toStringTag3){_inherits(Int,_DataType);var _super147=_createSuper(Int);function Int(isSigned,bitWidth){var _this120;_classCallCheck(this,Int);_this120=_super147.call(this);_defineProperty(_assertThisInitialized(_this120),"isSigned",void 0);_defineProperty(_assertThisInitialized(_this120),"bitWidth",void 0);_this120.isSigned=isSigned;_this120.bitWidth=bitWidth;return _this120;}_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);}}]);return Int;}(DataType,_Symbol$toStringTag);var Int8=/*#__PURE__*/function(_Int){_inherits(Int8,_Int);var _super148=_createSuper(Int8);function Int8(){_classCallCheck(this,Int8);return _super148.call(this,true,8);}return _createClass(Int8);}(Int);var Int16=/*#__PURE__*/function(_Int2){_inherits(Int16,_Int2);var _super149=_createSuper(Int16);function Int16(){_classCallCheck(this,Int16);return _super149.call(this,true,16);}return _createClass(Int16);}(Int);var Int32=/*#__PURE__*/function(_Int3){_inherits(Int32,_Int3);var _super150=_createSuper(Int32);function Int32(){_classCallCheck(this,Int32);return _super150.call(this,true,32);}return _createClass(Int32);}(Int);var Uint8=/*#__PURE__*/function(_Int4){_inherits(Uint8,_Int4);var _super151=_createSuper(Uint8);function Uint8(){_classCallCheck(this,Uint8);return _super151.call(this,false,8);}return _createClass(Uint8);}(Int);var Uint16=/*#__PURE__*/function(_Int5){_inherits(Uint16,_Int5);var _super152=_createSuper(Uint16);function Uint16(){_classCallCheck(this,Uint16);return _super152.call(this,false,16);}return _createClass(Uint16);}(Int);var Uint32=/*#__PURE__*/function(_Int6){_inherits(Uint32,_Int6);var _super153=_createSuper(Uint32);function Uint32(){_classCallCheck(this,Uint32);return _super153.call(this,false,32);}return _createClass(Uint32);}(Int);var Precision={HALF:16,SINGLE:32,DOUBLE:64};_Symbol$toStringTag2=Symbol.toStringTag;var Float=/*#__PURE__*/function(_DataType2,_Symbol$toStringTag4){_inherits(Float,_DataType2);var _super154=_createSuper(Float);function Float(precision){var _this121;_classCallCheck(this,Float);_this121=_super154.call(this);_defineProperty(_assertThisInitialized(_this121),"precision",void 0);_this121.precision=precision;return _this121;}_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);}}]);return Float;}(DataType,_Symbol$toStringTag2);var Float32=/*#__PURE__*/function(_Float){_inherits(Float32,_Float);var _super155=_createSuper(Float32);function Float32(){_classCallCheck(this,Float32);return _super155.call(this,Precision.SINGLE);}return _createClass(Float32);}(Float);var Float64=/*#__PURE__*/function(_Float2){_inherits(Float64,_Float2);var _super156=_createSuper(Float64);function Float64(){_classCallCheck(this,Float64);return _super156.call(this,Precision.DOUBLE);}return _createClass(Float64);}(Float);_Symbol$toStringTag7=Symbol.toStringTag;var FixedSizeList=/*#__PURE__*/function(_DataType3,_Symbol$toStringTag5){_inherits(FixedSizeList,_DataType3);var _super157=_createSuper(FixedSizeList);function FixedSizeList(listSize,child){var _this122;_classCallCheck(this,FixedSizeList);_this122=_super157.call(this);_defineProperty(_assertThisInitialized(_this122),"listSize",void 0);_defineProperty(_assertThisInitialized(_this122),"children",void 0);_this122.listSize=listSize;_this122.children=[child];return _this122;}_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,">");}}]);return FixedSizeList;}(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();}_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;attributeId2&&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$3=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$3(_x72,_x73,_x74){return _decode$2.apply(this,arguments);}function _decode$2(){_decode$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(gltfData,options,context){var _options$gltf,scenegraph,promises,_iterator48,_step48,_primitive5;return _regeneratorRuntime().wrap(function _callee40$(_context44){while(1){switch(_context44.prev=_context44.next){case 0:if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context44.next=2;break;}return _context44.abrupt("return");case 2:scenegraph=new GLTFScenegraph(gltfData);promises=[];_iterator48=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph));try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){_primitive5=_step48.value;if(scenegraph.getObjectExtension(_primitive5,KHR_DRACO_MESH_COMPRESSION)){promises.push(decompressPrimitive(scenegraph,_primitive5,options,context));}}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}_context44.next=8;return Promise.all(promises);case 8:scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);case 9:case"end":return _context44.stop();}}},_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 _mesh3=_step26.value;compressMesh(_mesh3);scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterator26.e(err);}finally{_iterator26.f();}}function decompressPrimitive(_x75,_x76,_x77,_x78){return _decompressPrimitive.apply(this,arguments);}function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,parse,dracoOptions,decodedData,decodedAttributes,_i603,_Object$entries5,_Object$entries5$_i,attributeName,decodedAttribute,accessorIndex,accessor;return _regeneratorRuntime().wrap(function _callee41$(_context45){while(1){switch(_context45.prev=_context45.next){case 0:dracoExtension=scenegraph.getObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);if(dracoExtension){_context45.next=3;break;}return _context45.abrupt("return");case 3:buffer=scenegraph.getTypedArrayForBufferView(dracoExtension.bufferView);bufferCopy=sliceArrayBuffer(buffer.buffer,buffer.byteOffset);parse=context.parse;dracoOptions=_objectSpread({},options);delete dracoOptions['3d-tiles'];_context45.next=10;return parse(bufferCopy,DracoLoader,dracoOptions,context);case 10:decodedData=_context45.sent;decodedAttributes=getGLTFAccessors(decodedData.attributes);for(_i603=0,_Object$entries5=Object.entries(decodedAttributes);_i603<_Object$entries5.length;_i603++){_Object$entries5$_i=_slicedToArray(_Object$entries5[_i603],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 16:case"end":return _context45.stop();}}},_callee41);}));return _decompressPrimitive.apply(this,arguments);}function compressMesh(attributes,indices){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;var _context$parseSync;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,_mesh4,_iterator28,_step28,_primitive2;return _regeneratorRuntime().wrap(function makeMeshPrimitiveIterator$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:_iterator27=_createForOfIteratorHelper(scenegraph.json.meshes||[]);_context10.prev=1;_iterator27.s();case 3:if((_step27=_iterator27.n()).done){_context10.next=24;break;}_mesh4=_step27.value;_iterator28=_createForOfIteratorHelper(_mesh4.primitives);_context10.prev=6;_iterator28.s();case 8:if((_step28=_iterator28.n()).done){_context10.next=14;break;}_primitive2=_step28.value;_context10.next=12;return _primitive2;case 12:_context10.next=8;break;case 14:_context10.next=19;break;case 16:_context10.prev=16;_context10.t0=_context10["catch"](6);_iterator28.e(_context10.t0);case 19:_context10.prev=19;_iterator28.f();return _context10.finish(19);case 22:_context10.next=3;break;case 24:_context10.next=29;break;case 26:_context10.prev=26;_context10.t1=_context10["catch"](1);_iterator27.e(_context10.t1);case 29:_context10.prev=29;_iterator27.f();return _context10.finish(29);case 32:case"end":return _context10.stop();}}},_marked3,null,[[1,26,29,32],[6,16,19,22]]);}var KHR_draco_mesh_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$3,preprocess:preprocess$1,decode:decode$3,encode:encode$3});var KHR_LIGHTS_PUNCTUAL='KHR_lights_punctual';var name$2=KHR_LIGHTS_PUNCTUAL;function decode$2(_x79){return _decode$3.apply(this,arguments);}function _decode$3(){_decode$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(gltfData){var gltfScenegraph,json,extension,_iterator49,_step49,_node12,nodeExtension;return _regeneratorRuntime().wrap(function _callee42$(_context46){while(1){switch(_context46.prev=_context46.next){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);}_iterator49=_createForOfIteratorHelper(json.nodes||[]);try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){_node12=_step49.value;nodeExtension=gltfScenegraph.getObjectExtension(_node12,KHR_LIGHTS_PUNCTUAL);if(nodeExtension){_node12.light=nodeExtension.light;}gltfScenegraph.removeObjectExtension(_node12,KHR_LIGHTS_PUNCTUAL);}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}case 6:case"end":return _context46.stop();}}},_callee42);}));return _decode$3.apply(this,arguments);}function encode$2(_x80){return _encode$.apply(this,arguments);}function _encode$(){_encode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(gltfData){var gltfScenegraph,json,extension,_iterator50,_step50,light,_node13;return _regeneratorRuntime().wrap(function _callee43$(_context47){while(1){switch(_context47.prev=_context47.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;if(json.lights){extension=gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);assert$1(!extension.lights);extension.lights=json.lights;delete json.lights;}if(gltfScenegraph.json.lights){_iterator50=_createForOfIteratorHelper(gltfScenegraph.json.lights);try{for(_iterator50.s();!(_step50=_iterator50.n()).done;){light=_step50.value;_node13=light.node;gltfScenegraph.addObjectExtension(_node13,KHR_LIGHTS_PUNCTUAL,light);}}catch(err){_iterator50.e(err);}finally{_iterator50.f();}delete gltfScenegraph.json.lights;}case 4:case"end":return _context47.stop();}}},_callee43);}));return _encode$.apply(this,arguments);}var KHR_lights_punctual=/*#__PURE__*/Object.freeze({__proto__:null,name:name$2,decode:decode$2,encode:encode$2});var KHR_MATERIALS_UNLIT='KHR_materials_unlit';var name$1=KHR_MATERIALS_UNLIT;function decode$1(_x81){return _decode$4.apply(this,arguments);}function _decode$4(){_decode$4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee44(gltfData){var gltfScenegraph,json,_iterator51,_step51,material,extension;return _regeneratorRuntime().wrap(function _callee44$(_context48){while(1){switch(_context48.prev=_context48.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);_iterator51=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){material=_step51.value;extension=material.extensions&&material.extensions.KHR_materials_unlit;if(extension){material.unlit=true;}gltfScenegraph.removeObjectExtension(material,KHR_MATERIALS_UNLIT);}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}case 5:case"end":return _context48.stop();}}},_callee44);}));return _decode$4.apply(this,arguments);}function encode$1(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;if(gltfScenegraph.materials){var _iterator29=_createForOfIteratorHelper(json.materials||[]),_step29;try{for(_iterator29.s();!(_step29=_iterator29.n()).done;){var material=_step29.value;if(material.unlit){delete material.unlit;gltfScenegraph.addObjectExtension(material,KHR_MATERIALS_UNLIT,{});gltfScenegraph.addExtension(KHR_MATERIALS_UNLIT);}}}catch(err){_iterator29.e(err);}finally{_iterator29.f();}}}var KHR_materials_unlit=/*#__PURE__*/Object.freeze({__proto__:null,name:name$1,decode:decode$1,encode:encode$1});var KHR_TECHNIQUES_WEBGL='KHR_techniques_webgl';var name=KHR_TECHNIQUES_WEBGL;function decode(_x82){return _decode.apply(this,arguments);}function _decode(){_decode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee45(gltfData){var gltfScenegraph,json,extension,techniques,_iterator52,_step52,material,materialExtension;return _regeneratorRuntime().wrap(function _callee45$(_context49){while(1){switch(_context49.prev=_context49.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_TECHNIQUES_WEBGL);if(extension){techniques=resolveTechniques(extension,gltfScenegraph);_iterator52=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator52.s();!(_step52=_iterator52.n()).done;){material=_step52.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){_iterator52.e(err);}finally{_iterator52.f();}gltfScenegraph.removeExtension(KHR_TECHNIQUES_WEBGL);}case 4:case"end":return _context49.stop();}}},_callee45);}));return _decode.apply(this,arguments);}function encode(_x83,_x84){return _encode.apply(this,arguments);}function _encode(){_encode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee46(gltfData,options){return _regeneratorRuntime().wrap(function _callee46$(_context50){while(1){switch(_context50.prev=_context50.next){case 0:case"end":return _context50.stop();}}},_callee46);}));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(_typeof(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,decode:decode,encode:encode});var EXTENSIONS=[EXT_meshopt_compression,EXT_texture_webp,KHR_texture_basisu,KHR_draco_mesh_compression,KHR_lights_punctual,KHR_materials_unlit,KHR_techniques_webgl];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 _iterator30=_createForOfIteratorHelper(extensions),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var extension=_step30.value;var _extension$preprocess;(_extension$preprocess=extension.preprocess)===null||_extension$preprocess===void 0?void 0:_extension$preprocess.call(extension,gltf,options,context);}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}}function decodeExtensions(_x85){return _decodeExtensions.apply(this,arguments);}function _decodeExtensions(){_decodeExtensions=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(gltf){var options,context,extensions,_iterator53,_step53,extension,_extension$decode,_args45=arguments;return _regeneratorRuntime().wrap(function _callee47$(_context51){while(1){switch(_context51.prev=_context51.next){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);});_iterator53=_createForOfIteratorHelper(extensions);_context51.prev=4;_iterator53.s();case 6:if((_step53=_iterator53.n()).done){_context51.next=12;break;}extension=_step53.value;_context51.next=10;return(_extension$decode=extension.decode)===null||_extension$decode===void 0?void 0:_extension$decode.call(extension,gltf,options,context);case 10:_context51.next=6;break;case 12:_context51.next=17;break;case 14:_context51.prev=14;_context51.t0=_context51["catch"](4);_iterator53.e(_context51.t0);case 17:_context51.prev=17;_iterator53.f();return _context51.finish(17);case 20:case"end":return _context51.stop();}}},_callee47,null,[[4,14,17,20]]);}));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 _iterator31=_createForOfIteratorHelper(json.images||[]),_step31;try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var _image7=_step31.value;var extension=gltfScenegraph.getObjectExtension(_image7,KHR_BINARY_GLTF);if(extension){Object.assign(_image7,extension);}gltfScenegraph.removeObjectExtension(_image7,KHR_BINARY_GLTF);}}catch(err){_iterator31.e(err);}finally{_iterator31.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);}_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 _iterator32=_createForOfIteratorHelper(json.textures),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var texture=_step32.value;this._convertTextureIds(texture);}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}var _iterator33=_createForOfIteratorHelper(json.meshes),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var _mesh5=_step33.value;this._convertMeshIds(_mesh5);}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}var _iterator34=_createForOfIteratorHelper(json.nodes),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var _node4=_step34.value;this._convertNodeIds(_node4);}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}var _iterator35=_createForOfIteratorHelper(json.scenes),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _node5=_step35.value;this._convertSceneIds(_node5);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}}},{key:"_convertTextureIds",value:function _convertTextureIds(texture){if(texture.source){texture.source=this._convertIdToIndex(texture.source,'image');}}},{key:"_convertMeshIds",value:function _convertMeshIds(mesh){var _iterator36=_createForOfIteratorHelper(mesh.primitives),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var _primitive3=_step36.value;var attributes=_primitive3.attributes,indices=_primitive3.indices,material=_primitive3.material;for(var attributeName in attributes){attributes[attributeName]=this._convertIdToIndex(attributes[attributeName],'accessor');}if(indices){_primitive3.indices=this._convertIdToIndex(indices,'accessor');}if(material){_primitive3.material=this._convertIdToIndex(material,'material');}}}catch(err){_iterator36.e(err);}finally{_iterator36.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 _iterator37=_createForOfIteratorHelper(json[topLevelArrayName]),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var object=_step37.value;for(var key in object){var id=object[key];var index=this._convertIdToIndex(id,key);object[key]=index;}}}catch(err){_iterator37.e(err);}finally{_iterator37.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 _iterator38=_createForOfIteratorHelper(this.json.buffers),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var buffer=_step38.value;delete buffer.type;}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}}},{key:"_updateMaterial",value:function _updateMaterial(json){var _iterator39=_createForOfIteratorHelper(json.materials),_step39;try{var _loop6=function _loop6(){var material=_step39.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);var textureIndex=json.textures.findIndex(function(texture){return texture.id===textureId;});if(textureIndex!==-1){material.pbrMetallicRoughness.baseColorTexture={index:textureIndex};}};for(_iterator39.s();!(_step39=_iterator39.n()).done;){var _material$values,_material$values2;_loop6();}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}}}]);return GLTFV1Normalizer;}();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=(_DEFAULT_SAMPLER={},_defineProperty2(_DEFAULT_SAMPLER,GL_SAMPLER.TEXTURE_MAG_FILTER,GL_SAMPLER.LINEAR),_defineProperty2(_DEFAULT_SAMPLER,GL_SAMPLER.TEXTURE_MIN_FILTER,GL_SAMPLER.NEAREST_MIPMAP_LINEAR),_defineProperty2(_DEFAULT_SAMPLER,GL_SAMPLER.TEXTURE_WRAP_S,GL_SAMPLER.REPEAT),_defineProperty2(_DEFAULT_SAMPLER,GL_SAMPLER.TEXTURE_WRAP_T,GL_SAMPLER.REPEAT),_DEFAULT_SAMPLER);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",[]);}_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$1(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;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};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(_typeof(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 _getAccessorArrayType2=getAccessorArrayTypeAndLength(accessor,accessor.bufferView),ArrayType=_getAccessorArrayType2.ArrayType,byteLength=_getAccessorArrayType2.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 _i510=0;_i5101&&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 options=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};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,options={});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__*/_regeneratorRuntime().mark(function _callee48(gltf,arrayBufferOrString){var byteOffset,options,context,_options$gltf,_options$gltf2,_options$gltf3,_options$gltf4,promises,_promise,promise,_args46=arguments;return _regeneratorRuntime().wrap(function _callee48$(_context52){while(1){switch(_context52.prev=_context52.next){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)){_context52.next=10;break;}_context52.next=10;return loadBuffers(gltf,options,context);case 10: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);_context52.next=15;return Promise.all(promises);case 15:return _context52.abrupt("return",options!==null&&options!==void 0&&(_options$gltf4=options.gltf)!==null&&_options$gltf4!==void 0&&_options$gltf4.postProcess?postProcessGLTF(gltf,options):gltf);case 16:case"end":return _context52.stop();}}},_callee48);}));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$1(glb.type==='glTF',"Invalid GLB magic string ".concat(glb.type));gltf._glb=glb;gltf.json=glb.json;}else{assert$1(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__*/_regeneratorRuntime().mark(function _callee49(gltf,options,context){var buffers,_i604,buffer,_context$fetch,_response$arrayBuffer,_fetch,uri,response,arrayBuffer;return _regeneratorRuntime().wrap(function _callee49$(_context53){while(1){switch(_context53.prev=_context53.next){case 0:buffers=gltf.json.buffers||[];_i604=0;case 2:if(!(_i6041&&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&&_typeof(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$3?this._createBrowserWorker():this._createNodeWorker();}_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 _this116=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){_this116.onError(new Error('No data received'));}else{_this116.onMessage(event.data);}};worker.onerror=function(error){_this116.onError(_this116._getErrorFromErrorEvent(error));_this116.terminated=true;};worker.onmessageerror=function(event){return console.error(event);};return worker;}},{key:"_createNodeWorker",value:function _createNodeWorker(){var _this117=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){_this117.onMessage(data);});worker.on('error',function(error){_this117.onError(error);});worker.on('exit',function(code){});return worker;}}],[{key:"isSupported",value:function isSupported(){return typeof Worker!=='undefined'&&isBrowser$3||_typeof(Worker$1)!==undefined;}}]);return WorkerThread;}();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);}_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__*/_regeneratorRuntime().mark(function _callee2(name){var _this118=this;var onMessage,onError,startPromise,_args2=arguments;return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1){switch(_context3.prev=_context3.next){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){_this118.jobQueue.push({name:name,onMessage:onMessage,onError:onError,onStart:onStart});return _this118;});this._startQueuedJob();_context3.next=6;return startPromise;case 6:return _context3.abrupt("return",_context3.sent);case 7:case"end":return _context3.stop();}}},_callee2,this);}));function startJob(_x7){return _startJob.apply(this,arguments);}return startJob;}()},{key:"_startQueuedJob",value:function(){var _startQueuedJob2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(){var workerThread,queuedJob,job;return _regeneratorRuntime().wrap(function _callee3$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:if(this.jobQueue.length){_context4.next=2;break;}return _context4.abrupt("return");case 2:workerThread=this._getAvailableWorker();if(workerThread){_context4.next=5;break;}return _context4.abrupt("return");case 5:queuedJob=this.jobQueue.shift();if(!queuedJob){_context4.next=18;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.prev=12;_context4.next=15;return job.result;case 15:_context4.prev=15;this.returnWorkerToQueue(workerThread);return _context4.finish(15);case 18:case"end":return _context4.stop();}}},_callee3,this,[[12,,15,18]]);}));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.count0&&arguments[0]!==undefined?arguments[0]:{};WorkerFarm._workerFarm=WorkerFarm._workerFarm||new WorkerFarm({});WorkerFarm._workerFarm.setProps(props);return WorkerFarm._workerFarm;}}]);return 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$9;assert$4(worker,'no worker provided');var workerVersion=worker.version;if(!coreVersion||!workerVersion){return false;}return true;}var ChildProcessProxy={};var node=/*#__PURE__*/Object.freeze({__proto__:null,'default':ChildProcessProxy});var VERSION$8="3.2.6";var loadLibraryPromises={};function loadLibrary(_x8){return _loadLibrary.apply(this,arguments);}function _loadLibrary(){_loadLibrary=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(libraryUrl){var moduleName,options,_args4=arguments;return _regeneratorRuntime().wrap(function _callee7$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:moduleName=_args4.length>1&&_args4[1]!==undefined?_args4[1]:null;options=_args4.length>2&&_args4[2]!==undefined?_args4[2]:{};if(moduleName){libraryUrl=getLibraryUrl(libraryUrl,moduleName,options);}loadLibraryPromises[libraryUrl]=loadLibraryPromises[libraryUrl]||loadLibraryFromFile(libraryUrl);_context11.next=6;return loadLibraryPromises[libraryUrl];case 6:return _context11.abrupt("return",_context11.sent);case 7:case"end":return _context11.stop();}}},_callee7);}));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$3){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$8,"/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__*/_regeneratorRuntime().mark(function _callee8(libraryUrl){var _response,response,scriptSource;return _regeneratorRuntime().wrap(function _callee8$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:if(!libraryUrl.endsWith('wasm')){_context12.next=7;break;}_context12.next=3;return fetch(libraryUrl);case 3:_response=_context12.sent;_context12.next=6;return _response.arrayBuffer();case 6:return _context12.abrupt("return",_context12.sent);case 7:if(isBrowser$3){_context12.next=20;break;}_context12.prev=8;_context12.t0=node&&undefined;if(!_context12.t0){_context12.next=14;break;}_context12.next=13;return undefined(libraryUrl);case 13:_context12.t0=_context12.sent;case 14:return _context12.abrupt("return",_context12.t0);case 17:_context12.prev=17;_context12.t1=_context12["catch"](8);return _context12.abrupt("return",null);case 20:if(!isWorker){_context12.next=22;break;}return _context12.abrupt("return",importScripts(libraryUrl));case 22:_context12.next=24;return fetch(libraryUrl);case 24:response=_context12.sent;_context12.next=27;return response.text();case 27:scriptSource=_context12.sent;return _context12.abrupt("return",loadLibraryFromString(scriptSource,libraryUrl));case 29:case"end":return _context12.stop();}}},_callee8,null,[[8,17]]);}));return _loadLibraryFromFile.apply(this,arguments);}function loadLibraryFromString(scriptSource,id){if(!isBrowser$3){return undefined&&undefined(scriptSource,id);}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$3&&!(options!==null&&options!==void 0&&options._nodeWorkers)){return false;}return loader.worker&&(options===null||options===void 0?void 0:options.worker);}function parseWithWorker(_x10,_x11,_x12,_x13,_x14){return _parseWithWorker.apply(this,arguments);}function _parseWithWorker(){_parseWithWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(loader,data,options,context,parseOnMainThread){var name,url,workerFarm,workerPool,job,result;return _regeneratorRuntime().wrap(function _callee9$(_context13){while(1){switch(_context13.prev=_context13.next){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||{}));_context13.next=8;return workerPool.startJob('process-on-worker',onMessage.bind(null,parseOnMainThread));case 8:job=_context13.sent;job.postMessage('process',{input:data,options:options,context:context});_context13.next=12;return job.result;case 12:result=_context13.sent;_context13.next=15;return result.result;case 15:return _context13.abrupt("return",_context13.sent);case 16:case"end":return _context13.stop();}}},_callee9);}));return _parseWithWorker.apply(this,arguments);}function onMessage(_x15,_x16,_x17,_x18){return _onMessage2.apply(this,arguments);}function _onMessage2(){_onMessage2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(parseOnMainThread,job,type,payload){var id,input,options,result,message;return _regeneratorRuntime().wrap(function _callee10$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:_context14.t0=type;_context14.next=_context14.t0==='done'?3:_context14.t0==='error'?5:_context14.t0==='process'?7:20;break;case 3:job.done(payload);return _context14.abrupt("break",21);case 5:job.error(new Error(payload.error));return _context14.abrupt("break",21);case 7:id=payload.id,input=payload.input,options=payload.options;_context14.prev=8;_context14.next=11;return parseOnMainThread(input,options);case 11:result=_context14.sent;job.postMessage('done',{id:id,result:result});_context14.next=19;break;case 15:_context14.prev=15;_context14.t1=_context14["catch"](8);message=_context14.t1 instanceof Error?_context14.t1.message:'unknown error';job.postMessage('error',{id:id,error:message});case 19:return _context14.abrupt("break",21);case 20:console.warn("parse-with-worker unknown message ".concat(type));case 21:case"end":return _context14.stop();}}},_callee10,null,[[8,15]]);}));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 _i496=0;_i496=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(_x19){return _concatenateArrayBuffersAsync.apply(this,arguments);}function _concatenateArrayBuffersAsync(){_concatenateArrayBuffersAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(asyncIterator){var arrayBuffers,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,chunk;return _regeneratorRuntime().wrap(function _callee11$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:arrayBuffers=[];_iteratorAbruptCompletion=false;_didIteratorError=false;_context15.prev=3;_iterator=_asyncIterator(asyncIterator);case 5:_context15.next=7;return _iterator.next();case 7:if(!(_iteratorAbruptCompletion=!(_step=_context15.sent).done)){_context15.next=13;break;}chunk=_step.value;arrayBuffers.push(chunk);case 10:_iteratorAbruptCompletion=false;_context15.next=5;break;case 13:_context15.next=19;break;case 15:_context15.prev=15;_context15.t0=_context15["catch"](3);_didIteratorError=true;_iteratorError=_context15.t0;case 19:_context15.prev=19;_context15.prev=20;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context15.next=24;break;}_context15.next=24;return _iterator["return"]();case 24:_context15.prev=24;if(!_didIteratorError){_context15.next=27;break;}throw _iteratorError;case 27:return _context15.finish(24);case 28:return _context15.finish(19);case 29:return _context15.abrupt("return",concatenateArrayBuffers.apply(void 0,arrayBuffers));case 30:case"end":return _context15.stop();}}},_callee11,null,[[3,15,19,29],[20,,24,28]]);}));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 filename(url){var slashIndex=url&&url.lastIndexOf('/');return slashIndex>=0?url.substr(slashIndex+1):'';}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&&_typeof(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&&_typeof(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 getResourceUrlAndType(resource){if(isResponse(resource)){var url=stripQueryString(resource.url||'');var contentTypeHeader=resource.headers.get('content-type')||'';return{url:url,type:parseMIMEType(contentTypeHeader)||parseMIMETypeFromURL(url)};}if(isBlob(resource)){return{url:stripQueryString(resource.name||''),type:resource.type||''};}if(typeof resource==='string'){return{url:stripQueryString(resource),type:parseMIMETypeFromURL(resource)};}return{url:'',type:''};}function getResourceContentLength(resource){if(isResponse(resource)){return resource.headers['content-length']||-1;}if(isBlob(resource)){return resource.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 stripQueryString(url){return url.replace(QUERY_STRING_PATTERN,'');}function makeResponse(_x20){return _makeResponse.apply(this,arguments);}function _makeResponse(){_makeResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(resource){var headers,contentLength,_getResourceUrlAndTyp3,url,type,initialDataUrl,response;return _regeneratorRuntime().wrap(function _callee12$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:if(!isResponse(resource)){_context16.next=2;break;}return _context16.abrupt("return",resource);case 2:headers={};contentLength=getResourceContentLength(resource);if(contentLength>=0){headers['content-length']=String(contentLength);}_getResourceUrlAndTyp3=getResourceUrlAndType(resource),url=_getResourceUrlAndTyp3.url,type=_getResourceUrlAndTyp3.type;if(type){headers['content-type']=type;}_context16.next=9;return getInitialDataUrl(resource);case 9:initialDataUrl=_context16.sent;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 _context16.abrupt("return",response);case 15:case"end":return _context16.stop();}}},_callee12);}));return _makeResponse.apply(this,arguments);}function checkResponse(_x21){return _checkResponse.apply(this,arguments);}function _checkResponse(){_checkResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(response){var message;return _regeneratorRuntime().wrap(function _callee13$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:if(response.ok){_context17.next=5;break;}_context17.next=3;return getResponseError(response);case 3:message=_context17.sent;throw new Error(message);case 5:case"end":return _context17.stop();}}},_callee13);}));return _checkResponse.apply(this,arguments);}function getResponseError(_x22){return _getResponseError.apply(this,arguments);}function _getResponseError(){_getResponseError=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(response){var message,contentType,text;return _regeneratorRuntime().wrap(function _callee14$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:message="Failed to fetch resource ".concat(response.url," (").concat(response.status,"): ");_context18.prev=1;contentType=response.headers.get('Content-Type');text=response.statusText;if(!contentType.includes('application/json')){_context18.next=11;break;}_context18.t0=text;_context18.t1=" ";_context18.next=9;return response.text();case 9:_context18.t2=_context18.sent;text=_context18.t0+=_context18.t1.concat.call(_context18.t1,_context18.t2);case 11:message+=text;message=message.length>60?"".concat(message.slice(0,60),"..."):message;_context18.next=17;break;case 15:_context18.prev=15;_context18.t3=_context18["catch"](1);case 17:return _context18.abrupt("return",message);case 18:case"end":return _context18.stop();}}},_callee14,null,[[1,15]]);}));return _getResponseError.apply(this,arguments);}function getInitialDataUrl(_x23){return _getInitialDataUrl.apply(this,arguments);}function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(resource){var INITIAL_DATA_LENGTH,blobSlice,slice,_base;return _regeneratorRuntime().wrap(function _callee15$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:INITIAL_DATA_LENGTH=5;if(!(typeof resource==='string')){_context19.next=3;break;}return _context19.abrupt("return","data:,".concat(resource.slice(0,INITIAL_DATA_LENGTH)));case 3:if(!(resource instanceof Blob)){_context19.next=8;break;}blobSlice=resource.slice(0,5);_context19.next=7;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 7:return _context19.abrupt("return",_context19.sent);case 8:if(!(resource instanceof ArrayBuffer)){_context19.next=12;break;}slice=resource.slice(0,INITIAL_DATA_LENGTH);_base=arrayBufferToBase64(slice);return _context19.abrupt("return","data:base64,".concat(_base));case 12:return _context19.abrupt("return",null);case 13:case"end":return _context19.stop();}}},_callee15);}));return _getInitialDataUrl.apply(this,arguments);}function arrayBufferToBase64(buffer){var binary='';var bytes=new Uint8Array(buffer);for(var _i498=0;_i498=0){return true;}return false;}function isBrowser$2(){var isNode=(typeof process==="undefined"?"undefined":_typeof(process))==='object'&&String(process)==='[object process]'&&!process.browser;return!isNode||isElectron$1();}var globals$1={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof global!=='undefined'&&global,document:typeof document!=='undefined'&&document,process:(typeof process==="undefined"?"undefined":_typeof(process))==='object'&&process};var window_$1=globals$1.window||globals$1.self||globals$1.global;var process_$1=globals$1.process||{};var VERSION$7=typeof __VERSION__!=='undefined'?__VERSION__:'untranspiled source';var isBrowser$1=isBrowser$2();function getStorage$1(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$1=/*#__PURE__*/function(){function LocalStorage$1(id,defaultSettings){var type=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'sessionStorage';_classCallCheck(this,LocalStorage$1);this.storage=getStorage$1(type);this.id=id;this.config={};Object.assign(this.config,defaultSettings);this._loadConfiguration();}_createClass(LocalStorage$1,[{key:"getConfiguration",value:function getConfiguration(){return this.config;}},{key:"setConfiguration",value:function setConfiguration(configuration){this.config={};return this.updateConfiguration(configuration);}},{key:"updateConfiguration",value:function updateConfiguration(configuration){Object.assign(this.config,configuration);if(this.storage){var serialized=JSON.stringify(this.config);this.storage.setItem(this.id,serialized);}return this;}},{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;}}]);return LocalStorage$1;}();function formatTime$1(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$1(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$1(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$1={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function getColor$1(color){return typeof color==='string'?COLOR$1[color.toUpperCase()]||COLOR$1.WHITE:color;}function addColor$1(string,color,background){if(!isBrowser$1&&typeof string==='string'){if(color){color=getColor$1(color);string="\x1B[".concat(color,"m").concat(string,"\x1B[39m");}if(background){color=getColor$1(background);string="\x1B[".concat(background+10,"m").concat(string,"\x1B[49m");}}return string;}function autobind$1(obj){var predefined=arguments.length>1&&arguments[1]!==undefined?arguments[1]:['constructor'];var proto=Object.getPrototypeOf(obj);var propNames=Object.getOwnPropertyNames(proto);var _iterator7=_createForOfIteratorHelper(propNames),_step7;try{var _loop4=function _loop4(){var key=_step7.value;if(typeof obj[key]==='function'){if(!predefined.find(function(name){return key===name;})){obj[key]=obj[key].bind(obj);}}};for(_iterator7.s();!(_step7=_iterator7.n()).done;){_loop4();}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}function assert$3(condition,message){if(!condition){throw new Error(message||'Assertion failed');}}function getHiResTimestamp$1(){var timestamp;if(isBrowser$1&&window_$1.performance){timestamp=window_$1.performance.now();}else if(process_$1.hrtime){var timeParts=process_$1.hrtime();timestamp=timeParts[0]*1000+timeParts[1]/1e6;}else{timestamp=Date.now();}return timestamp;}var originalConsole$1={debug:isBrowser$1?console.debug||console.log:console.log,log:console.log,info:console.info,warn:console.warn,error:console.error};var DEFAULT_SETTINGS$1={enabled:true,level:0};function noop$1(){}var cache$1={};var ONCE$1={once:true};function getTableHeader$1(table){for(var key in table){for(var title in table[key]){return title||'untitled';}}return'empty';}var Log$1=/*#__PURE__*/function(){function Log$1(){var _ref16=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{id:''},id=_ref16.id;_classCallCheck(this,Log$1);this.id=id;this.VERSION=VERSION$7;this._startTs=getHiResTimestamp$1();this._deltaTs=getHiResTimestamp$1();this.LOG_THROTTLE_TIMEOUT=0;this._storage=new LocalStorage$1("__probe-".concat(this.id,"__"),DEFAULT_SETTINGS$1);this.userData={};this.timeStamp("".concat(this.id," started"));autobind$1(this);Object.seal(this);}_createClass(Log$1,[{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$1()-this._startTs).toPrecision(10));}},{key:"getDelta",value:function getDelta(){return Number((getHiResTimestamp$1()-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.updateConfiguration({enabled:enabled});return this;}},{key:"setLevel",value:function setLevel(level){this._storage.updateConfiguration({level:level});return this;}},{key:"assert",value:function assert(condition,message){assert$3(condition,message);}},{key:"warn",value:function warn(message){return this._getLogFunction(0,message,originalConsole$1.warn,arguments,ONCE$1);}},{key:"error",value:function error(message){return this._getLogFunction(0,message,originalConsole$1.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$1.log,arguments,{time:true,once:true});}},{key:"log",value:function log(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole$1.debug,arguments);}},{key:"info",value:function info(logLevel,message){return this._getLogFunction(logLevel,message,console.info,arguments);}},{key:"once",value:function once(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole$1.debug||originalConsole$1.info,arguments,ONCE$1);}},{key:"table",value:function table(logLevel,_table,columns){if(_table){return this._getLogFunction(logLevel,_table,console.table||noop$1,columns&&[columns],{tag:getTableHeader$1(_table)});}return noop$1;}},{key:"image",value:function(_image6){function image(_x26){return _image6.apply(this,arguments);}image.toString=function(){return _image6.toString();};return image;}(function(_ref17){var logLevel=_ref17.logLevel,priority=_ref17.priority,image=_ref17.image,_ref17$message=_ref17.message,message=_ref17$message===void 0?'':_ref17$message,_ref17$scale=_ref17.scale,scale=_ref17$scale===void 0?1:_ref17$scale;if(!this._shouldLog(logLevel||priority)){return noop$1;}return isBrowser$1?logImageInBrowser$1({image:image,message:message,scale:scale}):logImageInNode$1({image:image,message:message,scale:scale});})},{key:"settings",value:function settings(){if(console.table){console.table(this._storage.config);}else{console.log(this._storage.config);}}},{key:"get",value:function get(setting){return this._storage.config[setting];}},{key:"set",value:function set(setting,value){this._storage.updateConfiguration(_defineProperty2({},setting,value));}},{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$1);}},{key:"group",value:function group(logLevel,message){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{collapsed:false};opts=normalizeArguments$1({logLevel:logLevel,message:message,opts:opts});var _opts=opts,collapsed=_opts.collapsed;opts.method=(collapsed?console.groupCollapsed:console.group)||console.info;return this._getLogFunction(opts);}},{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$1);}},{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$1(logLevel);}},{key:"_getLogFunction",value:function _getLogFunction(logLevel,message,method){var args=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[];var opts=arguments.length>4?arguments[4]:undefined;if(this._shouldLog(logLevel)){var _method;opts=normalizeArguments$1({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$1();var tag=opts.tag||opts.message;if(opts.once){if(!cache$1[tag]){cache$1[tag]=getHiResTimestamp$1();}else{return noop$1;}}message=decorateMessage$1(this.id,opts.message,opts);return(_method=method).bind.apply(_method,[console,message].concat(_toConsumableArray(opts.args)));}return noop$1;}}]);return Log$1;}();Log$1.VERSION=VERSION$7;function normalizeLogLevel$1(logLevel){if(!logLevel){return 0;}var resolvedLevel;switch(_typeof(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$1(opts){var logLevel=opts.logLevel,message=opts.message;opts.logLevel=normalizeLogLevel$1(logLevel);var args=opts.args?Array.from(opts.args):[];while(args.length&&args.shift()!==message){}opts.args=args;switch(_typeof(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=_typeof(opts.message);assert$3(messageType==='string'||messageType==='object');return Object.assign(opts,opts.opts);}function decorateMessage$1(id,message,opts){if(typeof message==='string'){var _time=opts.time?leftPad$1(formatTime$1(opts.total)):'';message=opts.time?"".concat(id,": ").concat(_time," ").concat(message):"".concat(id,": ").concat(message);message=addColor$1(message,opts.color,opts.background);}return message;}function logImageInNode$1(_ref18){var image=_ref18.image,_ref18$message=_ref18.message,message=_ref18$message===void 0?'':_ref18$message,_ref18$scale=_ref18.scale,scale=_ref18$scale===void 0?1:_ref18$scale;var asciify=null;try{asciify=module.require('asciify-image');}catch(error){}if(asciify){return function(){return asciify(image,{fit:'box',width:"".concat(Math.round(80*scale),"%")}).then(function(data){return console.log(data);});};}return noop$1;}function logImageInBrowser$1(_ref19){var image=_ref19.image,_ref19$message=_ref19.message,message=_ref19$message===void 0?'':_ref19$message,_ref19$scale=_ref19.scale,scale=_ref19$scale===void 0?1:_ref19$scale;if(typeof image==='string'){var img=new Image();img.onload=function(){var _console;var args=formatImage$1(img,message,scale);(_console=console).log.apply(_console,_toConsumableArray(args));};img.src=image;return noop$1;}var element=image.nodeName||'';if(element.toLowerCase()==='img'){var _console2;(_console2=console).log.apply(_console2,_toConsumableArray(formatImage$1(image,message,scale)));return noop$1;}if(element.toLowerCase()==='canvas'){var _img=new Image();_img.onload=function(){var _console3;return(_console3=console).log.apply(_console3,_toConsumableArray(formatImage$1(_img,message,scale)));};_img.src=image.toDataURL();return noop$1;}return noop$1;}var probeLog=new Log$1({id:'loaders.gl'});var NullLog=/*#__PURE__*/function(){function NullLog(){_classCallCheck(this,NullLog);}_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(){};}}]);return NullLog;}();var ConsoleLog=/*#__PURE__*/function(){function ConsoleLog(){_classCallCheck(this,ConsoleLog);_defineProperty(this,"console",void 0);this.console=console;}_createClass(ConsoleLog,[{key:"log",value:function log(){var _this$console$log;for(var _len105=arguments.length,args=new Array(_len105),_key7=0;_key7<_len105;_key7++){args[_key7]=arguments[_key7];}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 _len106=arguments.length,args=new Array(_len106),_key8=0;_key8<_len106;_key8++){args[_key8]=arguments[_key8];}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 _len107=arguments.length,args=new Array(_len107),_key9=0;_key9<_len107;_key9++){args[_key9]=arguments[_key9];}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 _len108=arguments.length,args=new Array(_len108),_key10=0;_key10<_len108;_key10++){args[_key10]=arguments[_key10];}return(_this$console$error=this.console.error).bind.apply(_this$console$error,[this.console].concat(args));}}]);return ConsoleLog;}();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$4,_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 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 validateOptions(options,loaders){validateOptionsObject(options,null,DEFAULT_LOADER_OPTIONS,REMOVED_LOADER_OPTIONS,loaders);var _iterator8=_createForOfIteratorHelper(loaders),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var loader=_step8.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){_iterator8.e(err);}finally{_iterator8.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 _iterator9=_createForOfIteratorHelper(loaders),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var loader=_step9.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){_iterator9.e(err);}finally{_iterator9.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();}function isElectron(mockUserAgent){if(typeof window!=='undefined'&&_typeof(window.process)==='object'&&window.process.type==='renderer'){return true;}if(typeof process!=='undefined'&&_typeof(process.versions)==='object'&&Boolean(process.versions.electron)){return true;}var realUserAgent=(typeof navigator==="undefined"?"undefined":_typeof(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":_typeof(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 global!=='undefined'&&global,document:typeof document!=='undefined'&&document,process:(typeof process==="undefined"?"undefined":_typeof(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){_classCallCheck(this,LocalStorage);var defaultSettings=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var type=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'sessionStorage';_defineProperty(this,"storage",void 0);_defineProperty(this,"id",void 0);_defineProperty(this,"config",{});this.storage=getStorage(type);this.id=id;this.config={};Object.assign(this.config,defaultSettings);this._loadConfiguration();}_createClass(LocalStorage,[{key:"getConfiguration",value:function getConfiguration(){return this.config;}},{key:"setConfiguration",value:function setConfiguration(configuration){this.config={};return this.updateConfiguration(configuration);}},{key:"updateConfiguration",value:function updateConfiguration(configuration){Object.assign(this.config,configuration);if(this.storage){var serialized=JSON.stringify(this.config);this.storage.setItem(this.id,serialized);}return this;}},{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;}}]);return LocalStorage;}();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 _iterator10=_createForOfIteratorHelper(propNames),_step10;try{var _loop5=function _loop5(){var key=_step10.value;if(typeof obj[key]==='function'){if(!predefined.find(function(name){return key===name;})){obj[key]=obj[key].bind(obj);}}};for(_iterator10.s();!(_step10=_iterator10.n()).done;){_loop5();}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}function assert$2(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 _ref20=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{id:''},id=_ref20.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._storage=new LocalStorage("__probe-".concat(this.id,"__"),DEFAULT_SETTINGS);this.userData={};this.timeStamp("".concat(this.id," started"));autobind(this);Object.seal(this);}_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.updateConfiguration({enabled:enabled});return this;}},{key:"setLevel",value:function setLevel(level){this._storage.updateConfiguration({level:level});return this;}},{key:"get",value:function get(setting){return this._storage.config[setting];}},{key:"set",value:function set(setting,value){this._storage.updateConfiguration(_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$2(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,_table2,columns){if(_table2){return this._getLogFunction(logLevel,_table2,console.table||noop,columns&&[columns],{tag:getTableHeader(_table2)});}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({image:image,message:message,scale:scale});}},{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 _method2;opts=normalizeArguments({logLevel:logLevel,message:message,args:args,opts:opts});method=method||opts.method;assert$2(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(_method2=method).bind.apply(_method2,[console,message].concat(_toConsumableArray(opts.args)));}return noop;}}]);return Log;}();_defineProperty(Log,"VERSION",VERSION$6);function normalizeLogLevel(logLevel){if(!logLevel){return 0;}var resolvedLevel;switch(_typeof(logLevel)){case'number':resolvedLevel=logLevel;break;case'object':resolvedLevel=logLevel.logLevel||logLevel.priority||0;break;default:return 0;}assert$2(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(_typeof(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=_typeof(opts.message);assert$2(messageType==='string'||messageType==='object');return Object.assign(opts,{args:args},opts.opts);}function decorateMessage(id,message,opts){if(typeof message==='string'){var _time2=opts.time?leftPad(formatTime(opts.total)):'';message=opts.time?"".concat(id,": ").concat(_time2," ").concat(message):"".concat(id,": ").concat(message);message=addColor(message,opts.color,opts.background);}return message;}function logImageInNode(_ref2){var image=_ref2.image,_ref2$message=_ref2.message,message=_ref2$message===void 0?'':_ref2$message,_ref2$scale=_ref2.scale,scale=_ref2$scale===void 0?1:_ref2$scale;var asciify=null;try{asciify=module.require('asciify-image');}catch(error){}if(asciify){return function(){return asciify(image,{fit:'box',width:"".concat(Math.round(80*scale),"%")}).then(function(data){return console.log(data);});};}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 _console4;var args=formatImage(img,message,scale);(_console4=console).log.apply(_console4,_toConsumableArray(args));};img.src=image;return noop;}var element=image.nodeName||'';if(element.toLowerCase()==='img'){var _console5;(_console5=console).log.apply(_console5,_toConsumableArray(formatImage(image,message,scale)));return noop;}if(element.toLowerCase()==='canvas'){var _img2=new Image();_img2.onload=function(){var _console6;return(_console6=console).log.apply(_console6,_toConsumableArray(formatImage(_img2,message,scale)));};_img2.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 log=new Log({id:'loaders.gl'});var EXT_PATTERN=/\.([^.]+)$/;function selectLoader(_x27){return _selectLoader.apply(this,arguments);}function _selectLoader(){_selectLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(data){var loaders,options,context,loader,_args15=arguments;return _regeneratorRuntime().wrap(function _callee17$(_context21){while(1){switch(_context21.prev=_context21.next){case 0:loaders=_args15.length>1&&_args15[1]!==undefined?_args15[1]:[];options=_args15.length>2?_args15[2]:undefined;context=_args15.length>3?_args15[3]:undefined;if(validHTTPResponse(data)){_context21.next=5;break;}return _context21.abrupt("return",null);case 5:loader=selectLoaderSync(data,loaders,_objectSpread(_objectSpread({},options),{},{nothrow:true}),context);if(!loader){_context21.next=8;break;}return _context21.abrupt("return",loader);case 8:if(!isBlob(data)){_context21.next=13;break;}_context21.next=11;return data.slice(0,10).arrayBuffer();case 11:data=_context21.sent;loader=selectLoaderSync(data,loaders,options,context);case 13:if(!(!loader&&!(options!==null&&options!==void 0&&options.nothrow))){_context21.next=15;break;}throw new Error(getNoValidLoaderMessage(data));case 15:return _context21.abrupt("return",loader);case 16:case"end":return _context21.stop();}}},_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 _getResourceUrlAndTyp=getResourceUrlAndType(data),url=_getResourceUrlAndTyp.url,type=_getResourceUrlAndTyp.type;var testUrl=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 _getResourceUrlAndTyp2=getResourceUrlAndType(data),url=_getResourceUrlAndTyp2.url,type=_getResourceUrlAndTyp2.type;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(_typeof(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.byteLength1&&_args5[1]!==undefined?_args5[1]:{};_options$chunkSize=options.chunkSize,chunkSize=_options$chunkSize===void 0?DEFAULT_CHUNK_SIZE$1:_options$chunkSize;byteOffset=0;case 3:if(!(byteOffset2&&arguments[2]!==undefined?arguments[2]:null;if(previousContext){return previousContext;}var resolvedContext=_objectSpread({fetch:getFetchFunction(options,context)},context);if(!Array.isArray(resolvedContext.loaders)){resolvedContext.loaders=null;}return resolvedContext;}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$3(_x31,_x32,_x33,_x34){return _parse$.apply(this,arguments);}function _parse$(){_parse$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(data,loaders,options,context){var _getResourceUrlAndTyp4,url,typedLoaders,candidateLoaders,loader;return _regeneratorRuntime().wrap(function _callee19$(_context23){while(1){switch(_context23.prev=_context23.next){case 0:assert$4(!context||_typeof(context)==='object');if(loaders&&!Array.isArray(loaders)&&!isLoaderObject(loaders)){context=undefined;options=loaders;loaders=undefined;}_context23.next=4;return data;case 4:data=_context23.sent;options=options||{};_getResourceUrlAndTyp4=getResourceUrlAndType(data),url=_getResourceUrlAndTyp4.url;typedLoaders=loaders;candidateLoaders=getLoadersFromContext(typedLoaders,context);_context23.next=11;return selectLoader(data,candidateLoaders,options);case 11:loader=_context23.sent;if(loader){_context23.next=14;break;}return _context23.abrupt("return",null);case 14:options=normalizeOptions(options,loader,candidateLoaders,url);context=getLoaderContext({url:url,parse:parse$3,loaders:candidateLoaders},options,context);_context23.next=18;return parseWithLoader(loader,data,options,context);case 18:return _context23.abrupt("return",_context23.sent);case 19:case"end":return _context23.stop();}}},_callee19);}));return _parse$.apply(this,arguments);}function parseWithLoader(_x35,_x36,_x37,_x38){return _parseWithLoader.apply(this,arguments);}function _parseWithLoader(){_parseWithLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(loader,data,options,context){var response,ok,redirected,status,statusText,type,url,headers;return _regeneratorRuntime().wrap(function _callee20$(_context24){while(1){switch(_context24.prev=_context24.next){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};}_context24.next=4;return getArrayBufferOrStringFromData(data,loader,options);case 4:data=_context24.sent;if(!(loader.parseTextSync&&typeof data==='string')){_context24.next=8;break;}options.dataType='text';return _context24.abrupt("return",loader.parseTextSync(data,options,context,loader));case 8:if(!canParseWithWorker(loader,options)){_context24.next=12;break;}_context24.next=11;return parseWithWorker(loader,data,options,context,parse$3);case 11:return _context24.abrupt("return",_context24.sent);case 12:if(!(loader.parseText&&typeof data==='string')){_context24.next=16;break;}_context24.next=15;return loader.parseText(data,options,context,loader);case 15:return _context24.abrupt("return",_context24.sent);case 16:if(!loader.parse){_context24.next=20;break;}_context24.next=19;return loader.parse(data,options,context,loader);case 19:return _context24.abrupt("return",_context24.sent);case 20:assert$4(!loader.parseSync);throw new Error("".concat(loader.id," loader - no parser found and worker is disabled"));case 22:case"end":return _context24.stop();}}},_callee20);}));return _parseWithLoader.apply(this,arguments);}var VERSION$5="3.2.6";var VERSION$4="3.2.6";var VERSION$3="3.2.6";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(_x39){return _loadBasisTrascoderModule.apply(this,arguments);}function _loadBasisTrascoderModule(){_loadBasisTrascoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(options){var modules;return _regeneratorRuntime().wrap(function _callee21$(_context25){while(1){switch(_context25.prev=_context25.next){case 0:modules=options.modules||{};if(!modules.basis){_context25.next=3;break;}return _context25.abrupt("return",modules.basis);case 3:loadBasisTranscoderPromise=loadBasisTranscoderPromise||loadBasisTrascoder(options);_context25.next=6;return loadBasisTranscoderPromise;case 6:return _context25.abrupt("return",_context25.sent);case 7:case"end":return _context25.stop();}}},_callee21);}));return _loadBasisTrascoderModule.apply(this,arguments);}function loadBasisTrascoder(_x40){return _loadBasisTrascoder.apply(this,arguments);}function _loadBasisTrascoder(){_loadBasisTrascoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(options){var BASIS,wasmBinary,_yield$Promise$all,_yield$Promise$all2;return _regeneratorRuntime().wrap(function _callee22$(_context26){while(1){switch(_context26.prev=_context26.next){case 0:BASIS=null;wasmBinary=null;_context26.t0=Promise;_context26.next=5;return loadLibrary('basis_transcoder.js','textures',options);case 5:_context26.t1=_context26.sent;_context26.next=8;return loadLibrary('basis_transcoder.wasm','textures',options);case 8:_context26.t2=_context26.sent;_context26.t3=[_context26.t1,_context26.t2];_context26.next=12;return _context26.t0.all.call(_context26.t0,_context26.t3);case 12:_yield$Promise$all=_context26.sent;_yield$Promise$all2=_slicedToArray(_yield$Promise$all,2);BASIS=_yield$Promise$all2[0];wasmBinary=_yield$Promise$all2[1];BASIS=BASIS||globalThis.BASIS;_context26.next=19;return initializeBasisTrascoderModule(BASIS,wasmBinary);case 19:return _context26.abrupt("return",_context26.sent);case 20:case"end":return _context26.stop();}}},_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(_x41){return _loadBasisEncoderModule.apply(this,arguments);}function _loadBasisEncoderModule(){_loadBasisEncoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(options){var modules;return _regeneratorRuntime().wrap(function _callee23$(_context27){while(1){switch(_context27.prev=_context27.next){case 0:modules=options.modules||{};if(!modules.basisEncoder){_context27.next=3;break;}return _context27.abrupt("return",modules.basisEncoder);case 3:loadBasisEncoderPromise=loadBasisEncoderPromise||loadBasisEncoder(options);_context27.next=6;return loadBasisEncoderPromise;case 6:return _context27.abrupt("return",_context27.sent);case 7:case"end":return _context27.stop();}}},_callee23);}));return _loadBasisEncoderModule.apply(this,arguments);}function loadBasisEncoder(_x42){return _loadBasisEncoder.apply(this,arguments);}function _loadBasisEncoder(){_loadBasisEncoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(options){var BASIS_ENCODER,wasmBinary,_yield$Promise$all3,_yield$Promise$all4;return _regeneratorRuntime().wrap(function _callee24$(_context28){while(1){switch(_context28.prev=_context28.next){case 0:BASIS_ENCODER=null;wasmBinary=null;_context28.t0=Promise;_context28.next=5;return loadLibrary(BASIS_CDN_ENCODER_JS,'textures',options);case 5:_context28.t1=_context28.sent;_context28.next=8;return loadLibrary(BASIS_CDN_ENCODER_WASM,'textures',options);case 8:_context28.t2=_context28.sent;_context28.t3=[_context28.t1,_context28.t2];_context28.next=12;return _context28.t0.all.call(_context28.t0,_context28.t3);case 12:_yield$Promise$all3=_context28.sent;_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;_context28.next=19;return initializeBasisEncoderModule(BASIS_ENCODER,wasmBinary);case 19:return _context28.abrupt("return",_context28.sent);case 20:case"end":return _context28.stop();}}},_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 _canvas6=document.createElement('canvas');return _canvas6.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.byteLength1&&_args27[1]!==undefined?_args27[1]:null;if(isEmptyObject(imagebitmapOptions)||!imagebitmapOptionsSupported){imagebitmapOptions=null;}if(!imagebitmapOptions){_context33.next=13;break;}_context33.prev=3;_context33.next=6;return createImageBitmap(blob,imagebitmapOptions);case 6:return _context33.abrupt("return",_context33.sent);case 9:_context33.prev=9;_context33.t0=_context33["catch"](3);console.warn(_context33.t0);imagebitmapOptionsSupported=false;case 13:_context33.next=15;return createImageBitmap(blob);case 15:return _context33.abrupt("return",_context33.sent);case 16:case"end":return _context33.stop();}}},_callee29,null,[[3,9]]);}));return _safeCreateImageBitmap.apply(this,arguments);}function isEmptyObject(object){for(var key in object||EMPTY_OBJECT){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);}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=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]];}}_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:"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(_typeof(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$1(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$1(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$1(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.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];}}},{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$1(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.length5&&_args30[5]!==undefined?_args30[5]:'NONE';_context36.next=3;return loadWasmInstance();case 3:instance=_context36.sent;decode$5(instance,instance.exports[DECODERS[mode]],target,count,size,source,instance.exports[FILTERS[filter||'NONE']]);case 5:case"end":return _context36.stop();}}},_callee32);}));return _meshoptDecodeGltfBuffer.apply(this,arguments);}var wasmPromise;function loadWasmInstance(){return _loadWasmInstance.apply(this,arguments);}function _loadWasmInstance(){_loadWasmInstance=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(){return _regeneratorRuntime().wrap(function _callee33$(_context37){while(1){switch(_context37.prev=_context37.next){case 0:if(!wasmPromise){wasmPromise=loadWasmModule();}return _context37.abrupt("return",wasmPromise);case 2:case"end":return _context37.stop();}}},_callee33);}));return _loadWasmInstance.apply(this,arguments);}function loadWasmModule(){return _loadWasmModule.apply(this,arguments);}function _loadWasmModule(){_loadWasmModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34(){var wasm,result;return _regeneratorRuntime().wrap(function _callee34$(_context38){while(1){switch(_context38.prev=_context38.next){case 0:wasm=wasm_base;if(WebAssembly.validate(detector)){wasm=wasm_simd;console.log('Warning: meshopt_decoder is using experimental SIMD support');}_context38.next=4;return WebAssembly.instantiate(unpack(wasm),{});case 4:result=_context38.sent;_context38.next=7;return result.instance.exports.__wasm_call_ctors();case 7:return _context38.abrupt("return",result.instance);case 8:case"end":return _context38.stop();}}},_callee34);}));return _loadWasmModule.apply(this,arguments);}function unpack(data){var result=new Uint8Array(data.length);for(var _i501=0;_i50196?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i502=0;_i502maxX?x:maxX;maxY=y>maxY?y:maxY;maxZ=_z4>maxZ?_z4:maxZ;}return[[minX,minY,minZ],[maxX,maxY,maxZ]];}function assert(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(Array.isArray(fields));checkNames(fields);this.fields=fields;this.metadata=metadata||new Map();}_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 _i504=0;_i5042&&arguments[2]!==undefined?arguments[2]:false;var metadata=arguments.length>3&&arguments[3]!==undefined?arguments[3]:new Map();_classCallCheck(this,Field);_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;}_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):'');}}]);return Field;}();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";})(Type||(Type={}));var _Symbol$toStringTag,_Symbol$toStringTag2,_Symbol$toStringTag7;var DataType=/*#__PURE__*/function(){function DataType(){_classCallCheck(this,DataType);}_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;}}]);return DataType;}();_Symbol$toStringTag=Symbol.toStringTag;var Int=/*#__PURE__*/function(_DataType,_Symbol$toStringTag3){_inherits(Int,_DataType);var _super147=_createSuper(Int);function Int(isSigned,bitWidth){var _this120;_classCallCheck(this,Int);_this120=_super147.call(this);_defineProperty(_assertThisInitialized(_this120),"isSigned",void 0);_defineProperty(_assertThisInitialized(_this120),"bitWidth",void 0);_this120.isSigned=isSigned;_this120.bitWidth=bitWidth;return _this120;}_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);}}]);return Int;}(DataType,_Symbol$toStringTag);var Int8=/*#__PURE__*/function(_Int){_inherits(Int8,_Int);var _super148=_createSuper(Int8);function Int8(){_classCallCheck(this,Int8);return _super148.call(this,true,8);}return _createClass(Int8);}(Int);var Int16=/*#__PURE__*/function(_Int2){_inherits(Int16,_Int2);var _super149=_createSuper(Int16);function Int16(){_classCallCheck(this,Int16);return _super149.call(this,true,16);}return _createClass(Int16);}(Int);var Int32=/*#__PURE__*/function(_Int3){_inherits(Int32,_Int3);var _super150=_createSuper(Int32);function Int32(){_classCallCheck(this,Int32);return _super150.call(this,true,32);}return _createClass(Int32);}(Int);var Uint8=/*#__PURE__*/function(_Int4){_inherits(Uint8,_Int4);var _super151=_createSuper(Uint8);function Uint8(){_classCallCheck(this,Uint8);return _super151.call(this,false,8);}return _createClass(Uint8);}(Int);var Uint16=/*#__PURE__*/function(_Int5){_inherits(Uint16,_Int5);var _super152=_createSuper(Uint16);function Uint16(){_classCallCheck(this,Uint16);return _super152.call(this,false,16);}return _createClass(Uint16);}(Int);var Uint32=/*#__PURE__*/function(_Int6){_inherits(Uint32,_Int6);var _super153=_createSuper(Uint32);function Uint32(){_classCallCheck(this,Uint32);return _super153.call(this,false,32);}return _createClass(Uint32);}(Int);var Precision={HALF:16,SINGLE:32,DOUBLE:64};_Symbol$toStringTag2=Symbol.toStringTag;var Float=/*#__PURE__*/function(_DataType2,_Symbol$toStringTag4){_inherits(Float,_DataType2);var _super154=_createSuper(Float);function Float(precision){var _this121;_classCallCheck(this,Float);_this121=_super154.call(this);_defineProperty(_assertThisInitialized(_this121),"precision",void 0);_this121.precision=precision;return _this121;}_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);}}]);return Float;}(DataType,_Symbol$toStringTag2);var Float32=/*#__PURE__*/function(_Float){_inherits(Float32,_Float);var _super155=_createSuper(Float32);function Float32(){_classCallCheck(this,Float32);return _super155.call(this,Precision.SINGLE);}return _createClass(Float32);}(Float);var Float64=/*#__PURE__*/function(_Float2){_inherits(Float64,_Float2);var _super156=_createSuper(Float64);function Float64(){_classCallCheck(this,Float64);return _super156.call(this,Precision.DOUBLE);}return _createClass(Float64);}(Float);_Symbol$toStringTag7=Symbol.toStringTag;var FixedSizeList=/*#__PURE__*/function(_DataType3,_Symbol$toStringTag5){_inherits(FixedSizeList,_DataType3);var _super157=_createSuper(FixedSizeList);function FixedSizeList(listSize,child){var _this122;_classCallCheck(this,FixedSizeList);_this122=_super157.call(this);_defineProperty(_assertThisInitialized(_this122),"listSize",void 0);_defineProperty(_assertThisInitialized(_this122),"children",void 0);_this122.listSize=listSize;_this122.children=[child];return _this122;}_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,">");}}]);return FixedSizeList;}(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();}_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;attributeId2&&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$3=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$3(_x72,_x73,_x74){return _decode$2.apply(this,arguments);}function _decode$2(){_decode$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(gltfData,options,context){var _options$gltf,scenegraph,promises,_iterator48,_step48,_primitive5;return _regeneratorRuntime().wrap(function _callee40$(_context44){while(1){switch(_context44.prev=_context44.next){case 0:if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context44.next=2;break;}return _context44.abrupt("return");case 2:scenegraph=new GLTFScenegraph(gltfData);promises=[];_iterator48=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph));try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){_primitive5=_step48.value;if(scenegraph.getObjectExtension(_primitive5,KHR_DRACO_MESH_COMPRESSION)){promises.push(decompressPrimitive(scenegraph,_primitive5,options,context));}}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}_context44.next=8;return Promise.all(promises);case 8:scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);case 9:case"end":return _context44.stop();}}},_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 _mesh3=_step26.value;compressMesh(_mesh3);scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterator26.e(err);}finally{_iterator26.f();}}function decompressPrimitive(_x75,_x76,_x77,_x78){return _decompressPrimitive.apply(this,arguments);}function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,parse,dracoOptions,decodedData,decodedAttributes,_i604,_Object$entries5,_Object$entries5$_i,attributeName,decodedAttribute,accessorIndex,accessor;return _regeneratorRuntime().wrap(function _callee41$(_context45){while(1){switch(_context45.prev=_context45.next){case 0:dracoExtension=scenegraph.getObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);if(dracoExtension){_context45.next=3;break;}return _context45.abrupt("return");case 3:buffer=scenegraph.getTypedArrayForBufferView(dracoExtension.bufferView);bufferCopy=sliceArrayBuffer(buffer.buffer,buffer.byteOffset);parse=context.parse;dracoOptions=_objectSpread({},options);delete dracoOptions['3d-tiles'];_context45.next=10;return parse(bufferCopy,DracoLoader,dracoOptions,context);case 10:decodedData=_context45.sent;decodedAttributes=getGLTFAccessors(decodedData.attributes);for(_i604=0,_Object$entries5=Object.entries(decodedAttributes);_i604<_Object$entries5.length;_i604++){_Object$entries5$_i=_slicedToArray(_Object$entries5[_i604],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 16:case"end":return _context45.stop();}}},_callee41);}));return _decompressPrimitive.apply(this,arguments);}function compressMesh(attributes,indices){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;var _context$parseSync;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,_mesh4,_iterator28,_step28,_primitive2;return _regeneratorRuntime().wrap(function makeMeshPrimitiveIterator$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:_iterator27=_createForOfIteratorHelper(scenegraph.json.meshes||[]);_context10.prev=1;_iterator27.s();case 3:if((_step27=_iterator27.n()).done){_context10.next=24;break;}_mesh4=_step27.value;_iterator28=_createForOfIteratorHelper(_mesh4.primitives);_context10.prev=6;_iterator28.s();case 8:if((_step28=_iterator28.n()).done){_context10.next=14;break;}_primitive2=_step28.value;_context10.next=12;return _primitive2;case 12:_context10.next=8;break;case 14:_context10.next=19;break;case 16:_context10.prev=16;_context10.t0=_context10["catch"](6);_iterator28.e(_context10.t0);case 19:_context10.prev=19;_iterator28.f();return _context10.finish(19);case 22:_context10.next=3;break;case 24:_context10.next=29;break;case 26:_context10.prev=26;_context10.t1=_context10["catch"](1);_iterator27.e(_context10.t1);case 29:_context10.prev=29;_iterator27.f();return _context10.finish(29);case 32:case"end":return _context10.stop();}}},_marked3,null,[[1,26,29,32],[6,16,19,22]]);}var KHR_draco_mesh_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$3,preprocess:preprocess$1,decode:decode$3,encode:encode$3});var KHR_LIGHTS_PUNCTUAL='KHR_lights_punctual';var name$2=KHR_LIGHTS_PUNCTUAL;function decode$2(_x79){return _decode$3.apply(this,arguments);}function _decode$3(){_decode$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(gltfData){var gltfScenegraph,json,extension,_iterator49,_step49,_node12,nodeExtension;return _regeneratorRuntime().wrap(function _callee42$(_context46){while(1){switch(_context46.prev=_context46.next){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);}_iterator49=_createForOfIteratorHelper(json.nodes||[]);try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){_node12=_step49.value;nodeExtension=gltfScenegraph.getObjectExtension(_node12,KHR_LIGHTS_PUNCTUAL);if(nodeExtension){_node12.light=nodeExtension.light;}gltfScenegraph.removeObjectExtension(_node12,KHR_LIGHTS_PUNCTUAL);}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}case 6:case"end":return _context46.stop();}}},_callee42);}));return _decode$3.apply(this,arguments);}function encode$2(_x80){return _encode$.apply(this,arguments);}function _encode$(){_encode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(gltfData){var gltfScenegraph,json,extension,_iterator50,_step50,light,_node13;return _regeneratorRuntime().wrap(function _callee43$(_context47){while(1){switch(_context47.prev=_context47.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;if(json.lights){extension=gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);assert$1(!extension.lights);extension.lights=json.lights;delete json.lights;}if(gltfScenegraph.json.lights){_iterator50=_createForOfIteratorHelper(gltfScenegraph.json.lights);try{for(_iterator50.s();!(_step50=_iterator50.n()).done;){light=_step50.value;_node13=light.node;gltfScenegraph.addObjectExtension(_node13,KHR_LIGHTS_PUNCTUAL,light);}}catch(err){_iterator50.e(err);}finally{_iterator50.f();}delete gltfScenegraph.json.lights;}case 4:case"end":return _context47.stop();}}},_callee43);}));return _encode$.apply(this,arguments);}var KHR_lights_punctual=/*#__PURE__*/Object.freeze({__proto__:null,name:name$2,decode:decode$2,encode:encode$2});var KHR_MATERIALS_UNLIT='KHR_materials_unlit';var name$1=KHR_MATERIALS_UNLIT;function decode$1(_x81){return _decode$4.apply(this,arguments);}function _decode$4(){_decode$4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee44(gltfData){var gltfScenegraph,json,_iterator51,_step51,material,extension;return _regeneratorRuntime().wrap(function _callee44$(_context48){while(1){switch(_context48.prev=_context48.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);_iterator51=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){material=_step51.value;extension=material.extensions&&material.extensions.KHR_materials_unlit;if(extension){material.unlit=true;}gltfScenegraph.removeObjectExtension(material,KHR_MATERIALS_UNLIT);}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}case 5:case"end":return _context48.stop();}}},_callee44);}));return _decode$4.apply(this,arguments);}function encode$1(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;if(gltfScenegraph.materials){var _iterator29=_createForOfIteratorHelper(json.materials||[]),_step29;try{for(_iterator29.s();!(_step29=_iterator29.n()).done;){var material=_step29.value;if(material.unlit){delete material.unlit;gltfScenegraph.addObjectExtension(material,KHR_MATERIALS_UNLIT,{});gltfScenegraph.addExtension(KHR_MATERIALS_UNLIT);}}}catch(err){_iterator29.e(err);}finally{_iterator29.f();}}}var KHR_materials_unlit=/*#__PURE__*/Object.freeze({__proto__:null,name:name$1,decode:decode$1,encode:encode$1});var KHR_TECHNIQUES_WEBGL='KHR_techniques_webgl';var name=KHR_TECHNIQUES_WEBGL;function decode(_x82){return _decode.apply(this,arguments);}function _decode(){_decode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee45(gltfData){var gltfScenegraph,json,extension,techniques,_iterator52,_step52,material,materialExtension;return _regeneratorRuntime().wrap(function _callee45$(_context49){while(1){switch(_context49.prev=_context49.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_TECHNIQUES_WEBGL);if(extension){techniques=resolveTechniques(extension,gltfScenegraph);_iterator52=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator52.s();!(_step52=_iterator52.n()).done;){material=_step52.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){_iterator52.e(err);}finally{_iterator52.f();}gltfScenegraph.removeExtension(KHR_TECHNIQUES_WEBGL);}case 4:case"end":return _context49.stop();}}},_callee45);}));return _decode.apply(this,arguments);}function encode(_x83,_x84){return _encode.apply(this,arguments);}function _encode(){_encode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee46(gltfData,options){return _regeneratorRuntime().wrap(function _callee46$(_context50){while(1){switch(_context50.prev=_context50.next){case 0:case"end":return _context50.stop();}}},_callee46);}));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(_typeof(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,decode:decode,encode:encode});var EXTENSIONS=[EXT_meshopt_compression,EXT_texture_webp,KHR_texture_basisu,KHR_draco_mesh_compression,KHR_lights_punctual,KHR_materials_unlit,KHR_techniques_webgl];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 _iterator30=_createForOfIteratorHelper(extensions),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var extension=_step30.value;var _extension$preprocess;(_extension$preprocess=extension.preprocess)===null||_extension$preprocess===void 0?void 0:_extension$preprocess.call(extension,gltf,options,context);}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}}function decodeExtensions(_x85){return _decodeExtensions.apply(this,arguments);}function _decodeExtensions(){_decodeExtensions=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(gltf){var options,context,extensions,_iterator53,_step53,extension,_extension$decode,_args45=arguments;return _regeneratorRuntime().wrap(function _callee47$(_context51){while(1){switch(_context51.prev=_context51.next){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);});_iterator53=_createForOfIteratorHelper(extensions);_context51.prev=4;_iterator53.s();case 6:if((_step53=_iterator53.n()).done){_context51.next=12;break;}extension=_step53.value;_context51.next=10;return(_extension$decode=extension.decode)===null||_extension$decode===void 0?void 0:_extension$decode.call(extension,gltf,options,context);case 10:_context51.next=6;break;case 12:_context51.next=17;break;case 14:_context51.prev=14;_context51.t0=_context51["catch"](4);_iterator53.e(_context51.t0);case 17:_context51.prev=17;_iterator53.f();return _context51.finish(17);case 20:case"end":return _context51.stop();}}},_callee47,null,[[4,14,17,20]]);}));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 _iterator31=_createForOfIteratorHelper(json.images||[]),_step31;try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var _image7=_step31.value;var extension=gltfScenegraph.getObjectExtension(_image7,KHR_BINARY_GLTF);if(extension){Object.assign(_image7,extension);}gltfScenegraph.removeObjectExtension(_image7,KHR_BINARY_GLTF);}}catch(err){_iterator31.e(err);}finally{_iterator31.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);}_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 _iterator32=_createForOfIteratorHelper(json.textures),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var texture=_step32.value;this._convertTextureIds(texture);}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}var _iterator33=_createForOfIteratorHelper(json.meshes),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var _mesh5=_step33.value;this._convertMeshIds(_mesh5);}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}var _iterator34=_createForOfIteratorHelper(json.nodes),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var _node4=_step34.value;this._convertNodeIds(_node4);}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}var _iterator35=_createForOfIteratorHelper(json.scenes),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _node5=_step35.value;this._convertSceneIds(_node5);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}}},{key:"_convertTextureIds",value:function _convertTextureIds(texture){if(texture.source){texture.source=this._convertIdToIndex(texture.source,'image');}}},{key:"_convertMeshIds",value:function _convertMeshIds(mesh){var _iterator36=_createForOfIteratorHelper(mesh.primitives),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var _primitive3=_step36.value;var attributes=_primitive3.attributes,indices=_primitive3.indices,material=_primitive3.material;for(var attributeName in attributes){attributes[attributeName]=this._convertIdToIndex(attributes[attributeName],'accessor');}if(indices){_primitive3.indices=this._convertIdToIndex(indices,'accessor');}if(material){_primitive3.material=this._convertIdToIndex(material,'material');}}}catch(err){_iterator36.e(err);}finally{_iterator36.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 _iterator37=_createForOfIteratorHelper(json[topLevelArrayName]),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var object=_step37.value;for(var key in object){var id=object[key];var index=this._convertIdToIndex(id,key);object[key]=index;}}}catch(err){_iterator37.e(err);}finally{_iterator37.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 _iterator38=_createForOfIteratorHelper(this.json.buffers),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var buffer=_step38.value;delete buffer.type;}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}}},{key:"_updateMaterial",value:function _updateMaterial(json){var _iterator39=_createForOfIteratorHelper(json.materials),_step39;try{var _loop6=function _loop6(){var material=_step39.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);var textureIndex=json.textures.findIndex(function(texture){return texture.id===textureId;});if(textureIndex!==-1){material.pbrMetallicRoughness.baseColorTexture={index:textureIndex};}};for(_iterator39.s();!(_step39=_iterator39.n()).done;){var _material$values,_material$values2;_loop6();}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}}}]);return GLTFV1Normalizer;}();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=(_DEFAULT_SAMPLER={},_defineProperty2(_DEFAULT_SAMPLER,GL_SAMPLER.TEXTURE_MAG_FILTER,GL_SAMPLER.LINEAR),_defineProperty2(_DEFAULT_SAMPLER,GL_SAMPLER.TEXTURE_MIN_FILTER,GL_SAMPLER.NEAREST_MIPMAP_LINEAR),_defineProperty2(_DEFAULT_SAMPLER,GL_SAMPLER.TEXTURE_WRAP_S,GL_SAMPLER.REPEAT),_defineProperty2(_DEFAULT_SAMPLER,GL_SAMPLER.TEXTURE_WRAP_T,GL_SAMPLER.REPEAT),_DEFAULT_SAMPLER);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",[]);}_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$1(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;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};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(_typeof(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 _getAccessorArrayType2=getAccessorArrayTypeAndLength(accessor,accessor.bufferView),ArrayType=_getAccessorArrayType2.ArrayType,byteLength=_getAccessorArrayType2.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 _i510=0;_i5101&&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 options=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};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,options={});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__*/_regeneratorRuntime().mark(function _callee48(gltf,arrayBufferOrString){var byteOffset,options,context,_options$gltf,_options$gltf2,_options$gltf3,_options$gltf4,promises,_promise,promise,_args46=arguments;return _regeneratorRuntime().wrap(function _callee48$(_context52){while(1){switch(_context52.prev=_context52.next){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)){_context52.next=10;break;}_context52.next=10;return loadBuffers(gltf,options,context);case 10: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);_context52.next=15;return Promise.all(promises);case 15:return _context52.abrupt("return",options!==null&&options!==void 0&&(_options$gltf4=options.gltf)!==null&&_options$gltf4!==void 0&&_options$gltf4.postProcess?postProcessGLTF(gltf,options):gltf);case 16:case"end":return _context52.stop();}}},_callee48);}));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$1(glb.type==='glTF',"Invalid GLB magic string ".concat(glb.type));gltf._glb=glb;gltf.json=glb.json;}else{assert$1(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__*/_regeneratorRuntime().mark(function _callee49(gltf,options,context){var buffers,_i605,buffer,_context$fetch,_response$arrayBuffer,_fetch,uri,response,arrayBuffer;return _regeneratorRuntime().wrap(function _callee49$(_context53){while(1){switch(_context53.prev=_context53.next){case 0:buffers=gltf.json.buffers||[];_i605=0;case 2:if(!(_i6051&&_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={};_context56.next=8;return parseGLTF$1(gltf,arrayBuffer,byteOffset,options,context);case 8:return _context56.abrupt("return",_context56.sent);case 9:case"end":return _context56.stop();}}},_callee52);}));return _parse$3.apply(this,arguments);}var GLTFSceneModelLoader=/*#__PURE__*/function(){function GLTFSceneModelLoader(cfg){_classCallCheck(this,GLTFSceneModelLoader);}_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 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 @@ -30232,12 +30232,13 @@ var onCanvasTouchMove=function onCanvasTouchMove(event){var touch=_toConsumableA var pos=[];var ind=[];var addPlane=function addPlane(isCeiling){var baseIdx=pos.length;var _iterator41=_createForOfIteratorHelper(baseVertices),_step41;try{for(_iterator41.s();!(_step41=_iterator41.n()).done;){var c=_step41.value;pos.push([c[0],altitude+(isCeiling?height:0),c[1]]);}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}var _iterator42=_createForOfIteratorHelper(baseTriangles),_step42;try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var t=_step42.value;ind.push.apply(ind,_toConsumableArray((isCeiling?t:t.slice(0).reverse()).map(function(i){return i+baseIdx;})));}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}};addPlane(false);// floor addPlane(true);// ceiling // sides -var _loop9=function _loop9(_i598){var a=baseVertices[_i598];var b=baseVertices[(_i598+1)%baseVertices.length];var f=altitude;var c=altitude+height;var baseIdx=pos.length;pos.push([a[0],f,a[1]],[b[0],f,b[1]],[b[0],c,b[1]],[a[0],c,a[1]]);ind.push.apply(ind,_toConsumableArray([0,1,2,0,2,3].map(function(i){return i+baseIdx;})));};for(var _i598=0;_i598_EPSILON?FRONT:COPLANAR;polygonType|=type;types.push(type);}// Put the polygon in the correct list, splitting it when necessary. -switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.push(face);break;case BACK:break;case SPANNING:var _f4=[];for(var _i601=0;_i601=3){newFaces.push(_f4);}break;}}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}faces=newFaces;}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}if(faces.length===0){return null;}else{var avg=math.vec3([0,0,0]);var unique=new Set();var _iterator44=_createForOfIteratorHelper(faces),_step44;try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){var _f3=_step44.value;var _iterator45=_createForOfIteratorHelper(_f3),_step45;try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var _p5=_step45.value;var id=_p5.map(function(x){return x.toFixed(3);}).join(":");if(!unique.has(id)){unique.add(id);math.addVec3(avg,_p5,avg);}}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}math.mulVec3Scalar(avg,1/unique.size,avg);return avg;}}},{key:"center",get:function get(){return this._center;}},{key:"altitude",get:function get(){return this._geometry.altitude;},set:function set(value){this._geometry.altitude=value;this._rebuildMesh();}},{key:"height",get:function get(){return this._geometry.height;},set:function set(value){this._geometry.height=value;this._rebuildMesh();}},{key:"highlighted",get:function get(){return this._highlighted;},set:function set(value){this._highlighted=value;if(this._zoneMesh){this._zoneMesh.highlighted=value;}}},{key:"color",get:function get(){return this._color;},set:function set(value){this._color=value;if(this._zoneMesh){this._zoneMesh.material.diffuse=hex2rgb(this._color);}}},{key:"alpha",get:function get(){return this._alpha;},set:function set(value){this._alpha=value;if(this._zoneMesh){this._zoneMesh.material.alpha=this._alpha;}}},{key:"edges",get:function get(){return this._edges;},set:function set(edges){this._edges=edges;if(this._zoneMesh){this._zoneMesh.edges=this._edges;}}/** +var _p5=function _p5(idx,y){return[planeCoords[idx][0],y,planeCoords[idx][1]];};for(var _i600=0;_i600_EPSILON?FRONT:COPLANAR;polygonType|=type;types.push(type);}// Put the polygon in the correct list, splitting it when necessary. +switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.push(face);break;case BACK:break;case SPANNING:var _f4=[];for(var _i602=0;_i602=3){newFaces.push(_f4);}break;}}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}faces=newFaces;}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}if(faces.length===0){return null;}else{var avg=math.vec3([0,0,0]);var unique=new Set();var _iterator44=_createForOfIteratorHelper(faces),_step44;try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){var _f3=_step44.value;var _iterator45=_createForOfIteratorHelper(_f3),_step45;try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var _p6=_step45.value;var id=_p6.map(function(x){return x.toFixed(3);}).join(":");if(!unique.has(id)){unique.add(id);math.addVec3(avg,_p6,avg);}}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}math.mulVec3Scalar(avg,1/unique.size,avg);return avg;}}},{key:"center",get:function get(){return this._center;}},{key:"altitude",get:function get(){return this._geometry.altitude;},set:function set(value){this._geometry.altitude=value;this._rebuildMesh();}},{key:"height",get:function get(){return this._geometry.height;},set:function set(value){this._geometry.height=value;this._rebuildMesh();}},{key:"highlighted",get:function get(){return this._highlighted;},set:function set(value){this._highlighted=value;if(this._zoneMesh){this._zoneMesh.highlighted=value;}}},{key:"color",get:function get(){return this._color;},set:function set(value){this._color=value;if(this._zoneMesh){this._zoneMesh.material.diffuse=hex2rgb(this._color);}}},{key:"alpha",get:function get(){return this._alpha;},set:function set(value){this._alpha=value;if(this._zoneMesh){this._zoneMesh.material.alpha=this._alpha;}}},{key:"edges",get:function get(){return this._edges;},set:function set(edges){this._edges=edges;if(this._zoneMesh){this._zoneMesh.edges=this._edges;}}/** * Sets whether this Zone is visible or not. * * @type {Boolean} @@ -30325,7 +30326,7 @@ switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces. */},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(ZonesPlugin.prototype),"destroy",this).call(this);}}]);return ZonesPlugin;}(Plugin);var ZonesTouchControl=/*#__PURE__*/function(_Component44){_inherits(ZonesTouchControl,_Component44);var _super177=_createSuper(ZonesTouchControl);function ZonesTouchControl(zonesPlugin){var _this182;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesTouchControl);_this182=_super177.call(this,zonesPlugin.viewer.scene);_this182.zonesPlugin=zonesPlugin;_this182.pointerLens=cfg.pointerLens;_this182.pointerCircle=new PointerCircle(zonesPlugin.viewer);_this182._deactivate=null;return _this182;}_createClass(ZonesTouchControl,[{key:"active",get:function get(){return!!this._deactivate;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._deactivate){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=touchPointSelector(viewer,this.pointerCircle,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._deactivate=startAAZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._deactivate=function(){reactivate=false;};self.fire("zoneEnd",zone);if(reactivate){rec();}}).deactivate;})();}},{key:"deactivate",value:function deactivate(){if(this._deactivate){this._deactivate();this._deactivate=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesTouchControl.prototype),"destroy",this).call(this);}}]);return ZonesTouchControl;}(Component);var startPolysurfaceZoneCreateUI=function startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,pointerLens,zonesPlugin,select3dPoint,onZoneCreated){var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var deactivatePointSelection;var cleanups=[function(){return updatePointerLens(null);}];var basePolygon=basePolygon3D(scene,zoneColor,zoneAlpha);cleanups.push(function(){return basePolygon.destroy();});(function selectNextPoint(markers){var marker=marker3D(scene,zoneColor);var wire=markers.length>0&&wire3D(scene,zoneColor,markers[markers.length-1].getWorldPos());cleanups.push(function(){marker.destroy();wire&&wire.destroy();});var firstMarker=markers.length>0&&markers[0];var getSnappedFirst=function getSnappedFirst(canvasPos){var firstCanvasPos=firstMarker&&firstMarker.getCanvasPos();var snapToFirst=firstCanvasPos&&math.distVec2(firstCanvasPos,canvasPos)<10;return snapToFirst&&{canvasPos:firstCanvasPos,worldPos:firstMarker.getWorldPos()};};var lastSegmentIntersects=function(){var onSegment=function onSegment(p,q,r){return q[0]<=Math.max(p[0],r[0])&&q[0]>=Math.min(p[0],r[0])&&q[1]<=Math.max(p[1],r[1])&&q[1]>=Math.min(p[1],r[1]);};var orient=function orient(p,q,r){var val=(q[1]-p[1])*(r[0]-q[0])-(q[0]-p[0])*(r[1]-q[1]);// collinear // clockwise // counterclockwise -return val===0?0:val>0?1:2;};return function(pos2D,excludeFirstSegment){var a=pos2D[pos2D.length-2];var b=pos2D[pos2D.length-1];for(var _i602=excludeFirstSegment?1:0;_i6020?1:2;};return function(pos2D,excludeFirstSegment){var a=pos2D[pos2D.length-2];var b=pos2D[pos2D.length-1];for(var _i603=excludeFirstSegment?1:0;_i6032?markers.map(function(m){return m.getWorldPos();}):null);},function(canvasPos,worldPos){var snappedFirst=markers.length>2&&getSnappedFirst(canvasPos);firstMarker&&firstMarker.setHighlighted(!!snappedFirst);updatePointerLens(snappedFirst?snappedFirst.canvasPos:canvasPos);marker.update(!snappedFirst&&worldPos);wire&&wire.update(snappedFirst?snappedFirst.worldPos:worldPos);if(markers.length>=2){var pos=markers.map(function(m){return m.getWorldPos();}).concat(snappedFirst?[]:[worldPos]);var inter=lastSegmentIntersects(pos.map(function(p){return[p[0],p[2]];}),snappedFirst);basePolygon.updateBase(inter?null:pos);}else basePolygon.updateBase(null);},function(canvasPos,worldPos){var snappedFirst=markers.length>2&&getSnappedFirst(canvasPos);var pos=markers.map(function(m){return m.getWorldPos();}).concat(snappedFirst?[]:[worldPos]);basePolygon.updateBase(pos);var pos2D=pos.map(function(p){return[p[0],p[2]];});if(markers.length>2&&lastSegmentIntersects(pos2D,snappedFirst)){cleanups.pop()();selectNextPoint(markers);}else if(snappedFirst){// `marker2.update' makes sure marker's position has been updated from its default [0,0,0] // This works around an unidentified bug somewhere around OcclusionLayer, that causes error // [.WebGL-0x13400c47e00] GL_INVALID_OPERATION: Vertex buffer is not big enough for the draw call -marker.update(worldPos);cleanups.forEach(function(c){return c();});onZoneCreated(zonesPlugin.createZone({id:math.createUUID(),geometry:{planeCoordinates:pos2D,altitude:zoneAltitude,height:zoneHeight},alpha:zoneAlpha,color:zoneColor}));}else{marker.update(worldPos);wire&&wire.update(worldPos);selectNextPoint(markers.concat(marker));}});})([]);return{closeSurface:function closeSurface(){throw"TODO";},deactivate:function deactivate(){deactivatePointSelection();cleanups.forEach(function(c){return c();});}};};var ZonesPolysurfaceMouseControl=/*#__PURE__*/function(_Component45){_inherits(ZonesPolysurfaceMouseControl,_Component45);var _super178=_createSuper(ZonesPolysurfaceMouseControl);function ZonesPolysurfaceMouseControl(zonesPlugin){var _this183;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceMouseControl);_this183=_super178.call(this,zonesPlugin.viewer.scene);_this183.zonesPlugin=zonesPlugin;_this183.pointerLens=cfg.pointerLens;_this183._action=null;return _this183;}_createClass(ZonesPolysurfaceMouseControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=mousePointSelector(viewer,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceMouseControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceMouseControl;}(Component);var ZonesPolysurfaceTouchControl=/*#__PURE__*/function(_Component46){_inherits(ZonesPolysurfaceTouchControl,_Component46);var _super179=_createSuper(ZonesPolysurfaceTouchControl);function ZonesPolysurfaceTouchControl(zonesPlugin){var _this184;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceTouchControl);_this184=_super179.call(this,zonesPlugin.viewer.scene);_this184.zonesPlugin=zonesPlugin;_this184.pointerLens=cfg.pointerLens;_this184.pointerCircle=new PointerCircle(zonesPlugin.viewer);_this184._action=null;return _this184;}_createClass(ZonesPolysurfaceTouchControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=touchPointSelector(viewer,this.pointerCircle,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceTouchControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceTouchControl;}(Component);var ZoneEditControl=/*#__PURE__*/function(_Component47){_inherits(ZoneEditControl,_Component47);var _super180=_createSuper(ZoneEditControl);function ZoneEditControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this185;_classCallCheck(this,ZoneEditControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;_this185=_super180.call(this,scene);var altitude=zone._geometry.altitude;var dots=zone._geometry.planeCoordinates.map(function(planeCoord){var dotParent=scene.canvas.canvas.ownerDocument.body;var dot=new Dot3D(scene,{},dotParent,{fillColor:zone._color});dot.worldPos=math.vec3([planeCoord[0],altitude,planeCoord[1]]);dot.on("worldPos",function(){planeCoord[0]=dot.worldPos[0];planeCoord[1]=dot.worldPos[2];try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}});return dot;});var cleanupDrag=activateDraggableDots({viewer:viewer,handleMouseEvents:handleMouseEvents,handleTouchEvents:handleTouchEvents,pointerLens:cfg&&cfg.pointerLens,dots:dots,ray2WorldPos:function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);},onEnd:function onEnd(initPos,dot){if(zone._zoneMesh){_this185.fire("edited");}return!!zone._zoneMesh;}});var cleanup=function cleanup(){cleanupDrag();dots.forEach(function(d){return d.destroy();});};var destroyCb=zone.on("destroyed",cleanup);_this185._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this185;}_createClass(ZoneEditControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneEditControl.prototype),"destroy",this).call(this);}}]);return ZoneEditControl;}(Component);var ZoneEditMouseControl=/*#__PURE__*/function(_ZoneEditControl){_inherits(ZoneEditMouseControl,_ZoneEditControl);var _super181=_createSuper(ZoneEditMouseControl);function ZoneEditMouseControl(zone,cfg){_classCallCheck(this,ZoneEditMouseControl);return _super181.call(this,zone,cfg,true,false);}return _createClass(ZoneEditMouseControl);}(ZoneEditControl);var ZoneEditTouchControl=/*#__PURE__*/function(_ZoneEditControl2){_inherits(ZoneEditTouchControl,_ZoneEditControl2);var _super182=_createSuper(ZoneEditTouchControl);function ZoneEditTouchControl(zone,cfg){_classCallCheck(this,ZoneEditTouchControl);return _super182.call(this,zone,cfg,false,true);}return _createClass(ZoneEditTouchControl);}(ZoneEditControl);var ZoneTranslateControl=/*#__PURE__*/function(_Component48){_inherits(ZoneTranslateControl,_Component48);var _super183=_createSuper(ZoneTranslateControl);function ZoneTranslateControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this186;_classCallCheck(this,ZoneTranslateControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;_this186=_super183.call(this,scene);var self=_assertThisInitialized(_this186);var altitude=zone._geometry.altitude;var pointerLens=cfg&&cfg.pointerLens;var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var ray2WorldPos=function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);};var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction);};var copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.body,canvas,vec2);return vec2;};var canvasHandle=function canvasHandle(type,cb){var callback=function callback(event){event.preventDefault();cb(event);};canvas.addEventListener(type,callback);return function(){return canvas.removeEventListener(type,callback);};};var _cleanupCurrentDrag=function cleanupCurrentDrag(){};var startDrag=function startDrag(event,onMoveType,onEndType,matchesEvent){var e=matchesEvent(event);var canvasPos=copyCanvasPos(e,math.vec2());var pickRecord=viewer.scene.pick({canvasPos:canvasPos,includeEntities:[zone._zoneMesh.id]});var pickZone=pickRecord&&pickRecord.entity&&pickRecord.entity.zone;if(pickZone===zone){_cleanupCurrentDrag();canvas.style.cursor="move";viewer.cameraControl.active=false;var onChange=function(){var initCoords=zone._geometry.planeCoordinates.map(function(c){return c.slice();});var initWorldPos=pickWorldPos(canvasPos);var initDragCoord=math.vec2([initWorldPos[0],initWorldPos[2]]);var dPos=math.vec2();return function(canvasPos){var worldPos=pickWorldPos(canvasPos);dPos[0]=worldPos[0];dPos[1]=worldPos[2];math.subVec2(initDragCoord,dPos,dPos);zone._geometry.planeCoordinates.forEach(function(planeCoord,idx){math.subVec2(initCoords[idx],dPos,planeCoord);});try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}};}();var cleanupMove=canvasHandle(onMoveType,function(event){var e=matchesEvent(event);if(e){var _canvasPos4=copyCanvasPos(e,math.vec2());onChange(_canvasPos4);updatePointerLens(_canvasPos4);}});var cleanupEnd=canvasHandle(onEndType,function(event){var e=matchesEvent(event);if(e){var _canvasPos5=copyCanvasPos(e,math.vec2());onChange(_canvasPos5);updatePointerLens(null);_cleanupCurrentDrag();self.fire("translated");}});_cleanupCurrentDrag=function cleanupCurrentDrag(){_cleanupCurrentDrag=function cleanupCurrentDrag(){};canvas.style.cursor="default";viewer.cameraControl.active=true;cleanupMove();cleanupEnd();};}};var startDragCbs=[];if(handleMouseEvents){startDragCbs.push(canvasHandle("mousedown",function(event){if(event.which===1){startDrag(event,"mousemove","mouseup",function(event){return event.which===1&&event;});}}));}if(handleTouchEvents){startDragCbs.push(canvasHandle("touchstart",function(event){if(event.touches.length===1){var touchStartId=event.touches[0].identifier;startDrag(event,"touchmove","touchend",function(event){return _toConsumableArray(event.changedTouches).find(function(e){return e.identifier===touchStartId;});});}}));}var cleanup=function cleanup(){_cleanupCurrentDrag();startDragCbs.forEach(function(cb){return cb();});updatePointerLens(null);};var destroyCb=zone.on("destroyed",cleanup);_this186._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this186;}_createClass(ZoneTranslateControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneTranslateControl.prototype),"destroy",this).call(this);}}]);return ZoneTranslateControl;}(Component);var ZoneTranslateMouseControl=/*#__PURE__*/function(_ZoneTranslateControl){_inherits(ZoneTranslateMouseControl,_ZoneTranslateControl);var _super184=_createSuper(ZoneTranslateMouseControl);function ZoneTranslateMouseControl(zone,cfg){_classCallCheck(this,ZoneTranslateMouseControl);return _super184.call(this,zone,cfg,true,false);}return _createClass(ZoneTranslateMouseControl);}(ZoneTranslateControl);var ZoneTranslateTouchControl=/*#__PURE__*/function(_ZoneTranslateControl2){_inherits(ZoneTranslateTouchControl,_ZoneTranslateControl2);var _super185=_createSuper(ZoneTranslateTouchControl);function ZoneTranslateTouchControl(zone,cfg){_classCallCheck(this,ZoneTranslateTouchControl);return _super185.call(this,zone,cfg,false,true);}return _createClass(ZoneTranslateTouchControl);}(ZoneTranslateControl);export{AlphaFormat,AmbientLight,AngleMeasurementEditMouseControl,AngleMeasurementEditTouchControl,AngleMeasurementsControl,AngleMeasurementsMouseControl,AngleMeasurementsPlugin,AngleMeasurementsTouchControl,AnnotationsPlugin,AxisGizmoPlugin,BCFViewpointsPlugin,Bitmap,ByteType,CameraMemento,CameraPath,CameraPathAnimation,CityJSONLoaderPlugin,ClampToEdgeWrapping,Component,CompressedMediaType,Configs,ContextMenu,CubicBezierCurve,Curve,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DirLight,DistanceMeasurementEditMouseControl,DistanceMeasurementEditTouchControl,DistanceMeasurementsControl,DistanceMeasurementsMouseControl,DistanceMeasurementsPlugin,DistanceMeasurementsTouchControl,DotBIMDefaultDataSource,DotBIMLoaderPlugin,EdgeMaterial,EmphasisMaterial,FaceAlignedSectionPlanesPlugin,FastNavPlugin,FloatType,Fresnel,Frustum$1 as Frustum,FrustumPlane,GIFMediaType,GLTFDefaultDataSource,GLTFLoaderPlugin,HalfFloatType,ImagePlane,IntType,JPEGMediaType,KTX2TextureTranscoder,LASLoaderPlugin,LambertMaterial,LightMap,LineSet,LinearEncoding,LinearFilter,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,Loader,LoadingManager,LocaleService,LuminanceAlphaFormat,LuminanceFormat,Map$1 as Map,Marker,MarqueePicker,MarqueePickerMouseControl,Mesh,MetallicMaterial,MirroredRepeatWrapping,ModelMemento,NavCubePlugin,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,Node$2 as Node,OBJLoaderPlugin,ObjectsKdTree3,ObjectsMemento,PNGMediaType,Path,PerformanceModel,PhongMaterial,PickResult,Plugin,PointLight,PointerCircle,PointerLens,QuadraticBezierCurve,Queue,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,ReadableGeometry,RedFormat,RedIntegerFormat,ReflectionMap,RepeatWrapping,STLDefaultDataSource,STLLoaderPlugin,SceneModel,SceneModelMesh,SceneModelTransform,SectionPlane,SectionPlanesPlugin,ShortType,Skybox,SkyboxesPlugin,SpecularMaterial,SplineCurve,SpriteMarker,StoreyViewsPlugin,Texture,TextureTranscoder,TreeViewPlugin,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VBOGeometry,ViewCullPlugin,Viewer,WebIFCLoaderPlugin,WorkerPool$1 as WorkerPool,XKTDefaultDataSource,XKTLoaderPlugin,XML3DLoaderPlugin,ZoneEditControl,ZoneEditMouseControl,ZoneEditTouchControl,ZoneTranslateControl,ZoneTranslateMouseControl,ZoneTranslateTouchControl,ZonesMouseControl,ZonesPlugin,ZonesPolysurfaceMouseControl,ZonesPolysurfaceTouchControl,ZonesTouchControl,buildBoxGeometry,buildBoxLinesGeometry,buildBoxLinesGeometryFromAABB,buildCylinderGeometry,buildGridGeometry,buildLineGeometry,buildPlaneGeometry,buildPolylineGeometry,buildPolylineGeometryFromCurve,buildSphereGeometry,buildTorusGeometry,buildVectorTextGeometry,createRTCViewMat,frustumIntersectsAABB3,getKTX2TextureTranscoder,getPlaneRTCPos,load3DSGeometry,loadOBJGeometry,math,rtcToWorldPos,sRGBEncoding,setFrustum,stats,utils,worldToRTCPos,worldToRTCPositions}; +marker.update(worldPos);cleanups.forEach(function(c){return c();});onZoneCreated(zonesPlugin.createZone({id:math.createUUID(),geometry:{planeCoordinates:pos2D,altitude:zoneAltitude,height:zoneHeight},alpha:zoneAlpha,color:zoneColor}));}else{marker.update(worldPos);wire&&wire.update(worldPos);selectNextPoint(markers.concat(marker));}});})([]);return{closeSurface:function closeSurface(){throw"TODO";},deactivate:function deactivate(){deactivatePointSelection();cleanups.forEach(function(c){return c();});}};};var ZonesPolysurfaceMouseControl=/*#__PURE__*/function(_Component45){_inherits(ZonesPolysurfaceMouseControl,_Component45);var _super178=_createSuper(ZonesPolysurfaceMouseControl);function ZonesPolysurfaceMouseControl(zonesPlugin){var _this183;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceMouseControl);_this183=_super178.call(this,zonesPlugin.viewer.scene);_this183.zonesPlugin=zonesPlugin;_this183.pointerLens=cfg.pointerLens;_this183._action=null;return _this183;}_createClass(ZonesPolysurfaceMouseControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=mousePointSelector(viewer,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceMouseControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceMouseControl;}(Component);var ZonesPolysurfaceTouchControl=/*#__PURE__*/function(_Component46){_inherits(ZonesPolysurfaceTouchControl,_Component46);var _super179=_createSuper(ZonesPolysurfaceTouchControl);function ZonesPolysurfaceTouchControl(zonesPlugin){var _this184;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceTouchControl);_this184=_super179.call(this,zonesPlugin.viewer.scene);_this184.zonesPlugin=zonesPlugin;_this184.pointerLens=cfg.pointerLens;_this184.pointerCircle=new PointerCircle(zonesPlugin.viewer);_this184._action=null;return _this184;}_createClass(ZonesPolysurfaceTouchControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=touchPointSelector(viewer,this.pointerCircle,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceTouchControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceTouchControl;}(Component);var ZoneEditControl=/*#__PURE__*/function(_Component47){_inherits(ZoneEditControl,_Component47);var _super180=_createSuper(ZoneEditControl);function ZoneEditControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this185;_classCallCheck(this,ZoneEditControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;_this185=_super180.call(this,scene);var altitude=zone._geometry.altitude;var dots=zone._geometry.planeCoordinates.map(function(planeCoord){var dotParent=scene.canvas.canvas.ownerDocument.body;var dot=new Dot3D(scene,{},dotParent,{fillColor:zone._color});dot.worldPos=math.vec3([planeCoord[0],altitude,planeCoord[1]]);dot.on("worldPos",function(){planeCoord[0]=dot.worldPos[0];planeCoord[1]=dot.worldPos[2];try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}});return dot;});var cleanupDrag=activateDraggableDots({viewer:viewer,handleMouseEvents:handleMouseEvents,handleTouchEvents:handleTouchEvents,pointerLens:cfg&&cfg.pointerLens,dots:dots,ray2WorldPos:function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);},onEnd:function onEnd(initPos,dot){if(zone._zoneMesh){_this185.fire("edited");}return!!zone._zoneMesh;}});var cleanup=function cleanup(){cleanupDrag();dots.forEach(function(d){return d.destroy();});};var destroyCb=zone.on("destroyed",cleanup);_this185._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this185;}_createClass(ZoneEditControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneEditControl.prototype),"destroy",this).call(this);}}]);return ZoneEditControl;}(Component);var ZoneEditMouseControl=/*#__PURE__*/function(_ZoneEditControl){_inherits(ZoneEditMouseControl,_ZoneEditControl);var _super181=_createSuper(ZoneEditMouseControl);function ZoneEditMouseControl(zone,cfg){_classCallCheck(this,ZoneEditMouseControl);return _super181.call(this,zone,cfg,true,false);}return _createClass(ZoneEditMouseControl);}(ZoneEditControl);var ZoneEditTouchControl=/*#__PURE__*/function(_ZoneEditControl2){_inherits(ZoneEditTouchControl,_ZoneEditControl2);var _super182=_createSuper(ZoneEditTouchControl);function ZoneEditTouchControl(zone,cfg){_classCallCheck(this,ZoneEditTouchControl);return _super182.call(this,zone,cfg,false,true);}return _createClass(ZoneEditTouchControl);}(ZoneEditControl);var ZoneTranslateControl=/*#__PURE__*/function(_Component48){_inherits(ZoneTranslateControl,_Component48);var _super183=_createSuper(ZoneTranslateControl);function ZoneTranslateControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this186;_classCallCheck(this,ZoneTranslateControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;_this186=_super183.call(this,scene);var self=_assertThisInitialized(_this186);var altitude=zone._geometry.altitude;var pointerLens=cfg&&cfg.pointerLens;var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var ray2WorldPos=function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);};var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction);};var copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.body,canvas,vec2);return vec2;};var canvasHandle=function canvasHandle(type,cb){var callback=function callback(event){event.preventDefault();cb(event);};canvas.addEventListener(type,callback);return function(){return canvas.removeEventListener(type,callback);};};var _cleanupCurrentDrag=function cleanupCurrentDrag(){};var startDrag=function startDrag(event,onMoveType,onEndType,matchesEvent){var e=matchesEvent(event);var canvasPos=copyCanvasPos(e,math.vec2());var pickRecord=viewer.scene.pick({canvasPos:canvasPos,includeEntities:[zone._zoneMesh.id]});var pickZone=pickRecord&&pickRecord.entity&&pickRecord.entity.zone;if(pickZone===zone){_cleanupCurrentDrag();canvas.style.cursor="move";viewer.cameraControl.active=false;var onChange=function(){var initCoords=zone._geometry.planeCoordinates.map(function(c){return c.slice();});var initWorldPos=pickWorldPos(canvasPos);var initDragCoord=math.vec2([initWorldPos[0],initWorldPos[2]]);var dPos=math.vec2();return function(canvasPos){var worldPos=pickWorldPos(canvasPos);dPos[0]=worldPos[0];dPos[1]=worldPos[2];math.subVec2(initDragCoord,dPos,dPos);zone._geometry.planeCoordinates.forEach(function(planeCoord,idx){math.subVec2(initCoords[idx],dPos,planeCoord);});try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}};}();var cleanupMove=canvasHandle(onMoveType,function(event){var e=matchesEvent(event);if(e){var _canvasPos4=copyCanvasPos(e,math.vec2());onChange(_canvasPos4);updatePointerLens(_canvasPos4);}});var cleanupEnd=canvasHandle(onEndType,function(event){var e=matchesEvent(event);if(e){var _canvasPos5=copyCanvasPos(e,math.vec2());onChange(_canvasPos5);updatePointerLens(null);_cleanupCurrentDrag();self.fire("translated");}});_cleanupCurrentDrag=function cleanupCurrentDrag(){_cleanupCurrentDrag=function cleanupCurrentDrag(){};canvas.style.cursor="default";viewer.cameraControl.active=true;cleanupMove();cleanupEnd();};}};var startDragCbs=[];if(handleMouseEvents){startDragCbs.push(canvasHandle("mousedown",function(event){if(event.which===1){startDrag(event,"mousemove","mouseup",function(event){return event.which===1&&event;});}}));}if(handleTouchEvents){startDragCbs.push(canvasHandle("touchstart",function(event){if(event.touches.length===1){var touchStartId=event.touches[0].identifier;startDrag(event,"touchmove","touchend",function(event){return _toConsumableArray(event.changedTouches).find(function(e){return e.identifier===touchStartId;});});}}));}var cleanup=function cleanup(){_cleanupCurrentDrag();startDragCbs.forEach(function(cb){return cb();});updatePointerLens(null);};var destroyCb=zone.on("destroyed",cleanup);_this186._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this186;}_createClass(ZoneTranslateControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneTranslateControl.prototype),"destroy",this).call(this);}}]);return ZoneTranslateControl;}(Component);var ZoneTranslateMouseControl=/*#__PURE__*/function(_ZoneTranslateControl){_inherits(ZoneTranslateMouseControl,_ZoneTranslateControl);var _super184=_createSuper(ZoneTranslateMouseControl);function ZoneTranslateMouseControl(zone,cfg){_classCallCheck(this,ZoneTranslateMouseControl);return _super184.call(this,zone,cfg,true,false);}return _createClass(ZoneTranslateMouseControl);}(ZoneTranslateControl);var ZoneTranslateTouchControl=/*#__PURE__*/function(_ZoneTranslateControl2){_inherits(ZoneTranslateTouchControl,_ZoneTranslateControl2);var _super185=_createSuper(ZoneTranslateTouchControl);function ZoneTranslateTouchControl(zone,cfg){_classCallCheck(this,ZoneTranslateTouchControl);return _super185.call(this,zone,cfg,false,true);}return _createClass(ZoneTranslateTouchControl);}(ZoneTranslateControl);export{AlphaFormat,AmbientLight,AngleMeasurementEditMouseControl,AngleMeasurementEditTouchControl,AngleMeasurementsControl,AngleMeasurementsMouseControl,AngleMeasurementsPlugin,AngleMeasurementsTouchControl,AnnotationsPlugin,AxisGizmoPlugin,BCFViewpointsPlugin,Bitmap,ByteType,CameraMemento,CameraPath,CameraPathAnimation,CityJSONLoaderPlugin,ClampToEdgeWrapping,Component,CompressedMediaType,Configs,ContextMenu,CubicBezierCurve,Curve,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DirLight,DistanceMeasurementEditControl,DistanceMeasurementEditMouseControl,DistanceMeasurementEditTouchControl,DistanceMeasurementsControl,DistanceMeasurementsMouseControl,DistanceMeasurementsPlugin,DistanceMeasurementsTouchControl,DotBIMDefaultDataSource,DotBIMLoaderPlugin,EdgeMaterial,EmphasisMaterial,FaceAlignedSectionPlanesPlugin,FastNavPlugin,FloatType,Fresnel,Frustum$1 as Frustum,FrustumPlane,GIFMediaType,GLTFDefaultDataSource,GLTFLoaderPlugin,HalfFloatType,ImagePlane,IntType,JPEGMediaType,KTX2TextureTranscoder,LASLoaderPlugin,LambertMaterial,LightMap,LineSet,LinearEncoding,LinearFilter,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,Loader,LoadingManager,LocaleService,LuminanceAlphaFormat,LuminanceFormat,Map$1 as Map,Marker,MarqueePicker,MarqueePickerMouseControl,Mesh,MetallicMaterial,MirroredRepeatWrapping,ModelMemento,NavCubePlugin,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,Node$2 as Node,OBJLoaderPlugin,ObjectsKdTree3,ObjectsMemento,PNGMediaType,Path,PerformanceModel,PhongMaterial,PickResult,Plugin,PointLight,PointerCircle,PointerLens,QuadraticBezierCurve,Queue,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,ReadableGeometry,RedFormat,RedIntegerFormat,ReflectionMap,RepeatWrapping,STLDefaultDataSource,STLLoaderPlugin,SceneModel,SceneModelMesh,SceneModelTransform,SectionPlane,SectionPlanesPlugin,ShortType,Skybox,SkyboxesPlugin,SpecularMaterial,SplineCurve,SpriteMarker,StoreyViewsPlugin,Texture,TextureTranscoder,TreeViewPlugin,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VBOGeometry,ViewCullPlugin,Viewer,WebIFCLoaderPlugin,WorkerPool$1 as WorkerPool,XKTDefaultDataSource,XKTLoaderPlugin,XML3DLoaderPlugin,ZoneEditControl,ZoneEditMouseControl,ZoneEditTouchControl,ZoneTranslateControl,ZoneTranslateMouseControl,ZoneTranslateTouchControl,ZonesMouseControl,ZonesPlugin,ZonesPolysurfaceMouseControl,ZonesPolysurfaceTouchControl,ZonesTouchControl,buildBoxGeometry,buildBoxLinesGeometry,buildBoxLinesGeometryFromAABB,buildCylinderGeometry,buildGridGeometry,buildLineGeometry,buildPlaneGeometry,buildPolylineGeometry,buildPolylineGeometryFromCurve,buildSphereGeometry,buildTorusGeometry,buildVectorTextGeometry,createRTCViewMat,frustumIntersectsAABB3,getKTX2TextureTranscoder,getPlaneRTCPos,load3DSGeometry,loadOBJGeometry,math,rtcToWorldPos,sRGBEncoding,setFrustum,stats,utils,worldToRTCPos,worldToRTCPositions}; diff --git a/dist/xeokit-sdk.min.cjs.js b/dist/xeokit-sdk.min.cjs.js index 98e56ab56..c372846f0 100644 --- a/dist/xeokit-sdk.min.cjs.js +++ b/dist/xeokit-sdk.min.cjs.js @@ -34,4 +34,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var Dc=function(e,t){return Dc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},Dc(e,t)};function Sc(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}Dc(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var Tc=function(){return Tc=Object.assign||function(e){for(var t,i=1,s=arguments.length;i0&&r[r.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]=55296&&r<=56319&&i>10),n%1024+56320)),(r+1===i||s.length>16384)&&(o+=String.fromCharCode.apply(String,s),s.length=0)}return o},Vc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Hc="undefined"==typeof Uint8Array?[]:new Uint8Array(256),jc=0;jc=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>5])<<2)+(31&e),this.data[t];if(e<=65535)return t=((t=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[t];if(e>11),t=this.index[t],t+=e>>5&63,t=((t=this.index[t])<<2)+(31&e),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Jc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yc="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Zc=0;Zc>4,h[l++]=(15&s)<<4|r>>2,h[l++]=(3&r)<<6|63&o;return A}(e),n=Array.isArray(o)?function(e){for(var t=e.length,i=[],s=0;s0;){var n=s[--o];if(Array.isArray(e)?-1!==e.indexOf(n):e===n)for(var a=i;a<=s.length;){var l;if((l=s[++a])===t)return!0;if(l!==qc)break}if(n!==qc)break}return!1},Su=function(e,t){for(var i=e;i>=0;){var s=t[i];if(s!==qc)return s;i--}return 0},Tu=function(e,t,i,s,r){if(0===i[s])return"×";var o=s-1;if(Array.isArray(r)&&!0===r[o])return"×";var n=o-1,a=o+1,l=t[o],A=n>=0?t[n]:0,h=t[a];if(2===l&&3===h)return"×";if(-1!==Pu.indexOf(l))return"!";if(-1!==Pu.indexOf(h))return"×";if(-1!==Cu.indexOf(h))return"×";if(8===Su(o,t))return"÷";if(11===Bu.get(e[o]))return"×";if((l===du||l===pu)&&11===Bu.get(e[a]))return"×";if(7===l||7===h)return"×";if(9===l)return"×";if(-1===[qc,$c,eu].indexOf(l)&&9===h)return"×";if(-1!==[tu,iu,su,au,cu].indexOf(h))return"×";if(Su(o,t)===nu)return"×";if(Du(23,nu,o,t))return"×";if(Du([tu,iu],ou,o,t))return"×";if(Du(12,12,o,t))return"×";if(l===qc)return"÷";if(23===l||23===h)return"×";if(16===h||16===l)return"÷";if(-1!==[$c,eu,ou].indexOf(h)||14===l)return"×";if(36===A&&-1!==Iu.indexOf(l))return"×";if(l===cu&&36===h)return"×";if(h===ru)return"×";if(-1!==wu.indexOf(h)&&l===lu||-1!==wu.indexOf(l)&&h===lu)return"×";if(l===hu&&-1!==[mu,du,pu].indexOf(h)||-1!==[mu,du,pu].indexOf(l)&&h===Au)return"×";if(-1!==wu.indexOf(l)&&-1!==Mu.indexOf(h)||-1!==Mu.indexOf(l)&&-1!==wu.indexOf(h))return"×";if(-1!==[hu,Au].indexOf(l)&&(h===lu||-1!==[nu,eu].indexOf(h)&&t[a+1]===lu)||-1!==[nu,eu].indexOf(l)&&h===lu||l===lu&&-1!==[lu,cu,au].indexOf(h))return"×";if(-1!==[lu,cu,au,tu,iu].indexOf(h))for(var c=o;c>=0;){if((u=t[c])===lu)return"×";if(-1===[cu,au].indexOf(u))break;c--}if(-1!==[hu,Au].indexOf(h))for(c=-1!==[tu,iu].indexOf(l)?n:o;c>=0;){var u;if((u=t[c])===lu)return"×";if(-1===[cu,au].indexOf(u))break;c--}if(_u===l&&-1!==[_u,vu,fu,gu].indexOf(h)||-1!==[vu,fu].indexOf(l)&&-1!==[vu,bu].indexOf(h)||-1!==[bu,gu].indexOf(l)&&h===bu)return"×";if(-1!==Fu.indexOf(l)&&-1!==[ru,Au].indexOf(h)||-1!==Fu.indexOf(h)&&l===hu)return"×";if(-1!==wu.indexOf(l)&&-1!==wu.indexOf(h))return"×";if(l===au&&-1!==wu.indexOf(h))return"×";if(-1!==wu.concat(lu).indexOf(l)&&h===nu&&-1===xu.indexOf(e[a])||-1!==wu.concat(lu).indexOf(h)&&l===iu)return"×";if(41===l&&41===h){for(var d=i[o],p=1;d>0&&41===t[--d];)p++;if(p%2!=0)return"×"}return l===du&&h===pu?"×":"÷"},Lu=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var i=function(e,t){void 0===t&&(t="strict");var i=[],s=[],r=[];return e.forEach((function(e,o){var n=Bu.get(e);if(n>50?(r.push(!0),n-=50):r.push(!1),-1!==["normal","auto","loose"].indexOf(t)&&-1!==[8208,8211,12316,12448].indexOf(e))return s.push(o),i.push(16);if(4===n||11===n){if(0===o)return s.push(o),i.push(uu);var a=i[o-1];return-1===Eu.indexOf(a)?(s.push(s[o-1]),i.push(a)):(s.push(o),i.push(uu))}return s.push(o),31===n?i.push("strict"===t?ou:mu):n===yu||29===n?i.push(uu):43===n?e>=131072&&e<=196605||e>=196608&&e<=262141?i.push(mu):i.push(uu):void i.push(n)})),[s,i,r]}(e,t.lineBreak),s=i[0],r=i[1],o=i[2];"break-all"!==t.wordBreak&&"break-word"!==t.wordBreak||(r=r.map((function(e){return-1!==[lu,uu,yu].indexOf(e)?mu:e})));var n="keep-all"===t.wordBreak?o.map((function(t,i){return t&&e[i]>=19968&&e[i]<=40959})):void 0;return[s,r,n]},Ru=function(){function e(e,t,i,s){this.codePoints=e,this.required="!"===t,this.start=i,this.end=s}return e.prototype.slice=function(){return Qc.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),Uu=function(e){return e>=48&&e<=57},ku=function(e){return Uu(e)||e>=65&&e<=70||e>=97&&e<=102},Ou=function(e){return 10===e||9===e||32===e},Nu=function(e){return function(e){return function(e){return e>=97&&e<=122}(e)||function(e){return e>=65&&e<=90}(e)}(e)||function(e){return e>=128}(e)||95===e},Qu=function(e){return Nu(e)||Uu(e)||45===e},Vu=function(e){return e>=0&&e<=8||11===e||e>=14&&e<=31||127===e},Hu=function(e,t){return 92===e&&10!==t},ju=function(e,t,i){return 45===e?Nu(t)||Hu(t,i):!!Nu(e)||!(92!==e||!Hu(e,t))},Gu=function(e,t,i){return 43===e||45===e?!!Uu(t)||46===t&&Uu(i):Uu(46===e?t:e)},zu=function(e){var t=0,i=1;43!==e[t]&&45!==e[t]||(45===e[t]&&(i=-1),t++);for(var s=[];Uu(e[t]);)s.push(e[t++]);var r=s.length?parseInt(Qc.apply(void 0,s),10):0;46===e[t]&&t++;for(var o=[];Uu(e[t]);)o.push(e[t++]);var n=o.length,a=n?parseInt(Qc.apply(void 0,o),10):0;69!==e[t]&&101!==e[t]||t++;var l=1;43!==e[t]&&45!==e[t]||(45===e[t]&&(l=-1),t++);for(var A=[];Uu(e[t]);)A.push(e[t++]);var h=A.length?parseInt(Qc.apply(void 0,A),10):0;return i*(r+a*Math.pow(10,-n))*Math.pow(10,l*h)},Wu={type:2},Ku={type:3},Xu={type:4},Ju={type:13},Yu={type:8},Zu={type:21},qu={type:9},$u={type:10},ed={type:11},td={type:12},id={type:14},sd={type:23},rd={type:1},od={type:25},nd={type:24},ad={type:26},ld={type:27},Ad={type:28},hd={type:29},cd={type:31},ud={type:32},dd=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(Nc(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==ud;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case 34:return this.consumeStringToken(34);case 35:var t=this.peekCodePoint(0),i=this.peekCodePoint(1),s=this.peekCodePoint(2);if(Qu(t)||Hu(i,s)){var r=ju(t,i,s)?2:1;return{type:5,value:this.consumeName(),flags:r}}break;case 36:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Ju;break;case 39:return this.consumeStringToken(39);case 40:return Wu;case 41:return Ku;case 42:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),id;break;case 43:if(Gu(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case 44:return Xu;case 45:var o=e,n=this.peekCodePoint(0),a=this.peekCodePoint(1);if(Gu(o,n,a))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(ju(o,n,a))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(45===n&&62===a)return this.consumeCodePoint(),this.consumeCodePoint(),nd;break;case 46:if(Gu(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case 47:if(42===this.peekCodePoint(0))for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(42===l&&47===(l=this.consumeCodePoint()))return this.consumeToken();if(-1===l)return this.consumeToken()}break;case 58:return ad;case 59:return ld;case 60:if(33===this.peekCodePoint(0)&&45===this.peekCodePoint(1)&&45===this.peekCodePoint(2))return this.consumeCodePoint(),this.consumeCodePoint(),od;break;case 64:var A=this.peekCodePoint(0),h=this.peekCodePoint(1),c=this.peekCodePoint(2);if(ju(A,h,c))return{type:7,value:this.consumeName()};break;case 91:return Ad;case 92:if(Hu(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case 93:return hd;case 61:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Yu;break;case 123:return ed;case 125:return td;case 117:case 85:var u=this.peekCodePoint(0),d=this.peekCodePoint(1);return 43!==u||!ku(d)&&63!==d||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case 124:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),qu;if(124===this.peekCodePoint(0))return this.consumeCodePoint(),Zu;break;case 126:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),$u;break;case-1:return ud}return Ou(e)?(this.consumeWhiteSpace(),cd):Uu(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Nu(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Qc(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return void 0===e?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();ku(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var i=!1;63===t&&e.length<6;)e.push(t),t=this.consumeCodePoint(),i=!0;if(i)return{type:30,start:parseInt(Qc.apply(void 0,e.map((function(e){return 63===e?48:e}))),16),end:parseInt(Qc.apply(void 0,e.map((function(e){return 63===e?70:e}))),16)};var s=parseInt(Qc.apply(void 0,e),16);if(45===this.peekCodePoint(0)&&ku(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var r=[];ku(t)&&r.length<6;)r.push(t),t=this.consumeCodePoint();return{type:30,start:s,end:parseInt(Qc.apply(void 0,r),16)}}return{type:30,start:s,end:s}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return"url"===e.toLowerCase()&&40===this.peekCodePoint(0)?(this.consumeCodePoint(),this.consumeUrlToken()):40===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),-1===this.peekCodePoint(0))return{type:22,value:""};var t=this.peekCodePoint(0);if(39===t||34===t){var i=this.consumeStringToken(this.consumeCodePoint());return 0===i.type&&(this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0))?(this.consumeCodePoint(),{type:22,value:i.value}):(this.consumeBadUrlRemnants(),sd)}for(;;){var s=this.consumeCodePoint();if(-1===s||41===s)return{type:22,value:Qc.apply(void 0,e)};if(Ou(s))return this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:22,value:Qc.apply(void 0,e)}):(this.consumeBadUrlRemnants(),sd);if(34===s||39===s||40===s||Vu(s))return this.consumeBadUrlRemnants(),sd;if(92===s){if(!Hu(s,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),sd;e.push(this.consumeEscapedCodePoint())}else e.push(s)}},e.prototype.consumeWhiteSpace=function(){for(;Ou(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(41===e||-1===e)return;Hu(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t="";e>0;){var i=Math.min(5e4,e);t+=Qc.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),t},e.prototype.consumeStringToken=function(e){for(var t="",i=0;;){var s=this._value[i];if(-1===s||void 0===s||s===e)return{type:0,value:t+=this.consumeStringSlice(i)};if(10===s)return this._value.splice(0,i),rd;if(92===s){var r=this._value[i+1];-1!==r&&void 0!==r&&(10===r?(t+=this.consumeStringSlice(i),i=-1,this._value.shift()):Hu(s,r)&&(t+=this.consumeStringSlice(i),t+=Qc(this.consumeEscapedCodePoint()),i=-1))}i++}},e.prototype.consumeNumber=function(){var e=[],t=4,i=this.peekCodePoint(0);for(43!==i&&45!==i||e.push(this.consumeCodePoint());Uu(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0);var s=this.peekCodePoint(1);if(46===i&&Uu(s))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;Uu(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0),s=this.peekCodePoint(1);var r=this.peekCodePoint(2);if((69===i||101===i)&&((43===s||45===s)&&Uu(r)||Uu(s)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;Uu(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[zu(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],i=e[1],s=this.peekCodePoint(0),r=this.peekCodePoint(1),o=this.peekCodePoint(2);return ju(s,r,o)?{type:15,number:t,flags:i,unit:this.consumeName()}:37===s?(this.consumeCodePoint(),{type:16,number:t,flags:i}):{type:17,number:t,flags:i}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(ku(e)){for(var t=Qc(e);ku(this.peekCodePoint(0))&&t.length<6;)t+=Qc(this.consumeCodePoint());Ou(this.peekCodePoint(0))&&this.consumeCodePoint();var i=parseInt(t,16);return 0===i||function(e){return e>=55296&&e<=57343}(i)||i>1114111?65533:i}return-1===e?65533:e},e.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Qu(t))e+=Qc(t);else{if(!Hu(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),e;e+=Qc(this.consumeEscapedCodePoint())}}},e}(),pd=function(){function e(e){this._tokens=e}return e.create=function(t){var i=new dd;return i.write(t),new e(i.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();31===e.type;)e=this.consumeToken();if(32===e.type)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do{e=this.consumeToken()}while(31===e.type);if(32===e.type)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(32===t.type)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},i=this.consumeToken();;){if(32===i.type||Bd(i,e))return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue()),i=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var i=this.consumeToken();if(32===i.type||3===i.type)return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return void 0===e?ud:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),fd=function(e){return 15===e.type},gd=function(e){return 17===e.type},md=function(e){return 20===e.type},_d=function(e){return 0===e.type},vd=function(e,t){return md(e)&&e.value===t},bd=function(e){return 31!==e.type},yd=function(e){return 31!==e.type&&4!==e.type},xd=function(e){var t=[],i=[];return e.forEach((function(e){if(4===e.type){if(0===i.length)throw new Error("Error parsing function args, zero tokens for arg");return t.push(i),void(i=[])}31!==e.type&&i.push(e)})),i.length&&t.push(i),t},Bd=function(e,t){return 11===t&&12===e.type||(28===t&&29===e.type||2===t&&3===e.type)},wd=function(e){return 17===e.type||15===e.type},Pd=function(e){return 16===e.type||wd(e)},Cd=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},Md={type:17,number:0,flags:4},Ed={type:16,number:50,flags:4},Fd={type:16,number:100,flags:4},Id=function(e,t,i){var s=e[0],r=e[1];return[Dd(s,t),Dd(void 0!==r?r:s,i)]},Dd=function(e,t){if(16===e.type)return e.number/100*t;if(fd(e))switch(e.unit){case"rem":case"em":return 16*e.number;default:return e.number}return e.number},Sd=function(e,t){if(15===t.type)switch(t.unit){case"deg":return Math.PI*t.number/180;case"grad":return Math.PI/200*t.number;case"rad":return t.number;case"turn":return 2*Math.PI*t.number}throw new Error("Unsupported angle type")},Td=function(e){return 15===e.type&&("deg"===e.unit||"grad"===e.unit||"rad"===e.unit||"turn"===e.unit)},Ld=function(e){switch(e.filter(md).map((function(e){return e.value})).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Md,Md];case"to top":case"bottom":return Rd(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Md,Fd];case"to right":case"left":return Rd(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Fd,Fd];case"to bottom":case"top":return Rd(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Fd,Md];case"to left":case"right":return Rd(270)}return 0},Rd=function(e){return Math.PI*e/180},Ud=function(e,t){if(18===t.type){var i=Gd[t.name];if(void 0===i)throw new Error('Attempting to parse an unsupported color function "'+t.name+'"');return i(e,t.values)}if(5===t.type){if(3===t.value.length){var s=t.value.substring(0,1),r=t.value.substring(1,2),o=t.value.substring(2,3);return Nd(parseInt(s+s,16),parseInt(r+r,16),parseInt(o+o,16),1)}if(4===t.value.length){s=t.value.substring(0,1),r=t.value.substring(1,2),o=t.value.substring(2,3);var n=t.value.substring(3,4);return Nd(parseInt(s+s,16),parseInt(r+r,16),parseInt(o+o,16),parseInt(n+n,16)/255)}if(6===t.value.length){s=t.value.substring(0,2),r=t.value.substring(2,4),o=t.value.substring(4,6);return Nd(parseInt(s,16),parseInt(r,16),parseInt(o,16),1)}if(8===t.value.length){s=t.value.substring(0,2),r=t.value.substring(2,4),o=t.value.substring(4,6),n=t.value.substring(6,8);return Nd(parseInt(s,16),parseInt(r,16),parseInt(o,16),parseInt(n,16)/255)}}if(20===t.type){var a=Wd[t.value.toUpperCase()];if(void 0!==a)return a}return Wd.TRANSPARENT},kd=function(e){return 0==(255&e)},Od=function(e){var t=255&e,i=255&e>>8,s=255&e>>16,r=255&e>>24;return t<255?"rgba("+r+","+s+","+i+","+t/255+")":"rgb("+r+","+s+","+i+")"},Nd=function(e,t,i,s){return(e<<24|t<<16|i<<8|Math.round(255*s)<<0)>>>0},Qd=function(e,t){if(17===e.type)return e.number;if(16===e.type){var i=3===t?1:255;return 3===t?e.number/100*i:Math.round(e.number/100*i)}return 0},Vd=function(e,t){var i=t.filter(yd);if(3===i.length){var s=i.map(Qd),r=s[0],o=s[1],n=s[2];return Nd(r,o,n,1)}if(4===i.length){var a=i.map(Qd),l=(r=a[0],o=a[1],n=a[2],a[3]);return Nd(r,o,n,l)}return 0};function Hd(e,t,i){return i<0&&(i+=1),i>=1&&(i-=1),i<1/6?(t-e)*i*6+e:i<.5?t:i<2/3?6*(t-e)*(2/3-i)+e:e}var jd=function(e,t){var i=t.filter(yd),s=i[0],r=i[1],o=i[2],n=i[3],a=(17===s.type?Rd(s.number):Sd(e,s))/(2*Math.PI),l=Pd(r)?r.number/100:0,A=Pd(o)?o.number/100:0,h=void 0!==n&&Pd(n)?Dd(n,1):1;if(0===l)return Nd(255*A,255*A,255*A,1);var c=A<=.5?A*(l+1):A+l-A*l,u=2*A-c,d=Hd(u,c,a+1/3),p=Hd(u,c,a),f=Hd(u,c,a-1/3);return Nd(255*d,255*p,255*f,h)},Gd={hsl:jd,hsla:jd,rgb:Vd,rgba:Vd},zd=function(e,t){return Ud(e,pd.create(t).parseComponentValue())},Wd={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Kd={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(md(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},Xd={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Jd=function(e,t){var i=Ud(e,t[0]),s=t[1];return s&&Pd(s)?{color:i,stop:s}:{color:i,stop:null}},Yd=function(e,t){var i=e[0],s=e[e.length-1];null===i.stop&&(i.stop=Md),null===s.stop&&(s.stop=Fd);for(var r=[],o=0,n=0;no?r.push(l):r.push(o),o=l}else r.push(null)}var A=null;for(n=0;ne.optimumDistance)?{optimumCorner:t,optimumDistance:a}:e}),{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},ep=function(e,t){var i=Rd(180),s=[];return xd(t).forEach((function(t,r){if(0===r){var o=t[0];if(20===o.type&&-1!==["top","left","right","bottom"].indexOf(o.value))return void(i=Ld(t));if(Td(o))return void(i=(Sd(e,o)+Rd(270))%Rd(360))}var n=Jd(e,t);s.push(n)})),{angle:i,stops:s,type:1}},tp=function(e,t){var i=0,s=3,r=[],o=[];return xd(t).forEach((function(t,n){var a=!0;if(0===n?a=t.reduce((function(e,t){if(md(t))switch(t.value){case"center":return o.push(Ed),!1;case"top":case"left":return o.push(Md),!1;case"right":case"bottom":return o.push(Fd),!1}else if(Pd(t)||wd(t))return o.push(t),!1;return e}),a):1===n&&(a=t.reduce((function(e,t){if(md(t))switch(t.value){case"circle":return i=0,!1;case"ellipse":return i=1,!1;case"contain":case"closest-side":return s=0,!1;case"farthest-side":return s=1,!1;case"closest-corner":return s=2,!1;case"cover":case"farthest-corner":return s=3,!1}else if(wd(t)||Pd(t))return Array.isArray(s)||(s=[]),s.push(t),!1;return e}),a)),a){var l=Jd(e,t);r.push(l)}})),{size:s,shape:i,stops:r,position:o,type:2}},ip=function(e,t){if(22===t.type){var i={url:t.value,type:0};return e.cache.addImage(t.value),i}if(18===t.type){var s=rp[t.name];if(void 0===s)throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return s(e,t.values)}throw new Error("Unsupported image type "+t.type)};var sp,rp={"linear-gradient":function(e,t){var i=Rd(180),s=[];return xd(t).forEach((function(t,r){if(0===r){var o=t[0];if(20===o.type&&"to"===o.value)return void(i=Ld(t));if(Td(o))return void(i=Sd(e,o))}var n=Jd(e,t);s.push(n)})),{angle:i,stops:s,type:1}},"-moz-linear-gradient":ep,"-ms-linear-gradient":ep,"-o-linear-gradient":ep,"-webkit-linear-gradient":ep,"radial-gradient":function(e,t){var i=0,s=3,r=[],o=[];return xd(t).forEach((function(t,n){var a=!0;if(0===n){var l=!1;a=t.reduce((function(e,t){if(l)if(md(t))switch(t.value){case"center":return o.push(Ed),e;case"top":case"left":return o.push(Md),e;case"right":case"bottom":return o.push(Fd),e}else(Pd(t)||wd(t))&&o.push(t);else if(md(t))switch(t.value){case"circle":return i=0,!1;case"ellipse":return i=1,!1;case"at":return l=!0,!1;case"closest-side":return s=0,!1;case"cover":case"farthest-side":return s=1,!1;case"contain":case"closest-corner":return s=2,!1;case"farthest-corner":return s=3,!1}else if(wd(t)||Pd(t))return Array.isArray(s)||(s=[]),s.push(t),!1;return e}),a)}if(a){var A=Jd(e,t);r.push(A)}})),{size:s,shape:i,stops:r,position:o,type:2}},"-moz-radial-gradient":tp,"-ms-radial-gradient":tp,"-o-radial-gradient":tp,"-webkit-radial-gradient":tp,"-webkit-gradient":function(e,t){var i=Rd(180),s=[],r=1;return xd(t).forEach((function(t,i){var o=t[0];if(0===i){if(md(o)&&"linear"===o.value)return void(r=1);if(md(o)&&"radial"===o.value)return void(r=2)}if(18===o.type)if("from"===o.name){var n=Ud(e,o.values[0]);s.push({stop:Md,color:n})}else if("to"===o.name){n=Ud(e,o.values[0]);s.push({stop:Fd,color:n})}else if("color-stop"===o.name){var a=o.values.filter(yd);if(2===a.length){n=Ud(e,a[1]);var l=a[0];gd(l)&&s.push({stop:{type:16,number:100*l.number,flags:l.flags},color:n})}}})),1===r?{angle:(i+Rd(180))%Rd(360),stops:s,type:r}:{size:3,shape:0,stops:s,position:[],type:r}}},op={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(0===t.length)return[];var i=t[0];return 20===i.type&&"none"===i.value?[]:t.filter((function(e){return yd(e)&&function(e){return!(20===e.type&&"none"===e.value||18===e.type&&!rp[e.name])}(e)})).map((function(t){return ip(e,t)}))}},np={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(md(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},ap={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return xd(t).map((function(e){return e.filter(Pd)})).map(Cd)}},lp={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return xd(t).map((function(e){return e.filter(md).map((function(e){return e.value})).join(" ")})).map(Ap)}},Ap=function(e){switch(e){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}};!function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"}(sp||(sp={}));var hp,cp={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return xd(t).map((function(e){return e.filter(up)}))}},up=function(e){return md(e)||Pd(e)},dp=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},pp=dp("top"),fp=dp("right"),gp=dp("bottom"),mp=dp("left"),_p=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return Cd(t.filter(Pd))}}},vp=_p("top-left"),bp=_p("top-right"),yp=_p("bottom-right"),xp=_p("bottom-left"),Bp=function(e){return{name:"border-"+e+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},wp=Bp("top"),Pp=Bp("right"),Cp=Bp("bottom"),Mp=Bp("left"),Ep=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return fd(t)?t.number:0}}},Fp=Ep("top"),Ip=Ep("right"),Dp=Ep("bottom"),Sp=Ep("left"),Tp={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Lp={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){return"rtl"===t?1:0}},Rp={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(md).reduce((function(e,t){return e|Up(t.value)}),0)}},Up=function(e){switch(e){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},kp={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},Op={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(e,t){return 20===t.type&&"normal"===t.value?0:17===t.type||15===t.type?t.number:0}};!function(e){e.NORMAL="normal",e.STRICT="strict"}(hp||(hp={}));var Np,Qp={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"strict"===t?hp.STRICT:hp.NORMAL}},Vp={name:"line-height",initialValue:"normal",prefix:!1,type:4},Hp=function(e,t){return md(e)&&"normal"===e.value?1.2*t:17===e.type?t*e.number:Pd(e)?Dd(e,t):t},jp={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return 20===t.type&&"none"===t.value?null:ip(e,t)}},Gp={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(e,t){return"inside"===t?0:1}},zp={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Wp=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},Kp=Wp("top"),Xp=Wp("right"),Jp=Wp("bottom"),Yp=Wp("left"),Zp={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(md).map((function(e){switch(e.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}}))}},qp={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"break-word"===t?"break-word":"normal"}},$p=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},ef=$p("top"),tf=$p("right"),sf=$p("bottom"),rf=$p("left"),of={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(e,t){switch(t){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},nf={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(e,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},af={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return 1===t.length&&vd(t[0],"none")?[]:xd(t).map((function(t){for(var i={color:Wd.TRANSPARENT,offsetX:Md,offsetY:Md,blur:Md},s=0,r=0;r1?1:0],this.overflowWrap=Qf(e,qp,t.overflowWrap),this.paddingTop=Qf(e,ef,t.paddingTop),this.paddingRight=Qf(e,tf,t.paddingRight),this.paddingBottom=Qf(e,sf,t.paddingBottom),this.paddingLeft=Qf(e,rf,t.paddingLeft),this.paintOrder=Qf(e,Lf,t.paintOrder),this.position=Qf(e,nf,t.position),this.textAlign=Qf(e,of,t.textAlign),this.textDecorationColor=Qf(e,vf,null!==(i=t.textDecorationColor)&&void 0!==i?i:t.color),this.textDecorationLine=Qf(e,bf,null!==(s=t.textDecorationLine)&&void 0!==s?s:t.textDecoration),this.textShadow=Qf(e,af,t.textShadow),this.textTransform=Qf(e,lf,t.textTransform),this.transform=Qf(e,Af,t.transform),this.transformOrigin=Qf(e,df,t.transformOrigin),this.visibility=Qf(e,pf,t.visibility),this.webkitTextStrokeColor=Qf(e,Rf,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Qf(e,Uf,t.webkitTextStrokeWidth),this.wordBreak=Qf(e,ff,t.wordBreak),this.zIndex=Qf(e,gf,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&0===this.visibility},e.prototype.isTransparent=function(){return kd(this.backgroundColor)},e.prototype.isTransformed=function(){return null!==this.transform},e.prototype.isPositioned=function(){return 0!==this.position},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return 0!==this.float},e.prototype.isInlineLevel=function(){return Cf(this.display,4)||Cf(this.display,33554432)||Cf(this.display,268435456)||Cf(this.display,536870912)||Cf(this.display,67108864)||Cf(this.display,134217728)},e}(),Of=function(e,t){this.content=Qf(e,Mf,t.content),this.quotes=Qf(e,Df,t.quotes)},Nf=function(e,t){this.counterIncrement=Qf(e,Ef,t.counterIncrement),this.counterReset=Qf(e,Ff,t.counterReset)},Qf=function(e,t,i){var s=new dd,r=null!=i?i.toString():t.initialValue;s.write(r);var o=new pd(s.read());switch(t.type){case 2:var n=o.parseComponentValue();return t.parse(e,md(n)?n.value:t.initialValue);case 0:return t.parse(e,o.parseComponentValue());case 1:return t.parse(e,o.parseComponentValues());case 4:return o.parseComponentValue();case 3:switch(t.format){case"angle":return Sd(e,o.parseComponentValue());case"color":return Ud(e,o.parseComponentValue());case"image":return ip(e,o.parseComponentValue());case"length":var a=o.parseComponentValue();return wd(a)?a:Md;case"length-percentage":var l=o.parseComponentValue();return Pd(l)?l:Md;case"time":return mf(e,o.parseComponentValue())}}},Vf=function(e,t){var i=function(e){switch(e.getAttribute("data-html2canvas-debug")){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}}(e);return 1===i||t===i},Hf=function(e,t){this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Vf(t,3),this.styles=new kf(e,window.getComputedStyle(t,null)),Hg(t)&&(this.styles.animationDuration.some((function(e){return e>0}))&&(t.style.animationDuration="0s"),null!==this.styles.transform&&(t.style.transform="none")),this.bounds=Oc(this.context,t),Vf(t,4)&&(this.flags|=16)},jf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Gf="undefined"==typeof Uint8Array?[]:new Uint8Array(256),zf=0;zf=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>5])<<2)+(31&e),this.data[t];if(e<=65535)return t=((t=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[t];if(e>11),t=this.index[t],t+=e>>5&63,t=((t=this.index[t])<<2)+(31&e),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Xf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jf="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Yf=0;Yf>10),n%1024+56320)),(r+1===i||s.length>16384)&&(o+=String.fromCharCode.apply(String,s),s.length=0)}return o},sg=function(e,t){var i,s,r,o=function(e){var t,i,s,r,o,n=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(n--,"="===e[e.length-2]&&n--);var A="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(n):new Array(n),h=Array.isArray(A)?A:new Uint8Array(A);for(t=0;t>4,h[l++]=(15&s)<<4|r>>2,h[l++]=(3&r)<<6|63&o;return A}(e),n=Array.isArray(o)?function(e){for(var t=e.length,i=[],s=0;s=55296&&r<=56319&&i=i)return{done:!0,value:null};for(var e="×";sn.x||r.y>n.y;return n=r,0===t||a}));return e.body.removeChild(t),a}(document);return Object.defineProperty(hg,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=function(e){var t=new Image,i=e.createElement("canvas"),s=i.getContext("2d");if(!s)return!1;t.src="data:image/svg+xml,";try{s.drawImage(t,0,0),i.toDataURL()}catch(e){return!1}return!0}(document);return Object.defineProperty(hg,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e="function"==typeof Array.from&&"function"==typeof window.fetch?function(e){var t=e.createElement("canvas"),i=100;t.width=i,t.height=i;var s=t.getContext("2d");if(!s)return Promise.reject(!1);s.fillStyle="rgb(0, 255, 0)",s.fillRect(0,0,i,i);var r=new Image,o=t.toDataURL();r.src=o;var n=lg(i,i,0,0,r);return s.fillStyle="red",s.fillRect(0,0,i,i),Ag(n).then((function(t){s.drawImage(t,0,0);var r=s.getImageData(0,0,i,i).data;s.fillStyle="red",s.fillRect(0,0,i,i);var n=e.createElement("div");return n.style.backgroundImage="url("+o+")",n.style.height="100px",ag(r)?Ag(lg(i,i,0,0,n)):Promise.reject(!1)})).then((function(e){return s.drawImage(e,0,0),ag(s.getImageData(0,0,i,i).data)})).catch((function(){return!1}))}(document):Promise.resolve(!1);return Object.defineProperty(hg,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=void 0!==(new Image).crossOrigin;return Object.defineProperty(hg,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e="string"==typeof(new XMLHttpRequest).responseType;return Object.defineProperty(hg,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(hg,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!("undefined"==typeof Intl||!Intl.Segmenter);return Object.defineProperty(hg,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},cg=function(e,t){this.text=e,this.bounds=t},ug=function(e,t){var i=t.ownerDocument;if(i){var s=i.createElement("html2canvaswrapper");s.appendChild(t.cloneNode(!0));var r=t.parentNode;if(r){r.replaceChild(s,t);var o=Oc(e,s);return s.firstChild&&r.replaceChild(s.firstChild,s),o}}return kc.EMPTY},dg=function(e,t,i){var s=e.ownerDocument;if(!s)throw new Error("Node has no owner document");var r=s.createRange();return r.setStart(e,t),r.setEnd(e,t+i),r},pg=function(e){if(hg.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(e)).map((function(e){return e.segment}))}return function(e){for(var t,i=ng(e),s=[];!(t=i.next()).done;)t.value&&s.push(t.value.slice());return s}(e)},fg=function(e,t){return 0!==t.letterSpacing?pg(e):function(e,t){if(hg.SUPPORT_NATIVE_TEXT_SEGMENTATION){var i=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(i.segment(e)).map((function(e){return e.segment}))}return mg(e,t)}(e,t)},gg=[32,160,4961,65792,65793,4153,4241],mg=function(e,t){for(var i,s=function(e,t){var i=Nc(e),s=Lu(i,t),r=s[0],o=s[1],n=s[2],a=i.length,l=0,A=0;return{next:function(){if(A>=a)return{done:!0,value:null};for(var e="×";A0)if(hg.SUPPORT_RANGE_BOUNDS){var r=dg(s,n,t.length).getClientRects();if(r.length>1){var a=pg(t),l=0;a.forEach((function(t){o.push(new cg(t,kc.fromDOMRectList(e,dg(s,l+n,t.length).getClientRects()))),l+=t.length}))}else o.push(new cg(t,kc.fromDOMRectList(e,r)))}else{var A=s.splitText(t.length);o.push(new cg(t,ug(e,s))),s=A}else hg.SUPPORT_RANGE_BOUNDS||(s=s.splitText(t.length));n+=t.length})),o}(e,this.text,i,t)},vg=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(bg,yg);case 2:return e.toUpperCase();default:return e}},bg=/(^|\s|:|-|\(|\))([a-z])/g,yg=function(e,t,i){return e.length>0?t+i.toUpperCase():e},xg=function(e){function t(t,i){var s=e.call(this,t,i)||this;return s.src=i.currentSrc||i.src,s.intrinsicWidth=i.naturalWidth,s.intrinsicHeight=i.naturalHeight,s.context.cache.addImage(s.src),s}return Sc(t,e),t}(Hf),Bg=function(e){function t(t,i){var s=e.call(this,t,i)||this;return s.canvas=i,s.intrinsicWidth=i.width,s.intrinsicHeight=i.height,s}return Sc(t,e),t}(Hf),wg=function(e){function t(t,i){var s=e.call(this,t,i)||this,r=new XMLSerializer,o=Oc(t,i);return i.setAttribute("width",o.width+"px"),i.setAttribute("height",o.height+"px"),s.svg="data:image/svg+xml,"+encodeURIComponent(r.serializeToString(i)),s.intrinsicWidth=i.width.baseVal.value,s.intrinsicHeight=i.height.baseVal.value,s.context.cache.addImage(s.svg),s}return Sc(t,e),t}(Hf),Pg=function(e){function t(t,i){var s=e.call(this,t,i)||this;return s.value=i.value,s}return Sc(t,e),t}(Hf),Cg=function(e){function t(t,i){var s=e.call(this,t,i)||this;return s.start=i.start,s.reversed="boolean"==typeof i.reversed&&!0===i.reversed,s}return Sc(t,e),t}(Hf),Mg=[{type:15,flags:0,unit:"px",number:3}],Eg=[{type:16,flags:0,number:50}],Fg="password",Ig=function(e){function t(t,i){var s,r=e.call(this,t,i)||this;switch(r.type=i.type.toLowerCase(),r.checked=i.checked,r.value=function(e){var t=e.type===Fg?new Array(e.value.length+1).join("•"):e.value;return 0===t.length?e.placeholder||"":t}(i),"checkbox"!==r.type&&"radio"!==r.type||(r.styles.backgroundColor=3739148031,r.styles.borderTopColor=r.styles.borderRightColor=r.styles.borderBottomColor=r.styles.borderLeftColor=2779096575,r.styles.borderTopWidth=r.styles.borderRightWidth=r.styles.borderBottomWidth=r.styles.borderLeftWidth=1,r.styles.borderTopStyle=r.styles.borderRightStyle=r.styles.borderBottomStyle=r.styles.borderLeftStyle=1,r.styles.backgroundClip=[0],r.styles.backgroundOrigin=[0],r.bounds=(s=r.bounds).width>s.height?new kc(s.left+(s.width-s.height)/2,s.top,s.height,s.height):s.width0)i.textNodes.push(new _g(e,r,i.styles));else if(Vg(r))if(im(r)&&r.assignedNodes)r.assignedNodes().forEach((function(t){return Rg(e,t,i,s)}));else{var n=Ug(e,r);n.styles.isVisible()&&(Og(r,n,s)?n.flags|=4:Ng(n.styles)&&(n.flags|=2),-1!==Lg.indexOf(r.tagName)&&(n.flags|=8),i.elements.push(n),r.slot,r.shadowRoot?Rg(e,r.shadowRoot,n,s):em(r)||Kg(r)||tm(r)||Rg(e,r,n,s))}},Ug=function(e,t){return Zg(t)?new xg(e,t):Jg(t)?new Bg(e,t):Kg(t)?new wg(e,t):Gg(t)?new Pg(e,t):zg(t)?new Cg(e,t):Wg(t)?new Ig(e,t):tm(t)?new Dg(e,t):em(t)?new Sg(e,t):qg(t)?new Tg(e,t):new Hf(e,t)},kg=function(e,t){var i=Ug(e,t);return i.flags|=4,Rg(e,t,i,i),i},Og=function(e,t,i){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||Xg(e)&&i.styles.isTransparent()},Ng=function(e){return e.isPositioned()||e.isFloating()},Qg=function(e){return e.nodeType===Node.TEXT_NODE},Vg=function(e){return e.nodeType===Node.ELEMENT_NODE},Hg=function(e){return Vg(e)&&void 0!==e.style&&!jg(e)},jg=function(e){return"object"==typeof e.className},Gg=function(e){return"LI"===e.tagName},zg=function(e){return"OL"===e.tagName},Wg=function(e){return"INPUT"===e.tagName},Kg=function(e){return"svg"===e.tagName},Xg=function(e){return"BODY"===e.tagName},Jg=function(e){return"CANVAS"===e.tagName},Yg=function(e){return"VIDEO"===e.tagName},Zg=function(e){return"IMG"===e.tagName},qg=function(e){return"IFRAME"===e.tagName},$g=function(e){return"STYLE"===e.tagName},em=function(e){return"TEXTAREA"===e.tagName},tm=function(e){return"SELECT"===e.tagName},im=function(e){return"SLOT"===e.tagName},sm=function(e){return e.tagName.indexOf("-")>0},rm=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},e.prototype.pop=function(e){var t=this;e.forEach((function(e){return t.counters[e].pop()}))},e.prototype.parse=function(e){var t=this,i=e.counterIncrement,s=e.counterReset,r=!0;null!==i&&i.forEach((function(e){var i=t.counters[e.counter];i&&0!==e.increment&&(r=!1,i.length||i.push(1),i[Math.max(0,i.length-1)]+=e.increment)}));var o=[];return r&&s.forEach((function(e){var i=t.counters[e.counter];o.push(e.counter),i||(i=t.counters[e.counter]=[]),i.push(e.reset)})),o},e}(),om={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},nm={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},am={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},lm={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Am=function(e,t,i,s,r,o){return ei?pm(e,r,o.length>0):s.integers.reduce((function(t,i,r){for(;e>=i;)e-=i,t+=s.values[r];return t}),"")+o},hm=function(e,t,i,s){var r="";do{i||e--,r=s(e)+r,e/=t}while(e*t>=t);return r},cm=function(e,t,i,s,r){var o=i-t+1;return(e<0?"-":"")+(hm(Math.abs(e),o,s,(function(e){return Qc(Math.floor(e%o)+t)}))+r)},um=function(e,t,i){void 0===i&&(i=". ");var s=t.length;return hm(Math.abs(e),s,!1,(function(e){return t[Math.floor(e%s)]}))+i},dm=function(e,t,i,s,r,o){if(e<-9999||e>9999)return pm(e,4,r.length>0);var n=Math.abs(e),a=r;if(0===n)return t[0]+a;for(var l=0;n>0&&l<=4;l++){var A=n%10;0===A&&Cf(o,1)&&""!==a?a=t[A]+a:A>1||1===A&&0===l||1===A&&1===l&&Cf(o,2)||1===A&&1===l&&Cf(o,4)&&e>100||1===A&&l>1&&Cf(o,8)?a=t[A]+(l>0?i[l-1]:"")+a:1===A&&l>0&&(a=i[l-1]+a),n=Math.floor(n/10)}return(e<0?s:"")+a},pm=function(e,t,i){var s=i?". ":"",r=i?"、":"",o=i?", ":"",n=i?" ":"";switch(t){case 0:return"•"+n;case 1:return"◦"+n;case 2:return"◾"+n;case 5:var a=cm(e,48,57,!0,s);return a.length<4?"0"+a:a;case 4:return um(e,"〇一二三四五六七八九",r);case 6:return Am(e,1,3999,om,3,s).toLowerCase();case 7:return Am(e,1,3999,om,3,s);case 8:return cm(e,945,969,!1,s);case 9:return cm(e,97,122,!1,s);case 10:return cm(e,65,90,!1,s);case 11:return cm(e,1632,1641,!0,s);case 12:case 49:return Am(e,1,9999,nm,3,s);case 35:return Am(e,1,9999,nm,3,s).toLowerCase();case 13:return cm(e,2534,2543,!0,s);case 14:case 30:return cm(e,6112,6121,!0,s);case 15:return um(e,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return um(e,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return dm(e,"零一二三四五六七八九","十百千萬","負",r,14);case 47:return dm(e,"零壹貳參肆伍陸柒捌玖","拾佰仟萬","負",r,15);case 42:return dm(e,"零一二三四五六七八九","十百千萬","负",r,14);case 41:return dm(e,"零壹贰叁肆伍陆柒捌玖","拾佰仟萬","负",r,15);case 26:return dm(e,"〇一二三四五六七八九","十百千万","マイナス",r,0);case 25:return dm(e,"零壱弐参四伍六七八九","拾百千万","マイナス",r,7);case 31:return dm(e,"영일이삼사오육칠팔구","십백천만","마이너스",o,7);case 33:return dm(e,"零一二三四五六七八九","十百千萬","마이너스",o,0);case 32:return dm(e,"零壹貳參四五六七八九","拾百千","마이너스",o,7);case 18:return cm(e,2406,2415,!0,s);case 20:return Am(e,1,19999,lm,3,s);case 21:return cm(e,2790,2799,!0,s);case 22:return cm(e,2662,2671,!0,s);case 22:return Am(e,1,10999,am,3,s);case 23:return um(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return um(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return cm(e,3302,3311,!0,s);case 28:return um(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return um(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return cm(e,3792,3801,!0,s);case 37:return cm(e,6160,6169,!0,s);case 38:return cm(e,4160,4169,!0,s);case 39:return cm(e,2918,2927,!0,s);case 40:return cm(e,1776,1785,!0,s);case 43:return cm(e,3046,3055,!0,s);case 44:return cm(e,3174,3183,!0,s);case 45:return cm(e,3664,3673,!0,s);case 46:return cm(e,3872,3881,!0,s);default:return cm(e,48,57,!0,s)}},fm=function(){function e(e,t,i){if(this.context=e,this.options=i,this.scrolledElements=[],this.referenceElement=t,this.counters=new rm,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var i=this,s=mm(e,t);if(!s.contentWindow)return Promise.reject("Unable to find iframe window");var r=e.defaultView.pageXOffset,o=e.defaultView.pageYOffset,n=s.contentWindow,a=n.document,l=bm(s).then((function(){return Lc(i,void 0,void 0,(function(){var e,i;return Rc(this,(function(r){switch(r.label){case 0:return this.scrolledElements.forEach(Pm),n&&(n.scrollTo(t.left,t.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||n.scrollY===t.top&&n.scrollX===t.left||(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(n.scrollX-t.left,n.scrollY-t.top,0,0))),e=this.options.onclone,void 0===(i=this.clonedReferenceElement)?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:a.fonts&&a.fonts.ready?[4,a.fonts.ready]:[3,2];case 1:r.sent(),r.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,vm(a)]:[3,4];case 3:r.sent(),r.label=4;case 4:return"function"==typeof e?[2,Promise.resolve().then((function(){return e(a,i)})).then((function(){return s}))]:[2,s]}}))}))}));return a.open(),a.write(Bm(document.doctype)+""),wm(this.referenceElement.ownerDocument,r,o),a.replaceChild(a.adoptNode(this.documentElement),a.documentElement),a.close(),l},e.prototype.createElementClone=function(e){if(Vf(e,2),Jg(e))return this.createCanvasClone(e);if(Yg(e))return this.createVideoClone(e);if($g(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return Zg(t)&&(Zg(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),"lazy"===t.loading&&(t.loading="eager")),sm(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return xm(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var i=[].slice.call(t.cssRules,0).reduce((function(e,t){return t&&"string"==typeof t.cssText?e+t.cssText:e}),""),s=e.cloneNode(!1);return s.textContent=i,s}}catch(e){if(this.context.logger.error("Unable to access cssRules property",e),"SecurityError"!==e.name)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var i=e.ownerDocument.createElement("img");try{return i.src=e.toDataURL(),i}catch(t){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var s=e.cloneNode(!1);try{s.width=e.width,s.height=e.height;var r=e.getContext("2d"),o=s.getContext("2d");if(o)if(!this.options.allowTaint&&r)o.putImageData(r.getImageData(0,0,e.width,e.height),0,0);else{var n=null!==(t=e.getContext("webgl2"))&&void 0!==t?t:e.getContext("webgl");if(n){var a=n.getContextAttributes();!1===(null==a?void 0:a.preserveDrawingBuffer)&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}o.drawImage(e,0,0)}return s}catch(t){this.context.logger.info("Unable to clone canvas as it is tainted",e)}return s},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var i=t.getContext("2d");try{return i&&(i.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||i.getImageData(0,0,t.width,t.height)),t}catch(t){this.context.logger.info("Unable to clone video as it is tainted",e)}var s=e.ownerDocument.createElement("canvas");return s.width=e.offsetWidth,s.height=e.offsetHeight,s},e.prototype.appendChildNode=function(e,t,i){Vg(t)&&(function(e){return"SCRIPT"===e.tagName}(t)||t.hasAttribute("data-html2canvas-ignore")||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(t))||this.options.copyStyles&&Vg(t)&&$g(t)||e.appendChild(this.cloneNode(t,i))},e.prototype.cloneChildNodes=function(e,t,i){for(var s=this,r=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;r;r=r.nextSibling)if(Vg(r)&&im(r)&&"function"==typeof r.assignedNodes){var o=r.assignedNodes();o.length&&o.forEach((function(e){return s.appendChildNode(t,e,i)}))}else this.appendChildNode(t,r,i)},e.prototype.cloneNode=function(e,t){if(Qg(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var i=e.ownerDocument.defaultView;if(i&&Vg(e)&&(Hg(e)||jg(e))){var s=this.createElementClone(e);s.style.transitionProperty="none";var r=i.getComputedStyle(e),o=i.getComputedStyle(e,":before"),n=i.getComputedStyle(e,":after");this.referenceElement===e&&Hg(s)&&(this.clonedReferenceElement=s),Xg(s)&&Em(s);var a=this.counters.parse(new Nf(this.context,r)),l=this.resolvePseudoContent(e,s,o,Zf.BEFORE);sm(e)&&(t=!0),Yg(e)||this.cloneChildNodes(e,s,t),l&&s.insertBefore(l,s.firstChild);var A=this.resolvePseudoContent(e,s,n,Zf.AFTER);return A&&s.appendChild(A),this.counters.pop(a),(r&&(this.options.copyStyles||jg(e))&&!qg(e)||t)&&xm(r,s),0===e.scrollTop&&0===e.scrollLeft||this.scrolledElements.push([s,e.scrollLeft,e.scrollTop]),(em(e)||tm(e))&&(em(s)||tm(s))&&(s.value=e.value),s}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,i,s){var r=this;if(i){var o=i.content,n=t.ownerDocument;if(n&&o&&"none"!==o&&"-moz-alt-content"!==o&&"none"!==i.display){this.counters.parse(new Nf(this.context,i));var a=new Of(this.context,i),l=n.createElement("html2canvaspseudoelement");xm(i,l),a.content.forEach((function(t){if(0===t.type)l.appendChild(n.createTextNode(t.value));else if(22===t.type){var i=n.createElement("img");i.src=t.value,i.style.opacity="1",l.appendChild(i)}else if(18===t.type){if("attr"===t.name){var s=t.values.filter(md);s.length&&l.appendChild(n.createTextNode(e.getAttribute(s[0].value)||""))}else if("counter"===t.name){var o=t.values.filter(yd),A=o[0],h=o[1];if(A&&md(A)){var c=r.counters.getCounterValue(A.value),u=h&&md(h)?zp.parse(r.context,h.value):3;l.appendChild(n.createTextNode(pm(c,u,!1)))}}else if("counters"===t.name){var d=t.values.filter(yd),p=(A=d[0],d[1]);h=d[2];if(A&&md(A)){var f=r.counters.getCounterValues(A.value),g=h&&md(h)?zp.parse(r.context,h.value):3,m=p&&0===p.type?p.value:"",_=f.map((function(e){return pm(e,g,!1)})).join(m);l.appendChild(n.createTextNode(_))}}}else if(20===t.type)switch(t.value){case"open-quote":l.appendChild(n.createTextNode(Sf(a.quotes,r.quoteDepth++,!0)));break;case"close-quote":l.appendChild(n.createTextNode(Sf(a.quotes,--r.quoteDepth,!1)));break;default:l.appendChild(n.createTextNode(t.value))}})),l.className=Cm+" "+Mm;var A=s===Zf.BEFORE?" "+Cm:" "+Mm;return jg(t)?t.className.baseValue+=A:t.className+=A,l}}},e.destroy=function(e){return!!e.parentNode&&(e.parentNode.removeChild(e),!0)},e}();!function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"}(Zf||(Zf={}));var gm,mm=function(e,t){var i=e.createElement("iframe");return i.className="html2canvas-container",i.style.visibility="hidden",i.style.position="fixed",i.style.left="-10000px",i.style.top="0px",i.style.border="0",i.width=t.width.toString(),i.height=t.height.toString(),i.scrolling="no",i.setAttribute("data-html2canvas-ignore","true"),e.body.appendChild(i),i},_m=function(e){return new Promise((function(t){e.complete?t():e.src?(e.onload=t,e.onerror=t):t()}))},vm=function(e){return Promise.all([].slice.call(e.images,0).map(_m))},bm=function(e){return new Promise((function(t,i){var s=e.contentWindow;if(!s)return i("No window assigned for iframe");var r=s.document;s.onload=e.onload=function(){s.onload=e.onload=null;var i=setInterval((function(){r.body.childNodes.length>0&&"complete"===r.readyState&&(clearInterval(i),t(e))}),50)}}))},ym=["all","d","content"],xm=function(e,t){for(var i=e.length-1;i>=0;i--){var s=e.item(i);-1===ym.indexOf(s)&&t.style.setProperty(s,e.getPropertyValue(s))}return t},Bm=function(e){var t="";return e&&(t+=""),t},wm=function(e,t,i){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||i!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,i)},Pm=function(e){var t=e[0],i=e[1],s=e[2];t.scrollLeft=i,t.scrollTop=s},Cm="___html2canvas___pseudoelement_before",Mm="___html2canvas___pseudoelement_after",Em=function(e){Fm(e,"."+Cm+':before{\n content: "" !important;\n display: none !important;\n}\n .'+Mm+':after{\n content: "" !important;\n display: none !important;\n}')},Fm=function(e,t){var i=e.ownerDocument;if(i){var s=i.createElement("style");s.textContent=t,e.appendChild(s)}},Im=function(){function e(){}return e.getOrigin=function(t){var i=e._link;return i?(i.href=t,i.href=i.href,i.protocol+i.hostname+i.port):"about:blank"},e.isSameOrigin=function(t){return e.getOrigin(t)===e._origin},e.setContext=function(t){e._link=t.document.createElement("a"),e._origin=e.getOrigin(t.location.href)},e._origin="about:blank",e}(),Dm=function(){function e(e,t){this.context=e,this._options=t,this._cache={}}return e.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)?t:Om(e)||Rm(e)?((this._cache[e]=this.loadImage(e)).catch((function(){})),t):t},e.prototype.match=function(e){return this._cache[e]},e.prototype.loadImage=function(e){return Lc(this,void 0,void 0,(function(){var t,i,s,r,o=this;return Rc(this,(function(n){switch(n.label){case 0:return t=Im.isSameOrigin(e),i=!Um(e)&&!0===this._options.useCORS&&hg.SUPPORT_CORS_IMAGES&&!t,s=!Um(e)&&!t&&!Om(e)&&"string"==typeof this._options.proxy&&hg.SUPPORT_CORS_XHR&&!i,t||!1!==this._options.allowTaint||Um(e)||Om(e)||s||i?(r=e,s?[4,this.proxy(r)]:[3,2]):[2];case 1:r=n.sent(),n.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise((function(e,t){var s=new Image;s.onload=function(){return e(s)},s.onerror=t,(km(r)||i)&&(s.crossOrigin="anonymous"),s.src=r,!0===s.complete&&setTimeout((function(){return e(s)}),500),o._options.imageTimeout>0&&setTimeout((function(){return t("Timed out ("+o._options.imageTimeout+"ms) loading image")}),o._options.imageTimeout)}))];case 3:return[2,n.sent()]}}))}))},e.prototype.has=function(e){return void 0!==this._cache[e]},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(e){var t=this,i=this._options.proxy;if(!i)throw new Error("No proxy defined");var s=e.substring(0,256);return new Promise((function(r,o){var n=hg.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(200===a.status)if("text"===n)r(a.response);else{var e=new FileReader;e.addEventListener("load",(function(){return r(e.result)}),!1),e.addEventListener("error",(function(e){return o(e)}),!1),e.readAsDataURL(a.response)}else o("Failed to proxy resource "+s+" with status code "+a.status)},a.onerror=o;var l=i.indexOf("?")>-1?"&":"?";if(a.open("GET",""+i+l+"url="+encodeURIComponent(e)+"&responseType="+n),"text"!==n&&a instanceof XMLHttpRequest&&(a.responseType=n),t._options.imageTimeout){var A=t._options.imageTimeout;a.timeout=A,a.ontimeout=function(){return o("Timed out ("+A+"ms) proxying "+s)}}a.send()}))},e}(),Sm=/^data:image\/svg\+xml/i,Tm=/^data:image\/.*;base64,/i,Lm=/^data:image\/.*/i,Rm=function(e){return hg.SUPPORT_SVG_DRAWING||!Nm(e)},Um=function(e){return Lm.test(e)},km=function(e){return Tm.test(e)},Om=function(e){return"blob"===e.substr(0,4)},Nm=function(e){return"svg"===e.substr(-3).toLowerCase()||Sm.test(e)},Qm=function(){function e(e,t){this.type=0,this.x=e,this.y=t}return e.prototype.add=function(t,i){return new e(this.x+t,this.y+i)},e}(),Vm=function(e,t,i){return new Qm(e.x+(t.x-e.x)*i,e.y+(t.y-e.y)*i)},Hm=function(){function e(e,t,i,s){this.type=1,this.start=e,this.startControl=t,this.endControl=i,this.end=s}return e.prototype.subdivide=function(t,i){var s=Vm(this.start,this.startControl,t),r=Vm(this.startControl,this.endControl,t),o=Vm(this.endControl,this.end,t),n=Vm(s,r,t),a=Vm(r,o,t),l=Vm(n,a,t);return i?new e(this.start,s,n,l):new e(l,a,o,this.end)},e.prototype.add=function(t,i){return new e(this.start.add(t,i),this.startControl.add(t,i),this.endControl.add(t,i),this.end.add(t,i))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),jm=function(e){return 1===e.type},Gm=function(e){var t=e.styles,i=e.bounds,s=Id(t.borderTopLeftRadius,i.width,i.height),r=s[0],o=s[1],n=Id(t.borderTopRightRadius,i.width,i.height),a=n[0],l=n[1],A=Id(t.borderBottomRightRadius,i.width,i.height),h=A[0],c=A[1],u=Id(t.borderBottomLeftRadius,i.width,i.height),d=u[0],p=u[1],f=[];f.push((r+a)/i.width),f.push((d+h)/i.width),f.push((o+p)/i.height),f.push((l+c)/i.height);var g=Math.max.apply(Math,f);g>1&&(r/=g,o/=g,a/=g,l/=g,h/=g,c/=g,d/=g,p/=g);var m=i.width-a,_=i.height-c,v=i.width-h,b=i.height-p,y=t.borderTopWidth,x=t.borderRightWidth,B=t.borderBottomWidth,w=t.borderLeftWidth,P=Dd(t.paddingTop,e.bounds.width),C=Dd(t.paddingRight,e.bounds.width),M=Dd(t.paddingBottom,e.bounds.width),E=Dd(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=r>0||o>0?zm(i.left+w/3,i.top+y/3,r-w/3,o-y/3,gm.TOP_LEFT):new Qm(i.left+w/3,i.top+y/3),this.topRightBorderDoubleOuterBox=r>0||o>0?zm(i.left+m,i.top+y/3,a-x/3,l-y/3,gm.TOP_RIGHT):new Qm(i.left+i.width-x/3,i.top+y/3),this.bottomRightBorderDoubleOuterBox=h>0||c>0?zm(i.left+v,i.top+_,h-x/3,c-B/3,gm.BOTTOM_RIGHT):new Qm(i.left+i.width-x/3,i.top+i.height-B/3),this.bottomLeftBorderDoubleOuterBox=d>0||p>0?zm(i.left+w/3,i.top+b,d-w/3,p-B/3,gm.BOTTOM_LEFT):new Qm(i.left+w/3,i.top+i.height-B/3),this.topLeftBorderDoubleInnerBox=r>0||o>0?zm(i.left+2*w/3,i.top+2*y/3,r-2*w/3,o-2*y/3,gm.TOP_LEFT):new Qm(i.left+2*w/3,i.top+2*y/3),this.topRightBorderDoubleInnerBox=r>0||o>0?zm(i.left+m,i.top+2*y/3,a-2*x/3,l-2*y/3,gm.TOP_RIGHT):new Qm(i.left+i.width-2*x/3,i.top+2*y/3),this.bottomRightBorderDoubleInnerBox=h>0||c>0?zm(i.left+v,i.top+_,h-2*x/3,c-2*B/3,gm.BOTTOM_RIGHT):new Qm(i.left+i.width-2*x/3,i.top+i.height-2*B/3),this.bottomLeftBorderDoubleInnerBox=d>0||p>0?zm(i.left+2*w/3,i.top+b,d-2*w/3,p-2*B/3,gm.BOTTOM_LEFT):new Qm(i.left+2*w/3,i.top+i.height-2*B/3),this.topLeftBorderStroke=r>0||o>0?zm(i.left+w/2,i.top+y/2,r-w/2,o-y/2,gm.TOP_LEFT):new Qm(i.left+w/2,i.top+y/2),this.topRightBorderStroke=r>0||o>0?zm(i.left+m,i.top+y/2,a-x/2,l-y/2,gm.TOP_RIGHT):new Qm(i.left+i.width-x/2,i.top+y/2),this.bottomRightBorderStroke=h>0||c>0?zm(i.left+v,i.top+_,h-x/2,c-B/2,gm.BOTTOM_RIGHT):new Qm(i.left+i.width-x/2,i.top+i.height-B/2),this.bottomLeftBorderStroke=d>0||p>0?zm(i.left+w/2,i.top+b,d-w/2,p-B/2,gm.BOTTOM_LEFT):new Qm(i.left+w/2,i.top+i.height-B/2),this.topLeftBorderBox=r>0||o>0?zm(i.left,i.top,r,o,gm.TOP_LEFT):new Qm(i.left,i.top),this.topRightBorderBox=a>0||l>0?zm(i.left+m,i.top,a,l,gm.TOP_RIGHT):new Qm(i.left+i.width,i.top),this.bottomRightBorderBox=h>0||c>0?zm(i.left+v,i.top+_,h,c,gm.BOTTOM_RIGHT):new Qm(i.left+i.width,i.top+i.height),this.bottomLeftBorderBox=d>0||p>0?zm(i.left,i.top+b,d,p,gm.BOTTOM_LEFT):new Qm(i.left,i.top+i.height),this.topLeftPaddingBox=r>0||o>0?zm(i.left+w,i.top+y,Math.max(0,r-w),Math.max(0,o-y),gm.TOP_LEFT):new Qm(i.left+w,i.top+y),this.topRightPaddingBox=a>0||l>0?zm(i.left+Math.min(m,i.width-x),i.top+y,m>i.width+x?0:Math.max(0,a-x),Math.max(0,l-y),gm.TOP_RIGHT):new Qm(i.left+i.width-x,i.top+y),this.bottomRightPaddingBox=h>0||c>0?zm(i.left+Math.min(v,i.width-w),i.top+Math.min(_,i.height-B),Math.max(0,h-x),Math.max(0,c-B),gm.BOTTOM_RIGHT):new Qm(i.left+i.width-x,i.top+i.height-B),this.bottomLeftPaddingBox=d>0||p>0?zm(i.left+w,i.top+Math.min(b,i.height-B),Math.max(0,d-w),Math.max(0,p-B),gm.BOTTOM_LEFT):new Qm(i.left+w,i.top+i.height-B),this.topLeftContentBox=r>0||o>0?zm(i.left+w+E,i.top+y+P,Math.max(0,r-(w+E)),Math.max(0,o-(y+P)),gm.TOP_LEFT):new Qm(i.left+w+E,i.top+y+P),this.topRightContentBox=a>0||l>0?zm(i.left+Math.min(m,i.width+w+E),i.top+y+P,m>i.width+w+E?0:a-w+E,l-(y+P),gm.TOP_RIGHT):new Qm(i.left+i.width-(x+C),i.top+y+P),this.bottomRightContentBox=h>0||c>0?zm(i.left+Math.min(v,i.width-(w+E)),i.top+Math.min(_,i.height+y+P),Math.max(0,h-(x+C)),c-(B+M),gm.BOTTOM_RIGHT):new Qm(i.left+i.width-(x+C),i.top+i.height-(B+M)),this.bottomLeftContentBox=d>0||p>0?zm(i.left+w+E,i.top+b,Math.max(0,d-(w+E)),p-(B+M),gm.BOTTOM_LEFT):new Qm(i.left+w+E,i.top+i.height-(B+M))};!function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"}(gm||(gm={}));var zm=function(e,t,i,s,r){var o=(Math.sqrt(2)-1)/3*4,n=i*o,a=s*o,l=e+i,A=t+s;switch(r){case gm.TOP_LEFT:return new Hm(new Qm(e,A),new Qm(e,A-a),new Qm(l-n,t),new Qm(l,t));case gm.TOP_RIGHT:return new Hm(new Qm(e,t),new Qm(e+n,t),new Qm(l,A-a),new Qm(l,A));case gm.BOTTOM_RIGHT:return new Hm(new Qm(l,t),new Qm(l,t+a),new Qm(e+n,A),new Qm(e,A));case gm.BOTTOM_LEFT:default:return new Hm(new Qm(l,A),new Qm(l-n,A),new Qm(e,t+a),new Qm(e,t))}},Wm=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Km=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Xm=function(e,t,i){this.offsetX=e,this.offsetY=t,this.matrix=i,this.type=0,this.target=6},Jm=function(e,t){this.path=e,this.target=t,this.type=1},Ym=function(e){this.opacity=e,this.type=2,this.target=6},Zm=function(e){return 1===e.type},qm=function(e,t){return e.length===t.length&&e.some((function(e,i){return e===t[i]}))},$m=function(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]},e_=function(){function e(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new Gm(this.container),this.container.styles.opacity<1&&this.effects.push(new Ym(this.container.styles.opacity)),null!==this.container.styles.transform){var i=this.container.bounds.left+this.container.styles.transformOrigin[0].number,s=this.container.bounds.top+this.container.styles.transformOrigin[1].number,r=this.container.styles.transform;this.effects.push(new Xm(i,s,r))}if(0!==this.container.styles.overflowX){var o=Wm(this.curves),n=Km(this.curves);qm(o,n)?this.effects.push(new Jm(o,6)):(this.effects.push(new Jm(o,2)),this.effects.push(new Jm(n,4)))}}return e.prototype.getEffects=function(e){for(var t=-1===[2,3].indexOf(this.container.styles.position),i=this.parent,s=this.effects.slice(0);i;){var r=i.effects.filter((function(e){return!Zm(e)}));if(t||0!==i.container.styles.position||!i.parent){if(s.unshift.apply(s,r),t=-1===[2,3].indexOf(i.container.styles.position),0!==i.container.styles.overflowX){var o=Wm(i.curves),n=Km(i.curves);qm(o,n)||s.unshift(new Jm(n,6))}}else s.unshift.apply(s,r);i=i.parent}return s.filter((function(t){return Cf(t.target,e)}))},e}(),t_=function(e,t,i,s){e.container.elements.forEach((function(r){var o=Cf(r.flags,4),n=Cf(r.flags,2),a=new e_(r,e);Cf(r.styles.display,2048)&&s.push(a);var l=Cf(r.flags,8)?[]:s;if(o||n){var A=o||r.styles.isPositioned()?i:t,h=new $m(a);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var c=r.styles.zIndex.order;if(c<0){var u=0;A.negativeZIndex.some((function(e,t){return c>e.element.container.styles.zIndex.order?(u=t,!1):u>0})),A.negativeZIndex.splice(u,0,h)}else if(c>0){var d=0;A.positiveZIndex.some((function(e,t){return c>=e.element.container.styles.zIndex.order?(d=t+1,!1):d>0})),A.positiveZIndex.splice(d,0,h)}else A.zeroOrAutoZIndexOrTransformedOrOpacity.push(h)}else r.styles.isFloating()?A.nonPositionedFloats.push(h):A.nonPositionedInlineLevel.push(h);t_(a,h,o?h:i,l)}else r.styles.isInlineLevel()?t.inlineLevel.push(a):t.nonInlineLevel.push(a),t_(a,t,i,l);Cf(r.flags,8)&&i_(r,l)}))},i_=function(e,t){for(var i=e instanceof Cg?e.start:1,s=e instanceof Cg&&e.reversed,r=0;r0&&e.intrinsicHeight>0){var s=a_(e),r=Km(t);this.path(r),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,e.intrinsicWidth,e.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},t.prototype.renderNodeContent=function(e){return Lc(this,void 0,void 0,(function(){var i,s,r,o,n,a,l,A,h,c,u,d,p,f,g,m,_,v;return Rc(this,(function(b){switch(b.label){case 0:this.applyEffects(e.getEffects(4)),i=e.container,s=e.curves,r=i.styles,o=0,n=i.textNodes,b.label=1;case 1:return o0&&B>0&&(m=s.ctx.createPattern(p,"repeat"),s.renderRepeat(v,m,P,C))):function(e){return 2===e.type}(i)&&(_=l_(e,t,[null,null,null]),v=_[0],b=_[1],y=_[2],x=_[3],B=_[4],w=0===i.position.length?[Ed]:i.position,P=Dd(w[0],x),C=Dd(w[w.length-1],B),M=function(e,t,i,s,r){var o=0,n=0;switch(e.size){case 0:0===e.shape?o=n=Math.min(Math.abs(t),Math.abs(t-s),Math.abs(i),Math.abs(i-r)):1===e.shape&&(o=Math.min(Math.abs(t),Math.abs(t-s)),n=Math.min(Math.abs(i),Math.abs(i-r)));break;case 2:if(0===e.shape)o=n=Math.min(qd(t,i),qd(t,i-r),qd(t-s,i),qd(t-s,i-r));else if(1===e.shape){var a=Math.min(Math.abs(i),Math.abs(i-r))/Math.min(Math.abs(t),Math.abs(t-s)),l=$d(s,r,t,i,!0),A=l[0],h=l[1];n=a*(o=qd(A-t,(h-i)/a))}break;case 1:0===e.shape?o=n=Math.max(Math.abs(t),Math.abs(t-s),Math.abs(i),Math.abs(i-r)):1===e.shape&&(o=Math.max(Math.abs(t),Math.abs(t-s)),n=Math.max(Math.abs(i),Math.abs(i-r)));break;case 3:if(0===e.shape)o=n=Math.max(qd(t,i),qd(t,i-r),qd(t-s,i),qd(t-s,i-r));else if(1===e.shape){a=Math.max(Math.abs(i),Math.abs(i-r))/Math.max(Math.abs(t),Math.abs(t-s));var c=$d(s,r,t,i,!1);A=c[0],h=c[1],n=a*(o=qd(A-t,(h-i)/a))}}return Array.isArray(e.size)&&(o=Dd(e.size[0],s),n=2===e.size.length?Dd(e.size[1],r):o),[o,n]}(i,P,C,x,B),E=M[0],F=M[1],E>0&&F>0&&(I=s.ctx.createRadialGradient(b+P,y+C,0,b+P,y+C,E),Yd(i.stops,2*E).forEach((function(e){return I.addColorStop(e.stop,Od(e.color))})),s.path(v),s.ctx.fillStyle=I,E!==F?(D=e.bounds.left+.5*e.bounds.width,S=e.bounds.top+.5*e.bounds.height,L=1/(T=F/E),s.ctx.save(),s.ctx.translate(D,S),s.ctx.transform(1,0,0,T,0,0),s.ctx.translate(-D,-S),s.ctx.fillRect(b,L*(y-S)+S,x,B*L),s.ctx.restore()):s.ctx.fill())),R.label=6;case 6:return t--,[2]}}))},s=this,r=0,o=e.styles.backgroundImage.slice(0).reverse(),a.label=1;case 1:return r0?2!==l.style?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,o,e.curves,2)]:[3,11]:[3,13];case 4:return h.sent(),[3,11];case 5:return 3!==l.style?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,o,e.curves,3)];case 6:return h.sent(),[3,11];case 7:return 4!==l.style?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,o,e.curves)];case 8:return h.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,o,e.curves)];case 10:h.sent(),h.label=11;case 11:o++,h.label=12;case 12:return n++,[3,3];case 13:return[2]}}))}))},t.prototype.renderDashedDottedBorder=function(e,t,i,s,r){return Lc(this,void 0,void 0,(function(){var o,n,a,l,A,h,c,u,d,p,f,g,m,_,v,b;return Rc(this,(function(y){return this.ctx.save(),o=function(e,t){switch(t){case 0:return r_(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return r_(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return r_(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);default:return r_(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}}(s,i),n=s_(s,i),2===r&&(this.path(n),this.ctx.clip()),jm(n[0])?(a=n[0].start.x,l=n[0].start.y):(a=n[0].x,l=n[0].y),jm(n[1])?(A=n[1].end.x,h=n[1].end.y):(A=n[1].x,h=n[1].y),c=0===i||2===i?Math.abs(a-A):Math.abs(l-h),this.ctx.beginPath(),3===r?this.formatPath(o):this.formatPath(n.slice(0,2)),u=t<3?3*t:2*t,d=t<3?2*t:t,3===r&&(u=t,d=t),p=!0,c<=2*u?p=!1:c<=2*u+d?(u*=f=c/(2*u+d),d*=f):(g=Math.floor((c+d)/(u+d)),m=(c-g*u)/(g-1),d=(_=(c-(g+1)*u)/g)<=0||Math.abs(d-m){})),N_(this,"_reject",(()=>{})),this.name=e,this.workerThread=t,this.result=new Promise(((e,t)=>{this._resolve=e,this._reject=t}))}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){S_(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){S_(this.isRunning),this.isRunning=!1,this._reject(e)}}class V_{}const H_=new Map;function j_(e){S_(e.source&&!e.url||!e.source&&e.url);let t=H_.get(e.source||e.url);return t||(e.url&&(t=function(e){if(!e.startsWith("http"))return e;return G_((t=e,"try {\n importScripts('".concat(t,"');\n} catch (error) {\n console.error(error);\n throw error;\n}")));var t}(e.url),H_.set(e.url,t)),e.source&&(t=G_(e.source),H_.set(e.source,t))),S_(t),t}function G_(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function z_(e,t=!0,i){const s=i||new Set;if(e){if(W_(e))s.add(e);else if(W_(e.buffer))s.add(e.buffer);else if(ArrayBuffer.isView(e));else if(t&&"object"==typeof e)for(const i in e)z_(e[i],t,s)}else;return void 0===i?Array.from(s):[]}function W_(e){return!!e&&(e instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&e instanceof MessagePort||("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)))}const K_=()=>{};class X_{static isSupported(){return"undefined"!=typeof Worker&&R_||void 0!==typeof V_}constructor(e){N_(this,"name",void 0),N_(this,"source",void 0),N_(this,"url",void 0),N_(this,"terminated",!1),N_(this,"worker",void 0),N_(this,"onMessage",void 0),N_(this,"onError",void 0),N_(this,"_loadableURL","");const{name:t,source:i,url:s}=e;S_(i||s),this.name=t,this.source=i,this.url=s,this.onMessage=K_,this.onError=e=>console.log(e),this.worker=R_?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=K_,this.onError=K_,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,t){t=t||z_(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+="worker ".concat(this.name," from ").concat(this.url,". "),e.message&&(t+="".concat(e.message," in ")),e.lineno&&(t+=":".concat(e.lineno,":").concat(e.colno)),new Error(t)}_createBrowserWorker(){this._loadableURL=j_({source:this.source,url:this.url});const e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=e=>{e.data?this.onMessage(e.data):this.onError(new Error("No data received"))},e.onerror=e=>{this.onError(this._getErrorFromErrorEvent(e)),this.terminated=!0},e.onmessageerror=e=>console.error(e),e}_createNodeWorker(){let e;if(this.url){const t=this.url.includes(":/")||this.url.startsWith("/")?this.url:"./".concat(this.url);e=new V_(t,{eval:!1})}else{if(!this.source)throw new Error("no worker");e=new V_(this.source,{eval:!0})}return e.on("message",(e=>{this.onMessage(e)})),e.on("error",(e=>{this.onError(e)})),e.on("exit",(e=>{})),e}}class J_{static isSupported(){return X_.isSupported()}constructor(e){N_(this,"name","unnamed"),N_(this,"source",void 0),N_(this,"url",void 0),N_(this,"maxConcurrency",1),N_(this,"maxMobileConcurrency",1),N_(this,"onDebug",(()=>{})),N_(this,"reuseWorkers",!0),N_(this,"props",{}),N_(this,"jobQueue",[]),N_(this,"idleQueue",[]),N_(this,"count",0),N_(this,"isDestroyed",!1),this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach((e=>e.destroy())),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},void 0!==e.name&&(this.name=e.name),void 0!==e.maxConcurrency&&(this.maxConcurrency=e.maxConcurrency),void 0!==e.maxMobileConcurrency&&(this.maxMobileConcurrency=e.maxMobileConcurrency),void 0!==e.reuseWorkers&&(this.reuseWorkers=e.reuseWorkers),void 0!==e.onDebug&&(this.onDebug=e.onDebug)}async startJob(e,t=((e,t,i)=>e.done(i)),i=((e,t)=>e.error(t))){const s=new Promise((s=>(this.jobQueue.push({name:e,onMessage:t,onError:i,onStart:s}),this)));return this._startQueuedJob(),await s}async _startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:e,backlog:this.jobQueue.length});const i=new Q_(t.name,e);e.onMessage=e=>t.onMessage(i,e.type,e.payload),e.onError=e=>t.onError(i,e),t.onStart(i);try{await i.result}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count{}};class Z_{static isSupported(){return X_.isSupported()}static getWorkerFarm(e={}){return Z_._workerFarm=Z_._workerFarm||new Z_({}),Z_._workerFarm.setProps(e),Z_._workerFarm}constructor(e){N_(this,"props",void 0),N_(this,"workerPools",new Map),this.props={...Y_},this.setProps(e),this.workerPools=new Map}destroy(){for(const e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(const e of this.workerPools.values())e.setProps(this._getWorkerPoolProps())}getWorkerPool(e){const{name:t,source:i,url:s}=e;let r=this.workerPools.get(t);return r||(r=new J_({name:t,source:i,url:s}),r.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,r)),r}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}N_(Z_,"_workerFarm",void 0);var q_=Object.freeze({__proto__:null,default:{}});const $_={};async function ev(e,t=null,i={}){return t&&(e=function(e,t,i){if(e.startsWith("http"))return e;const s=i.modules||{};if(s[e])return s[e];if(!R_)return"modules/".concat(t,"/dist/libs/").concat(e);if(i.CDN)return S_(i.CDN.startsWith("http")),"".concat(i.CDN,"/").concat(t,"@").concat("3.2.6","/dist/libs/").concat(e);if(U_)return"../src/libs/".concat(e);return"modules/".concat(t,"/src/libs/").concat(e)}(e,t,i)),$_[e]=$_[e]||async function(e){if(e.endsWith("wasm")){const t=await fetch(e);return await t.arrayBuffer()}if(!R_)try{return q_&&void 0}catch{return null}if(U_)return importScripts(e);const t=await fetch(e);return function(e,t){if(!R_)return;if(U_)return eval.call(L_,e),null;const i=document.createElement("script");i.id=t;try{i.appendChild(document.createTextNode(e))}catch(t){i.text=e}return document.body.appendChild(i),null}(await t.text(),e)}(e),await $_[e]}async function tv(e,t,i,s,r){const o=e.id,n=function(e,t={}){const i=t[e.id]||{},s="".concat(e.id,"-worker.js");let r=i.workerUrl;if(r||"compression"!==e.id||(r=t.workerUrl),"test"===t._workerType&&(r="modules/".concat(e.module,"/dist/").concat(s)),!r){let t=e.version;"latest"===t&&(t="latest");const i=t?"@".concat(t):"";r="https://unpkg.com/@loaders.gl/".concat(e.module).concat(i,"/dist/").concat(s)}return S_(r),r}(e,i),a=Z_.getWorkerFarm(i).getWorkerPool({name:o,url:n});i=JSON.parse(JSON.stringify(i)),s=JSON.parse(JSON.stringify(s||{}));const l=await a.startJob("process-on-worker",iv.bind(null,r));l.postMessage("process",{input:t,options:i,context:s});const A=await l.result;return await A.result}async function iv(e,t,i,s){switch(i){case"done":t.done(s);break;case"error":t.error(new Error(s.error));break;case"process":const{id:r,input:o,options:n}=s;try{const i=await e(o,n);t.postMessage("done",{id:r,result:i})}catch(e){const i=e instanceof Error?e.message:"unknown error";t.postMessage("error",{id:r,error:i})}break;default:console.warn("parse-with-worker unknown message ".concat(i))}}function sv(e,t,i){if(e.byteLength<=t+i)return"";const s=new DataView(e);let r="";for(let e=0;e=0),F_(t>0),e+(t-1)&~(t-1)}function Av(e,t,i){let s;if(e instanceof ArrayBuffer)s=new Uint8Array(e);else{const t=e.byteOffset,i=e.byteLength;s=new Uint8Array(e.buffer||e.arrayBuffer,t,i)}return t.set(s,i),i+lv(s.byteLength,4)}async function hv(e){const t=[];for await(const i of e)t.push(i);return function(...e){const t=e.map((e=>e instanceof ArrayBuffer?new Uint8Array(e):e)),i=t.reduce(((e,t)=>e+t.byteLength),0),s=new Uint8Array(i);let r=0;for(const e of t)s.set(e,r),r+=e.byteLength;return s.buffer}(...t)}const cv={};const uv=e=>"function"==typeof e,dv=e=>null!==e&&"object"==typeof e,pv=e=>dv(e)&&e.constructor==={}.constructor,fv=e=>"undefined"!=typeof Response&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json,gv=e=>"undefined"!=typeof Blob&&e instanceof Blob,mv=e=>(e=>"undefined"!=typeof ReadableStream&&e instanceof ReadableStream||dv(e)&&uv(e.tee)&&uv(e.cancel)&&uv(e.getReader))(e)||(e=>dv(e)&&uv(e.read)&&uv(e.pipe)&&(e=>"boolean"==typeof e)(e.readable))(e),_v=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,vv=/^([-\w.]+\/[-\w.+]+)/;function bv(e){const t=vv.exec(e);return t?t[1]:e}function yv(e){const t=_v.exec(e);return t?t[1]:""}const xv=/\?.*/;function Bv(e){if(fv(e)){const t=wv(e.url||"");return{url:t,type:bv(e.headers.get("content-type")||"")||yv(t)}}return gv(e)?{url:wv(e.name||""),type:e.type||""}:"string"==typeof e?{url:wv(e),type:yv(e)}:{url:"",type:""}}function wv(e){return e.replace(xv,"")}async function Pv(e){if(fv(e))return e;const t={},i=function(e){return fv(e)?e.headers["content-length"]||-1:gv(e)?e.size:"string"==typeof e?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}(e);i>=0&&(t["content-length"]=String(i));const{url:s,type:r}=Bv(e);r&&(t["content-type"]=r);const o=await async function(e){const t=5;if("string"==typeof e)return"data:,".concat(e.slice(0,t));if(e instanceof Blob){const t=e.slice(0,5);return await new Promise((e=>{const i=new FileReader;i.onload=t=>{var i;return e(null==t||null===(i=t.target)||void 0===i?void 0:i.result)},i.readAsDataURL(t)}))}if(e instanceof ArrayBuffer){const i=function(e){let t="";const i=new Uint8Array(e);for(let e=0;e=0)}();class Sv{constructor(e,t,i="sessionStorage"){this.storage=function(e){try{const t=window[e],i="__storage_test__";return t.setItem(i,i),t.removeItem(i),t}catch(e){return null}}(i),this.id=e,this.config={},Object.assign(this.config,t),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){return this.config={},this.updateConfiguration(e)}updateConfiguration(e){if(Object.assign(this.config,e),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}return this}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function Tv(e,t,i,s=600){const r=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>s&&(i=Math.min(i,s/e.width));const o=e.width*i,n=e.height*i,a=["font-size:1px;","padding:".concat(Math.floor(n/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(n,"px;"),"background:url(".concat(r,");"),"background-size:".concat(o,"px ").concat(n,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}const Lv={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function Rv(e){return"string"==typeof e?Lv[e.toUpperCase()]||Lv.WHITE:e}function Uv(e,t){if(!e)throw new Error(t||"Assertion failed")}function kv(){let e;if(Dv&&Ev.performance)e=Ev.performance.now();else if(Fv.hrtime){const t=Fv.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}const Ov={debug:Dv&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Nv={enabled:!0,level:0};function Qv(){}const Vv={},Hv={once:!0};function jv(e){for(const t in e)for(const i in e[t])return i||"untitled";return"empty"}class Gv{constructor({id:e}={id:""}){this.id=e,this.VERSION=Iv,this._startTs=kv(),this._deltaTs=kv(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new Sv("__probe-".concat(this.id,"__"),Nv),this.userData={},this.timeStamp("".concat(this.id," started")),function(e,t=["constructor"]){const i=Object.getPrototypeOf(e),s=Object.getOwnPropertyNames(i);for(const i of s)"function"==typeof e[i]&&(t.find((e=>i===e))||(e[i]=e[i].bind(e)))}(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((kv()-this._startTs).toPrecision(10))}getDelta(){return Number((kv()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.updateConfiguration({enabled:e}),this}setLevel(e){return this._storage.updateConfiguration({level:e}),this}assert(e,t){Uv(e,t)}warn(e){return this._getLogFunction(0,e,Ov.warn,arguments,Hv)}error(e){return this._getLogFunction(0,e,Ov.error,arguments)}deprecated(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}probe(e,t){return this._getLogFunction(e,t,Ov.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,Ov.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,Ov.debug||Ov.info,arguments,Hv)}table(e,t,i){return t?this._getLogFunction(e,t,console.table||Qv,i&&[i],{tag:jv(t)}):Qv}image({logLevel:e,priority:t,image:i,message:s="",scale:r=1}){return this._shouldLog(e||t)?Dv?function({image:e,message:t="",scale:i=1}){if("string"==typeof e){const s=new Image;return s.onload=()=>{const e=Tv(s,t,i);console.log(...e)},s.src=e,Qv}const s=e.nodeName||"";if("img"===s.toLowerCase())return console.log(...Tv(e,t,i)),Qv;if("canvas"===s.toLowerCase()){const s=new Image;return s.onload=()=>console.log(...Tv(s,t,i)),s.src=e.toDataURL(),Qv}return Qv}({image:i,message:s,scale:r}):function({image:e,message:t="",scale:i=1}){let s=null;try{s=module.require("asciify-image")}catch(e){}if(s)return()=>s(e,{fit:"box",width:"".concat(Math.round(80*i),"%")}).then((e=>console.log(e)));return Qv}({image:i,message:s,scale:r}):Qv}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}get(e){return this._storage.config[e]}set(e,t){this._storage.updateConfiguration({[e]:t})}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||Qv)}group(e,t,i={collapsed:!1}){i=Wv({logLevel:e,message:t,opts:i});const{collapsed:s}=i;return i.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,t,i={}){return this.group(e,t,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Qv)}withGroup(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=zv(e)}_getLogFunction(e,t,i,s=[],r){if(this._shouldLog(e)){r=Wv({logLevel:e,message:t,args:s,opts:r}),Uv(i=i||r.method),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=kv();const o=r.tag||r.message;if(r.once){if(Vv[o])return Qv;Vv[o]=kv()}return t=function(e,t,i){if("string"==typeof t){const s=i.time?function(e,t=8){const i=Math.max(t-e.length,0);return"".concat(" ".repeat(i)).concat(e)}(function(e){let t;return t=e<10?"".concat(e.toFixed(2),"ms"):e<100?"".concat(e.toFixed(1),"ms"):e<1e3?"".concat(e.toFixed(0),"ms"):"".concat((e/1e3).toFixed(2),"s"),t}(i.total)):"";t=i.time?"".concat(e,": ").concat(s," ").concat(t):"".concat(e,": ").concat(t),t=function(e,t,i){return Dv||"string"!=typeof e||(t&&(t=Rv(t),e="[".concat(t,"m").concat(e,"")),i&&(t=Rv(i),e="[".concat(i+10,"m").concat(e,""))),e}(t,i.color,i.background)}return t}(this.id,r.message,r),i.bind(console,t,...r.args)}return Qv}}function zv(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Uv(Number.isFinite(t)&&t>=0),t}function Wv(e){const{logLevel:t,message:i}=e;e.logLevel=zv(t);const s=e.args?Array.from(e.args):[];for(;s.length&&s.shift()!==i;);switch(e.args=s,typeof t){case"string":case"function":void 0!==i&&s.unshift(i),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());const r=typeof e.message;return Uv("string"===r||"object"===r),Object.assign(e,e.opts)}Gv.VERSION=Iv;const Kv=new Gv({id:"loaders.gl"});class Xv{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const Jv={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){N_(this,"console",void 0),this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}},CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:I_,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},Yv={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 Zv(){globalThis.loaders=globalThis.loaders||{};const{loaders:e}=globalThis;return e._state=e._state||{},e._state}const qv=()=>{const e=Zv();return e.globalOptions=e.globalOptions||{...Jv},e.globalOptions};function $v(e,t,i,s){return i=i||[],function(e,t){tb(e,null,Jv,Yv,t);for(const i of t){const s=e&&e[i.id]||{},r=i.options&&i.options[i.id]||{},o=i.deprecatedOptions&&i.deprecatedOptions[i.id]||{};tb(s,i.id,r,o,t)}}(e,i=Array.isArray(i)?i:[i]),function(e,t,i){const s={...e.options||{}};(function(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)})(s,i),null===s.log&&(s.log=new Xv);return sb(s,qv()),sb(s,t),s}(t,e,s)}function eb(e,t){const i=qv(),s=e||i;return"function"==typeof s.fetch?s.fetch:dv(s.fetch)?e=>Cv(e,s):null!=t&&t.fetch?null==t?void 0:t.fetch:Cv}function tb(e,t,i,s,r){const o=t||"Top level",n=t?"".concat(t,"."):"";for(const a in e){const l=!t&&dv(e[a]),A="baseUri"===a&&!t,h="workerUrl"===a&&t;if(!(a in i)&&!A&&!h)if(a in s)Kv.warn("".concat(o," loader option '").concat(n).concat(a,"' no longer supported, use '").concat(s[a],"'"))();else if(!l){const e=ib(a,r);Kv.warn("".concat(o," loader option '").concat(n).concat(a,"' not recognized. ").concat(e))()}}}function ib(e,t){const i=e.toLowerCase();let s="";for(const r of t)for(const t in r.options){if(e===t)return"Did you mean '".concat(r.id,".").concat(t,"'?");const o=t.toLowerCase();(i.startsWith(o)||o.startsWith(i))&&(s=s||"Did you mean '".concat(r.id,".").concat(t,"'?"))}return s}function sb(e,t){for(const i in t)if(i in t){const s=t[i];pv(s)&&pv(e[i])?e[i]={...e[i],...t[i]}:e[i]=t[i]}}function rb(e){var t;if(!e)return!1;Array.isArray(e)&&(e=e[0]);return Array.isArray(null===(t=e)||void 0===t?void 0:t.extensions)}function ob(e){var t,i;let s;return F_(e,"null loader"),F_(rb(e),"invalid loader"),Array.isArray(e)&&(s=e[1],e=e[0],e={...e,options:{...e.options,...s}}),(null!==(t=e)&&void 0!==t&&t.parseTextSync||null!==(i=e)&&void 0!==i&&i.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}function nb(){return(()=>{const e=Zv();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry})()}function ab(){return!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)||function(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof process&&"object"==typeof process.versions&&Boolean(process.versions.electron))return!0;const t="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,i=e||t;return!!(i&&i.indexOf("Electron")>=0)}()}const lb={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"==typeof process&&process},Ab=lb.window||lb.self||lb.global,hb=lb.process||{},cb="undefined"!=typeof __VERSION__?__VERSION__:"untranspiled source";ab();class ub{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";N_(this,"storage",void 0),N_(this,"id",void 0),N_(this,"config",{}),this.storage=function(e){try{const t=window[e],i="__storage_test__";return t.setItem(i,i),t.removeItem(i),t}catch(e){return null}}(i),this.id=e,this.config={},Object.assign(this.config,t),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){return this.config={},this.updateConfiguration(e)}updateConfiguration(e){if(Object.assign(this.config,e),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}return this}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function db(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600;const r=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>s&&(i=Math.min(i,s/e.width));const o=e.width*i,n=e.height*i,a=["font-size:1px;","padding:".concat(Math.floor(n/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(n,"px;"),"background:url(".concat(r,");"),"background-size:".concat(o,"px ").concat(n,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}let pb;function fb(e){return"string"==typeof e?pb[e.toUpperCase()]||pb.WHITE:e}function gb(e,t){if(!e)throw new Error(t||"Assertion failed")}function mb(){let e;var t,i;if(ab&&"performance"in Ab)e=null==Ab||null===(t=Ab.performance)||void 0===t||null===(i=t.now)||void 0===i?void 0:i.call(t);else if("hrtime"in hb){var s;const t=null==hb||null===(s=hb.hrtime)||void 0===s?void 0:s.call(hb);e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}!function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(pb||(pb={}));const _b={debug:ab&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},vb={enabled:!0,level:0};function bb(){}const yb={},xb={once:!0};class Bb{constructor(){let{id:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""};N_(this,"id",void 0),N_(this,"VERSION",cb),N_(this,"_startTs",mb()),N_(this,"_deltaTs",mb()),N_(this,"_storage",void 0),N_(this,"userData",{}),N_(this,"LOG_THROTTLE_TIMEOUT",0),this.id=e,this._storage=new ub("__probe-".concat(this.id,"__"),vb),this.userData={},this.timeStamp("".concat(this.id," started")),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"];const i=Object.getPrototypeOf(e),s=Object.getOwnPropertyNames(i);for(const i of s)"function"==typeof e[i]&&(t.find((e=>i===e))||(e[i]=e[i].bind(e)))}(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((mb()-this._startTs).toPrecision(10))}getDelta(){return Number((mb()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:e}),this}setLevel(e){return this._storage.updateConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.updateConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){gb(e,t)}warn(e){return this._getLogFunction(0,e,_b.warn,arguments,xb)}error(e){return this._getLogFunction(0,e,_b.error,arguments)}deprecated(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}probe(e,t){return this._getLogFunction(e,t,_b.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,_b.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){for(var i=arguments.length,s=new Array(i>2?i-2:0),r=2;r{const t=db(e,i,s);console.log(...t)},e.src=t,bb}const r=t.nodeName||"";if("img"===r.toLowerCase())return console.log(...db(t,i,s)),bb;if("canvas"===r.toLowerCase()){const e=new Image;return e.onload=()=>console.log(...db(e,i,s)),e.src=t.toDataURL(),bb}return bb}({image:s,message:r,scale:o}):function(e){let{image:t,message:i="",scale:s=1}=e,r=null;try{r=module.require("asciify-image")}catch(e){}if(r)return()=>r(t,{fit:"box",width:"".concat(Math.round(80*s),"%")}).then((e=>console.log(e)));return bb}({image:s,message:r,scale:o}):bb}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||bb)}group(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};const s=Pb({logLevel:e,message:t,opts:i}),{collapsed:r}=i;return s.method=(r?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(e,t,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||bb)}withGroup(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=wb(e)}_getLogFunction(e,t,i,s,r){if(this._shouldLog(e)){r=Pb({logLevel:e,message:t,args:s,opts:r}),gb(i=i||r.method),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=mb();const o=r.tag||r.message;if(r.once){if(yb[o])return bb;yb[o]=mb()}return t=function(e,t,i){if("string"==typeof t){const s=i.time?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const i=Math.max(t-e.length,0);return"".concat(" ".repeat(i)).concat(e)}(function(e){let t;return t=e<10?"".concat(e.toFixed(2),"ms"):e<100?"".concat(e.toFixed(1),"ms"):e<1e3?"".concat(e.toFixed(0),"ms"):"".concat((e/1e3).toFixed(2),"s"),t}(i.total)):"";t=i.time?"".concat(e,": ").concat(s," ").concat(t):"".concat(e,": ").concat(t),t=function(e,t,i){return ab||"string"!=typeof e||(t&&(t=fb(t),e="[".concat(t,"m").concat(e,"")),i&&(t=fb(i),e="[".concat(i+10,"m").concat(e,""))),e}(t,i.color,i.background)}return t}(this.id,r.message,r),i.bind(console,t,...r.args)}return bb}}function wb(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return gb(Number.isFinite(t)&&t>=0),t}function Pb(e){const{logLevel:t,message:i}=e;e.logLevel=wb(t);const s=e.args?Array.from(e.args):[];for(;s.length&&s.shift()!==i;);switch(typeof t){case"string":case"function":void 0!==i&&s.unshift(i),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());const r=typeof e.message;return gb("string"===r||"object"===r),Object.assign(e,{args:s},e.opts)}function Cb(e){for(const t in e)for(const i in e[t])return i||"untitled";return"empty"}N_(Bb,"VERSION",cb);const Mb=new Bb({id:"loaders.gl"}),Eb=/\.([^.]+)$/;function Fb(e,t=[],i,s){if(!Ib(e))return null;if(t&&!Array.isArray(t))return ob(t);let r=[];t&&(r=r.concat(t)),null!=i&&i.ignoreRegisteredLoaders||r.push(...nb()),function(e){for(const t of e)ob(t)}(r);const o=function(e,t,i,s){const{url:r,type:o}=Bv(e),n=r||(null==s?void 0:s.url);let a=null,l="";null!=i&&i.mimeType&&(a=Sb(t,null==i?void 0:i.mimeType),l="match forced by supplied MIME type ".concat(null==i?void 0:i.mimeType));var A;a=a||function(e,t){const i=t&&Eb.exec(t),s=i&&i[1];return s?function(e,t){t=t.toLowerCase();for(const i of e)for(const e of i.extensions)if(e.toLowerCase()===t)return i;return null}(e,s):null}(t,n),l=l||(a?"matched url ".concat(n):""),a=a||Sb(t,o),l=l||(a?"matched MIME type ".concat(o):""),a=a||function(e,t){if(!t)return null;for(const i of e)if("string"==typeof t){if(Tb(t,i))return i}else if(ArrayBuffer.isView(t)){if(Lb(t.buffer,t.byteOffset,i))return i}else if(t instanceof ArrayBuffer){if(Lb(t,0,i))return i}return null}(t,e),l=l||(a?"matched initial data ".concat(Rb(e)):""),a=a||Sb(t,null==i?void 0:i.fallbackMimeType),l=l||(a?"matched fallback MIME type ".concat(o):""),l&&Mb.log(1,"selectLoader selected ".concat(null===(A=a)||void 0===A?void 0:A.name,": ").concat(l,"."));return a}(e,r,i,s);if(!(o||null!=i&&i.nothrow))throw new Error(Db(e));return o}function Ib(e){return!(e instanceof Response&&204===e.status)}function Db(e){const{url:t,type:i}=Bv(e);let s="No valid loader found (";s+=t?"".concat(function(e){const t=e&&e.lastIndexOf("/");return t>=0?e.substr(t+1):""}(t),", "):"no url provided, ",s+="MIME type: ".concat(i?'"'.concat(i,'"'):"not provided",", ");const r=e?Rb(e):"";return s+=r?' first bytes: "'.concat(r,'"'):"first bytes: not available",s+=")",s}function Sb(e,t){for(const i of e){if(i.mimeTypes&&i.mimeTypes.includes(t))return i;if(t==="application/x.".concat(i.id))return i}return null}function Tb(e,t){if(t.testText)return t.testText(e);return(Array.isArray(t.tests)?t.tests:[t.tests]).some((t=>e.startsWith(t)))}function Lb(e,t,i){return(Array.isArray(i.tests)?i.tests:[i.tests]).some((s=>function(e,t,i,s){if(s instanceof ArrayBuffer)return function(e,t,i){if(i=i||e.byteLength,e.byteLength60?"".concat(t.slice(0,60),"..."):t}catch(e){}return t}(e);throw new Error(t)}}(i),t.binary?await i.arrayBuffer():await i.text()}if(mv(e)&&(e=Nb(e,i)),(r=e)&&"function"==typeof r[Symbol.iterator]||(e=>e&&"function"==typeof e[Symbol.asyncIterator])(e))return hv(e);var r;throw new Error(Qb)}async function Hb(e,t,i,s){S_(!s||"object"==typeof s),!t||Array.isArray(t)||rb(t)||(s=void 0,i=t,t=void 0),e=await e,i=i||{};const{url:r}=Bv(e),o=function(e,t){if(!t&&e&&!Array.isArray(e))return e;let i;if(e&&(i=Array.isArray(e)?e:[e]),t&&t.loaders){const e=Array.isArray(t.loaders)?t.loaders:[t.loaders];i=i?[...i,...e]:e}return i&&i.length?i:null}(t,s),n=await async function(e,t=[],i,s){if(!Ib(e))return null;let r=Fb(e,t,{...i,nothrow:!0},s);if(r)return r;if(gv(e)&&(r=Fb(e=await e.slice(0,10).arrayBuffer(),t,i,s)),!(r||null!=i&&i.nothrow))throw new Error(Db(e));return r}(e,o,i);return n?(s=function(e,t,i=null){if(i)return i;const s={fetch:eb(t,e),...e};return Array.isArray(s.loaders)||(s.loaders=null),s}({url:r,parse:Hb,loaders:o},i=$v(i,n,o,r),s),await async function(e,t,i,s){if(function(e,t="3.2.6"){S_(e,"no worker provided");const i=e.version}(e),fv(t)){const e=t,{ok:i,redirected:r,status:o,statusText:n,type:a,url:l}=e,A=Object.fromEntries(e.headers.entries());s.response={headers:A,ok:i,redirected:r,status:o,statusText:n,type:a,url:l}}if(t=await Vb(t,e,i),e.parseTextSync&&"string"==typeof t)return i.dataType="text",e.parseTextSync(t,i,s,e);if(function(e,t){return!!Z_.isSupported()&&!!(R_||null!=t&&t._nodeWorkers)&&e.worker&&(null==t?void 0:t.worker)}(e,i))return await tv(e,t,i,s,Hb);if(e.parseText&&"string"==typeof t)return await e.parseText(t,i,s,e);if(e.parse)return await e.parse(t,i,s,e);throw S_(!e.parseSync),new Error("".concat(e.id," loader - no parser found and worker is disabled"))}(n,e,i,s)):null}const jb="https://unpkg.com/@loaders.gl/textures@".concat("3.2.6","/dist/libs/basis_encoder.wasm"),Gb="https://unpkg.com/@loaders.gl/textures@".concat("3.2.6","/dist/libs/basis_encoder.js");let zb,Wb;async function Kb(e){const t=e.modules||{};return t.basis?t.basis:(zb=zb||async function(e){let t=null,i=null;return[t,i]=await Promise.all([await ev("basis_transcoder.js","textures",e),await ev("basis_transcoder.wasm","textures",e)]),t=t||globalThis.BASIS,await function(e,t){const i={};t&&(i.wasmBinary=t);return new Promise((t=>{e(i).then((e=>{const{BasisFile:i,initializeBasis:s}=e;s(),t({BasisFile:i})}))}))}(t,i)}(e),await zb)}async function Xb(e){const t=e.modules||{};return t.basisEncoder?t.basisEncoder:(Wb=Wb||async function(e){let t=null,i=null;return[t,i]=await Promise.all([await ev(Gb,"textures",e),await ev(jb,"textures",e)]),t=t||globalThis.BASIS,await function(e,t){const i={};t&&(i.wasmBinary=t);return new Promise((t=>{e(i).then((e=>{const{BasisFile:i,KTX2File:s,initializeBasis:r,BasisEncoder:o}=e;r(),t({BasisFile:i,KTX2File:s,BasisEncoder:o})}))}))}(t,i)}(e),await Wb)}const Jb=33776,Yb=33779,Zb=35840,qb=35842,$b=36196,ey=37808,ty=["","WEBKIT_","MOZ_"],iy={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"};let sy=null;function ry(e){if(!sy){e=e||function(){try{return document.createElement("canvas").getContext("webgl")}catch(e){return null}}()||void 0,sy=new Set;for(const t of ty)for(const i in iy)if(e&&e.getExtension("".concat(t).concat(i))){const e=iy[i];sy.add(e)}}return sy}var oy,ny,ay,ly,Ay,hy,cy,uy,dy;(dy=oy||(oy={}))[dy.NONE=0]="NONE",dy[dy.BASISLZ=1]="BASISLZ",dy[dy.ZSTD=2]="ZSTD",dy[dy.ZLIB=3]="ZLIB",function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(ny||(ny={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(ay||(ay={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(ly||(ly={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(Ay||(Ay={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(hy||(hy={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(cy||(cy={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(uy||(uy={}));const py=[171,75,84,88,32,50,48,187,13,10,26,10];const fy={etc1:{basisFormat:0,compressed:!0,format:$b},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Jb},bc3:{basisFormat:3,compressed:!0,format:Yb},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:Zb},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:qb},"astc-4x4":{basisFormat:10,compressed:!0,format:ey},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};function gy(e,t,i){const s=new e(new Uint8Array(t));try{if(!s.startTranscoding())throw new Error("Failed to start basis transcoding");const e=s.getNumImages(),t=[];for(let r=0;r{try{i.onload=()=>t(i),i.onerror=t=>s(new Error("Could not load image ".concat(e,": ").concat(t)))}catch(e){s(e)}}))}(o||s,t)}finally{o&&r.revokeObjectURL(o)}}const Ly={};let Ry=!0;async function Uy(e,t,i){let s;if(Dy(i)){s=await Ty(e,t,i)}else s=Sy(e,i);const r=t&&t.imagebitmap;return await async function(e,t=null){!function(e){for(const t in e||Ly)return!1;return!0}(t)&&Ry||(t=null);if(t)try{return await createImageBitmap(e,t)}catch(e){console.warn(e),Ry=!1}return await createImageBitmap(e)}(s,r)}function ky(e){const t=Oy(e);return function(e){const t=Oy(e);if(!(t.byteLength>=24&&2303741511===t.getUint32(0,false)))return null;return{mimeType:"image/png",width:t.getUint32(16,false),height:t.getUint32(20,false)}}(t)||function(e){const t=Oy(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,false)&&255===t.getUint8(2)))return null;const{tableMarkers:i,sofMarkers:s}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let r=2;for(;r+9=10&&1195984440===t.getUint32(0,false)))return null;return{mimeType:"image/gif",width:t.getUint16(6,true),height:t.getUint16(8,true)}}(t)||function(e){const t=Oy(e);if(!(t.byteLength>=14&&16973===t.getUint16(0,false)&&t.getUint32(2,true)===t.byteLength))return null;return{mimeType:"image/bmp",width:t.getUint32(18,true),height:t.getUint32(22,true)}}(t)}function Oy(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}const Ny={id:"image",module:"images",name:"Images",version:"3.2.6",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:async function(e,t,i){const s=((t=t||{}).image||{}).type||"auto",{url:r}=i||{};let o;switch(function(e){switch(e){case"auto":case"data":return function(){if(Py)return"imagebitmap";if(wy)return"image";if(My)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(e){switch(e){case"auto":return Py||wy||My;case"imagebitmap":return Py;case"image":return wy;case"data":return My;default:throw new Error("@loaders.gl/images: image ".concat(e," not supported in this environment"))}}(e),e}}(s)){case"imagebitmap":o=await Uy(e,t,r);break;case"image":o=await Ty(e,t,r);break;case"data":o=await async function(e,t){const{mimeType:i}=ky(e)||{},s=globalThis._parseImageNode;return F_(s),await s(e,i)}(e);break;default:F_(!1)}return"data"===s&&(o=function(e){switch(Ey(e)){case"data":return e;case"image":case"imagebitmap":const t=document.createElement("canvas"),i=t.getContext("2d");if(!i)throw new Error("getImageData");return t.width=e.width,t.height=e.height,i.drawImage(e,0,0),i.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}(o)),o},tests:[e=>Boolean(ky(new DataView(e)))],options:{image:{type:"auto",decode:!0}}},Qy=["image/png","image/jpeg","image/gif"],Vy={};function Hy(e){return void 0===Vy[e]&&(Vy[e]=function(e){switch(e){case"image/webp":return function(){if(!I_)return!1;try{return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}catch{return!1}}();case"image/svg":return I_;default:if(!I_){const{_parseImageNode:t}=globalThis;return Boolean(t)&&Qy.includes(e)}return!0}}(e)),Vy[e]}function jy(e,t){if(!e)throw new Error(t||"assert failed: gltf")}function Gy(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;const i=t.baseUri||t.uri;if(!i)throw new Error("'baseUri' must be provided to resolve relative url ".concat(e));return i.substr(0,i.lastIndexOf("/")+1)+e}const zy=["SCALAR","VEC2","VEC3","VEC4"],Wy=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],Ky=new Map(Wy),Xy={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Jy={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Yy={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function Zy(e){return zy[e-1]||zy[0]}function qy(e){const t=Ky.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function $y(e,t){const i=Yy[e.componentType],s=Xy[e.type],r=Jy[e.componentType],o=e.count*s,n=e.count*s*r;return jy(n>=0&&n<=t.byteLength),{ArrayType:i,length:o,byteLength:n}}const ex={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]};class tx{constructor(e){N_(this,"gltf",void 0),N_(this,"sourceBuffers",void 0),N_(this,"byteLength",void 0),this.gltf=e||{json:{...ex},buffers:[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}getExtension(e){const t=this.getUsedExtensions().find((t=>t===e)),i=this.json.extensions||{};return t?i[e]||!0:null}getRequiredExtension(e){const t=this.getRequiredExtensions().find((t=>t===e));return t?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,t){if("object"==typeof t)return t;const i=this.json[e]&&this.json[e][t];if(!i)throw new Error("glTF file error: Could not find ".concat(e,"[").concat(t,"]"));return i}getTypedArrayForBufferView(e){const t=(e=this.getBufferView(e)).buffer,i=this.gltf.buffers[t];jy(i);const s=(e.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,s,e.byteLength)}getTypedArrayForAccessor(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),i=this.getBuffer(t.buffer).data,{ArrayType:s,length:r}=$y(e,t);return new s(i,t.byteOffset+e.byteOffset,r)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),i=this.getBuffer(t.buffer).data,s=t.byteOffset||0;return new Uint8Array(i,s,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,i){return e.extensions=e.extensions||{},e.extensions[t]=i,this.registerUsedExtension(t),this}setObjectExtension(e,t,i){(e.extensions||{})[t]=i}removeObjectExtension(e,t){const i=e.extensions||{},s=i[t];return delete i[t],s}addExtension(e,t={}){return jy(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return jy(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find((t=>t===e))||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find((t=>t===e))||this.json.extensionsRequired.push(e)}removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}setDefaultScene(e){this.json.scene=e}addScene(e){const{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){const{meshIndex:t,matrix:i}=e;this.json.nodes=this.json.nodes||[];const s={mesh:t};return i&&(s.matrix=i),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(e){const{attributes:t,indices:i,material:s,mode:r=4}=e,o={primitives:[{attributes:this._addAttributes(t),mode:r}]};if(i){const e=this._addIndices(i);o.primitives[0].indices=e}return Number.isFinite(s)&&(o.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(o),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addImage(e,t){const i=ky(e),s=t||(null==i?void 0:i.mimeType),r={bufferView:this.addBufferView(e),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(r),this.json.images.length-1}addBufferView(e){const t=e.byteLength;jy(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const i={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=lv(t,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(e,t){const i={bufferView:e,type:Zy(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(i),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const i=this.addBufferView(e);let s={min:t.min,max:t.max};s.min&&s.max||(s=this._getAccessorMinMax(e,t.size));const r={size:t.size,componentType:qy(e),count:Math.round(e.length/t.size),min:s.min,max:s.max};return this.addAccessor(i,Object.assign(r,t))}addTexture(e){const{imageIndex:t}=e,i={source:t};return this.json.textures=this.json.textures||[],this.json.textures.push(i),this.json.textures.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){var e,t;this.gltf.buffers=[];const i=this.byteLength,s=new ArrayBuffer(i),r=new Uint8Array(s);let o=0;for(const e of this.sourceBuffers||[])o=Av(e,r,o);null!==(e=this.json)&&void 0!==e&&null!==(t=e.buffers)&&void 0!==t&&t[0]?this.json.buffers[0].byteLength=i:this.json.buffers=[{byteLength:i}],this.gltf.binary=s,this.sourceBuffers=[s]}_removeStringFromArray(e,t){let i=!0;for(;i;){const s=e.indexOf(t);s>-1?e.splice(s,1):i=!1}}_addAttributes(e={}){const t={};for(const i in e){const s=e[i],r=this._getGltfAttributeName(i),o=this.addBinaryBuffer(s.value,s);t[r]=o}return t}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.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 e}}_getAccessorMinMax(e,t){const i={min:null,max:null};if(e.length96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let i=0;for(let s=0;st[e.name]));return new fx(i,this.metadata)}selectAt(...e){const t=e.map((e=>this.fields[e])).filter(Boolean);return new fx(t,this.metadata)}assign(e){let t,i=this.metadata;if(e instanceof fx){const s=e;t=s.fields,i=gx(gx(new Map,this.metadata),s.metadata)}else t=e;const s=Object.create(null);for(const e of this.fields)s[e.name]=e;for(const e of t)s[e.name]=e;const r=Object.values(s);return new fx(r,i)}}function gx(e,t){return new Map([...e||new Map,...t||new Map])}class mx{constructor(e,t,i=!1,s=new Map){N_(this,"name",void 0),N_(this,"type",void 0),N_(this,"nullable",void 0),N_(this,"metadata",void 0),this.name=e,this.type=t,this.nullable=i,this.metadata=s}get typeId(){return this.type&&this.type.typeId}clone(){return new mx(this.name,this.type,this.nullable,this.metadata)}compareTo(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}toString(){return"".concat(this.type).concat(this.nullable?", nullable":"").concat(this.metadata?", metadata: ".concat(this.metadata):"")}}let _x,vx,bx,yx;!function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(_x||(_x={}));class xx{static isNull(e){return e&&e.typeId===_x.Null}static isInt(e){return e&&e.typeId===_x.Int}static isFloat(e){return e&&e.typeId===_x.Float}static isBinary(e){return e&&e.typeId===_x.Binary}static isUtf8(e){return e&&e.typeId===_x.Utf8}static isBool(e){return e&&e.typeId===_x.Bool}static isDecimal(e){return e&&e.typeId===_x.Decimal}static isDate(e){return e&&e.typeId===_x.Date}static isTime(e){return e&&e.typeId===_x.Time}static isTimestamp(e){return e&&e.typeId===_x.Timestamp}static isInterval(e){return e&&e.typeId===_x.Interval}static isList(e){return e&&e.typeId===_x.List}static isStruct(e){return e&&e.typeId===_x.Struct}static isUnion(e){return e&&e.typeId===_x.Union}static isFixedSizeBinary(e){return e&&e.typeId===_x.FixedSizeBinary}static isFixedSizeList(e){return e&&e.typeId===_x.FixedSizeList}static isMap(e){return e&&e.typeId===_x.Map}static isDictionary(e){return e&&e.typeId===_x.Dictionary}get typeId(){return _x.NONE}compareTo(e){return this===e}}vx=Symbol.toStringTag;class Bx extends xx{constructor(e,t){super(),N_(this,"isSigned",void 0),N_(this,"bitWidth",void 0),this.isSigned=e,this.bitWidth=t}get typeId(){return _x.Int}get[vx](){return"Int"}toString(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}}class wx extends Bx{constructor(){super(!0,8)}}class Px extends Bx{constructor(){super(!0,16)}}class Cx extends Bx{constructor(){super(!0,32)}}class Mx extends Bx{constructor(){super(!1,8)}}class Ex extends Bx{constructor(){super(!1,16)}}class Fx extends Bx{constructor(){super(!1,32)}}const Ix=32,Dx=64;bx=Symbol.toStringTag;class Sx extends xx{constructor(e){super(),N_(this,"precision",void 0),this.precision=e}get typeId(){return _x.Float}get[bx](){return"Float"}toString(){return"Float".concat(this.precision)}}class Tx extends Sx{constructor(){super(Ix)}}class Lx extends Sx{constructor(){super(Dx)}}yx=Symbol.toStringTag;class Rx extends xx{constructor(e,t){super(),N_(this,"listSize",void 0),N_(this,"children",void 0),this.listSize=e,this.children=[t]}get typeId(){return _x.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[yx](){return"FixedSizeList"}toString(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}}function Ux(e,t,i){const s=function(e){switch(e.constructor){case Int8Array:return new wx;case Uint8Array:return new Mx;case Int16Array:return new Px;case Uint16Array:return new Ex;case Int32Array:return new Cx;case Uint32Array:return new Fx;case Float32Array:return new Tx;case Float64Array:return new Lx;default:throw new Error("array type not supported")}}(t.value),r=i||function(e){const t=new Map;"byteOffset"in e&&t.set("byteOffset",e.byteOffset.toString(10));"byteStride"in e&&t.set("byteStride",e.byteStride.toString(10));"normalized"in e&&t.set("normalized",e.normalized.toString());return t}(t);return new mx(e,new Rx(t.size,new mx("value",s)),!1,r)}function kx(e,t,i){return Ux(e,t,i?Ox(i.metadata):void 0)}function Ox(e){const t=new Map;for(const i in e)t.set("".concat(i,".string"),JSON.stringify(e[i]));return t}const Nx={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},Qx={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class Vx{constructor(e){N_(this,"draco",void 0),N_(this,"decoder",void 0),N_(this,"metadataQuerier",void 0),this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,t={}){const i=new this.draco.DecoderBuffer;i.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(t);const s=this.decoder.GetEncodedGeometryType(i),r=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let e;switch(s){case this.draco.TRIANGULAR_MESH:e=this.decoder.DecodeBufferToMesh(i,r);break;case this.draco.POINT_CLOUD:e=this.decoder.DecodeBufferToPointCloud(i,r);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!e.ok()||!r.ptr){const t="DRACO decompression failed: ".concat(e.error_msg());throw new Error(t)}const o=this._getDracoLoaderData(r,s,t),n=this._getMeshData(r,o,t),a=function(e){let t=1/0,i=1/0,s=1/0,r=-1/0,o=-1/0,n=-1/0;const a=e.POSITION?e.POSITION.value:[],l=a&&a.length;for(let e=0;er?l:r,o=A>o?A:o,n=h>n?h:n}return[[t,i,s],[r,o,n]]}(n.attributes),l=function(e,t,i){const s=Ox(t.metadata),r=[],o=function(e){const t={};for(const i in e){const s=e[i];t[s.name||"undefined"]=s}return t}(t.attributes);for(const t in e){const i=kx(t,e[t],o[t]);r.push(i)}if(i){const e=kx("indices",i);r.push(e)}return new fx(r,s)}(n.attributes,o,n.indices);return{loader:"draco",loaderData:o,header:{vertexCount:r.num_points(),boundingBox:a},...n,schema:l}}finally{this.draco.destroy(i),r&&this.draco.destroy(r)}}_getDracoLoaderData(e,t,i){const s=this._getTopLevelMetadata(e),r=this._getDracoAttributes(e,i);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:s,attributes:r}}_getDracoAttributes(e,t){const i={};for(let s=0;sthis.decoder[e])).includes(s)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits(),range:t.range(),min_values:new Float32Array([1,2,3]).map((e=>t.min_value(e)))}}finally{this.draco.destroy(t)}}return null}_getOctahedronTransform(e,t){const{octahedronAttributes:i=[]}=t,s=e.attribute_type();if(i.map((e=>this.decoder[e])).includes(s)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits()}}finally{this.draco.destroy(t)}}return null}}const Hx="https://www.gstatic.com/draco/versioned/decoders/".concat("1.4.1","/draco_decoder.js"),jx="https://www.gstatic.com/draco/versioned/decoders/".concat("1.4.1","/draco_wasm_wrapper.js"),Gx="https://www.gstatic.com/draco/versioned/decoders/".concat("1.4.1","/draco_decoder.wasm");let zx;async function Wx(e){const t=e.modules||{};return zx=t.draco3d?zx||t.draco3d.createDecoderModule({}).then((e=>({draco:e}))):zx||async function(e){let t,i;if("js"===(e.draco&&e.draco.decoderType))t=await ev(Hx,"draco",e);else[t,i]=await Promise.all([await ev(jx,"draco",e),await ev(Gx,"draco",e)]);return t=t||globalThis.DracoDecoderModule,await function(e,t){const i={};t&&(i.wasmBinary=t);return new Promise((t=>{e({...i,onModuleLoaded:e=>t({draco:e})})}))}(t,i)}(e),await zx}const Kx={...px,parse:async function(e,t){const{draco:i}=await Wx(t),s=new Vx(i);try{return s.parseSync(e,null==t?void 0:t.draco)}finally{s.destroy()}}};function Xx(e){const{buffer:t,size:i,count:s}=function(e){let t=e,i=1,s=0;e&&e.value&&(t=e.value,i=e.size||1);t&&(ArrayBuffer.isView(t)||(t=function(e,t,i=!1){if(!e)return null;if(Array.isArray(e))return new t(e);if(i&&!(e instanceof t))return new t(e);return e}(t,Float32Array)),s=t.length/i);return{buffer:t,size:i,count:s}}(e);return{value:t,size:i,byteOffset:0,count:s,type:Zy(i),componentType:qy(t)}}async function Jx(e,t,i,s){const r=e.getObjectExtension(t,"KHR_draco_mesh_compression");if(!r)return;const o=e.getTypedArrayForBufferView(r.bufferView),n=av(o.buffer,o.byteOffset),{parse:a}=s,l={...i};delete l["3d-tiles"];const A=await a(n,Kx,l,s),h=function(e){const t={};for(const i in e){const s=e[i];if("indices"!==i){const e=Xx(s);t[i]=e}}return t}(A.attributes);for(const[i,s]of Object.entries(h))if(i in t.attributes){const r=t.attributes[i],o=e.getAccessor(r);null!=o&&o.min&&null!=o&&o.max&&(s.min=o.min,s.max=o.max)}t.attributes=h,A.indices&&(t.indices=Xx(A.indices)),function(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(t)}function Yx(e,t,i=4,s,r){var o;if(!s.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const n=s.DracoWriter.encodeSync({attributes:e}),a=null==r||null===(o=r.parseSync)||void 0===o?void 0:o.call(r,{attributes:e}),l=s._addFauxAttributes(a.attributes);return{primitives:[{attributes:l,mode:i,extensions:{KHR_draco_mesh_compression:{bufferView:s.addBufferView(n),attributes:l}}}]}}function*Zx(e){for(const t of e.json.meshes||[])for(const e of t.primitives)yield e}var qx=Object.freeze({__proto__:null,name:"KHR_draco_mesh_compression",preprocess:function(e,t,i){const s=new tx(e);for(const e of Zx(s))s.getObjectExtension(e,"KHR_draco_mesh_compression")},decode:async function(e,t,i){var s;if(null==t||null===(s=t.gltf)||void 0===s||!s.decompressMeshes)return;const r=new tx(e),o=[];for(const e of Zx(r))r.getObjectExtension(e,"KHR_draco_mesh_compression")&&o.push(Jx(r,e,t,i));await Promise.all(o),r.removeExtension("KHR_draco_mesh_compression")},encode:function(e,t={}){const i=new tx(e);for(const e of i.json.meshes||[])Yx(e),i.addRequiredExtension("KHR_draco_mesh_compression")}});var $x=Object.freeze({__proto__:null,name:"KHR_lights_punctual",decode:async function(e){const t=new tx(e),{json:i}=t,s=t.getExtension("KHR_lights_punctual");s&&(t.json.lights=s.lights,t.removeExtension("KHR_lights_punctual"));for(const e of i.nodes||[]){const i=t.getObjectExtension(e,"KHR_lights_punctual");i&&(e.light=i.light),t.removeObjectExtension(e,"KHR_lights_punctual")}},encode:async function(e){const t=new tx(e),{json:i}=t;if(i.lights){const e=t.addExtension("KHR_lights_punctual");jy(!e.lights),e.lights=i.lights,delete i.lights}if(t.json.lights){for(const e of t.json.lights){const i=e.node;t.addObjectExtension(i,"KHR_lights_punctual",e)}delete t.json.lights}}});function eB(e,t){const i=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach((t=>{e.uniforms[t].value&&!(t in i)&&(i[t]=e.uniforms[t].value)})),Object.keys(i).forEach((e=>{"object"==typeof i[e]&&void 0!==i[e].index&&(i[e].texture=t.getTexture(i[e].index))})),i}const tB=[cx,ux,dx,qx,$x,Object.freeze({__proto__:null,name:"KHR_materials_unlit",decode:async function(e){const t=new tx(e),{json:i}=t;t.removeExtension("KHR_materials_unlit");for(const e of i.materials||[]){e.extensions&&e.extensions.KHR_materials_unlit&&(e.unlit=!0),t.removeObjectExtension(e,"KHR_materials_unlit")}},encode:function(e){const t=new tx(e),{json:i}=t;if(t.materials)for(const e of i.materials||[])e.unlit&&(delete e.unlit,t.addObjectExtension(e,"KHR_materials_unlit",{}),t.addExtension("KHR_materials_unlit"))}}),Object.freeze({__proto__:null,name:"KHR_techniques_webgl",decode:async function(e){const t=new tx(e),{json:i}=t,s=t.getExtension("KHR_techniques_webgl");if(s){const e=function(e,t){const{programs:i=[],shaders:s=[],techniques:r=[]}=e,o=new TextDecoder;return s.forEach((e=>{if(!Number.isFinite(e.bufferView))throw new Error("KHR_techniques_webgl: no shader code");e.code=o.decode(t.getTypedArrayForBufferView(e.bufferView))})),i.forEach((e=>{e.fragmentShader=s[e.fragmentShader],e.vertexShader=s[e.vertexShader]})),r.forEach((e=>{e.program=i[e.program]})),r}(s,t);for(const s of i.materials||[]){const i=t.getObjectExtension(s,"KHR_techniques_webgl");i&&(s.technique=Object.assign({},i,e[i.technique]),s.technique.values=eB(s.technique,t)),t.removeObjectExtension(s,"KHR_techniques_webgl")}t.removeExtension("KHR_techniques_webgl")}},encode:async function(e,t){}})];function iB(e,t){var i;const s=(null==t||null===(i=t.gltf)||void 0===i?void 0:i.excludeExtensions)||{};return!(e in s&&!s[e])}const sB={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},rB={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class oB{constructor(){N_(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),N_(this,"json",void 0)}normalize(e,t){this.json=e.json;const i=e.json;switch(i.asset&&i.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version ".concat(i.asset.version))}if(!t.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(i),this._convertTopLevelObjectsToArrays(i),function(e){const t=new tx(e),{json:i}=t;for(const e of i.images||[]){const i=t.getObjectExtension(e,"KHR_binary_glTF");i&&Object.assign(e,i),t.removeObjectExtension(e,"KHR_binary_glTF")}i.buffers&&i.buffers[0]&&delete i.buffers[0].uri,t.removeExtension("KHR_binary_glTF")}(e),this._convertObjectIdsToArrayIndices(i),this._updateObjects(i),this._updateMaterial(i)}_addAsset(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(e){for(const t in sB)this._convertTopLevelObjectToArray(e,t)}_convertTopLevelObjectToArray(e,t){const i=e[t];if(i&&!Array.isArray(i)){e[t]=[];for(const s in i){const r=i[s];r.id=r.id||s;const o=e[t].length;e[t].push(r),this.idToIndexMap[t][s]=o}}}_convertObjectIdsToArrayIndices(e){for(const t in sB)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(const t of e.textures)this._convertTextureIds(t);for(const t of e.meshes)this._convertMeshIds(t);for(const t of e.nodes)this._convertNodeIds(t);for(const t of e.scenes)this._convertSceneIds(t)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(const t of e.primitives){const{attributes:e,indices:i,material:s}=t;for(const t in e)e[t]=this._convertIdToIndex(e[t],"accessor");i&&(t.indices=this._convertIdToIndex(i,"accessor")),s&&(t.material=this._convertIdToIndex(s,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map((e=>this._convertIdToIndex(e,"node")))),e.meshes&&(e.meshes=e.meshes.map((e=>this._convertIdToIndex(e,"mesh"))))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map((e=>this._convertIdToIndex(e,"node"))))}_convertIdsToIndices(e,t){e[t]||(console.warn("gltf v1: json doesn't contain attribute ".concat(t)),e[t]=[]);for(const i of e[t])for(const e in i){const t=i[e],s=this._convertIdToIndex(t,e);i[e]=s}}_convertIdToIndex(e,t){const i=rB[t];if(i in this.idToIndexMap){const s=this.idToIndexMap[i][e];if(!Number.isFinite(s))throw new Error("gltf v1: failed to resolve ".concat(t," with id ").concat(e));return s}return e}_updateObjects(e){for(const e of this.json.buffers)delete e.type}_updateMaterial(e){for(const s of e.materials){var t,i;s.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const r=(null===(t=s.values)||void 0===t?void 0:t.tex)||(null===(i=s.values)||void 0===i?void 0:i.texture2d_0),o=e.textures.findIndex((e=>e.id===r));-1!==o&&(s.pbrMetallicRoughness.baseColorTexture={index:o})}}}const nB={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},aB={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},lB=10240,AB=10241,hB=10242,cB=10243,uB=10497,dB={magFilter:lB,minFilter:AB,wrapS:hB,wrapT:cB},pB={[lB]:9729,[AB]:9986,[hB]:uB,[cB]:uB};class fB{constructor(){N_(this,"baseUri",""),N_(this,"json",{}),N_(this,"buffers",[]),N_(this,"images",[])}postProcess(e,t={}){const{json:i,buffers:s=[],images:r=[],baseUri:o=""}=e;return jy(i),this.baseUri=o,this.json=i,this.buffers=s,this.images=r,this._resolveTree(this.json,t),this.json}_resolveTree(e,t={}){e.bufferViews&&(e.bufferViews=e.bufferViews.map(((e,t)=>this._resolveBufferView(e,t)))),e.images&&(e.images=e.images.map(((e,t)=>this._resolveImage(e,t)))),e.samplers&&(e.samplers=e.samplers.map(((e,t)=>this._resolveSampler(e,t)))),e.textures&&(e.textures=e.textures.map(((e,t)=>this._resolveTexture(e,t)))),e.accessors&&(e.accessors=e.accessors.map(((e,t)=>this._resolveAccessor(e,t)))),e.materials&&(e.materials=e.materials.map(((e,t)=>this._resolveMaterial(e,t)))),e.meshes&&(e.meshes=e.meshes.map(((e,t)=>this._resolveMesh(e,t)))),e.nodes&&(e.nodes=e.nodes.map(((e,t)=>this._resolveNode(e,t)))),e.skins&&(e.skins=e.skins.map(((e,t)=>this._resolveSkin(e,t)))),e.scenes&&(e.scenes=e.scenes.map(((e,t)=>this._resolveScene(e,t)))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene])}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const i=this.json[e]&&this.json[e][t];return i||console.warn("glTF file error: Could not find ".concat(e,"[").concat(t,"]")),i}_resolveScene(e,t){return e.id=e.id||"scene-".concat(t),e.nodes=(e.nodes||[]).map((e=>this.getNode(e))),e}_resolveNode(e,t){return e.id=e.id||"node-".concat(t),e.children&&(e.children=e.children.map((e=>this.getNode(e)))),void 0!==e.mesh?e.mesh=this.getMesh(e.mesh):void 0!==e.meshes&&e.meshes.length&&(e.mesh=e.meshes.reduce(((e,t)=>{const i=this.getMesh(t);return e.id=i.id,e.primitives=e.primitives.concat(i.primitives),e}),{primitives:[]})),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}_resolveSkin(e,t){return e.id=e.id||"skin-".concat(t),e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}_resolveMesh(e,t){return e.id=e.id||"mesh-".concat(t),e.primitives&&(e.primitives=e.primitives.map((e=>{const t=(e={...e}).attributes;e.attributes={};for(const i in t)e.attributes[i]=this.getAccessor(t[i]);return void 0!==e.indices&&(e.indices=this.getAccessor(e.indices)),void 0!==e.material&&(e.material=this.getMaterial(e.material)),e}))),e}_resolveMaterial(e,t){if(e.id=e.id||"material-".concat(t),e.normalTexture&&(e.normalTexture={...e.normalTexture},e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture={...e.occlustionTexture},e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture={...e.emmisiveTexture},e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.emissiveFactor||(e.emissiveFactor=e.emmisiveTexture?[1,1,1]:[0,0,0]),e.pbrMetallicRoughness){e.pbrMetallicRoughness={...e.pbrMetallicRoughness};const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return e}_resolveAccessor(e,t){var i,s;if(e.id=e.id||"accessor-".concat(t),void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(i=e.componentType,aB[i]),e.components=(s=e.type,nB[s]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){const t=e.bufferView.buffer,{ArrayType:i,byteLength:s}=$y(e,e.bufferView),r=(e.bufferView.byteOffset||0)+(e.byteOffset||0)+t.byteOffset;let o=t.arrayBuffer.slice(r,r+s);e.bufferView.byteStride&&(o=this._getValueFromInterleavedBuffer(t,r,e.bufferView.byteStride,e.bytesPerElement,e.count)),e.value=new i(o)}return e}_getValueFromInterleavedBuffer(e,t,i,s,r){const o=new Uint8Array(r*s);for(let n=0;n20);const s=t.getUint32(i+0,mB),r=t.getUint32(i+4,mB);return i+=8,F_(0===r),vB(e,t,i,s),i+=s,i+=bB(e,t,i,e.header.byteLength)}(e,r,i);case 2:return function(e,t,i,s){return F_(e.header.byteLength>20),function(e,t,i,s){for(;i+8<=e.header.byteLength;){const r=t.getUint32(i+0,mB),o=t.getUint32(i+4,mB);switch(i+=8,o){case 1313821514:vB(e,t,i,r);break;case 5130562:bB(e,t,i,r);break;case 0:s.strict||vB(e,t,i,r);break;case 1:s.strict||bB(e,t,i,r)}i+=lv(r,4)}}(e,t,i,s),i+e.header.byteLength}(e,r,i,{});default:throw new Error("Invalid GLB version ".concat(e.version,". Only supports v1 and v2."))}}function vB(e,t,i,s){const r=new Uint8Array(t.buffer,i,s),o=new TextDecoder("utf8").decode(r);return e.json=JSON.parse(o),lv(s,4)}function bB(e,t,i,s){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:i,byteLength:s,arrayBuffer:t.buffer}),lv(s,4)}async function yB(e,t,i=0,s,r){var o,n,a,l;!function(e,t,i,s){s.uri&&(e.baseUri=s.uri);if(t instanceof ArrayBuffer&&!function(e,t=0,i={}){const s=new DataView(e),{magic:r=gB}=i,o=s.getUint32(t,!1);return o===r||o===gB}(t,i,s)){t=(new TextDecoder).decode(t)}if("string"==typeof t)e.json=rv(t);else if(t instanceof ArrayBuffer){const r={};i=_B(r,t,i,s.glb),jy("glTF"===r.type,"Invalid GLB magic string ".concat(r.type)),e._glb=r,e.json=r.json}else jy(!1,"GLTF: must be ArrayBuffer or string");const r=e.json.buffers||[];if(e.buffers=new Array(r.length).fill(null),e._glb&&e._glb.header.hasBinChunk){const{binChunks:t}=e._glb;e.buffers[0]={arrayBuffer:t[0].arrayBuffer,byteOffset:t[0].byteOffset,byteLength:t[0].byteLength}}const o=e.json.images||[];e.images=new Array(o.length).fill({})}(e,t,i,s),function(e,t={}){(new oB).normalize(e,t)}(e,{normalize:null==s||null===(o=s.gltf)||void 0===o?void 0:o.normalize}),function(e,t={},i){const s=tB.filter((e=>iB(e.name,t)));for(const o of s){var r;null===(r=o.preprocess)||void 0===r||r.call(o,e,t,i)}}(e,s,r);const A=[];if(null!=s&&null!==(n=s.gltf)&&void 0!==n&&n.loadBuffers&&e.json.buffers&&await async function(e,t,i){const s=e.json.buffers||[];for(let n=0;niB(e.name,t)));for(const o of s){var r;await(null===(r=o.decode)||void 0===r?void 0:r.call(o,e,t,i))}}(e,s,r);return A.push(h),await Promise.all(A),null!=s&&null!==(l=s.gltf)&&void 0!==l&&l.postProcess?function(e,t){return(new fB).postProcess(e,t)}(e,s):e}async function xB(e,t,i,s,r){const{fetch:o,parse:n}=r;let a;if(t.uri){const e=Gy(t.uri,s),i=await o(e);a=await i.arrayBuffer()}if(Number.isFinite(t.bufferView)){const i=function(e,t,i){const s=e.bufferViews[i];jy(s);const r=t[s.buffer];jy(r);const o=(s.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,o,s.byteLength)}(e.json,e.buffers,t.bufferView);a=av(i.buffer,i.byteOffset,i.byteLength)}jy(a,"glTF image has no data");let l=await n(a,[Ny,xy],{mimeType:t.mimeType,basis:s.basis||{format:yy()}},r);l&&l[0]&&(l={compressed:!0,mipmaps:!1,width:l[0].width,height:l[0].height,data:l[0]}),e.images=e.images||[],e.images[i]=l}const BB={name:"glTF",id:"gltf",module:"gltf",version:"3.2.6",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:async function(e,t={},i){(t={...BB.options,...t}).gltf={...BB.options.gltf,...t.gltf};const{byteOffset:s=0}=t;return await yB({},e,s,t,i)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0,postProcess:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes"}}};class wB{constructor(e){}load(e,t,i,s,r,o,n){!function(e,t,i,s,r,o,n){const a=e.viewer.scene.canvas.spinner;a.processes++;"glb"===t.split(".").pop()?e.dataSource.getGLB(t,(n=>{s.basePath=CB(t),MB(e,t,n,i,s,r,o),a.processes--}),(e=>{a.processes--,n(e)})):e.dataSource.getGLTF(t,(n=>{s.basePath=CB(t),MB(e,t,n,i,s,r,o),a.processes--}),(e=>{a.processes--,n(e)}))}(e,t,i,s=s||{},r,(function(){M.scheduleTask((function(){r.scene.fire("modelLoaded",r.id),r.fire("loaded",!0,!1)})),o&&o()}),(function(t){e.error(t),n&&n(t),r.fire("error",t)}))}parse(e,t,i,s,r,o,n){MB(e,"",t,i,s=s||{},r,(function(){r.scene.fire("modelLoaded",r.id),r.fire("loaded",!0,!1),o&&o()}))}}function PB(e){const t={},i={},s=e.metaObjects||[],r={};for(let e=0,t=s.length;e{const l={src:t,entityId:r.entityId,metaModelCorrections:s?PB(s):null,loadBuffer:r.loadBuffer,basePath:r.basePath,handlenode:r.handlenode,backfaces:!!r.backfaces,gltfData:i,scene:o.scene,plugin:e,sceneModel:o,numObjects:0,nodes:[],nextId:0,log:t=>{e.log(t)}};!function(e){const t=e.gltfData.textures;if(t)for(let i=0,s=t.length;i0)for(let t=0;t0){null==s&&e.log("Warning: 'name' properties not found on glTF scene nodes - will randomly-generate object IDs in XKT");let t=s;if(e.metaModelCorrections){const i=e.metaModelCorrections.eachChildRoot[t];if(i){const t=e.metaModelCorrections.eachRootStats[i.id];t.countChildren++,t.countChildren>=t.numChildren&&(o.createEntity({id:i.id,meshIds:SB,isObject:!0}),SB.length=0)}else{e.metaModelCorrections.metaObjectsMap[t]&&(o.createEntity({id:t,meshIds:SB,isObject:!0}),SB.length=0)}}else o.createEntity({id:t,meshIds:SB,isObject:!0}),SB.length=0}}}function LB(e,t){e.plugin.error(t)}const RB={DEFAULT:{}};function UB(e,t,i={}){const s="lightgrey",r=i.hoverColor||"rgba(0,0,0,0.4)",o=i.textColor||"black",n=500,a=n+n/3,l=a/24,A=[{boundary:[6,6,6,6],color:i.frontColor||i.color||"#55FF55"},{boundary:[18,6,6,6],color:i.backColor||i.color||"#55FF55"},{boundary:[12,6,6,6],color:i.rightColor||i.color||"#FF5555"},{boundary:[0,6,6,6],color:i.leftColor||i.color||"#FF5555"},{boundary:[6,0,6,6],color:i.topColor||i.color||"#7777FF"},{boundary:[6,12,6,6],color:i.bottomColor||i.color||"#7777FF"}],h=[{label:"NavCube.front",boundaries:[[7,7,4,4]],dir:[0,1,0],up:[0,0,1]},{label:"NavCube.back",boundaries:[[19,7,4,4]],dir:[0,-1,0],up:[0,0,1]},{label:"NavCube.right",boundaries:[[13,7,4,4]],dir:[-1,0,0],up:[0,0,1]},{label:"NavCube.left",boundaries:[[1,7,4,4]],dir:[1,0,0],up:[0,0,1]},{label:"NavCube.top",boundaries:[[7,1,4,4]],dir:[0,0,-1],up:[0,1,0]},{label:"NavCube.bottom",boundaries:[[7,13,4,4]],dir:[0,0,1],up:[0,-1,0]},{boundaries:[[7,5,4,2]],dir:[0,1,-1],up:[0,1,1]},{boundaries:[[1,6,4,1],[6,1,1,4]],dir:[1,0,-1],up:[1,0,1]},{boundaries:[[7,0,4,1],[19,6,4,1]],dir:[0,-1,-1],up:[0,-1,1]},{boundaries:[[13,6,4,1],[11,1,1,4]],dir:[-1,0,-1],up:[-1,0,1]},{boundaries:[[7,11,4,2]],dir:[0,1,1],up:[0,-1,1]},{boundaries:[[1,11,4,1],[6,13,1,4]],dir:[1,0,1],up:[-1,0,1]},{boundaries:[[7,17,4,1],[19,11,4,1]],dir:[0,-1,1],up:[0,1,1]},{boundaries:[[13,11,4,1],[11,13,1,4]],dir:[-1,0,1],up:[1,0,1]},{boundaries:[[5,7,2,4]],dir:[1,1,0],up:[0,0,1]},{boundaries:[[11,7,2,4]],dir:[-1,1,0],up:[0,0,1]},{boundaries:[[17,7,2,4]],dir:[-1,-1,0],up:[0,0,1]},{boundaries:[[0,7,1,4],[23,7,1,4]],dir:[1,-1,0],up:[0,0,1]},{boundaries:[[5,11,2,2]],dir:[1,1,1],up:[-1,-1,1]},{boundaries:[[23,11,1,1],[6,17,1,1],[0,11,1,1]],dir:[1,-1,1],up:[-1,1,1]},{boundaries:[[5,5,2,2]],dir:[1,1,-1],up:[1,1,1]},{boundaries:[[11,17,1,1],[17,11,2,1]],dir:[-1,-1,1],up:[1,1,1]},{boundaries:[[17,6,2,1],[11,0,1,1]],dir:[-1,-1,-1],up:[-1,-1,1]},{boundaries:[[11,11,2,2]],dir:[-1,1,1],up:[1,-1,1]},{boundaries:[[0,6,1,1],[6,0,1,1],[23,6,1,1]],dir:[1,-1,-1],up:[1,-1,1]},{boundaries:[[11,5,2,2]],dir:[-1,1,-1],up:[-1,1,1]}];i.frontColor||i.color,i.backColor||i.color,i.rightColor||i.color,i.leftColor||i.color,i.topColor||i.color,i.bottomColor||i.color;const u=[{yUp:"",label:"NavCube.front",boundaries:[[7,7,4,4]],dir:[0,0,-1],up:[0,1,0]},{label:"NavCube.back",boundaries:[[19,7,4,4]],dir:[0,0,1],up:[0,1,0]},{label:"NavCube.right",boundaries:[[13,7,4,4]],dir:[-1,0,0],up:[0,1,0]},{label:"NavCube.left",boundaries:[[1,7,4,4]],dir:[1,0,0],up:[0,1,0]},{label:"NavCube.top",boundaries:[[7,1,4,4]],dir:[0,-1,0],up:[0,0,-1]},{label:"NavCube.bottom",boundaries:[[7,13,4,4]],dir:[0,1,0],up:[0,0,1]},{boundaries:[[7,5,4,2]],dir:[0,-.7071,-.7071],up:[0,.7071,-.7071]},{boundaries:[[1,6,4,1],[6,1,1,4]],dir:[1,-1,0],up:[1,1,0]},{boundaries:[[7,0,4,1],[19,6,4,1]],dir:[0,-.7071,.7071],up:[0,.7071,.7071]},{boundaries:[[13,6,4,1],[11,1,1,4]],dir:[-1,-1,0],up:[-1,1,0]},{boundaries:[[7,11,4,2]],dir:[0,1,-1],up:[0,1,1]},{boundaries:[[1,11,4,1],[6,13,1,4]],dir:[1,1,0],up:[-1,1,0]},{boundaries:[[7,17,4,1],[19,11,4,1]],dir:[0,1,1],up:[0,1,-1]},{boundaries:[[13,11,4,1],[11,13,1,4]],dir:[-1,1,0],up:[1,1,0]},{boundaries:[[5,7,2,4]],dir:[1,0,-1],up:[0,1,0]},{boundaries:[[11,7,2,4]],dir:[-1,0,-1],up:[0,1,0]},{boundaries:[[17,7,2,4]],dir:[-1,0,1],up:[0,1,0]},{boundaries:[[0,7,1,4],[23,7,1,4]],dir:[1,0,1],up:[0,1,0]},{boundaries:[[5,11,2,2]],dir:[.5,.7071,-.5],up:[-.5,.7071,.5]},{boundaries:[[23,11,1,1],[6,17,1,1],[0,11,1,1]],dir:[.5,.7071,.5],up:[-.5,.7071,-.5]},{boundaries:[[5,5,2,2]],dir:[.5,-.7071,-.5],up:[.5,.7071,-.5]},{boundaries:[[11,17,1,1],[17,11,2,1]],dir:[-.5,.7071,.5],up:[.5,.7071,-.5]},{boundaries:[[17,6,2,1],[11,0,1,1]],dir:[-.5,-.7071,.5],up:[-.5,.7071,.5]},{boundaries:[[11,11,2,2]],dir:[-.5,.7071,-.5],up:[.5,.7071,.5]},{boundaries:[[0,6,1,1],[6,0,1,1],[23,6,1,1]],dir:[.5,-.7071,.5],up:[.5,.7071,.5]},{boundaries:[[11,5,2,2]],dir:[-.5,-.7071,-.5],up:[-.5,.7071,-.5]}];for(let e=0,t=h.length;e=r[0]*l&&t<=(r[0]+r[2])*l&&i>=r[1]*l&&i<=(r[1]+r[3])*l)return s}}return-1},this.setAreaHighlighted=function(e,t){var i=d[e];if(!i)throw"Area not found: "+e;i.highlighted=!!t,g()},this.getAreaDir=function(e){var t=d[e];if(!t)throw"Unknown area: "+e;return t.dir},this.getAreaUp=function(e){var t=d[e];if(!t)throw"Unknown area: "+e;return t.up},this.getImage=function(){return this._textureCanvas},this.destroy=function(){this._textureCanvas&&(this._textureCanvas.parentNode.removeChild(this._textureCanvas),this._textureCanvas=null)}}const kB=c.vec3(),OB=c.vec3();c.mat4();const NB=c.vec3();class QB{load(e,t,i={}){var s=e.scene.canvas.spinner;s.processes++,VB(e,t,(function(t){!function(e,t,i){for(var s=t.basePath,r=Object.keys(t.materialLibraries),o=r.length,n=0,a=o;n=0?i-1:i+t/3)}function r(e,t){var i=parseInt(e,10);return 3*(i>=0?i-1:i+t/3)}function o(e,t){var i=parseInt(e,10);return 2*(i>=0?i-1:i+t/2)}function n(e,t,i,s){var r=e.positions,o=e.object.geometry.positions;o.push(r[t+0]),o.push(r[t+1]),o.push(r[t+2]),o.push(r[i+0]),o.push(r[i+1]),o.push(r[i+2]),o.push(r[s+0]),o.push(r[s+1]),o.push(r[s+2])}function a(e,t){var i=e.positions,s=e.object.geometry.positions;s.push(i[t+0]),s.push(i[t+1]),s.push(i[t+2])}function l(e,t,i,s){var r=e.normals,o=e.object.geometry.normals;o.push(r[t+0]),o.push(r[t+1]),o.push(r[t+2]),o.push(r[i+0]),o.push(r[i+1]),o.push(r[i+2]),o.push(r[s+0]),o.push(r[s+1]),o.push(r[s+2])}function A(e,t,i,s){var r=e.uv,o=e.object.geometry.uv;o.push(r[t+0]),o.push(r[t+1]),o.push(r[i+0]),o.push(r[i+1]),o.push(r[s+0]),o.push(r[s+1])}function h(e,t){var i=e.uv,s=e.object.geometry.uv;s.push(i[t+0]),s.push(i[t+1])}function c(e,t,i,a,h,c,u,d,p,f,g,m,_){var v,b=e.positions.length,y=s(t,b),x=s(i,b),B=s(a,b);if(void 0===h?n(e,y,x,B):(n(e,y,x,v=s(h,b)),n(e,x,B,v)),void 0!==c){var w=e.uv.length;y=o(c,w),x=o(u,w),B=o(d,w),void 0===h?A(e,y,x,B):(A(e,y,x,v=o(p,w)),A(e,x,B,v))}if(void 0!==f){var P=e.normals.length;y=r(f,P),x=f===g?y:r(g,P),B=f===m?y:r(m,P),void 0===h?l(e,y,x,B):(l(e,y,x,v=r(_,P)),l(e,x,B,v))}}function u(e,t,i){e.object.geometry.type="Line";for(var r=e.positions.length,n=e.uv.length,l=0,A=t.length;l=0?n.substring(0,a):n).toLowerCase(),A=(A=a>=0?n.substring(a+1):"").trim(),l.toLowerCase()){case"newmtl":i(e,u),u={id:A},d=!0;break;case"ka":u.ambient=s(A);break;case"kd":u.diffuse=s(A);break;case"ks":u.specular=s(A);break;case"map_kd":u.diffuseMap||(u.diffuseMap=t(e,o,A,"sRGB"));break;case"map_ks":u.specularMap||(u.specularMap=t(e,o,A,"linear"));break;case"map_bump":case"bump":u.normalMap||(u.normalMap=t(e,o,A));break;case"ns":u.shininess=parseFloat(A);break;case"d":(h=parseFloat(A))<1&&(u.alpha=h,u.alphaMode="blend");break;case"tr":(h=parseFloat(A))>0&&(u.alpha=1-h,u.alphaMode="blend")}d&&i(e,u)};function t(e,t,i,s){var r={},o=i.split(/\s+/),n=o.indexOf("-bm");return n>=0&&o.splice(n,2),(n=o.indexOf("-s"))>=0&&(r.scale=[parseFloat(o[n+1]),parseFloat(o[n+2])],o.splice(n,4)),(n=o.indexOf("-o"))>=0&&(r.translate=[parseFloat(o[n+1]),parseFloat(o[n+2])],o.splice(n,4)),r.src=t+o.join(" ").trim(),r.flipY=!0,r.encoding=s||"linear",new Ds(e,r).id}function i(e,t){new Xt(e,t)}function s(t){var i=t.split(e,3);return[parseFloat(i[0]),parseFloat(i[1]),parseFloat(i[2])]}}();function zB(e,t){for(var i=0,s=t.objects.length;i0&&(n.normals=o.normals),o.uv.length>0&&(n.uv=o.uv);for(var a=new Array(n.positions.length/3),l=0;l{this._setPos(this._sectionPlane.pos)})),this._onSectionPlaneDir=e.on("dir",(()=>{this._ignoreNextSectionPlaneDirUpdate?this._ignoreNextSectionPlaneDirUpdate=!1:this._setDir(this._sectionPlane.dir)})))}get sectionPlane(){return this._sectionPlane}_setPos(e){this._pos.set(e),W(this._pos,this._origin,this._rtcPos),this._rootNode.origin=this._origin,this._rootNode.position=this._rtcPos}_setDir(e){this._baseDir.set(e),this._rootNode.quaternion=c.vec3PairToQuaternion(KB,e,XB)}_setSectionPlaneDir(e){this._sectionPlane&&(this._ignoreNextSectionPlaneDirUpdate=!0,this._sectionPlane.dir=e)}setVisible(e=!0){if(this._visible!==e){var t;for(t in this._visible=e,this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].visible=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].visible=e)}}getVisible(){return this._visible}setCulled(e){var t;for(t in this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].culled=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].culled=e)}_createNodes(){const e=!1,t=this._viewer.scene,i=.01;this._rootNode=new fs(t,{position:[0,0,0],scale:[5,5,5],isObject:!1});const s=this._rootNode,r={arrowHead:new jt(s,ts({radiusTop:.001,radiusBottom:.07,radialSegments:32,heightSegments:1,height:.2,openEnded:!1})),arrowHeadBig:new jt(s,ts({radiusTop:.001,radiusBottom:.09,radialSegments:32,heightSegments:1,height:.25,openEnded:!1})),arrowHeadHandle:new jt(s,ts({radiusTop:.09,radiusBottom:.09,radialSegments:8,heightSegments:1,height:.37,openEnded:!1})),curve:new jt(s,Ns({radius:.8,tube:i,radialSegments:64,tubeSegments:14,arc:2*Math.PI/4})),curveHandle:new jt(s,Ns({radius:.8,tube:.06,radialSegments:64,tubeSegments:14,arc:2*Math.PI/4})),hoop:new jt(s,Ns({radius:.8,tube:i,radialSegments:64,tubeSegments:8,arc:2*Math.PI})),axis:new jt(s,ts({radiusTop:i,radiusBottom:i,radialSegments:20,heightSegments:1,height:1,openEnded:!1})),axisHandle:new jt(s,ts({radiusTop:.08,radiusBottom:.08,radialSegments:20,heightSegments:1,height:1,openEnded:!1}))},o={pickable:new Xt(s,{diffuse:[1,1,0],alpha:0,alphaMode:"blend"}),red:new Xt(s,{diffuse:[1,0,0],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightRed:new Yt(s,{edges:!1,fill:!0,fillColor:[1,0,0],fillAlpha:.6}),green:new Xt(s,{diffuse:[0,1,0],emissive:[0,1,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightGreen:new Yt(s,{edges:!1,fill:!0,fillColor:[0,1,0],fillAlpha:.6}),blue:new Xt(s,{diffuse:[0,0,1],emissive:[0,0,1],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightBlue:new Yt(s,{edges:!1,fill:!0,fillColor:[0,0,1],fillAlpha:.2}),center:new Xt(s,{diffuse:[0,0,0],emissive:[0,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80}),highlightBall:new Yt(s,{edges:!1,fill:!0,fillColor:[.5,.5,.5],fillAlpha:.5,vertices:!1}),highlightPlane:new Yt(s,{edges:!0,edgeWidth:3,fill:!1,fillColor:[.5,.5,.5],fillAlpha:.5,vertices:!1})};this._displayMeshes={plane:s.addChild(new $i(s,{geometry:new jt(s,{primitive:"triangles",positions:[.5,.5,0,.5,-.5,0,-.5,-.5,0,-.5,.5,0,.5,.5,-0,.5,-.5,-0,-.5,-.5,-0,-.5,.5,-0],indices:[0,1,2,2,3,0]}),material:new Xt(s,{emissive:[0,0,0],diffuse:[0,0,0],backfaces:!0}),opacity:.6,ghosted:!0,ghostMaterial:new Yt(s,{edges:!1,filled:!0,fillColor:[1,1,0],edgeColor:[0,0,0],fillAlpha:.1,backfaces:!0}),pickable:!1,collidable:!0,clippable:!1,visible:!1,scale:[2.4,2.4,1],isObject:!1}),e),planeFrame:s.addChild(new $i(s,{geometry:new jt(s,Ns({center:[0,0,0],radius:1.7,tube:.02,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Xt(s,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),highlightMaterial:new Yt(s,{edges:!1,edgeColor:[0,0,0],filled:!0,fillColor:[.8,.8,.8],fillAlpha:1}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,.1],rotation:[0,0,45],isObject:!1}),e),xCurve:s.addChild(new $i(s,{geometry:r.curve,material:o.red,matrix:function(){const e=c.rotationMat4v(90*c.DEGTORAD,[0,1,0],c.identityMat4()),t=c.rotationMat4v(270*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),xCurveHandle:s.addChild(new $i(s,{geometry:r.curveHandle,material:o.pickable,matrix:function(){const e=c.rotationMat4v(90*c.DEGTORAD,[0,1,0],c.identityMat4()),t=c.rotationMat4v(270*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),xCurveArrow1:s.addChild(new $i(s,{geometry:r.arrowHead,material:o.red,matrix:function(){const e=c.translateMat4c(0,-.07,-.8,c.identityMat4()),t=c.scaleMat4v([.6,.6,.6],c.identityMat4()),i=c.rotationMat4v(0*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(c.mulMat4(e,t,c.identityMat4()),i,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xCurveArrow2:s.addChild(new $i(s,{geometry:r.arrowHead,material:o.red,matrix:function(){const e=c.translateMat4c(0,-.8,-.07,c.identityMat4()),t=c.scaleMat4v([.6,.6,.6],c.identityMat4()),i=c.rotationMat4v(90*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(c.mulMat4(e,t,c.identityMat4()),i,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yCurve:s.addChild(new $i(s,{geometry:r.curve,material:o.green,rotation:[-90,0,0],pickable:!1,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),yCurveHandle:s.addChild(new $i(s,{geometry:r.curveHandle,material:o.pickable,rotation:[-90,0,0],pickable:!0,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),yCurveArrow1:s.addChild(new $i(s,{geometry:r.arrowHead,material:o.green,matrix:function(){const e=c.translateMat4c(.07,0,-.8,c.identityMat4()),t=c.scaleMat4v([.6,.6,.6],c.identityMat4()),i=c.rotationMat4v(90*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(c.mulMat4(e,t,c.identityMat4()),i,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yCurveArrow2:s.addChild(new $i(s,{geometry:r.arrowHead,material:o.green,matrix:function(){const e=c.translateMat4c(.8,0,-.07,c.identityMat4()),t=c.scaleMat4v([.6,.6,.6],c.identityMat4()),i=c.rotationMat4v(90*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(c.mulMat4(e,t,c.identityMat4()),i,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurve:s.addChild(new $i(s,{geometry:r.curve,material:o.blue,matrix:c.rotationMat4v(180*c.DEGTORAD,[1,0,0],c.identityMat4()),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurveHandle:s.addChild(new $i(s,{geometry:r.curveHandle,material:o.pickable,matrix:c.rotationMat4v(180*c.DEGTORAD,[1,0,0],c.identityMat4()),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurveCurveArrow1:s.addChild(new $i(s,{geometry:r.arrowHead,material:o.blue,matrix:function(){const e=c.translateMat4c(.8,-.07,0,c.identityMat4()),t=c.scaleMat4v([.6,.6,.6],c.identityMat4());return c.mulMat4(e,t,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurveArrow2:s.addChild(new $i(s,{geometry:r.arrowHead,material:o.blue,matrix:function(){const e=c.translateMat4c(.05,-.8,0,c.identityMat4()),t=c.scaleMat4v([.6,.6,.6],c.identityMat4()),i=c.rotationMat4v(90*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(c.mulMat4(e,t,c.identityMat4()),i,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),center:s.addChild(new $i(s,{geometry:new jt(s,is({radius:.05})),material:o.center,pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxisArrow:s.addChild(new $i(s,{geometry:r.arrowHead,material:o.red,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxisArrowHandle:s.addChild(new $i(s,{geometry:r.arrowHeadHandle,material:o.pickable,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxis:s.addChild(new $i(s,{geometry:r.axis,material:o.red,matrix:function(){const e=c.translateMat4c(0,.5,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxisHandle:s.addChild(new $i(s,{geometry:r.axisHandle,material:o.pickable,matrix:function(){const e=c.translateMat4c(0,.5,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yAxisArrow:s.addChild(new $i(s,{geometry:r.arrowHead,material:o.green,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(180*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yAxisArrowHandle:s.addChild(new $i(s,{geometry:r.arrowHeadHandle,material:o.pickable,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(180*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,opacity:.2,isObject:!1}),e),yShaft:s.addChild(new $i(s,{geometry:r.axis,material:o.green,position:[0,-.5,0],pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yShaftHandle:s.addChild(new $i(s,{geometry:r.axisHandle,material:o.pickable,position:[0,-.5,0],pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zAxisArrow:s.addChild(new $i(s,{geometry:r.arrowHead,material:o.blue,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[.8,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zAxisArrowHandle:s.addChild(new $i(s,{geometry:r.arrowHeadHandle,material:o.pickable,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[.8,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zShaft:s.addChild(new $i(s,{geometry:r.axis,material:o.blue,matrix:function(){const e=c.translateMat4c(0,.5,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),clippable:!1,pickable:!1,collidable:!0,visible:!1,isObject:!1}),e),zAxisHandle:s.addChild(new $i(s,{geometry:r.axisHandle,material:o.pickable,matrix:function(){const e=c.translateMat4c(0,.5,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),clippable:!1,pickable:!0,collidable:!0,visible:!1,isObject:!1}),e)},this._affordanceMeshes={planeFrame:s.addChild(new $i(s,{geometry:new jt(s,Ns({center:[0,0,0],radius:2,tube:i,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Xt(s,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:!0,highlightMaterial:new Yt(s,{edges:!1,filled:!0,fillColor:[1,1,0],fillAlpha:1}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,1],rotation:[0,0,45],isObject:!1}),e),xHoop:s.addChild(new $i(s,{geometry:r.hoop,material:o.red,highlighted:!0,highlightMaterial:o.highlightRed,matrix:function(){const e=c.rotationMat4v(90*c.DEGTORAD,[0,1,0],c.identityMat4()),t=c.rotationMat4v(270*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yHoop:s.addChild(new $i(s,{geometry:r.hoop,material:o.green,highlighted:!0,highlightMaterial:o.highlightGreen,rotation:[-90,0,0],pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zHoop:s.addChild(new $i(s,{geometry:r.hoop,material:o.blue,highlighted:!0,highlightMaterial:o.highlightBlue,matrix:c.rotationMat4v(180*c.DEGTORAD,[1,0,0],c.identityMat4()),pickable:!1,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),xAxisArrow:s.addChild(new $i(s,{geometry:r.arrowHeadBig,material:o.red,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[0,0,1],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yAxisArrow:s.addChild(new $i(s,{geometry:r.arrowHeadBig,material:o.green,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(180*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zAxisArrow:s.addChild(new $i(s,{geometry:r.arrowHeadBig,material:o.blue,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[.8,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e)}}_bindEvents(){const e=this;var t=!1;const i=-1,s=0,r=1,o=2,n=3,a=4,l=5,A=this._rootNode;var h=null,u=null;const d=c.vec2(),p=c.vec3([1,0,0]),f=c.vec3([0,1,0]),g=c.vec3([0,0,1]),m=this._viewer.scene.canvas.canvas,_=this._viewer.camera,v=this._viewer.scene;{const e=c.vec3([0,0,0]);let t=-1;this._onCameraViewMatrix=v.camera.on("viewMatrix",(()=>{})),this._onCameraProjMatrix=v.camera.on("projMatrix",(()=>{})),this._onSceneTick=v.on("tick",(()=>{const i=Math.abs(c.lenVec3(c.subVec3(v.camera.eye,this._pos,e)));if(i!==t&&"perspective"===_.projection){const e=.07*(Math.tan(_.perspective.fov*c.DEGTORAD)*i);A.scale=[e,e,e],t=i}if("ortho"===_.projection){const e=_.ortho.scale/10;A.scale=[e,e,e],t=i}}))}const b=function(){const e=new Float64Array(2);return function(t){if(t){for(var i=t.target,s=0,r=0;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;e[0]=t.pageX-s,e[1]=t.pageY-r}else t=window.event,e[0]=t.x,e[1]=t.y;return e}}(),y=function(){const t=c.mat4();return function(i,s){return c.quaternionToMat4(e._rootNode.quaternion,t),c.transformVec3(t,i,s),c.normalizeVec3(s),s}}();var x=function(){const e=c.vec3();return function(t){const i=Math.abs(t[0]);return i>Math.abs(t[1])&&i>Math.abs(t[2])?c.cross3Vec3(t,[0,1,0],e):c.cross3Vec3(t,[1,0,0],e),c.cross3Vec3(e,t,e),c.normalizeVec3(e),e}}();const B=function(){const t=c.vec3(),i=c.vec3(),s=c.vec4();return function(r,o,n){y(r,s);const a=x(s,o,n);P(o,a,t),P(n,a,i),c.subVec3(i,t);const l=c.dotVec3(i,s);e._pos[0]+=s[0]*l,e._pos[1]+=s[1]*l,e._pos[2]+=s[2]*l,e._rootNode.position=e._pos,e._sectionPlane&&(e._sectionPlane.pos=e._pos)}}();var w=function(){const t=c.vec4(),i=c.vec4(),s=c.vec4(),r=c.vec4();return function(o,n,a){y(o,r);if(!(P(n,r,t)&&P(a,r,i))){const e=x(r,n,a);P(n,e,t,1),P(a,e,i,1);var l=c.dotVec3(t,r);t[0]-=l*r[0],t[1]-=l*r[1],t[2]-=l*r[2],l=c.dotVec3(i,r),i[0]-=l*r[0],i[1]-=l*r[1],i[2]-=l*r[2]}c.normalizeVec3(t),c.normalizeVec3(i),l=c.dotVec3(t,i),l=c.clamp(l,-1,1);var A=Math.acos(l)*c.RADTODEG;c.cross3Vec3(t,i,s),c.dotVec3(s,r)<0&&(A=-A),e._rootNode.rotate(o,A),C()}}(),P=function(){const t=c.vec4([0,0,0,1]),i=c.mat4();return function(s,r,o,n){n=n||0,t[0]=s[0]/m.width*2-1,t[1]=-(s[1]/m.height*2-1),t[2]=0,t[3]=1,c.mulMat4(_.projMatrix,_.viewMatrix,i),c.inverseMat4(i),c.transformVec4(i,t,t),c.mulVec4Scalar(t,1/t[3]);var a=_.eye;c.subVec4(t,a,t);const l=e._sectionPlane.pos;var A=-c.dotVec3(l,r)-n,h=c.dotVec3(r,t);if(Math.abs(h)>.005){var u=-(c.dotVec3(r,a)+A)/h;return c.mulVec3Scalar(t,u,o),c.addVec3(o,a),c.subVec3(o,l,o),!0}return!1}}();const C=function(){const t=c.vec3(),i=c.mat4();return function(){e.sectionPlane&&(c.quaternionToMat4(A.quaternion,i),c.transformVec3(i,[0,0,1],t),e._setSectionPlaneDir(t))}}();var M,E=!1;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",(e=>{if(!this._visible)return;if(E)return;var A;t=!1,M&&(M.visible=!1);switch(e.entity.id){case this._displayMeshes.xAxisArrowHandle.id:case this._displayMeshes.xAxisHandle.id:A=this._affordanceMeshes.xAxisArrow,h=s;break;case this._displayMeshes.yAxisArrowHandle.id:case this._displayMeshes.yShaftHandle.id:A=this._affordanceMeshes.yAxisArrow,h=r;break;case this._displayMeshes.zAxisArrowHandle.id:case this._displayMeshes.zAxisHandle.id:A=this._affordanceMeshes.zAxisArrow,h=o;break;case this._displayMeshes.xCurveHandle.id:A=this._affordanceMeshes.xHoop,h=n;break;case this._displayMeshes.yCurveHandle.id:A=this._affordanceMeshes.yHoop,h=a;break;case this._displayMeshes.zCurveHandle.id:A=this._affordanceMeshes.zHoop,h=l;break;default:return void(h=i)}A&&(A.visible=!0),M=A,t=!0})),this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOutEntity",(e=>{this._visible&&(M&&(M.visible=!1),M=null,h=i)})),m.addEventListener("mousedown",this._canvasMouseDownListener=e=>{if(e.preventDefault(),this._visible&&t&&(this._viewer.cameraControl.pointerEnabled=!1,1===e.which)){E=!0;var i=b(e);u=h,d[0]=i[0],d[1]=i[1]}}),m.addEventListener("mousemove",this._canvasMouseMoveListener=e=>{if(!this._visible)return;if(!E)return;var t=b(e);const i=t[0],A=t[1];switch(u){case s:B(p,d,t);break;case r:B(f,d,t);break;case o:B(g,d,t);break;case n:w(p,d,t);break;case a:w(f,d,t);break;case l:w(g,d,t)}d[0]=i,d[1]=A}),m.addEventListener("mouseup",this._canvasMouseUpListener=e=>{this._visible&&(this._viewer.cameraControl.pointerEnabled=!0,E&&(e.which,E=!1,t=!1))}),m.addEventListener("wheel",this._canvasWheelListener=e=>{if(this._visible)Math.max(-1,Math.min(1,40*-e.deltaY))})}_destroy(){this._unbindEvents(),this._destroyNodes()}_unbindEvents(){const e=this._viewer,t=e.scene,i=t.canvas.canvas,s=e.camera,r=e.cameraControl;t.off(this._onSceneTick),i.removeEventListener("mousedown",this._canvasMouseDownListener),i.removeEventListener("mousemove",this._canvasMouseMoveListener),i.removeEventListener("mouseup",this._canvasMouseUpListener),i.removeEventListener("wheel",this._canvasWheelListener),s.off(this._onCameraViewMatrix),s.off(this._onCameraProjMatrix),r.off(this._onCameraControlHover),r.off(this._onCameraControlHoverLeave)}_destroyNodes(){this._setSectionPlane(null),this._rootNode.destroy(),this._displayMeshes={},this._affordanceMeshes={}}}class YB{constructor(e,t,i){this.id=i.id,this._sectionPlane=i,this._mesh=new $i(t,{id:i.id,geometry:new jt(t,Gt({xSize:.5,ySize:.5,zSize:.001})),material:new Xt(t,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:!1}),edgeMaterial:new qt(t,{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),highlightMaterial:new Yt(t,{fill:!0,fillColor:[.5,1,.5],fillAlpha:.7,edges:!0,edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),selectedMaterial:new Yt(t,{fill:!0,fillColor:[0,0,1],fillAlpha:.7,edges:!0,edgeColor:[1,0,0],edgeAlpha:1,edgeWidth:1}),highlighted:!0,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:.3,edges:!0});{const e=c.vec3([0,0,0]),t=c.vec3(),i=c.vec3([0,0,1]),s=c.vec4(4),r=c.vec3(),o=()=>{const o=this._sectionPlane.scene.center,n=[-this._sectionPlane.dir[0],-this._sectionPlane.dir[1],-this._sectionPlane.dir[2]];c.subVec3(o,this._sectionPlane.pos,e);const a=-c.dotVec3(n,e);c.normalizeVec3(n),c.mulVec3Scalar(n,a,t);const l=c.vec3PairToQuaternion(i,this._sectionPlane.dir,s);r[0]=.1*t[0],r[1]=.1*t[1],r[2]=.1*t[2],this._mesh.quaternion=l,this._mesh.position=r};this._onSectionPlanePos=this._sectionPlane.on("pos",o),this._onSectionPlaneDir=this._sectionPlane.on("dir",o)}this._highlighted=!1,this._selected=!1}setHighlighted(e){this._highlighted=!!e,this._mesh.highlighted=this._highlighted,this._mesh.highlightMaterial.fillColor=e?[0,.7,0]:[0,0,0]}getHighlighted(){return this._highlighted}setSelected(e){this._selected=!!e,this._mesh.edgeMaterial.edgeWidth=e?3:1,this._mesh.highlightMaterial.edgeWidth=e?3:1}getSelected(){return this._selected}destroy(){this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._mesh.destroy()}}class ZB{constructor(e,t){if(!(t.onHoverEnterPlane&&t.onHoverLeavePlane&&t.onClickedNothing&&t.onClickedPlane))throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";this.plugin=e,this._viewer=e.viewer,this._onHoverEnterPlane=t.onHoverEnterPlane,this._onHoverLeavePlane=t.onHoverLeavePlane,this._onClickedNothing=t.onClickedNothing,this._onClickedPlane=t.onClickedPlane,this._visible=!0,this._planes={},this._canvas=t.overviewCanvas,this._scene=new li(this._viewer,{canvasId:this._canvas.id,transparent:!0}),this._scene.clearLights(),new It(this._scene,{dir:[.4,-.4,.8],color:[.8,1,1],intensity:1,space:"view"}),new It(this._scene,{dir:[-.8,-.3,-.4],color:[.8,.8,.8],intensity:1,space:"view"}),new It(this._scene,{dir:[.8,-.6,-.8],color:[1,1,1],intensity:1,space:"view"}),this._scene.camera,this._scene.camera.perspective.fov=70,this._zUp=!1;{const e=this._scene.camera,t=c.rotationMat4c(-90*c.DEGTORAD,1,0,0),i=c.vec3(),s=c.vec3(),r=c.vec3();this._synchCamera=()=>{const o=this._viewer.camera.eye,n=this._viewer.camera.look,a=this._viewer.camera.up;c.mulVec3Scalar(c.normalizeVec3(c.subVec3(o,n,i)),7),this._zUp?(c.transformVec3(t,i,s),c.transformVec3(t,a,r),e.look=[0,0,0],e.eye=c.transformVec3(t,i,s),e.up=c.transformPoint3(t,a,r)):(e.look=[0,0,0],e.eye=i,e.up=a)}}this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera),this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera),this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",(e=>{this._scene.camera.perspective.fov=e}));var i=null;this._onInputMouseMove=this._scene.input.on("mousemove",(e=>{const t=this._scene.pick({canvasPos:e});if(t){if(!i||t.entity.id!==i.id){if(i){this._planes[i.id]&&this._onHoverLeavePlane(i.id)}i=t.entity;this._planes[i.id]&&this._onHoverEnterPlane(i.id)}}else i&&(this._onHoverLeavePlane(i.id),i=null)})),this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=()=>{if(i){this._planes[i.id]&&this._onClickedPlane(i.id)}else this._onClickedNothing()}),this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=()=>{i&&(this._onHoverLeavePlane(i.id),i=null)}),this.setVisible(t.overviewVisible)}addSectionPlane(e){this._planes[e.id]=new YB(this,this._scene,e)}setPlaneHighlighted(e,t){const i=this._planes[e];i&&i.setHighlighted(t)}setPlaneSelected(e,t){const i=this._planes[e];i&&i.setSelected(t)}removeSectionPlane(e){const t=this._planes[e.id];t&&(t.destroy(),delete this._planes[e.id])}setVisible(e=!0){this._visible=e,this._canvas.style.visibility=e?"visible":"hidden"}getVisible(){return this._visible}destroy(){this._viewer.camera.off(this._onViewerCameraMatrix),this._viewer.camera.off(this._onViewerCameraWorldAxis),this._viewer.camera.perspective.off(this._onViewerCameraFOV),this._scene.input.off(this._onInputMouseMove),this._scene.canvas.canvas.removeEventListener("mouseup",this._onCanvasMouseUp),this._scene.canvas.canvas.removeEventListener("mouseout",this._onCanvasMouseOut),this._scene.destroy()}}const qB=c.AABB3(),$B=c.vec3();class ew{constructor(e,t,i,s,r,o){this.plugin=e,this.storeyId=r,this.modelId=s,this.storeyAABB=i.slice(),this.aabb=this.storeyAABB,this.modelAABB=t.slice(),this.numObjects=o}}class tw{constructor(e,t,i,s,r,o){this.storeyId=e,this.imageData=t,this.format=i,this.width=s,this.height=r}}const iw=c.vec3(),sw=c.mat4();const rw=new Float64Array([0,0,1]),ow=new Float64Array(4);class nw{constructor(e){this.id=null,this._viewer=e.viewer,this._plugin=e,this._visible=!1,this._pos=c.vec3(),this._origin=c.vec3(),this._rtcPos=c.vec3(),this._baseDir=c.vec3(),this._rootNode=null,this._displayMeshes=null,this._affordanceMeshes=null,this._ignoreNextSectionPlaneDirUpdate=!1,this._createNodes(),this._bindEvents()}_setSectionPlane(e){this._sectionPlane&&(this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._onSectionPlanePos=null,this._onSectionPlaneDir=null,this._sectionPlane=null),e&&(this.id=e.id,this._setPos(e.pos),this._setDir(e.dir),this._sectionPlane=e,this._onSectionPlanePos=e.on("pos",(()=>{this._setPos(this._sectionPlane.pos)})),this._onSectionPlaneDir=e.on("dir",(()=>{this._ignoreNextSectionPlaneDirUpdate?this._ignoreNextSectionPlaneDirUpdate=!1:this._setDir(this._sectionPlane.dir)})))}get sectionPlane(){return this._sectionPlane}_setPos(e){this._pos.set(e),W(this._pos,this._origin,this._rtcPos),this._rootNode.origin=this._origin,this._rootNode.position=this._rtcPos}_setDir(e){this._baseDir.set(e),this._rootNode.quaternion=c.vec3PairToQuaternion(rw,e,ow)}_setSectionPlaneDir(e){this._sectionPlane&&(this._ignoreNextSectionPlaneDirUpdate=!0,this._sectionPlane.dir=e)}setVisible(e=!0){if(this._visible!==e){var t;for(t in this._visible=e,this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].visible=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].visible=e)}}getVisible(){return this._visible}setCulled(e){var t;for(t in this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].culled=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].culled=e)}_createNodes(){const e=!1,t=this._viewer.scene,i=.01;this._rootNode=new fs(t,{position:[0,0,0],scale:[5,5,5]});const s=this._rootNode,r={arrowHead:new jt(s,ts({radiusTop:.001,radiusBottom:.07,radialSegments:32,heightSegments:1,height:.2,openEnded:!1})),arrowHeadBig:new jt(s,ts({radiusTop:.001,radiusBottom:.09,radialSegments:32,heightSegments:1,height:.25,openEnded:!1})),axis:new jt(s,ts({radiusTop:i,radiusBottom:i,radialSegments:20,heightSegments:1,height:1,openEnded:!1}))},o={red:new Xt(s,{diffuse:[1,0,0],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),green:new Xt(s,{diffuse:[0,1,0],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),blue:new Xt(s,{diffuse:[0,0,1],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightRed:new Yt(s,{edges:!1,fill:!0,fillColor:[1,0,0],fillAlpha:.6})};this._displayMeshes={plane:s.addChild(new $i(s,{geometry:new jt(s,{primitive:"triangles",positions:[.5,.5,0,.5,-.5,0,-.5,-.5,0,-.5,.5,0,.5,.5,-0,.5,-.5,-0,-.5,-.5,-0,-.5,.5,-0],indices:[0,1,2,2,3,0]}),material:new Xt(s,{emissive:[0,0,0],diffuse:[0,0,0],backfaces:!0}),opacity:.6,ghosted:!0,pickable:!1,collidable:!0,clippable:!1,visible:!1,scale:[2.4,2.4,1]}),e),planeFrame:s.addChild(new $i(s,{geometry:new jt(s,Ns({center:[0,0,0],radius:1.7,tube:.02,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Xt(s,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,.1],rotation:[0,0,45]}),e),center:s.addChild(new $i(s,{geometry:new jt(s,is({radius:.05})),material:o.center,pickable:!1,collidable:!0,clippable:!1,visible:!1}),e),zAxisArrow:s.addChild(new $i(s,{geometry:r.arrowHead,material:o.blue,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[.8,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1}),e),zShaft:s.addChild(new $i(s,{geometry:r.axis,material:o.blue,matrix:function(){const e=c.translateMat4c(0,.5,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[1,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),clippable:!1,pickable:!1,collidable:!0,visible:!1}),e)},this._affordanceMeshes={planeFrame:s.addChild(new $i(s,{geometry:new jt(s,Ns({center:[0,0,0],radius:2,tube:i,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Xt(s,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:!0,highlightMaterial:new Yt(s,{edges:!1,filled:!0,fillColor:[1,1,0],fillAlpha:1}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,1],rotation:[0,0,45]}),e),zAxisArrow:s.addChild(new $i(s,{geometry:r.arrowHeadBig,material:o.blue,matrix:function(){const e=c.translateMat4c(0,1.1,0,c.identityMat4()),t=c.rotationMat4v(-90*c.DEGTORAD,[.8,0,0],c.identityMat4());return c.mulMat4(t,e,c.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1}),e)}}_bindEvents(){const e=this._rootNode,t=c.vec2(),i=this._viewer.camera,s=this._viewer.scene;let r=0,o=!1;{const t=c.vec3([0,0,0]);let n=-1;this._onCameraViewMatrix=s.camera.on("viewMatrix",(()=>{})),this._onCameraProjMatrix=s.camera.on("projMatrix",(()=>{})),this._onSceneTick=s.on("tick",(()=>{o=!1;const l=Math.abs(c.lenVec3(c.subVec3(s.camera.eye,this._pos,t)));if(l!==n&&"perspective"===i.projection){const t=.07*(Math.tan(i.perspective.fov*c.DEGTORAD)*l);e.scale=[t,t,t],n=l}if("ortho"===i.projection){const t=i.ortho.scale/10;e.scale=[t,t,t],n=l}0!==r&&(a(r),r=0)}))}const n=function(){const e=new Float64Array(2);return function(t){if(t){for(var i=t.target,s=0,r=0;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;e[0]=t.pageX-s,e[1]=t.pageY-r}else t=window.event,e[0]=t.x,e[1]=t.y;return e}}(),a=e=>{const t=this._sectionPlane.pos,i=this._sectionPlane.dir;c.addVec3(t,c.mulVec3Scalar(i,.1*e*this._plugin.getDragSensitivity(),c.vec3())),this._sectionPlane.pos=t};{let e=!1;this._plugin._controlElement.addEventListener("mousedown",this._canvasMouseDownListener=i=>{if(i.preventDefault(),this._visible&&(this._viewer.cameraControl.pointerEnabled=!1,1===i.which)){e=!0;var s=n(i);t[0]=s[0],t[1]=s[1]}}),this._plugin._controlElement.addEventListener("mousemove",this._canvasMouseMoveListener=i=>{if(!this._visible)return;if(!e)return;if(o)return;var s=n(i);const r=s[0],l=s[1];a(l-t[1]),t[0]=r,t[1]=l}),this._plugin._controlElement.addEventListener("mouseup",this._canvasMouseUpListener=t=>{this._visible&&(this._viewer.cameraControl.pointerEnabled=!0,e&&(t.which,e=!1))}),this._plugin._controlElement.addEventListener("wheel",this._canvasWheelListener=e=>{this._visible&&(r+=Math.max(-1,Math.min(1,40*-e.deltaY)))})}{let e,t,i=null;this._plugin._controlElement.addEventListener("touchstart",this._handleTouchStart=t=>{t.stopPropagation(),t.preventDefault(),this._visible&&(e=t.touches[0].clientY,i=e,r=0)}),this._plugin._controlElement.addEventListener("touchmove",this._handleTouchMove=e=>{e.stopPropagation(),e.preventDefault(),this._visible&&(o||(o=!0,t=e.touches[0].clientY,null!==i&&(r+=t-i),i=t))}),this._plugin._controlElement.addEventListener("touchend",this._handleTouchEnd=i=>{i.stopPropagation(),i.preventDefault(),this._visible&&(e=null,t=null,r=0)})}}_destroy(){this._unbindEvents(),this._destroyNodes()}_unbindEvents(){const e=this._viewer,t=e.scene,i=t.canvas.canvas,s=e.camera,r=this._plugin._controlElement;t.off(this._onSceneTick),i.removeEventListener("mousedown",this._canvasMouseDownListener),i.removeEventListener("mousemove",this._canvasMouseMoveListener),i.removeEventListener("mouseup",this._canvasMouseUpListener),i.removeEventListener("wheel",this._canvasWheelListener),r.removeEventListener("touchstart",this._handleTouchStart),r.removeEventListener("touchmove",this._handleTouchMove),r.removeEventListener("touchend",this._handleTouchEnd),s.off(this._onCameraViewMatrix),s.off(this._onCameraProjMatrix)}_destroyNodes(){this._setSectionPlane(null),this._rootNode.destroy(),this._displayMeshes={},this._affordanceMeshes={}}}class aw{constructor(e,t,i){this.id=i.id,this._sectionPlane=i,this._mesh=new $i(t,{id:i.id,geometry:new jt(t,Gt({xSize:.5,ySize:.5,zSize:.001})),material:new Xt(t,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:!1}),edgeMaterial:new qt(t,{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),highlightMaterial:new Yt(t,{fill:!0,fillColor:[.5,1,.5],fillAlpha:.7,edges:!0,edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),selectedMaterial:new Yt(t,{fill:!0,fillColor:[0,0,1],fillAlpha:.7,edges:!0,edgeColor:[1,0,0],edgeAlpha:1,edgeWidth:1}),highlighted:!0,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:.3,edges:!0});{const e=c.vec3([0,0,0]),t=c.vec3(),i=c.vec3([0,0,1]),s=c.vec4(4),r=c.vec3(),o=()=>{const o=this._sectionPlane.scene.center,n=[-this._sectionPlane.dir[0],-this._sectionPlane.dir[1],-this._sectionPlane.dir[2]];c.subVec3(o,this._sectionPlane.pos,e);const a=-c.dotVec3(n,e);c.normalizeVec3(n),c.mulVec3Scalar(n,a,t);const l=c.vec3PairToQuaternion(i,this._sectionPlane.dir,s);r[0]=.1*t[0],r[1]=.1*t[1],r[2]=.1*t[2],this._mesh.quaternion=l,this._mesh.position=r};this._onSectionPlanePos=this._sectionPlane.on("pos",o),this._onSectionPlaneDir=this._sectionPlane.on("dir",o)}this._highlighted=!1,this._selected=!1}setHighlighted(e){this._highlighted=!!e,this._mesh.highlighted=this._highlighted,this._mesh.highlightMaterial.fillColor=e?[0,.7,0]:[0,0,0]}getHighlighted(){return this._highlighted}setSelected(e){this._selected=!!e,this._mesh.edgeMaterial.edgeWidth=e?3:1,this._mesh.highlightMaterial.edgeWidth=e?3:1}getSelected(){return this._selected}destroy(){this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._mesh.destroy()}}class lw{constructor(e,t){if(!(t.onHoverEnterPlane&&t.onHoverLeavePlane&&t.onClickedNothing&&t.onClickedPlane))throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";this.plugin=e,this._viewer=e.viewer,this._onHoverEnterPlane=t.onHoverEnterPlane,this._onHoverLeavePlane=t.onHoverLeavePlane,this._onClickedNothing=t.onClickedNothing,this._onClickedPlane=t.onClickedPlane,this._visible=!0,this._planes={},this._canvas=t.overviewCanvas,this._scene=new li(this._viewer,{canvasId:this._canvas.id,transparent:!0}),this._scene.clearLights(),new It(this._scene,{dir:[.4,-.4,.8],color:[.8,1,1],intensity:1,space:"view"}),new It(this._scene,{dir:[-.8,-.3,-.4],color:[.8,.8,.8],intensity:1,space:"view"}),new It(this._scene,{dir:[.8,-.6,-.8],color:[1,1,1],intensity:1,space:"view"}),this._scene.camera,this._scene.camera.perspective.fov=70,this._zUp=!1;{const e=this._scene.camera,t=c.rotationMat4c(-90*c.DEGTORAD,1,0,0),i=c.vec3(),s=c.vec3(),r=c.vec3();this._synchCamera=()=>{const o=this._viewer.camera.eye,n=this._viewer.camera.look,a=this._viewer.camera.up;c.mulVec3Scalar(c.normalizeVec3(c.subVec3(o,n,i)),7),this._zUp?(c.transformVec3(t,i,s),c.transformVec3(t,a,r),e.look=[0,0,0],e.eye=c.transformVec3(t,i,s),e.up=c.transformPoint3(t,a,r)):(e.look=[0,0,0],e.eye=i,e.up=a)}}this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera),this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera),this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",(e=>{this._scene.camera.perspective.fov=e}));var i=null;this._onInputMouseMove=this._scene.input.on("mousemove",(e=>{const t=this._scene.pick({canvasPos:e});if(t){if(!i||t.entity.id!==i.id){if(i){this._planes[i.id]&&this._onHoverLeavePlane(i.id)}i=t.entity;this._planes[i.id]&&this._onHoverEnterPlane(i.id)}}else i&&(this._onHoverLeavePlane(i.id),i=null)})),this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=()=>{if(i){this._planes[i.id]&&this._onClickedPlane(i.id)}else this._onClickedNothing()}),this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=()=>{i&&(this._onHoverLeavePlane(i.id),i=null)}),this.setVisible(t.overviewVisible)}addSectionPlane(e){this._planes[e.id]=new aw(this,this._scene,e)}setPlaneHighlighted(e,t){const i=this._planes[e];i&&i.setHighlighted(t)}setPlaneSelected(e,t){const i=this._planes[e];i&&i.setSelected(t)}removeSectionPlane(e){const t=this._planes[e.id];t&&(t.destroy(),delete this._planes[e.id])}setVisible(e=!0){this._visible=e,this._canvas.style.visibility=e?"visible":"hidden"}getVisible(){return this._visible}destroy(){this._viewer.camera.off(this._onViewerCameraMatrix),this._viewer.camera.off(this._onViewerCameraWorldAxis),this._viewer.camera.perspective.off(this._onViewerCameraFOV),this._scene.input.off(this._onInputMouseMove),this._scene.canvas.canvas.removeEventListener("mouseup",this._onCanvasMouseUp),this._scene.canvas.canvas.removeEventListener("mouseout",this._onCanvasMouseOut),this._scene.destroy()}}const Aw=c.AABB3(),hw=c.vec3();class cw{constructor(e={}){this.cacheBuster=!1!==e.cacheBuster}_cacheBusterURL(e){if(!this.cacheBuster)return e;const t=(new Date).getTime();return e.indexOf("?")>-1?e+"&_="+t:e+"?_="+t}getSTL(e,t,i){e=this._cacheBusterURL(e);const s=new XMLHttpRequest;s.overrideMimeType("application/json"),s.open("GET",e,!0),s.responseType="arraybuffer",s.onreadystatechange=function(){4===s.readyState&&(200===s.status?t(s.response):i(s.statusText))},s.send(null)}}const uw=c.vec3();class dw{load(e,t,i,s,r,o){s=s||{};const n=e.viewer.scene.canvas.spinner;n.processes++,e.dataSource.getSTL(i,(function(i){!function(e,t,i,s){try{const r=vw(i);pw(r)?fw(e,r,t,s):gw(e,_w(i),t,s)}catch(e){t.fire("error",e)}}(e,t,i,s);try{const o=vw(i);pw(o)?fw(e,o,t,s):gw(e,_w(i),t,s),n.processes--,M.scheduleTask((function(){t.fire("loaded",!0,!1)})),r&&r()}catch(i){n.processes--,e.error(i),o&&o(i),t.fire("error",i)}}),(function(i){n.processes--,e.error(i),o&&o(i),t.fire("error",i)}))}parse(e,t,i,s){const r=e.viewer.scene.canvas.spinner;r.processes++;try{const o=vw(i);pw(o)?fw(e,o,t,s):gw(e,_w(i),t,s),r.processes--,M.scheduleTask((function(){t.fire("loaded",!0,!1)}))}catch(e){r.processes--,t.fire("error",e)}}}function pw(e){const t=new DataView(e);if(84+50*t.getUint32(80,!0)===t.byteLength)return!0;const i=[115,111,108,105,100];for(var s=0;s<5;s++)if(i[s]!==t.getUint8(s,!1))return!0;return!1}function fw(e,t,i,s){const r=new DataView(t),o=r.getUint32(80,!0);let n,a,l,A,h,c,u,d=!1,p=null,f=null,g=null,m=!1;for(let e=0;e<70;e++)1129270351===r.getUint32(e,!1)&&82===r.getUint8(e+4)&&61===r.getUint8(e+5)&&(d=!0,A=[],h=r.getUint8(e+6)/255,c=r.getUint8(e+7)/255,u=r.getUint8(e+8)/255,r.getUint8(e+9));const _=new vs(i,{roughness:.5});let v=[],b=[],y=s.splitMeshes;for(let e=0;e>5&31)/31,l=(e>>10&31)/31):(n=h,a=c,l=u),(y&&n!==p||a!==f||l!==g)&&(null!==p&&(m=!0),p=n,f=a,g=l)}for(let e=1;e<=3;e++){let i=t+12*e;v.push(r.getFloat32(i,!0)),v.push(r.getFloat32(i+4,!0)),v.push(r.getFloat32(i+8,!0)),b.push(o,x,B),d&&A.push(n,a,l,1)}y&&m&&(mw(i,v,b,A,_,s),v=[],b=[],A=A?[]:null,m=!1)}v.length>0&&mw(i,v,b,A,_,s)}function gw(e,t,i,s){const r=/facet([\s\S]*?)endfacet/g;let o=0;const n=/[\s]+([+-]?(?:\d+.\d+|\d+.|\d+|.\d+)(?:[eE][+-]?\d+)?)/.source,a=new RegExp("vertex"+n+n+n,"g"),l=new RegExp("normal"+n+n+n,"g"),A=[],h=[];let c,u,d,p,f,g,m;for(;null!==(p=r.exec(t));){for(f=0,g=0,m=p[0];null!==(p=l.exec(m));)c=parseFloat(p[1]),u=parseFloat(p[2]),d=parseFloat(p[3]),g++;for(;null!==(p=a.exec(m));)A.push(parseFloat(p[1]),parseFloat(p[2]),parseFloat(p[3])),h.push(c,u,d),f++;1!==g&&e.error("Error in normal of face "+o),3!==f&&e.error("Error in positions of face "+o),o++}mw(i,A,h,null,new vs(i,{roughness:.5}),s)}function mw(e,t,i,s,r,o){const n=new Int32Array(t.length/3);for(let e=0,t=n.length;e0?i:null,s=s&&s.length>0?s:null,o.smoothNormals&&c.faceToVertexNormals(t,i,o);const a=uw;K(t,t,a);const l=new jt(e,{primitive:"triangles",positions:t,normals:i,colors:s,indices:n}),A=new $i(e,{origin:0!==a[0]||0!==a[1]||0!==a[2]?a:null,geometry:l,material:r,edges:o.edges});e.addChild(A)}function _w(e){return"string"!=typeof e?function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let i=0,s=e.length;i0){const i=document.createElement("a");i.href="#",i.id=`switch-${e.nodeId}`,i.textContent="+",i.classList.add("plus"),t&&i.addEventListener("click",t),o.appendChild(i)}const n=document.createElement("input");n.id=`checkbox-${e.nodeId}`,n.type="checkbox",n.checked=e.checked,n.style["pointer-events"]="all",i&&n.addEventListener("change",i),o.appendChild(n);const a=document.createElement("span");return a.textContent=e.title,o.appendChild(a),s&&(a.oncontextmenu=s),r&&(a.onclick=r),o}createDisabledNodeElement(e){const t=document.createElement("li"),i=document.createElement("a");i.href="#",i.textContent="!",i.classList.add("warn"),i.classList.add("warning"),t.appendChild(i);const s=document.createElement("span");return s.textContent=e,t.appendChild(s),t}addChildren(e,t){const i=document.createElement("ul");t.forEach((e=>{i.appendChild(e)})),e.parentElement.appendChild(i)}expand(e,t,i){e.classList.remove("plus"),e.classList.add("minus"),e.textContent="-",e.removeEventListener("click",t),e.addEventListener("click",i)}collapse(e,t,i){if(!e)return;const s=e.parentElement;if(!s)return;const r=s.querySelector("ul");r&&(s.removeChild(r),e.classList.remove("minus"),e.classList.add("plus"),e.textContent="+",e.removeEventListener("click",i),e.addEventListener("click",t))}isExpanded(e){return void 0!==e.parentElement.getElementsByTagName("li")[0]}getId(e){return e.parentElement.id}getIdFromCheckbox(e){return e.id.replace("checkbox-","")}getSwitchElement(e){return document.getElementById(`switch-${e}`)}isChecked(e){return e.checked}setCheckbox(e,t){const i=document.getElementById(`checkbox-${e}`);i&&t!==i.checked&&(i.checked=t)}setXRayed(e,t){const i=document.getElementById(e);i&&(t?i.classList.add("xrayed-node"):i.classList.remove("xrayed-node"))}setHighlighted(e,t){const i=document.getElementById(e);i&&(t?(i.scrollIntoView({block:"center"}),i.classList.add("highlighted-node")):i.classList.remove("highlighted-node"))}}const yw=[];class xw{constructor(e){this._scene=e,this._objects=[],this._objectsViewCulled=[],this._objectsDetailCulled=[],this._objectsChanged=[],this._objectsChangedList=[],this._modelInfos={},this._numObjects=0,this._lenObjectsChangedList=0,this._dirty=!0,this._onModelLoaded=e.on("modelLoaded",(t=>{const i=e.models[t];i&&this._addModel(i)})),this._onTick=e.on("tick",(()=>{this._dirty&&this._build(),this._applyChanges()}))}_addModel(e){const t={model:e,onDestroyed:e.on("destroyed",(()=>{this._removeModel(e)}))};this._modelInfos[e.id]=t,this._dirty=!0}_removeModel(e){const t=this._modelInfos[e.id];t&&(t.model.off(t.onDestroyed),delete this._modelInfos[e.id],this._dirty=!0)}_build(){if(!this._dirty)return;this._applyChanges();const e=this._scene.objects;for(let e=0;e0){for(let e=0;e-1?e+"&_="+t:e+"?_="+t}getManifest(e,t,i){_.loadJSON(this._cacheBusterURL(e),(e=>{t(e)}),(function(e){i(e)}))}getMetaModel(e,t,i){_.loadJSON(this._cacheBusterURL(e),(e=>{t(e)}),(function(e){i(e)}))}getXKT(e,t,i){var s=()=>{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n=0;)e[t]=0}const i=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]),s=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]),r=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),n=new Array(576);t(n);const a=new Array(60);t(a);const l=new Array(512);t(l);const A=new Array(256);t(A);const h=new Array(29);t(h);const c=new Array(30);function u(e,t,i,s,r){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=s,this.max_length=r,this.has_stree=e&&e.length}let d,p,f;function g(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}t(c);const m=e=>e<256?l[e]:l[256+(e>>>7)],_=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},v=(e,t,i)=>{e.bi_valid>16-i?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<{v(e,i[2*t],i[2*t+1])},y=(e,t)=>{let i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1},x=(e,t,i)=>{const s=new Array(16);let r,o,n=0;for(r=1;r<=15;r++)n=n+i[r-1]<<1,s[r]=n;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=y(s[t]++,t))}},B=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},w=e=>{e.bi_valid>8?_(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},P=(e,t,i,s)=>{const r=2*t,o=2*i;return e[r]{const s=e.heap[i];let r=i<<1;for(;r<=e.heap_len&&(r{let o,n,a,l,u=0;if(0!==e.sym_next)do{o=255&e.pending_buf[e.sym_buf+u++],o+=(255&e.pending_buf[e.sym_buf+u++])<<8,n=e.pending_buf[e.sym_buf+u++],0===o?b(e,n,t):(a=A[n],b(e,a+256+1,t),l=i[a],0!==l&&(n-=h[a],v(e,n,l)),o--,a=m(o),b(e,a,r),l=s[a],0!==l&&(o-=c[a],v(e,o,l)))}while(u{const i=t.dyn_tree,s=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.elems;let n,a,l,A=-1;for(e.heap_len=0,e.heap_max=573,n=0;n>1;n>=1;n--)C(e,i,n);l=o;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],C(e,i,1),a=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=a,i[2*l]=i[2*n]+i[2*a],e.depth[l]=(e.depth[n]>=e.depth[a]?e.depth[n]:e.depth[a])+1,i[2*n+1]=i[2*a+1]=l,e.heap[1]=l++,C(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const i=t.dyn_tree,s=t.max_code,r=t.stat_desc.static_tree,o=t.stat_desc.has_stree,n=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,l=t.stat_desc.max_length;let A,h,c,u,d,p,f=0;for(u=0;u<=15;u++)e.bl_count[u]=0;for(i[2*e.heap[e.heap_max]+1]=0,A=e.heap_max+1;A<573;A++)h=e.heap[A],u=i[2*i[2*h+1]+1]+1,u>l&&(u=l,f++),i[2*h+1]=u,h>s||(e.bl_count[u]++,d=0,h>=a&&(d=n[h-a]),p=i[2*h],e.opt_len+=p*(u+d),o&&(e.static_len+=p*(r[2*h+1]+d)));if(0!==f){do{for(u=l-1;0===e.bl_count[u];)u--;e.bl_count[u]--,e.bl_count[u+1]+=2,e.bl_count[l]--,f-=2}while(f>0);for(u=l;0!==u;u--)for(h=e.bl_count[u];0!==h;)c=e.heap[--A],c>s||(i[2*c+1]!==u&&(e.opt_len+=(u-i[2*c+1])*i[2*c],i[2*c+1]=u),h--)}})(e,t),x(i,A,e.bl_count)},F=(e,t,i)=>{let s,r,o=-1,n=t[1],a=0,l=7,A=4;for(0===n&&(l=138,A=3),t[2*(i+1)+1]=65535,s=0;s<=i;s++)r=n,n=t[2*(s+1)+1],++a{let s,r,o=-1,n=t[1],a=0,l=7,A=4;for(0===n&&(l=138,A=3),s=0;s<=i;s++)if(r=n,n=t[2*(s+1)+1],!(++a{v(e,0+(s?1:0),3),w(e),_(e,i),_(e,~i),i&&e.pending_buf.set(e.window.subarray(t,t+i),e.pending),e.pending+=i};var T={_tr_init:e=>{D||((()=>{let e,t,o,g,m;const _=new Array(16);for(o=0,g=0;g<28;g++)for(h[g]=o,e=0;e<1<>=7;g<30;g++)for(c[g]=m<<7,e=0;e<1<{let r,l,A=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),E(e,e.l_desc),E(e,e.d_desc),A=(e=>{let t;for(F(e,e.dyn_ltree,e.l_desc.max_code),F(e,e.dyn_dtree,e.d_desc.max_code),E(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*o[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,l=e.static_len+3+7>>>3,l<=r&&(r=l)):r=l=i+5,i+4<=r&&-1!==t?S(e,t,i,s):4===e.strategy||l===r?(v(e,2+(s?1:0),3),M(e,n,a)):(v(e,4+(s?1:0),3),((e,t,i,s)=>{let r;for(v(e,t-257,5),v(e,i-1,5),v(e,s-4,4),r=0;r(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=i,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(A[i]+256+1)]++,e.dyn_dtree[2*m(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{v(e,2,3),b(e,256,n),(e=>{16===e.bi_valid?(_(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}},L=(e,t,i,s)=>{let r=65535&e|0,o=e>>>16&65535|0,n=0;for(;0!==i;){n=i>2e3?2e3:i,i-=n;do{r=r+t[s++]|0,o=o+r|0}while(--n);r%=65521,o%=65521}return r|o<<16|0};const R=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var U=(e,t,i,s)=>{const r=R,o=s+i;e^=-1;for(let i=s;i>>8^r[255&(e^t[i])];return-1^e},k={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"},O={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};const{_tr_init:N,_tr_stored_block:Q,_tr_flush_block:V,_tr_tally:H,_tr_align:j}=T,{Z_NO_FLUSH:G,Z_PARTIAL_FLUSH:z,Z_FULL_FLUSH:W,Z_FINISH:K,Z_BLOCK:X,Z_OK:J,Z_STREAM_END:Y,Z_STREAM_ERROR:Z,Z_DATA_ERROR:q,Z_BUF_ERROR:$,Z_DEFAULT_COMPRESSION:ee,Z_FILTERED:te,Z_HUFFMAN_ONLY:ie,Z_RLE:se,Z_FIXED:re,Z_DEFAULT_STRATEGY:oe,Z_UNKNOWN:ne,Z_DEFLATED:ae}=O,le=258,Ae=262,he=42,ce=113,ue=666,de=(e,t)=>(e.msg=k[t],t),pe=e=>2*e-(e>4?9:0),fe=e=>{let t=e.length;for(;--t>=0;)e[t]=0},ge=e=>{let t,i,s,r=e.w_size;t=e.hash_size,s=t;do{i=e.head[--s],e.head[s]=i>=r?i-r:0}while(--t);t=r,s=t;do{i=e.prev[--s],e.prev[s]=i>=r?i-r:0}while(--t)};let me=(e,t,i)=>(t<{const t=e.state;let i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+i),e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))},ve=(e,t)=>{V(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,_e(e.strm)},be=(e,t)=>{e.pending_buf[e.pending++]=t},ye=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},xe=(e,t,i,s)=>{let r=e.avail_in;return r>s&&(r=s),0===r?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),i),1===e.state.wrap?e.adler=L(e.adler,t,r,i):2===e.state.wrap&&(e.adler=U(e.adler,t,r,i)),e.next_in+=r,e.total_in+=r,r)},Be=(e,t)=>{let i,s,r=e.max_chain_length,o=e.strstart,n=e.prev_length,a=e.nice_match;const l=e.strstart>e.w_size-Ae?e.strstart-(e.w_size-Ae):0,A=e.window,h=e.w_mask,c=e.prev,u=e.strstart+le;let d=A[o+n-1],p=A[o+n];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do{if(i=t,A[i+n]===p&&A[i+n-1]===d&&A[i]===A[o]&&A[++i]===A[o+1]){o+=2,i++;do{}while(A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&on){if(e.match_start=t,n=s,s>=a)break;d=A[o+n-1],p=A[o+n]}}}while((t=c[t&h])>l&&0!=--r);return n<=e.lookahead?n:e.lookahead},we=e=>{const t=e.w_size;let i,s,r;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ae)&&(e.window.set(e.window.subarray(t,t+t-s),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),ge(e),s+=t),0===e.strm.avail_in)break;if(i=xe(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=i,e.lookahead+e.insert>=3)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=me(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=me(e,e.ins_h,e.window[r+3-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead{let i,s,r,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,n=0,a=e.strm.avail_in;do{if(i=65535,r=e.bi_valid+42>>3,e.strm.avail_outs+e.strm.avail_in&&(i=s+e.strm.avail_in),i>r&&(i=r),i>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,_e(e.strm),s&&(s>i&&(s=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+s),e.strm.next_out),e.strm.next_out+=s,e.strm.avail_out-=s,e.strm.total_out+=s,e.block_start+=s,i-=s),i&&(xe(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(0===n);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_waterr&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,r+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),r>e.strm.avail_in&&(r=e.strm.avail_in),r&&(xe(e.strm,e.window,e.strstart,r),e.strstart+=r,e.insert+=r>e.w_size-e.insert?e.w_size-e.insert:r),e.high_water>3,r=e.pending_buf_size-r>65535?65535:e.pending_buf_size-r,o=r>e.w_size?e.w_size:r,s=e.strstart-e.block_start,(s>=o||(s||t===K)&&t!==G&&0===e.strm.avail_in&&s<=r)&&(i=s>r?r:s,n=t===K&&0===e.strm.avail_in&&i===s?1:0,Q(e,e.block_start,i,n),e.block_start+=i,_e(e.strm)),n?3:1)},Ce=(e,t)=>{let i,s;for(;;){if(e.lookahead=3&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-Ae&&(e.match_length=Be(e,i)),e.match_length>=3)if(s=H(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=me(e,e.ins_h,e.window[e.strstart+1]);else s=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2},Me=(e,t)=>{let i,s,r;for(;;){if(e.lookahead=3&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,s=H(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=r&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,s&&(ve(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(s=H(e,0,e.window[e.strstart-1]),s&&ve(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(s=H(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2};function Ee(e,t,i,s,r){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=s,this.func=r}const Fe=[new Ee(0,0,0,0,Pe),new Ee(4,4,8,4,Ce),new Ee(4,5,16,8,Ce),new Ee(4,6,32,32,Ce),new Ee(4,4,16,16,Me),new Ee(8,16,32,32,Me),new Ee(8,16,128,128,Me),new Ee(8,32,128,256,Me),new Ee(32,128,258,1024,Me),new Ee(32,258,258,4096,Me)];function Ie(){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=ae,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),fe(this.dyn_ltree),fe(this.dyn_dtree),fe(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),fe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),fe(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}const De=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==he&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==ce&&t.status!==ue?1:0},Se=e=>{if(De(e))return de(e,Z);e.total_in=e.total_out=0,e.data_type=ne;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?he:ce,e.adler=2===t.wrap?0:1,t.last_flush=-2,N(t),J},Te=e=>{const t=Se(e);var i;return t===J&&((i=e.state).window_size=2*i.w_size,fe(i.head),i.max_lazy_match=Fe[i.level].max_lazy,i.good_match=Fe[i.level].good_length,i.nice_match=Fe[i.level].nice_length,i.max_chain_length=Fe[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),t},Le=(e,t,i,s,r,o)=>{if(!e)return Z;let n=1;if(t===ee&&(t=6),s<0?(n=0,s=-s):s>15&&(n=2,s-=16),r<1||r>9||i!==ae||s<8||s>15||t<0||t>9||o<0||o>re||8===s&&1!==n)return de(e,Z);8===s&&(s=9);const a=new Ie;return e.state=a,a.strm=e,a.status=he,a.wrap=n,a.gzhead=null,a.w_bits=s,a.w_size=1<De(e)||2!==e.state.wrap?Z:(e.state.gzhead=t,J),ke=(e,t)=>{if(De(e)||t>X||t<0)return e?de(e,Z):Z;const i=e.state;if(!e.output||0!==e.avail_in&&!e.input||i.status===ue&&t!==K)return de(e,0===e.avail_out?$:Z);const s=i.last_flush;if(i.last_flush=t,0!==i.pending){if(_e(e),0===e.avail_out)return i.last_flush=-1,J}else if(0===e.avail_in&&pe(t)<=pe(s)&&t!==K)return de(e,$);if(i.status===ue&&0!==e.avail_in)return de(e,$);if(i.status===he&&0===i.wrap&&(i.status=ce),i.status===he){let t=ae+(i.w_bits-8<<4)<<8,s=-1;if(s=i.strategy>=ie||i.level<2?0:i.level<6?1:6===i.level?2:3,t|=s<<6,0!==i.strstart&&(t|=32),t+=31-t%31,ye(i,t),0!==i.strstart&&(ye(i,e.adler>>>16),ye(i,65535&e.adler)),e.adler=1,i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J}if(57===i.status)if(e.adler=0,be(i,31),be(i,139),be(i,8),i.gzhead)be(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),be(i,255&i.gzhead.time),be(i,i.gzhead.time>>8&255),be(i,i.gzhead.time>>16&255),be(i,i.gzhead.time>>24&255),be(i,9===i.level?2:i.strategy>=ie||i.level<2?4:0),be(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(be(i,255&i.gzhead.extra.length),be(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=U(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(be(i,0),be(i,0),be(i,0),be(i,0),be(i,0),be(i,9===i.level?2:i.strategy>=ie||i.level<2?4:0),be(i,3),i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J;if(69===i.status){if(i.gzhead.extra){let t=i.pending,s=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+s>i.pending_buf_size;){let r=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+r),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>t&&(e.adler=U(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex+=r,_e(e),0!==i.pending)return i.last_flush=-1,J;t=0,s-=r}let r=new Uint8Array(i.gzhead.extra);i.pending_buf.set(r.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending+=s,i.gzhead.hcrc&&i.pending>t&&(e.adler=U(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),_e(e),0!==i.pending)return i.last_flush=-1,J;s=0}t=i.gzindexs&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),_e(e),0!==i.pending)return i.last_flush=-1,J;s=0}t=i.gzindexs&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(_e(e),0!==i.pending))return i.last_flush=-1,J;be(i,255&e.adler),be(i,e.adler>>8&255),e.adler=0}if(i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J}if(0!==e.avail_in||0!==i.lookahead||t!==G&&i.status!==ue){let s=0===i.level?Pe(i,t):i.strategy===ie?((e,t)=>{let i;for(;;){if(0===e.lookahead&&(we(e),0===e.lookahead)){if(t===G)return 1;break}if(e.match_length=0,i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2})(i,t):i.strategy===se?((e,t)=>{let i,s,r,o;const n=e.window;for(;;){if(e.lookahead<=le){if(we(e),e.lookahead<=le&&t===G)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,s=n[r],s===n[++r]&&s===n[++r]&&s===n[++r])){o=e.strstart+le;do{}while(s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&re.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=H(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2})(i,t):Fe[i.level].func(i,t);if(3!==s&&4!==s||(i.status=ue),1===s||3===s)return 0===e.avail_out&&(i.last_flush=-1),J;if(2===s&&(t===z?j(i):t!==X&&(Q(i,0,0,!1),t===W&&(fe(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),_e(e),0===e.avail_out))return i.last_flush=-1,J}return t!==K?J:i.wrap<=0?Y:(2===i.wrap?(be(i,255&e.adler),be(i,e.adler>>8&255),be(i,e.adler>>16&255),be(i,e.adler>>24&255),be(i,255&e.total_in),be(i,e.total_in>>8&255),be(i,e.total_in>>16&255),be(i,e.total_in>>24&255)):(ye(i,e.adler>>>16),ye(i,65535&e.adler)),_e(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?J:Y)},Oe=e=>{if(De(e))return Z;const t=e.state.status;return e.state=null,t===ce?de(e,q):J},Ne=(e,t)=>{let i=t.length;if(De(e))return Z;const s=e.state,r=s.wrap;if(2===r||1===r&&s.status!==he||s.lookahead)return Z;if(1===r&&(e.adler=L(e.adler,t,i,0)),s.wrap=0,i>=s.w_size){0===r&&(fe(s.head),s.strstart=0,s.block_start=0,s.insert=0);let e=new Uint8Array(s.w_size);e.set(t.subarray(i-s.w_size,i),0),t=e,i=s.w_size}const o=e.avail_in,n=e.next_in,a=e.input;for(e.avail_in=i,e.next_in=0,e.input=t,we(s);s.lookahead>=3;){let e=s.strstart,t=s.lookahead-2;do{s.ins_h=me(s,s.ins_h,s.window[e+3-1]),s.prev[e&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=e,e++}while(--t);s.strstart=e,s.lookahead=2,we(s)}return s.strstart+=s.lookahead,s.block_start=s.strstart,s.insert=s.lookahead,s.lookahead=0,s.match_length=s.prev_length=2,s.match_available=0,e.next_in=n,e.input=a,e.avail_in=o,s.wrap=r,J};const Qe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ve=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)Qe(i,t)&&(e[t]=i[t])}}return e},He=e=>{let t=0;for(let i=0,s=e.length;i=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Ge[254]=Ge[254]=1;var ze=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,s,r,o,n=e.length,a=0;for(r=0;r>>6,t[o++]=128|63&i):i<65536?(t[o++]=224|i>>>12,t[o++]=128|i>>>6&63,t[o++]=128|63&i):(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63,t[o++]=128|i>>>6&63,t[o++]=128|63&i);return t},We=(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let s,r;const o=new Array(2*i);for(r=0,s=0;s4)o[r++]=65533,s+=n-1;else{for(t&=2===n?31:3===n?15:7;n>1&&s1?o[r++]=65533:t<65536?o[r++]=t:(t-=65536,o[r++]=55296|t>>10&1023,o[r++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&je)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let s=0;s{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+Ge[e[i]]>t?i:t},Xe=function(){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};const Je=Object.prototype.toString,{Z_NO_FLUSH:Ye,Z_SYNC_FLUSH:Ze,Z_FULL_FLUSH:qe,Z_FINISH:$e,Z_OK:et,Z_STREAM_END:tt,Z_DEFAULT_COMPRESSION:it,Z_DEFAULT_STRATEGY:st,Z_DEFLATED:rt}=O;function ot(e){this.options=Ve({level:it,method:rt,chunkSize:16384,windowBits:15,memLevel:8,strategy:st},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xe,this.strm.avail_out=0;let i=Re(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==et)throw new Error(k[i]);if(t.header&&Ue(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?ze(t.dictionary):"[object ArrayBuffer]"===Je.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,i=Ne(this.strm,e),i!==et)throw new Error(k[i]);this._dict_set=!0}}function nt(e,t){const i=new ot(t);if(i.push(e,!0),i.err)throw i.msg||k[i.err];return i.result}ot.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize;let r,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?$e:Ye,"string"==typeof e?i.input=ze(e):"[object ArrayBuffer]"===Je.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),(o===Ze||o===qe)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(r=ke(i,o),r===tt)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),r=Oe(this.strm),this.onEnd(r),this.ended=!0,r===et;if(0!==i.avail_out){if(o>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},ot.prototype.onData=function(e){this.chunks.push(e)},ot.prototype.onEnd=function(e){e===et&&(this.result=He(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var at={Deflate:ot,deflate:nt,deflateRaw:function(e,t){return(t=t||{}).raw=!0,nt(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,nt(e,t)},constants:O};const lt=16209;var At=function(e,t){let i,s,r,o,n,a,l,A,h,c,u,d,p,f,g,m,_,v,b,y,x,B,w,P;const C=e.state;i=e.next_in,w=e.input,s=i+(e.avail_in-5),r=e.next_out,P=e.output,o=r-(t-e.avail_out),n=r+(e.avail_out-257),a=C.dmax,l=C.wsize,A=C.whave,h=C.wnext,c=C.window,u=C.hold,d=C.bits,p=C.lencode,f=C.distcode,g=(1<>>24,u>>>=v,d-=v,v=_>>>16&255,0===v)P[r++]=65535&_;else{if(!(16&v)){if(0==(64&v)){_=p[(65535&_)+(u&(1<>>=v,d-=v),d<15&&(u+=w[i++]<>>24,u>>>=v,d-=v,v=_>>>16&255,!(16&v)){if(0==(64&v)){_=f[(65535&_)+(u&(1<a){e.msg="invalid distance too far back",C.mode=lt;break e}if(u>>>=v,d-=v,v=r-o,y>v){if(v=y-v,v>A&&C.sane){e.msg="invalid distance too far back",C.mode=lt;break e}if(x=0,B=c,0===h){if(x+=l-v,v2;)P[r++]=B[x++],P[r++]=B[x++],P[r++]=B[x++],b-=3;b&&(P[r++]=B[x++],b>1&&(P[r++]=B[x++]))}else{x=r-y;do{P[r++]=P[x++],P[r++]=P[x++],P[r++]=P[x++],b-=3}while(b>2);b&&(P[r++]=P[x++],b>1&&(P[r++]=P[x++]))}break}}break}}while(i>3,i-=b,d-=b<<3,u&=(1<{const l=a.bits;let A,h,c,u,d,p,f=0,g=0,m=0,_=0,v=0,b=0,y=0,x=0,B=0,w=0,P=null;const C=new Uint16Array(16),M=new Uint16Array(16);let E,F,I,D=null;for(f=0;f<=15;f++)C[f]=0;for(g=0;g=1&&0===C[_];_--);if(v>_&&(v=_),0===_)return r[o++]=20971520,r[o++]=20971520,a.bits=1,0;for(m=1;m<_&&0===C[m];m++);for(v0&&(0===e||1!==_))return-1;for(M[1]=0,f=1;f<15;f++)M[f+1]=M[f]+C[f];for(g=0;g852||2===e&&B>592)return 1;for(;;){E=f-y,n[g]+1=p?(F=D[n[g]-p],I=P[n[g]-p]):(F=96,I=0),A=1<>y)+h]=E<<24|F<<16|I|0}while(0!==h);for(A=1<>=1;if(0!==A?(w&=A-1,w+=A):w=0,g++,0==--C[f]){if(f===_)break;f=t[i+n[g]]}if(f>v&&(w&u)!==c){for(0===y&&(y=v),d+=m,b=f-y,x=1<852||2===e&&B>592)return 1;c=w&u,r[c]=v<<24|b<<16|d-o|0}}return 0!==w&&(r[d+w]=f-y<<24|64<<16|0),a.bits=v,0};const{Z_FINISH:ft,Z_BLOCK:gt,Z_TREES:mt,Z_OK:_t,Z_STREAM_END:vt,Z_NEED_DICT:bt,Z_STREAM_ERROR:yt,Z_DATA_ERROR:xt,Z_MEM_ERROR:Bt,Z_BUF_ERROR:wt,Z_DEFLATED:Pt}=O,Ct=16180,Mt=16190,Et=16191,Ft=16192,It=16194,Dt=16199,St=16200,Tt=16206,Lt=16209,Rt=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Ut(){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}const kt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode16211?1:0},Ot=e=>{if(kt(e))return yt;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Ct,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,_t},Nt=e=>{if(kt(e))return yt;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Ot(e)},Qt=(e,t)=>{let i;if(kt(e))return yt;const s=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?yt:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=i,s.wbits=t,Nt(e))},Vt=(e,t)=>{if(!e)return yt;const i=new Ut;e.state=i,i.strm=e,i.window=null,i.mode=Ct;const s=Qt(e,t);return s!==_t&&(e.state=null),s};let Ht,jt,Gt=!0;const zt=e=>{if(Gt){Ht=new Int32Array(512),jt=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(pt(1,e.lens,0,288,Ht,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;pt(2,e.lens,0,32,jt,0,e.work,{bits:5}),Gt=!1}e.lencode=Ht,e.lenbits=9,e.distcode=jt,e.distbits=5},Wt=(e,t,i,s)=>{let r;const o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(o.window.set(t.subarray(i-o.wsize,i),0),o.wnext=0,o.whave=o.wsize):(r=o.wsize-o.wnext,r>s&&(r=s),o.window.set(t.subarray(i-s,i-s+r),o.wnext),(s-=r)?(o.window.set(t.subarray(i-s,i),0),o.wnext=s,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave{let i,s,r,o,n,a,l,A,h,c,u,d,p,f,g,m,_,v,b,y,x,B,w=0;const P=new Uint8Array(4);let C,M;const E=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(kt(e)||!e.output||!e.input&&0!==e.avail_in)return yt;i=e.state,i.mode===Et&&(i.mode=Ft),n=e.next_out,r=e.output,l=e.avail_out,o=e.next_in,s=e.input,a=e.avail_in,A=i.hold,h=i.bits,c=a,u=l,B=_t;e:for(;;)switch(i.mode){case Ct:if(0===i.wrap){i.mode=Ft;break}for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>>8&255,i.check=U(i.check,P,2,0),A=0,h=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&A)<<8)+(A>>8))%31){e.msg="incorrect header check",i.mode=Lt;break}if((15&A)!==Pt){e.msg="unknown compression method",i.mode=Lt;break}if(A>>>=4,h-=4,x=8+(15&A),0===i.wbits&&(i.wbits=x),x>15||x>i.wbits){e.msg="invalid window size",i.mode=Lt;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(P[0]=255&A,P[1]=A>>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0,i.mode=16182;case 16182:for(;h<32;){if(0===a)break e;a--,A+=s[o++]<>>8&255,P[2]=A>>>16&255,P[3]=A>>>24&255,i.check=U(i.check,P,4,0)),A=0,h=0,i.mode=16183;case 16183:for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>8),512&i.flags&&4&i.wrap&&(P[0]=255&A,P[1]=A>>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0,i.mode=16184;case 16184:if(1024&i.flags){for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(d=i.length,d>a&&(d=a),d&&(i.head&&(x=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(s.subarray(o,o+d),x)),512&i.flags&&4&i.wrap&&(i.check=U(i.check,s,d,o)),a-=d,o+=d,i.length-=d),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break e;d=0;do{x=s[o+d++],i.head&&x&&i.length<65536&&(i.head.name+=String.fromCharCode(x))}while(x&&d>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Et;break;case 16189:for(;h<32;){if(0===a)break e;a--,A+=s[o++]<>>=7&h,h-=7&h,i.mode=Tt;break}for(;h<3;){if(0===a)break e;a--,A+=s[o++]<>>=1,h-=1,3&A){case 0:i.mode=16193;break;case 1:if(zt(i),i.mode=Dt,t===mt){A>>>=2,h-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=Lt}A>>>=2,h-=2;break;case 16193:for(A>>>=7&h,h-=7&h;h<32;){if(0===a)break e;a--,A+=s[o++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=Lt;break}if(i.length=65535&A,A=0,h=0,i.mode=It,t===mt)break e;case It:i.mode=16195;case 16195:if(d=i.length,d){if(d>a&&(d=a),d>l&&(d=l),0===d)break e;r.set(s.subarray(o,o+d),n),a-=d,o+=d,l-=d,n+=d,i.length-=d;break}i.mode=Et;break;case 16196:for(;h<14;){if(0===a)break e;a--,A+=s[o++]<>>=5,h-=5,i.ndist=1+(31&A),A>>>=5,h-=5,i.ncode=4+(15&A),A>>>=4,h-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=Lt;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,h-=3}for(;i.have<19;)i.lens[E[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,C={bits:i.lenbits},B=pt(0,i.lens,0,19,i.lencode,0,i.work,C),i.lenbits=C.bits,B){e.msg="invalid code lengths set",i.mode=Lt;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=w>>>16&255,_=65535&w,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=g,h-=g,i.lens[i.have++]=_;else{if(16===_){for(M=g+2;h>>=g,h-=g,0===i.have){e.msg="invalid bit length repeat",i.mode=Lt;break}x=i.lens[i.have-1],d=3+(3&A),A>>>=2,h-=2}else if(17===_){for(M=g+3;h>>=g,h-=g,x=0,d=3+(7&A),A>>>=3,h-=3}else{for(M=g+7;h>>=g,h-=g,x=0,d=11+(127&A),A>>>=7,h-=7}if(i.have+d>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=Lt;break}for(;d--;)i.lens[i.have++]=x}}if(i.mode===Lt)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=Lt;break}if(i.lenbits=9,C={bits:i.lenbits},B=pt(1,i.lens,0,i.nlen,i.lencode,0,i.work,C),i.lenbits=C.bits,B){e.msg="invalid literal/lengths set",i.mode=Lt;break}if(i.distbits=6,i.distcode=i.distdyn,C={bits:i.distbits},B=pt(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,C),i.distbits=C.bits,B){e.msg="invalid distances set",i.mode=Lt;break}if(i.mode=Dt,t===mt)break e;case Dt:i.mode=St;case St:if(a>=6&&l>=258){e.next_out=n,e.avail_out=l,e.next_in=o,e.avail_in=a,i.hold=A,i.bits=h,At(e,u),n=e.next_out,r=e.output,l=e.avail_out,o=e.next_in,s=e.input,a=e.avail_in,A=i.hold,h=i.bits,i.mode===Et&&(i.back=-1);break}for(i.back=0;w=i.lencode[A&(1<>>24,m=w>>>16&255,_=65535&w,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>v)],g=w>>>24,m=w>>>16&255,_=65535&w,!(v+g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=v,h-=v,i.back+=v}if(A>>>=g,h-=g,i.back+=g,i.length=_,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=Et;break}if(64&m){e.msg="invalid literal/length code",i.mode=Lt;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;w=i.distcode[A&(1<>>24,m=w>>>16&255,_=65535&w,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>v)],g=w>>>24,m=w>>>16&255,_=65535&w,!(v+g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=v,h-=v,i.back+=v}if(A>>>=g,h-=g,i.back+=g,64&m){e.msg="invalid distance code",i.mode=Lt;break}i.offset=_,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=Lt;break}i.mode=16204;case 16204:if(0===l)break e;if(d=u-l,i.offset>d){if(d=i.offset-d,d>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=Lt;break}d>i.wnext?(d-=i.wnext,p=i.wsize-d):p=i.wnext-d,d>i.length&&(d=i.length),f=i.window}else f=r,p=n-i.offset,d=i.length;d>l&&(d=l),l-=d,i.length-=d;do{r[n++]=f[p++]}while(--d);0===i.length&&(i.mode=St);break;case 16205:if(0===l)break e;r[n++]=i.length,l--,i.mode=St;break;case Tt:if(i.wrap){for(;h<32;){if(0===a)break e;a--,A|=s[o++]<{if(kt(e))return yt;let t=e.state;return t.window&&(t.window=null),e.state=null,_t},Zt=(e,t)=>{if(kt(e))return yt;const i=e.state;return 0==(2&i.wrap)?yt:(i.head=t,t.done=!1,_t)},qt=(e,t)=>{const i=t.length;let s,r,o;return kt(e)?yt:(s=e.state,0!==s.wrap&&s.mode!==Mt?yt:s.mode===Mt&&(r=1,r=L(r,t,i,0),r!==s.check)?xt:(o=Wt(e,t,i,i),o?(s.mode=16210,Bt):(s.havedict=1,_t)))},$t=function(){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};const ei=Object.prototype.toString,{Z_NO_FLUSH:ti,Z_FINISH:ii,Z_OK:si,Z_STREAM_END:ri,Z_NEED_DICT:oi,Z_STREAM_ERROR:ni,Z_DATA_ERROR:ai,Z_MEM_ERROR:li}=O;function Ai(e){this.options=Ve({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xe,this.strm.avail_out=0;let i=Xt(this.strm,t.windowBits);if(i!==si)throw new Error(k[i]);if(this.header=new $t,Zt(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=ze(t.dictionary):"[object ArrayBuffer]"===ei.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=qt(this.strm,t.dictionary),i!==si)))throw new Error(k[i])}function hi(e,t){const i=new Ai(t);if(i.push(e),i.err)throw i.msg||k[i.err];return i.result}Ai.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize,r=this.options.dictionary;let o,n,a;if(this.ended)return!1;for(n=t===~~t?t:!0===t?ii:ti,"[object ArrayBuffer]"===ei.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),o=Jt(i,n),o===oi&&r&&(o=qt(i,r),o===si?o=Jt(i,n):o===ai&&(o=oi));i.avail_in>0&&o===ri&&i.state.wrap>0&&0!==e[i.next_in];)Kt(i),o=Jt(i,n);switch(o){case ni:case ai:case oi:case li:return this.onEnd(o),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||o===ri))if("string"===this.options.to){let e=Ke(i.output,i.next_out),t=i.next_out-e,r=We(i.output,e);i.next_out=t,i.avail_out=s-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(r)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(o!==si||0!==a){if(o===ri)return o=Yt(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ai.prototype.onData=function(e){this.chunks.push(e)},Ai.prototype.onEnd=function(e){e===si&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=He(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ci={Inflate:Ai,inflate:hi,inflateRaw:function(e,t){return(t=t||{}).raw=!0,hi(e,t)},ungzip:hi,constants:O};const{Deflate:ui,deflate:di,deflateRaw:pi,gzip:fi}=at,{Inflate:gi,inflate:mi,inflateRaw:_i,ungzip:vi}=ci;var bi=ui,yi=di,xi=pi,Bi=fi,wi=gi,Pi=mi,Ci=_i,Mi=vi,Ei=O,Fi={Deflate:bi,deflate:yi,deflateRaw:xi,gzip:Bi,Inflate:wi,inflate:Pi,inflateRaw:Ci,ungzip:Mi,constants:Ei};e.Deflate=bi,e.Inflate=wi,e.constants=Ei,e.default=Fi,e.deflate=yi,e.deflateRaw=xi,e.gzip=Bi,e.inflate=Pi,e.inflateRaw=Ci,e.ungzip=Mi,Object.defineProperty(e,"__esModule",{value:!0})}));var Cw=Object.freeze({__proto__:null});let Mw=window.pako||Cw;Mw.inflate||(Mw=Mw.default);const Ew=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const Fw={version:1,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],meshPositions:e[4],meshIndices:e[5],meshEdgesIndices:e[6],meshColors:e[7],entityIDs:e[8],entityMeshes:e[9],entityIsObjects:e[10],positionsDecodeMatrix:e[11]}}(i),a=function(e){return{positions:new Uint16Array(Mw.inflate(e.positions).buffer),normals:new Int8Array(Mw.inflate(e.normals).buffer),indices:new Uint32Array(Mw.inflate(e.indices).buffer),edgeIndices:new Uint32Array(Mw.inflate(e.edgeIndices).buffer),meshPositions:new Uint32Array(Mw.inflate(e.meshPositions).buffer),meshIndices:new Uint32Array(Mw.inflate(e.meshIndices).buffer),meshEdgesIndices:new Uint32Array(Mw.inflate(e.meshEdgesIndices).buffer),meshColors:new Uint8Array(Mw.inflate(e.meshColors).buffer),entityIDs:Mw.inflate(e.entityIDs,{to:"string"}),entityMeshes:new Uint32Array(Mw.inflate(e.entityMeshes).buffer),entityIsObjects:new Uint8Array(Mw.inflate(e.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(Mw.inflate(e.positionsDecodeMatrix).buffer)}}(n);!function(e,t,i,s,r,o){o.getNextId(),s.positionsCompression="precompressed",s.normalsCompression="precompressed";const n=i.positions,a=i.normals,l=i.indices,A=i.edgeIndices,h=i.meshPositions,u=i.meshIndices,d=i.meshEdgesIndices,p=i.meshColors,f=JSON.parse(i.entityIDs),g=i.entityMeshes,m=i.entityIsObjects,v=h.length,b=g.length;for(let r=0;rg[e]g[t]?1:0));for(let e=0;e1||(E[i]=e)}}for(let e=0;e1,o=kw(m.subarray(4*t,4*t+3)),u=m[4*t+3]/255,v=a.subarray(d[t],i?a.length:d[t+1]),y=l.subarray(d[t],i?l.length:d[t+1]),x=A.subarray(p[t],i?A.length:p[t+1]),w=h.subarray(f[t],i?h.length:f[t+1]),M=c.subarray(g[t],g[t]+16);if(r){const e=`${n}-geometry.${t}`;s.createGeometry({id:e,primitive:"triangles",positionsCompressed:v,normalsCompressed:y,indices:x,edgeIndices:w,positionsDecodeMatrix:M})}else{const e=`${n}-${t}`;b[E[t]];const i={};s.createMesh(_.apply(i,{id:e,primitive:"triangles",positionsCompressed:v,normalsCompressed:y,indices:x,edgeIndices:w,positionsDecodeMatrix:M,color:o,opacity:u}))}}let F=0;for(let e=0;e1){const t={},r=`${n}-instance.${F++}`,o=`${n}-geometry.${i}`,a=16*x[e],A=u.subarray(a,a+16);s.createMesh(_.apply(t,{id:r,geometryId:o,matrix:A})),l.push(r)}else l.push(i)}if(l.length>0){const e={};s.createEntity(_.apply(e,{id:r,isObject:!0,meshIds:l}))}}}(0,0,a,s,0,o)}};let Nw=window.pako||Cw;Nw.inflate||(Nw=Nw.default);const Qw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const Vw={version:5,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],eachPrimitivePositionsAndNormalsPortion:e[5],eachPrimitiveIndicesPortion:e[6],eachPrimitiveEdgeIndicesPortion:e[7],eachPrimitiveColor:e[8],primitiveInstances:e[9],eachEntityId:e[10],eachEntityPrimitiveInstancesPortion:e[11],eachEntityMatricesPortion:e[12]}}(i),a=function(e){return{positions:new Float32Array(Nw.inflate(e.positions).buffer),normals:new Int8Array(Nw.inflate(e.normals).buffer),indices:new Uint32Array(Nw.inflate(e.indices).buffer),edgeIndices:new Uint32Array(Nw.inflate(e.edgeIndices).buffer),matrices:new Float32Array(Nw.inflate(e.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(Nw.inflate(e.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(Nw.inflate(e.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(Nw.inflate(e.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveColor:new Uint8Array(Nw.inflate(e.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(Nw.inflate(e.primitiveInstances).buffer),eachEntityId:Nw.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(Nw.inflate(e.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(Nw.inflate(e.eachEntityMatricesPortion).buffer)}}(n);!function(e,t,i,s,r,o){const n=o.getNextId();s.positionsCompression="disabled",s.normalsCompression="precompressed";const a=i.positions,l=i.normals,A=i.indices,h=i.edgeIndices,c=i.matrices,u=i.eachPrimitivePositionsAndNormalsPortion,d=i.eachPrimitiveIndicesPortion,p=i.eachPrimitiveEdgeIndicesPortion,f=i.eachPrimitiveColor,g=i.primitiveInstances,m=JSON.parse(i.eachEntityId),v=i.eachEntityPrimitiveInstancesPortion,b=i.eachEntityMatricesPortion,y=u.length,x=g.length,B=new Uint8Array(y),w=m.length;for(let e=0;e1||(P[i]=e)}}for(let e=0;e1,r=Qw(f.subarray(4*e,4*e+3)),o=f[4*e+3]/255,c=a.subarray(u[e],t?a.length:u[e+1]),g=l.subarray(u[e],t?l.length:u[e+1]),v=A.subarray(d[e],t?A.length:d[e+1]),b=h.subarray(p[e],t?h.length:p[e+1]);if(i){const t=`${n}-geometry.${e}`;s.createGeometry({id:t,primitive:"triangles",positionsCompressed:c,normalsCompressed:g,indices:v,edgeIndices:b})}else{const t=e;m[P[e]];const i={};s.createMesh(_.apply(i,{id:t,primitive:"triangles",positionsCompressed:c,normalsCompressed:g,indices:v,edgeIndices:b,color:r,opacity:o}))}}let C=0;for(let e=0;e1){const t={},r="instance."+C++,o="geometry"+i,n=16*b[e],l=c.subarray(n,n+16);s.createMesh(_.apply(t,{id:r,geometryId:o,matrix:l})),a.push(r)}else a.push(i)}if(a.length>0){const e={};s.createEntity(_.apply(e,{id:r,isObject:!0,meshIds:a}))}}}(0,0,a,s,0,o)}};let Hw=window.pako||Cw;Hw.inflate||(Hw=Hw.default);const jw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const Gw={version:6,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],reusedPrimitivesDecodeMatrix:e[5],eachPrimitivePositionsAndNormalsPortion:e[6],eachPrimitiveIndicesPortion:e[7],eachPrimitiveEdgeIndicesPortion:e[8],eachPrimitiveColorAndOpacity:e[9],primitiveInstances:e[10],eachEntityId:e[11],eachEntityPrimitiveInstancesPortion:e[12],eachEntityMatricesPortion:e[13],eachTileAABB:e[14],eachTileEntitiesPortion:e[15]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:Hw.inflate(e,t).buffer}return{positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedPrimitivesDecodeMatrix:new Float32Array(t(e.reusedPrimitivesDecodeMatrix)),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(t(e.eachPrimitivePositionsAndNormalsPortion)),eachPrimitiveIndicesPortion:new Uint32Array(t(e.eachPrimitiveIndicesPortion)),eachPrimitiveEdgeIndicesPortion:new Uint32Array(t(e.eachPrimitiveEdgeIndicesPortion)),eachPrimitiveColorAndOpacity:new Uint8Array(t(e.eachPrimitiveColorAndOpacity)),primitiveInstances:new Uint32Array(t(e.primitiveInstances)),eachEntityId:Hw.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(t(e.eachEntityPrimitiveInstancesPortion)),eachEntityMatricesPortion:new Uint32Array(t(e.eachEntityMatricesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(n);!function(e,t,i,s,r,o){const n=o.getNextId(),a=i.positions,l=i.normals,A=i.indices,h=i.edgeIndices,u=i.matrices,d=i.reusedPrimitivesDecodeMatrix,p=i.eachPrimitivePositionsAndNormalsPortion,f=i.eachPrimitiveIndicesPortion,g=i.eachPrimitiveEdgeIndicesPortion,m=i.eachPrimitiveColorAndOpacity,v=i.primitiveInstances,b=JSON.parse(i.eachEntityId),y=i.eachEntityPrimitiveInstancesPortion,x=i.eachEntityMatricesPortion,B=i.eachTileAABB,w=i.eachTileEntitiesPortion,P=p.length,C=v.length,M=b.length,E=w.length,F=new Uint32Array(P);for(let e=0;e1,c=t===P-1,u=a.subarray(p[t],c?a.length:p[t+1]),b=l.subarray(p[t],c?l.length:p[t+1]),y=A.subarray(f[t],c?A.length:f[t+1]),x=h.subarray(g[t],c?h.length:g[t+1]),B=jw(m.subarray(4*t,4*t+3)),w=m[4*t+3]/255,C=o.getNextId();if(r){const e=`${n}-geometry.${i}.${t}`;U[e]||(s.createGeometry({id:e,primitive:"triangles",positionsCompressed:u,indices:y,edgeIndices:x,positionsDecodeMatrix:d}),U[e]=!0),s.createMesh(_.apply(N,{id:C,geometryId:e,origin:I,matrix:E,color:B,opacity:w})),L.push(C)}else s.createMesh(_.apply(N,{id:C,origin:I,primitive:"triangles",positionsCompressed:u,normalsCompressed:b,indices:y,edgeIndices:x,positionsDecodeMatrix:R,color:B,opacity:w})),L.push(C)}L.length>0&&s.createEntity(_.apply(O,{id:w,isObject:!0,meshIds:L}))}}}(e,t,a,s,0,o)}};let zw=window.pako||Cw;zw.inflate||(zw=zw.default);const Ww=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function Kw(e){const t=[];for(let i=0,s=e.length;i1,c=t===F-1,P=Ww(w.subarray(6*e,6*e+3)),C=w[6*e+3]/255,M=w[6*e+4]/255,E=w[6*e+5]/255,I=o.getNextId();if(r){const r=B[e],o=d.slice(r,r+16),x=`${n}-geometry.${i}.${t}`;if(!Q[x]){let e,i,r,o,n,d;switch(f[t]){case 0:e="solid",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 1:e="surface",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 2:e="points",i=a.subarray(g[t],c?a.length:g[t+1]),o=Kw(A.subarray(v[t],c?A.length:v[t+1]));break;case 3:e="lines",i=a.subarray(g[t],c?a.length:g[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]);break;default:continue}s.createGeometry({id:x,primitive:e,positionsCompressed:i,normalsCompressed:r,colors:o,indices:n,edgeIndices:d,positionsDecodeMatrix:p}),Q[x]=!0}s.createMesh(_.apply(V,{id:I,geometryId:x,origin:L,matrix:o,color:P,metallic:M,roughness:E,opacity:C})),U.push(I)}else{let e,i,r,o,n,d;switch(f[t]){case 0:e="solid",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 1:e="surface",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 2:e="points",i=a.subarray(g[t],c?a.length:g[t+1]),o=Kw(A.subarray(v[t],c?A.length:v[t+1]));break;case 3:e="lines",i=a.subarray(g[t],c?a.length:g[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]);break;default:continue}s.createMesh(_.apply(V,{id:I,origin:L,primitive:e,positionsCompressed:i,normalsCompressed:r,colors:o,indices:n,edgeIndices:d,positionsDecodeMatrix:N,color:P,metallic:M,roughness:E,opacity:C})),U.push(I)}}U.length>0&&s.createEntity(_.apply(O,{id:E,isObject:!0,meshIds:U}))}}}(e,t,a,s,0,o)}};let Jw=window.pako||Cw;Jw.inflate||(Jw=Jw.default);const Yw=c.vec4(),Zw=c.vec4();const qw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function $w(e){const t=[];for(let i=0,s=e.length;i1,l=r===R-1,A=qw(F.subarray(6*e,6*e+3)),h=F[6*e+3]/255,u=F[6*e+4]/255,I=F[6*e+5]/255,D=o.getNextId();if(a){const o=E[e],a=v.slice(o,o+16),M=`${n}-geometry.${i}.${r}`;let F=H[M];if(!F){F={batchThisMesh:!t.reuseGeometries};let e=!1;switch(y[r]){case 0:F.primitiveName="solid",F.geometryPositions=d.subarray(x[r],l?d.length:x[r+1]),F.geometryNormals=p.subarray(B[r],l?p.length:B[r+1]),F.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),F.geometryEdgeIndices=m.subarray(C[r],l?m.length:C[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 1:F.primitiveName="surface",F.geometryPositions=d.subarray(x[r],l?d.length:x[r+1]),F.geometryNormals=p.subarray(B[r],l?p.length:B[r+1]),F.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),F.geometryEdgeIndices=m.subarray(C[r],l?m.length:C[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 2:F.primitiveName="points",F.geometryPositions=d.subarray(x[r],l?d.length:x[r+1]),F.geometryColors=$w(f.subarray(w[r],l?f.length:w[r+1])),e=F.geometryPositions.length>0;break;case 3:F.primitiveName="lines",F.geometryPositions=d.subarray(x[r],l?d.length:x[r+1]),F.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;default:continue}if(e||(F=null),F&&(F.geometryPositions.length,F.batchThisMesh)){F.decompressedPositions=new Float32Array(F.geometryPositions.length);const e=F.geometryPositions,t=F.decompressedPositions;for(let i=0,s=e.length;i0&&n.length>0;break;case 1:e="surface",t=d.subarray(x[r],l?d.length:x[r+1]),i=p.subarray(B[r],l?p.length:B[r+1]),n=g.subarray(P[r],l?g.length:P[r+1]),a=m.subarray(C[r],l?m.length:C[r+1]),c=t.length>0&&n.length>0;break;case 2:e="points",t=d.subarray(x[r],l?d.length:x[r+1]),o=$w(f.subarray(w[r],l?f.length:w[r+1])),c=t.length>0;break;case 3:e="lines",t=d.subarray(x[r],l?d.length:x[r+1]),n=g.subarray(P[r],l?g.length:P[r+1]),c=t.length>0&&n.length>0;break;default:continue}c&&(s.createMesh(_.apply(G,{id:D,origin:Q,primitive:e,positionsCompressed:t,normalsCompressed:i,colorsCompressed:o,indices:n,edgeIndices:a,positionsDecodeMatrix:L,color:A,metallic:u,roughness:I,opacity:h})),T.push(D))}}T.length>0&&s.createEntity(_.apply(j,{id:A,isObject:!0,meshIds:T}))}}}(e,t,a,s,r,o)}};let tP=window.pako||Cw;tP.inflate||(tP=tP.default);const iP=c.vec4(),sP=c.vec4();const rP=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const oP={version:9,parse:function(e,t,i,s,r,o){const n=function(e){return{metadata:e[0],positions:e[1],normals:e[2],colors:e[3],indices:e[4],edgeIndices:e[5],matrices:e[6],reusedGeometriesDecodeMatrix:e[7],eachGeometryPrimitiveType:e[8],eachGeometryPositionsPortion:e[9],eachGeometryNormalsPortion:e[10],eachGeometryColorsPortion:e[11],eachGeometryIndicesPortion:e[12],eachGeometryEdgeIndicesPortion:e[13],eachMeshGeometriesPortion:e[14],eachMeshMatricesPortion:e[15],eachMeshMaterial:e[16],eachEntityId:e[17],eachEntityMeshesPortion:e[18],eachTileAABB:e[19],eachTileEntitiesPortion:e[20]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:tP.inflate(e,t).buffer}return{metadata:JSON.parse(tP.inflate(e.metadata,{to:"string"})),positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),colors:new Uint8Array(t(e.colors)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(t(e.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(t(e.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(t(e.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(t(e.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(t(e.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(t(e.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(t(e.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(t(e.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(t(e.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(t(e.eachMeshMaterial)),eachEntityId:JSON.parse(tP.inflate(e.eachEntityId,{to:"string"})),eachEntityMeshesPortion:new Uint32Array(t(e.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(n);!function(e,t,i,s,r,o){const n=o.getNextId(),a=i.metadata,l=i.positions,A=i.normals,h=i.colors,u=i.indices,d=i.edgeIndices,p=i.matrices,f=i.reusedGeometriesDecodeMatrix,g=i.eachGeometryPrimitiveType,m=i.eachGeometryPositionsPortion,v=i.eachGeometryNormalsPortion,b=i.eachGeometryColorsPortion,y=i.eachGeometryIndicesPortion,x=i.eachGeometryEdgeIndicesPortion,B=i.eachMeshGeometriesPortion,w=i.eachMeshMatricesPortion,P=i.eachMeshMaterial,C=i.eachEntityId,M=i.eachEntityMeshesPortion,E=i.eachTileAABB,F=i.eachTileEntitiesPortion,I=m.length,D=B.length,S=M.length,T=F.length;r&&r.loadData(a,{includeTypes:t.includeTypes,excludeTypes:t.excludeTypes,globalizeObjectIds:t.globalizeObjectIds});const L=new Uint32Array(I);for(let e=0;e1,C=r===I-1,M=rP(P.subarray(6*e,6*e+3)),E=P[6*e+3]/255,F=P[6*e+4]/255,D=P[6*e+5]/255,S=o.getNextId();if(a){const o=w[e],a=p.slice(o,o+16),B=`${n}-geometry.${i}.${r}`;let P=k[B];if(!P){P={batchThisMesh:!t.reuseGeometries};let e=!1;switch(g[r]){case 0:P.primitiveName="solid",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryNormals=A.subarray(v[r],C?A.length:v[r+1]),P.geometryIndices=u.subarray(y[r],C?u.length:y[r+1]),P.geometryEdgeIndices=d.subarray(x[r],C?d.length:x[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;case 1:P.primitiveName="surface",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryNormals=A.subarray(v[r],C?A.length:v[r+1]),P.geometryIndices=u.subarray(y[r],C?u.length:y[r+1]),P.geometryEdgeIndices=d.subarray(x[r],C?d.length:x[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;case 2:P.primitiveName="points",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryColors=h.subarray(b[r],C?h.length:b[r+1]),e=P.geometryPositions.length>0;break;case 3:P.primitiveName="lines",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryIndices=u.subarray(y[r],C?u.length:y[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;default:continue}if(e||(P=null),P&&(P.geometryPositions.length,P.batchThisMesh)){P.decompressedPositions=new Float32Array(P.geometryPositions.length),P.transformedAndRecompressedPositions=new Uint16Array(P.geometryPositions.length);const e=P.geometryPositions,t=P.decompressedPositions;for(let i=0,s=e.length;i0&&n.length>0;break;case 1:e="surface",t=l.subarray(m[r],C?l.length:m[r+1]),i=A.subarray(v[r],C?A.length:v[r+1]),n=u.subarray(y[r],C?u.length:y[r+1]),a=d.subarray(x[r],C?d.length:x[r+1]),c=t.length>0&&n.length>0;break;case 2:e="points",t=l.subarray(m[r],C?l.length:m[r+1]),o=h.subarray(b[r],C?h.length:b[r+1]),c=t.length>0;break;case 3:e="lines",t=l.subarray(m[r],C?l.length:m[r+1]),n=u.subarray(y[r],C?u.length:y[r+1]),c=t.length>0&&n.length>0;break;default:continue}c&&(s.createMesh(_.apply(j,{id:S,origin:R,primitive:e,positionsCompressed:t,normalsCompressed:i,colorsCompressed:o,indices:n,edgeIndices:a,positionsDecodeMatrix:Q,color:M,metallic:F,roughness:D,opacity:E})),O.push(S))}}O.length>0&&s.createEntity(_.apply(H,{id:E,isObject:!0,meshIds:O}))}}}(e,t,a,s,r,o)}};let nP=window.pako||Cw;nP.inflate||(nP=nP.default);const aP=c.vec4(),lP=c.vec4();const AP=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function hP(e,t){const i=[];if(t.length>1)for(let e=0,s=t.length-1;e1)for(let t=0,s=e.length/3-1;t0,a=9*e,c=1===h[a+0],u=h[a+1];h[a+2],h[a+3];const d=h[a+4],p=h[a+5],f=h[a+6],g=h[a+7],m=h[a+8];if(o){const t=new Uint8Array(l.subarray(i,r)).buffer,o=`${n}-texture-${e}`;if(c)s.createTexture({id:o,buffers:[t],minFilter:d,magFilter:p,wrapS:f,wrapT:g,wrapR:m});else{const e=new Blob([t],{type:10001===u?"image/jpeg":10002===u?"image/png":"image/gif"}),i=(window.URL||window.webkitURL).createObjectURL(e),r=document.createElement("img");r.src=i,s.createTexture({id:o,image:r,minFilter:d,magFilter:p,wrapS:f,wrapT:g,wrapR:m})}}}for(let e=0;e=0?`${n}-texture-${r}`:null,normalsTextureId:a>=0?`${n}-texture-${a}`:null,metallicRoughnessTextureId:o>=0?`${n}-texture-${o}`:null,emissiveTextureId:l>=0?`${n}-texture-${l}`:null,occlusionTextureId:A>=0?`${n}-texture-${A}`:null})}const j=new Uint32Array(N);for(let e=0;e1,l=r===N-1,A=D[e],h=A>=0?`${n}-textureSet-${A}`:null,T=AP(S.subarray(6*e,6*e+3)),L=S[6*e+3]/255,R=S[6*e+4]/255,O=S[6*e+5]/255,Q=o.getNextId();if(a){const o=I[e],a=b.slice(o,o+16),A=`${n}-geometry.${i}.${r}`;let F=W[A];if(!F){F={batchThisMesh:!t.reuseGeometries};let e=!1;switch(x[r]){case 0:F.primitiveName="solid",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryNormals=d.subarray(w[r],l?d.length:w[r+1]),F.geometryUVs=f.subarray(C[r],l?f.length:C[r+1]),F.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),F.geometryEdgeIndices=m.subarray(E[r],l?m.length:E[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 1:F.primitiveName="surface",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryNormals=d.subarray(w[r],l?d.length:w[r+1]),F.geometryUVs=f.subarray(C[r],l?f.length:C[r+1]),F.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),F.geometryEdgeIndices=m.subarray(E[r],l?m.length:E[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 2:F.primitiveName="points",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryColors=p.subarray(P[r],l?p.length:P[r+1]),e=F.geometryPositions.length>0;break;case 3:F.primitiveName="lines",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 4:F.primitiveName="lines",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryIndices=hP(F.geometryPositions,g.subarray(M[r],l?g.length:M[r+1])),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;default:continue}if(e||(F=null),F&&(F.geometryPositions.length,F.batchThisMesh)){F.decompressedPositions=new Float32Array(F.geometryPositions.length),F.transformedAndRecompressedPositions=new Uint16Array(F.geometryPositions.length);const e=F.geometryPositions,t=F.decompressedPositions;for(let i=0,s=e.length;i0&&a.length>0;break;case 1:e="surface",t=u.subarray(B[r],l?u.length:B[r+1]),i=d.subarray(w[r],l?d.length:w[r+1]),o=f.subarray(C[r],l?f.length:C[r+1]),a=g.subarray(M[r],l?g.length:M[r+1]),A=m.subarray(E[r],l?m.length:E[r+1]),c=t.length>0&&a.length>0;break;case 2:e="points",t=u.subarray(B[r],l?u.length:B[r+1]),n=p.subarray(P[r],l?p.length:P[r+1]),c=t.length>0;break;case 3:e="lines",t=u.subarray(B[r],l?u.length:B[r+1]),a=g.subarray(M[r],l?g.length:M[r+1]),c=t.length>0&&a.length>0;break;case 4:e="lines",t=u.subarray(B[r],l?u.length:B[r+1]),a=hP(t,g.subarray(M[r],l?g.length:M[r+1])),c=t.length>0&&a.length>0;break;default:continue}c&&(s.createMesh(_.apply(H,{id:Q,textureSetId:h,origin:G,primitive:e,positionsCompressed:t,normalsCompressed:i,uv:o&&o.length>0?o:null,colorsCompressed:n,indices:a,edgeIndices:A,positionsDecodeMatrix:v,color:T,metallic:R,roughness:O,opacity:L})),U.push(Q))}}U.length>0&&s.createEntity(_.apply(Q,{id:l,isObject:!0,meshIds:U}))}}}(e,t,a,s,r,o)}},uP={};uP[Fw.version]=Fw,uP[Sw.version]=Sw,uP[Rw.version]=Rw,uP[Ow.version]=Ow,uP[Vw.version]=Vw,uP[Gw.version]=Gw,uP[Xw.version]=Xw,uP[eP.version]=eP,uP[oP.version]=oP,uP[cP.version]=cP;var dP={};!function(e){var t,i="File format is not recognized.",s="Error while reading zip file.",r="Error while reading file data.",o=524288,n="text/plain";try{t=0===new Blob([new DataView(new ArrayBuffer(0))]).size}catch(e){}function a(){this.crc=-1}function l(){}function A(e,t){var i,s;return i=new ArrayBuffer(e),s=new Uint8Array(i),t&&s.set(t,0),{buffer:i,array:s,view:new DataView(i)}}function h(){}function c(e){var t,i=this;i.size=0,i.init=function(s,r){var o=new Blob([e],{type:n});(t=new d(o)).init((function(){i.size=t.size,s()}),r)},i.readUint8Array=function(e,i,s,r){t.readUint8Array(e,i,s,r)}}function u(t){var i,s=this;s.size=0,s.init=function(e){for(var r=t.length;"="==t.charAt(r-1);)r--;i=t.indexOf(",")+1,s.size=Math.floor(.75*(r-i)),e()},s.readUint8Array=function(s,r,o){var n,a=A(r),l=4*Math.floor(s/3),h=4*Math.ceil((s+r)/3),c=e.atob(t.substring(l+i,h+i)),u=s-3*Math.floor(l/4);for(n=u;ne.size)throw new RangeError("offset:"+t+", length:"+i+", size:"+e.size);return e.slice?e.slice(t,t+i):e.webkitSlice?e.webkitSlice(t,t+i):e.mozSlice?e.mozSlice(t,t+i):e.msSlice?e.msSlice(t,t+i):void 0}(e,t,i))}catch(e){r(e)}}}function p(){}function f(e){var i,s=this;s.init=function(e){i=new Blob([],{type:n}),e()},s.writeUint8Array=function(e,s){i=new Blob([i,t?e:e.buffer],{type:n}),s()},s.getData=function(t,s){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=s,r.readAsText(i,e)}}function g(t){var i=this,s="",r="";i.init=function(e){s+="data:"+(t||"")+";base64,",e()},i.writeUint8Array=function(t,i){var o,n=r.length,a=r;for(r="",o=0;o<3*Math.floor((n+t.length)/3)-n;o++)a+=String.fromCharCode(t[o]);for(;o2?s+=e.btoa(a):r=a,i()},i.getData=function(t){t(s+e.btoa(r))}}function m(e){var i,s=this;s.init=function(t){i=new Blob([],{type:e}),t()},s.writeUint8Array=function(s,r){i=new Blob([i,t?s:s.buffer],{type:e}),r()},s.getData=function(e){e(i)}}function _(e,t,i,s,r,n,a,l,A,h){var c,u,d,p=0,f=t.sn;function g(){e.removeEventListener("message",m,!1),l(u,d)}function m(t){var i=t.data,r=i.data,o=i.error;if(o)return o.toString=function(){return"Error: "+this.message},void A(o);if(i.sn===f)switch("number"==typeof i.codecTime&&(e.codecTime+=i.codecTime),"number"==typeof i.crcTime&&(e.crcTime+=i.crcTime),i.type){case"append":r?(u+=r.length,s.writeUint8Array(r,(function(){_()}),h)):_();break;case"flush":d=i.crc,r?(u+=r.length,s.writeUint8Array(r,(function(){g()}),h)):g();break;case"progress":a&&a(c+i.loaded,n);break;case"importScripts":case"newTask":case"echo":break;default:console.warn("zip.js:launchWorkerProcess: unknown message: ",i)}}function _(){(c=p*o)<=n?i.readUint8Array(r+c,Math.min(o,n-c),(function(i){a&&a(c,n);var s=0===c?t:{sn:f};s.type="append",s.data=i;try{e.postMessage(s,[i.buffer])}catch(t){e.postMessage(s)}p++}),A):e.postMessage({sn:f,type:"flush"})}u=0,e.addEventListener("message",m,!1),_()}function v(e,t,i,s,r,n,l,A,h,c){var u,d=0,p=0,f="input"===n,g="output"===n,m=new a;!function n(){var a;if((u=d*o)127?r[i-128]:String.fromCharCode(i);return s}function x(e){return decodeURIComponent(escape(e))}function B(e){var t,i="";for(t=0;t>16,i=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&i)>>11,(2016&i)>>5,2*(31&i),0)}catch(e){}}(e.lastModDateRaw),1!=(1&e.bitFlag)?((s||8!=(8&e.bitFlag))&&(e.crc32=t.view.getUint32(i+10,!0),e.compressedSize=t.view.getUint32(i+14,!0),e.uncompressedSize=t.view.getUint32(i+18,!0)),4294967295!==e.compressedSize&&4294967295!==e.uncompressedSize?(e.filenameLength=t.view.getUint16(i+22,!0),e.extraFieldLength=t.view.getUint16(i+24,!0)):r("File is using Zip64 (4gb+ file size).")):r("File contains encrypted entry.")}function P(t,o,n){var a=0;function l(){}l.prototype.getData=function(s,o,l,h){var c=this;function u(e,t){h&&!function(e){var t=A(4);return t.view.setUint32(0,e),c.crc32==t.view.getUint32(0)}(t)?n("CRC failed."):s.getData((function(e){o(e)}))}function d(e){n(e||r)}function p(e){n(e||"Error while writing file data.")}t.readUint8Array(c.offset,30,(function(r){var o,f=A(r.length,r);1347093252==f.view.getUint32(0)?(w(c,f,4,!1,n),o=c.offset+30+c.filenameLength+c.extraFieldLength,s.init((function(){0===c.compressionMethod?b(c._worker,a++,t,s,o,c.compressedSize,h,u,l,d,p):function(t,i,s,r,o,n,a,l,A,h,c){var u=a?"output":"none";e.zip.useWebWorkers?_(t,{sn:i,codecClass:"Inflater",crcType:u},s,r,o,n,A,l,h,c):v(new e.zip.Inflater,s,r,o,n,u,A,l,h,c)}(c._worker,a++,t,s,o,c.compressedSize,h,u,l,d,p)}),p)):n(i)}),d)};var h={getEntries:function(e){var r=this._worker;!function(e){t.size<22?n(i):r(22,(function(){r(Math.min(65558,t.size),(function(){n(i)}))}));function r(i,r){t.readUint8Array(t.size-i,i,(function(t){for(var i=t.length-22;i>=0;i--)if(80===t[i]&&75===t[i+1]&&5===t[i+2]&&6===t[i+3])return void e(new DataView(t.buffer,i,22));r()}),(function(){n(s)}))}}((function(o){var a,h;a=o.getUint32(16,!0),h=o.getUint16(8,!0),a<0||a>=t.size?n(i):t.readUint8Array(a,t.size-a,(function(t){var s,o,a,c,u=0,d=[],p=A(t.length,t);for(s=0;s>>8^i[255&(t^e[s])];this.crc=t},a.prototype.get=function(){return~this.crc},a.prototype.table=function(){var e,t,i,s=[];for(e=0;e<256;e++){for(i=e,t=0;t<8;t++)1&i?i=i>>>1^3988292384:i>>>=1;s[e]=i}return s}(),l.prototype.append=function(e,t){return e},l.prototype.flush=function(){},c.prototype=new h,c.prototype.constructor=c,u.prototype=new h,u.prototype.constructor=u,d.prototype=new h,d.prototype.constructor=d,p.prototype.getData=function(e){e(this.data)},f.prototype=new p,f.prototype.constructor=f,g.prototype=new p,g.prototype.constructor=g,m.prototype=new p,m.prototype.constructor=m;var F={deflater:["z-worker.js","deflate.js"],inflater:["z-worker.js","inflate.js"]};function I(t,i,s){if(null===e.zip.workerScripts||null===e.zip.workerScriptsPath){var r;if(e.zip.workerScripts){if(r=e.zip.workerScripts[t],!Array.isArray(r))return void s(new Error("zip.workerScripts."+t+" is not an array!"));r=function(e){var t=document.createElement("a");return e.map((function(e){return t.href=e,t.href}))}(r)}else(r=F[t].slice(0))[0]=(e.zip.workerScriptsPath||"")+r[0];var o=new Worker(r[0]);o.codecTime=o.crcTime=0,o.postMessage({type:"importScripts",scripts:r.slice(1)}),o.addEventListener("message",(function e(t){var r=t.data;if(r.error)return o.terminate(),void s(r.error);"importScripts"===r.type&&(o.removeEventListener("message",e),o.removeEventListener("error",n),i(o))})),o.addEventListener("error",n)}else s(new Error("Either zip.workerScripts or zip.workerScriptsPath may be set, not both."));function n(e){o.terminate(),s(e)}}function D(e){console.error(e)}e.zip={Reader:h,Writer:p,BlobReader:d,Data64URIReader:u,TextReader:c,BlobWriter:m,Data64URIWriter:g,TextWriter:f,createReader:function(e,t,i){i=i||D,e.init((function(){P(e,t,i)}),i)},createWriter:function(e,t,i,s){i=i||D,s=!!s,e.init((function(){E(e,t,i,s)}),i)},useWebWorkers:!0,workerScriptsPath:null,workerScripts:null}}(dP);const pP=dP.zip;!function(e){var t,i,s=e.Reader,r=e.Writer;try{i=0===new Blob([new DataView(new ArrayBuffer(0))]).size}catch(e){}function o(e){var t=this;function i(i,s){var r;t.data?i():((r=new XMLHttpRequest).addEventListener("load",(function(){t.size||(t.size=Number(r.getResponseHeader("Content-Length"))||Number(r.response.byteLength)),t.data=new Uint8Array(r.response),i()}),!1),r.addEventListener("error",s,!1),r.open("GET",e),r.responseType="arraybuffer",r.send())}t.size=0,t.init=function(s,r){if(function(e){var t=document.createElement("a");return t.href=e,"http:"===t.protocol||"https:"===t.protocol}(e)){var o=new XMLHttpRequest;o.addEventListener("load",(function(){t.size=Number(o.getResponseHeader("Content-Length")),t.size?s():i(s,r)}),!1),o.addEventListener("error",r,!1),o.open("HEAD",e),o.send()}else i(s,r)},t.readUint8Array=function(e,s,r,o){i((function(){r(new Uint8Array(t.data.subarray(e,e+s)))}),o)}}function n(e){var t=this;t.size=0,t.init=function(i,s){var r=new XMLHttpRequest;r.addEventListener("load",(function(){t.size=Number(r.getResponseHeader("Content-Length")),"bytes"==r.getResponseHeader("Accept-Ranges")?i():s("HTTP Range not supported.")}),!1),r.addEventListener("error",s,!1),r.open("HEAD",e),r.send()},t.readUint8Array=function(t,i,s,r){!function(t,i,s,r){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="arraybuffer",o.setRequestHeader("Range","bytes="+t+"-"+(t+i-1)),o.addEventListener("load",(function(){s(o.response)}),!1),o.addEventListener("error",r,!1),o.send()}(t,i,(function(e){s(new Uint8Array(e))}),r)}}function a(e){var t=this;t.size=0,t.init=function(i,s){t.size=e.byteLength,i()},t.readUint8Array=function(t,i,s,r){s(new Uint8Array(e.slice(t,t+i)))}}function l(){var e,t=this;t.init=function(t,i){e=new Uint8Array,t()},t.writeUint8Array=function(t,i,s){var r=new Uint8Array(e.length+t.length);r.set(e),r.set(t,e.length),e=r,i()},t.getData=function(t){t(e.buffer)}}function A(e,t){var s,r=this;r.init=function(t,i){e.createWriter((function(e){s=e,t()}),i)},r.writeUint8Array=function(e,r,o){var n=new Blob([i?e:e.buffer],{type:t});s.onwrite=function(){s.onwrite=null,r()},s.onerror=o,s.write(n)},r.getData=function(t){e.file(t)}}o.prototype=new s,o.prototype.constructor=o,n.prototype=new s,n.prototype.constructor=n,a.prototype=new s,a.prototype.constructor=a,l.prototype=new r,l.prototype.constructor=l,A.prototype=new r,A.prototype.constructor=A,e.FileWriter=A,e.HttpReader=o,e.HttpRangeReader=n,e.ArrayBufferReader=a,e.ArrayBufferWriter=l,e.fs&&((t=e.fs.ZipDirectoryEntry).prototype.addHttpContent=function(i,s,r){return function(i,s,r,o){if(i.directory)return o?new t(i.fs,s,r,i):new e.fs.ZipFileEntry(i.fs,s,r,i);throw"Parent entry is not a directory."}(this,i,{data:s,Reader:r?n:o})},t.prototype.importHttpContent=function(e,t,i,s){this.importZip(t?new n(e):new o(e),i,s)},e.fs.FS.prototype.importHttpContent=function(e,i,s,r){this.entries=[],this.root=new t(this),this.root.importHttpContent(e,i,s,r)})}(pP);const fP=["4.2"];class gP{constructor(e,t={}){this.supportedSchemas=fP,this._xrayOpacity=.7,this._src=null,this._options=t,this.viewpoint=null,t.workerScriptsPath?(pP.workerScriptsPath=t.workerScriptsPath,this.src=t.src,this.xrayOpacity=.7,this.displayEffect=t.displayEffect,this.createMetaModel=t.createMetaModel):e.error("Config expected: workerScriptsPath")}load(e,t,i,s,r,o){switch(s.materialType){case"MetallicMaterial":t._defaultMaterial=new vs(t,{baseColor:[1,1,1],metallic:.6,roughness:.6});break;case"SpecularMaterial":t._defaultMaterial=new xs(t,{diffuse:[1,1,1],specular:c.vec3([1,1,1]),glossiness:.5});break;default:t._defaultMaterial=new Xt(t,{reflectivity:.75,shiness:100,diffuse:[1,1,1]})}t._wireframeMaterial=new gs(t,{color:[0,0,0],lineWidth:2});var n=t.scene.canvas.spinner;n.processes++,mP(e,t,i,s,(function(){n.processes--,r&&r(),t.fire("loaded",!0,!1)}),(function(e){n.processes--,t.error(e),o&&o(e),t.fire("error",e)}),(function(e){console.log("Error, Will Robinson: "+e)}))}}var mP=function(e,t,i,s,r,o){!function(e,t,i){var s=new PP;s.load(e,(function(){t(s)}),(function(e){i("Error loading ZIP archive: "+e)}))}(i,(function(i){_P(e,i,s,t,r,o)}),o)},_P=function(){return function(t,i,s,r,o){var n={plugin:t,zip:i,edgeThreshold:30,materialType:s.materialType,scene:r.scene,modelNode:r,info:{references:{}},materials:{}};s.createMetaModel&&(n.metaModelData={modelId:r.id,metaObjects:[{name:r.id,type:"Default",id:r.id}]}),r.scene.loading++,function(t,i){t.zip.getFile("Manifest.xml",(function(s,r){for(var o=r.children,n=0,a=o.length;n0){for(var n=o.trim().split(" "),a=new Int16Array(n.length),l=0,A=0,h=n.length;A0){i.primitive="triangles";for(var o=[],n=0,a=r.length;n=t.length)i();else{var a=t[o].id,l=a.lastIndexOf(":");l>0&&(a=a.substring(l+1));var A=a.lastIndexOf("#");A>0&&(a=a.substring(0,A)),s[a]?r(o+1):function(e,t,i){e.zip.getFile(t,(function(t,s){!function(e,t,i){for(var s,r=t.children,o=0,n=r.length;o0)for(var s=0,r=t.length;s-1?e+"&_="+t:e+"?_="+t}getIFC(e,t,i){e=this._cacheBusterURL(e);var s=()=>{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n-1?e+"&_="+t:e+"?_="+t}getLAS(e,t,i){e=this._cacheBusterURL(e);var s=()=>{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n{let t=0,i=0,s=0;const r=new DataView(e),o=new Uint8Array(6e3),n=({item:s,format:o,size:n})=>{let a,l;switch(o){case"char":return l=new Uint8Array(e,t,n),t+=n,a=LP(l),[s,a];case"uShort":return a=r.getUint16(t,!0),t+=n,[s,a];case"uLong":return a=r.getUint32(t,!0),"NumberOfVariableLengthRecords"===s&&(i=a),t+=n,[s,a];case"uChar":return a=r.getUint8(t),t+=n,[s,a];case"double":return a=r.getFloat64(t,!0),t+=n,[s,a];default:t+=n}};return(()=>{const e={};IP.forEach((t=>{const i=n({...t});if(void 0!==i){if("FileSignature"===i[0]&&"LASF"!==i[1])throw new Error("Ivalid FileSignature. Is this a LAS/LAZ file");e[i[0]]=i[1]}}));const r=[];let a=i;for(;a--;){const e={};DP.forEach((i=>{const r=n({...i});e[r[0]]=r[1],"UserId"===r[0]&&"LASF_Projection"===r[1]&&(s=t-18+54)})),r.push(e)}const l=(e=>{if(void 0===e)return;const t=s+e.RecordLengthAfterHeader,i=o.slice(s,t),r=TP(i),n=new DataView(r);let a=6,l=Number(n.getUint16(a,!0));const A=[];for(;l--;){const e={};e.key=n.getUint16(a+=2,!0),e.tiffTagLocation=n.getUint16(a+=2,!0),e.count=n.getUint16(a+=2,!0),e.valueOffset=n.getUint16(a+=2,!0),A.push(e)}const h=A.find((e=>3072===e.key));if(h&&h.hasOwnProperty("valueOffset"))return h.valueOffset})(r.find((e=>"LASF_Projection"===e.UserId)));return l&&(e.epsg=l),e})()},TP=e=>{let t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let t=0;t{let t="";return e.forEach((e=>{let i=String.fromCharCode(e);"\0"!==i&&(t+=i)})),t.trim()};function RP(e,t){if(t>=e.length)return[e];let i=[];for(let s=0;s-1?e+"&_="+t:e+"?_="+t}getCityJSON(e,t,i){_.loadJSON(this._cacheBusterURL(e),(e=>{t(e)}),(function(e){i(e)}))}}function kP(e,t,i){i=i||2;var s,r,o,n,a,l,A,h=t&&t.length,c=h?t[0]*i:e.length,u=OP(e,0,c,i,!0),d=[];if(!u||u.next===u.prev)return d;if(h&&(u=function(e,t,i,s){var r,o,n,a=[];for(r=0,o=t.length;r80*i){s=o=e[0],r=n=e[1];for(var p=i;po&&(o=a),l>n&&(n=l);A=0!==(A=Math.max(o-s,n-r))?1/A:0}return QP(u,d,i,s,r,A),d}function OP(e,t,i,s,r){var o,n;if(r===lC(e,t,i,s)>0)for(o=t;o=t;o-=s)n=oC(o,e[o],e[o+1],n);return n&&$P(n,n.next)&&(nC(n),n=n.next),n}function NP(e,t){if(!e)return e;t||(t=e);var i,s=e;do{if(i=!1,s.steiner||!$P(s,s.next)&&0!==qP(s.prev,s,s.next))s=s.next;else{if(nC(s),(s=t=s.prev)===s.next)break;i=!0}}while(i||s!==t);return t}function QP(e,t,i,s,r,o,n){if(e){!n&&o&&function(e,t,i,s){var r=e;do{null===r.z&&(r.z=XP(r.x,r.y,t,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,i,s,r,o,n,a,l,A=1;do{for(i=e,e=null,o=null,n=0;i;){for(n++,s=i,a=0,t=0;t0||l>0&&s;)0!==a&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;i=s}o.nextZ=null,A*=2}while(n>1)}(r)}(e,s,r,o);for(var a,l,A=e;e.prev!==e.next;)if(a=e.prev,l=e.next,o?HP(e,s,r,o):VP(e))t.push(a.i/i),t.push(e.i/i),t.push(l.i/i),nC(e),e=l.next,A=l.next;else if((e=l)===A){n?1===n?QP(e=jP(NP(e),t,i),t,i,s,r,o,2):2===n&&GP(e,t,i,s,r,o):QP(NP(e),t,i,s,r,o,1);break}}}function VP(e){var t=e.prev,i=e,s=e.next;if(qP(t,i,s)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(YP(t.x,t.y,i.x,i.y,s.x,s.y,r.x,r.y)&&qP(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function HP(e,t,i,s){var r=e.prev,o=e,n=e.next;if(qP(r,o,n)>=0)return!1;for(var a=r.xo.x?r.x>n.x?r.x:n.x:o.x>n.x?o.x:n.x,h=r.y>o.y?r.y>n.y?r.y:n.y:o.y>n.y?o.y:n.y,c=XP(a,l,t,i,s),u=XP(A,h,t,i,s),d=e.prevZ,p=e.nextZ;d&&d.z>=c&&p&&p.z<=u;){if(d!==e.prev&&d!==e.next&&YP(r.x,r.y,o.x,o.y,n.x,n.y,d.x,d.y)&&qP(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==e.prev&&p!==e.next&&YP(r.x,r.y,o.x,o.y,n.x,n.y,p.x,p.y)&&qP(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==e.prev&&d!==e.next&&YP(r.x,r.y,o.x,o.y,n.x,n.y,d.x,d.y)&&qP(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=u;){if(p!==e.prev&&p!==e.next&&YP(r.x,r.y,o.x,o.y,n.x,n.y,p.x,p.y)&&qP(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function jP(e,t,i){var s=e;do{var r=s.prev,o=s.next.next;!$P(r,o)&&eC(r,s,s.next,o)&&sC(r,o)&&sC(o,r)&&(t.push(r.i/i),t.push(s.i/i),t.push(o.i/i),nC(s),nC(s.next),s=e=o),s=s.next}while(s!==e);return NP(s)}function GP(e,t,i,s,r,o){var n=e;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&ZP(n,a)){var l=rC(n,a);return n=NP(n,n.next),l=NP(l,l.next),QP(n,t,i,s,r,o),void QP(l,t,i,s,r,o)}a=a.next}n=n.next}while(n!==e)}function zP(e,t){return e.x-t.x}function WP(e,t){if(t=function(e,t){var i,s=t,r=e.x,o=e.y,n=-1/0;do{if(o<=s.y&&o>=s.next.y&&s.next.y!==s.y){var a=s.x+(o-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(a<=r&&a>n){if(n=a,a===r){if(o===s.y)return s;if(o===s.next.y)return s.next}i=s.x=s.x&&s.x>=h&&r!==s.x&&YP(oi.x||s.x===i.x&&KP(i,s)))&&(i=s,u=l)),s=s.next}while(s!==A);return i}(e,t),t){var i=rC(t,e);NP(t,t.next),NP(i,i.next)}}function KP(e,t){return qP(e.prev,e,t.prev)<0&&qP(t.next,e,e.next)<0}function XP(e,t,i,s,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-s)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function JP(e){var t=e,i=e;do{(t.x=0&&(e-n)*(s-a)-(i-n)*(t-a)>=0&&(i-n)*(o-a)-(r-n)*(s-a)>=0}function ZP(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&eC(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(sC(e,t)&&sC(t,e)&&function(e,t){var i=e,s=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==e);return s}(e,t)&&(qP(e.prev,e,t.prev)||qP(e,t.prev,t))||$P(e,t)&&qP(e.prev,e,e.next)>0&&qP(t.prev,t,t.next)>0)}function qP(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function $P(e,t){return e.x===t.x&&e.y===t.y}function eC(e,t,i,s){var r=iC(qP(e,t,i)),o=iC(qP(e,t,s)),n=iC(qP(i,s,e)),a=iC(qP(i,s,t));return r!==o&&n!==a||(!(0!==r||!tC(e,i,t))||(!(0!==o||!tC(e,s,t))||(!(0!==n||!tC(i,e,s))||!(0!==a||!tC(i,t,s)))))}function tC(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function iC(e){return e>0?1:e<0?-1:0}function sC(e,t){return qP(e.prev,e,e.next)<0?qP(e,t,e.next)>=0&&qP(e,e.prev,t)>=0:qP(e,t,e.prev)<0||qP(e,e.next,t)<0}function rC(e,t){var i=new aC(e.i,e.x,e.y),s=new aC(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=r,r.prev=i,s.next=i,i.prev=s,o.next=s,s.prev=o,s}function oC(e,t,i,s){var r=new aC(e,t,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function nC(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function aC(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function lC(e,t,i,s){for(var r=0,o=t,n=i-s;o0&&(s+=e[r-1].length,i.holes.push(s))}return i};const AC=c.vec2(),hC=c.vec3(),cC=c.vec3(),uC=c.vec3();class dC{constructor(e={}){this.cacheBuster=!1!==e.cacheBuster}_cacheBusterURL(e){if(!this.cacheBuster)return e;const t=(new Date).getTime();return e.indexOf("?")>-1?e+"&_="+t:e+"?_="+t}getDotBIM(e,t,i){_.loadJSON(this._cacheBusterURL(e),(e=>{t(e)}),(function(e){i(e)}))}}const pC=function(e){const t=t=>parseInt(e.substr(t+1,2),16)/255;return[t(0),t(2),t(4)]},fC=function(e){const t=[];for(let i=0;i=0?h:2*Math.PI-h}return r(e[0]-i[0])*(t[1]-i[1])-(t[0]-i[0])*(e[1]-i[1]);return(t,i,s,r)=>{const o=e(t,i,s),n=e(t,s,r),a=e(t,r,i);return!((o<0||n<0||a<0)&&(o>0||n>0||a>0))}}(),r=[],o=(i?t:t.slice(0).reverse()).map((e=>({idx:e})));o.forEach(((e,t)=>{e.prev=o[(t-1+o.length)%o.length],e.next=o[(t+1)%o.length]}));const n=c.vec2(),a=c.vec2();for(;o.length>2;){let t=0;for(;;){if(t>=o.length)throw`isCCW = ${i}; earIdx = ${t}; len = ${o.length}`;const r=o[t],l=e[r.prev.idx],A=e[r.idx],h=e[r.next.idx];if(c.subVec2(l,A,n),c.subVec2(h,A,a),n[0]*a[1]-n[1]*a[0]>=0&&o.every((t=>t===r||t===r.prev||t===r.next||!s(e[t.idx],l,A,h))))break;++t}const l=o[t];o.splice(t,1),r.push([l.idx,l.next.idx,l.prev.idx]);l.prev.next=l.next;l.next.prev=l.prev}return[e,r]},gC=function(e,t){const i=e.canvas.canvas,s=i.parentNode,r=document.createElement("div");s.insertBefore(r,i);let o=5;r.style.background=t,r.style.border="2px solid white",r.style.margin="0 0",r.style.zIndex="100",r.style.position="absolute",r.style.pointerEvents="none",r.style.display="none";const n=new Ae(e,{}),a=e=>e+"px",l=function(){const e=n.canvasPos.slice();ce(i,s,e),r.style.left=a(e[0]-3-o/2),r.style.top=a(e[1]-3-o/2),r.style.borderRadius=a(2*o),r.style.width=a(o),r.style.height=a(o)},A=e.camera.on("viewMatrix",l),h=e.camera.on("projMatrix",l);return{update:function(e){e&&(n.worldPos=e,l()),r.style.display=e?"":"none"},setHighlighted:function(e){o=e?10:5,l()},getCanvasPos:()=>n.canvasPos,getWorldPos:()=>n.worldPos,destroy:function(){r.parentNode.removeChild(r),e.camera.off(A),e.camera.off(h),n.destroy()}}},mC=function(e,t,i){let s=null;const r=r=>{if(r){s&&s.destroy();try{const[o,n]=fC(r.map((e=>[e[0],e[2]]))),a=[].concat(...o.map((e=>[e[0],r[0][1],e[1]]))),l=[].concat(...n);s=new $i(e,{pickable:!1,geometry:new jt(e,{positions:a,indices:l,normals:c.buildNormals(a,l)}),material:new Xt(e,{alpha:void 0!==i?i:.5,backfaces:!0,diffuse:pC(t)})})}catch(e){s=null}}s&&(s.visible=!!r)};return r(null),{updateBase:r,destroy:()=>s&&s.destroy()}},_C=function(e,t,i,s,r,o,n,a,l){const A=gC(e,s),h=gC(e,s),u=mC(e,s,r),d=o?function(e){o.visible=!!e,e&&(o.canvasPos=e)}:()=>{};let p=a((()=>{d(null),A.update(null)}),((e,t)=>{d(e),A.update(t)}),(function(e,o){A.update(o),p=a((function(){d(null),h.update(null),u.updateBase(null)}),(function(e,t){if(d(e),h.update(t),c.distVec3(o,t)>.01){const e=e=>Math.min(o[e],t[e]),i=e=>Math.max(o[e],t[e]),s=e(0),r=e(1),n=e(2),a=i(0);i(1);const l=i(2);u.updateBase([[s,r,l],[a,r,l],[a,r,n],[s,r,n]])}else u.updateBase(null)}),(function(e,a){h.update(a),A.destroy(),h.destroy(),u.destroy(),d(null);const p=e=>Math.min(o[e],a[e]),f=e=>Math.max(o[e],a[e]),g=p(0),m=p(2),_=f(0),v=f(2),b=n.createZone({id:c.createUUID(),geometry:{planeCoordinates:[[g,v],[_,v],[_,m],[g,m]],altitude:t,height:i},alpha:r,color:s});l(b)}))}));return{deactivate:function(){p(),A.destroy(),h.destroy(),u.destroy(),d(null)}}},vC=function(e,t){return function(i,s,r){const o=e.scene,n=o.canvas.canvas,a=(e,t)=>(t[0]=e.clientX,t[1]=e.clientY,ce(n.ownerDocument.body,n,t),t),l=e=>{const i=c.vec3(),s=c.vec3();return c.canvasPosToWorldRay(n,o.camera.viewMatrix,o.camera.projMatrix,o.camera.projection,e,i,s),t(i,s)};let A=!1;const h=function(){A=!1},u=function(){h(),n.removeEventListener("mousedown",p),n.removeEventListener("mousemove",f),e.cameraControl.off(g),n.removeEventListener("mouseup",m)},d=c.vec2(),p=function(e){1===e.which&&(a(e,d),A=!0)};n.addEventListener("mousedown",p);const f=function(e){const t=a(e,c.vec2());A&&c.distVec2(d,t)>20&&(h(),i())};n.addEventListener("mousemove",f);const g=e.cameraControl.on("rayMove",(e=>{const t=e.canvasPos;s(t,l(t))})),m=function(e){if(1===e.which&&A){u();const t=a(e,c.vec2());r(t,l(t))}};return n.addEventListener("mouseup",m),u}},bC=function(e,t,i){return function(s,r,o){const n=e.scene,a=n.canvas.canvas,l=(e,t)=>(t[0]=e.clientX,t[1]=e.clientY,ce(a.ownerDocument.body,a,t),t),A=e=>{const t=c.vec3(),s=c.vec3();return c.canvasPosToWorldRay(a,n.camera.viewMatrix,n.camera.projMatrix,n.camera.projection,e,t,s),i(t,s)};let h=null;const u=()=>{};let d,p=u;const f=function(){t.stop(),clearTimeout(h),e.cameraControl.active=!0,p=u,d=null},g=function(){f(),a.removeEventListener("touchstart",m),a.removeEventListener("touchmove",_),a.removeEventListener("touchend",v)},m=function(i){const o=i.touches;if(1!==o.length)f(),s();else{const i=o[0],s=l(i,c.vec2());A(s)&&(d=i.identifier,p=e=>{c.distVec2(s,e)>20&&f()},h=setTimeout((function(){t.start(s),h=setTimeout((function(){t.stop(),e.cameraControl.active=!1,p=e=>{r(e,A(e))},p(s)}),300)}),250))}};a.addEventListener("touchstart",m,{passive:!0});const _=function(e){const t=[...e.changedTouches].find((e=>e.identifier===d));t&&p(l(t,c.vec2()))};a.addEventListener("touchmove",_,{passive:!0});const v=function(e){const t=[...e.changedTouches].find((e=>e.identifier===d));if(t){g();const e=l(t,c.vec2());o(e,A(e))}};return a.addEventListener("touchend",v,{passive:!0}),g}},yC=function(e,t,i,s){const r=-(c.dotVec3(i,t)-e)/c.dotVec3(s,t);{const e=c.vec3();return c.mulVec3Scalar(s,r,e),c.addVec3(i,e,e),e}};class xC extends D{constructor(e,t={}){if(super(e.viewer.scene,t),this.plugin=e,this._container=t.container,!this._container)throw"config missing: container";this._eventSubs={},this.plugin.viewer.scene,this._geometry=t.geometry,t.onMouseOver,t.onMouseLeave,t.onContextMenu,this._alpha="alpha"in t&&void 0!==t.alpha?t.alpha:.5,this.color=t.color,this._visible=!0,this._rebuildMesh()}_rebuildMesh(){const e=this.plugin.viewer.scene,t=this._geometry.planeCoordinates.slice(),i=this._geometry.height<0,s=this._geometry.altitude+(i?this._geometry.height:0),r=this._geometry.height*(i?-1:1),[o,n]=fC(t),a=[],l=[],A=e=>{const t=a.length;for(let t of o)a.push([t[0],s+(e?r:0),t[1]]);for(let i of n)l.push(...(e?i:i.slice(0).reverse()).map((e=>e+t)))};A(!1),A(!0);for(let e=0;ee+h)))}this._zoneMesh&&this._zoneMesh.destroy();const h=[].concat(...a);this._zoneMesh=new $i(e,{edges:this._edges,geometry:new jt(e,{positions:h,indices:l,normals:c.buildNormals(h,l)}),material:new Xt(e,{alpha:this._alpha,backfaces:!0,diffuse:pC(this._color)}),visible:this._visible}),this._zoneMesh.highlighted=this._highlighted,this._zoneMesh.zone=this;const u=e=>Math.min(...a.map((t=>t[e]))),d=e=>Math.max(...a.map((t=>t[e]))),p=u(0),f=u(1),g=u(2),m=d(0),_=d(1),v=d(2);this._center=c.vec3([(p+m)/2,(f+_)/2,(g+v)/2])}sectionedAverage(e){const t=this._geometry.planeCoordinates.slice();let i=[];{const e=this._geometry.height,s=this._geometry.altitude,r=s+Math.max(0,e),o=s+Math.min(0,e),n=e=>{const s=t.map((t=>[t[0],e?r:o,t[1]]));i.push(e?s:s.slice(0).reverse())};n(!0),n(!1);const a=(e,i)=>[t[e][0],i,t[e][1]];for(let e=0;ei?a:n;h|=A,u.push(A)}switch(h){case n:case a:o.push(t);break;case l:break;case A:const i=[];for(let o=0;o=3&&o.push(i)}}i=o}if(0===i.length)return null;{const e=c.vec3([0,0,0]),t=new Set;for(const s of i)for(const i of s){const s=i.map((e=>e.toFixed(3))).join(":");t.has(s)||(t.add(s),c.addVec3(e,i,e))}return c.mulVec3Scalar(e,1/t.size,e),e}}get center(){return this._center}get altitude(){return this._geometry.altitude}set altitude(e){this._geometry.altitude=e,this._rebuildMesh()}get height(){return this._geometry.height}set height(e){this._geometry.height=e,this._rebuildMesh()}get highlighted(){return this._highlighted}set highlighted(e){this._highlighted=e,this._zoneMesh&&(this._zoneMesh.highlighted=e)}set color(e){this._color=e,this._zoneMesh&&(this._zoneMesh.material.diffuse=pC(this._color))}get color(){return this._color}set alpha(e){this._alpha=e,this._zoneMesh&&(this._zoneMesh.material.alpha=this._alpha)}get alpha(){return this._alpha}get edges(){return this._edges}set edges(e){this._edges=e,this._zoneMesh&&(this._zoneMesh.edges=this._edges)}set visible(e){this._visible=!!e,this._zoneMesh.visible=this._visible,this._needUpdate()}get visible(){return this._visible}getJSON(){return{id:this.id,geometry:this._geometry,alpha:this._alpha,color:this._color}}duplicate(){return this.plugin.createZone({id:c.createUUID(),geometry:{planeCoordinates:this._geometry.planeCoordinates.map((e=>e.slice())),altitude:this._geometry.altitude,height:this._geometry.height},alpha:this._alpha,color:this._color})}destroy(){this._zoneMesh.destroy(),super.destroy()}}const BC=function(e,t,i,s,r,o,n,a,l){const A=o?function(e){o.visible=!!e,e&&(o.canvasPos=e)}:()=>{};let h;const u=[()=>A(null)],d=mC(e,s,r);return u.push((()=>d.destroy())),function o(p){const f=gC(e,s),g=p.length>0&&function(e,t,i){const s=e.canvas.canvas,r=new Ae(e,{});r.worldPos=i;const o=new Ae(e,{}),n=s.ownerDocument.body,a=new fe(n,{color:t,thickness:1,thicknessClickable:6});a.setVisible(!1);const l=function(){const e=r.canvasPos.slice(),t=o.canvasPos.slice();ce(s,n,e),ce(s,n,t),a.setStartAndEnd(e[0],e[1],t[0],t[1])},A=e.camera.on("viewMatrix",l),h=e.camera.on("projMatrix",l);return{update:function(e){e&&(o.worldPos=e,l()),a.setVisible(!!e)},destroy:function(){e.camera.off(A),e.camera.off(h),r.destroy(),o.destroy(),a.destroy()}}}(e,s,p[p.length-1].getWorldPos());u.push((()=>{f.destroy(),g&&g.destroy()}));const m=p.length>0&&p[0],_=function(e){const t=m&&m.getCanvasPos();return t&&c.distVec2(t,e)<10&&{canvasPos:t,worldPos:m.getWorldPos()}},v=function(){const e=(e,t,i)=>t[0]<=Math.max(e[0],i[0])&&t[0]>=Math.min(e[0],i[0])&&t[1]<=Math.max(e[1],i[1])&&t[1]>=Math.min(e[1],i[1]),t=(e,t,i)=>{const s=(t[1]-e[1])*(i[0]-t[0])-(t[0]-e[0])*(i[1]-t[1]);return 0===s?0:s>0?1:2};return function(i,s){const r=i[i.length-2],o=i[i.length-1];for(let n=s?1:0;n{A(null),f.update(null),g&&g.update(null),d.updateBase(p.length>2?p.map((e=>e.getWorldPos())):null)}),((e,t)=>{const i=p.length>2&&_(e);if(m&&m.setHighlighted(!!i),A(i?i.canvasPos:e),f.update(!i&&t),g&&g.update(i?i.worldPos:t),p.length>=2){const e=p.map((e=>e.getWorldPos())).concat(i?[]:[t]),s=v(e.map((e=>[e[0],e[2]])),i);d.updateBase(s?null:e)}else d.updateBase(null)}),(function(e,a){const A=p.length>2&&_(e),h=p.map((e=>e.getWorldPos())).concat(A?[]:[a]);d.updateBase(h);const m=h.map((e=>[e[0],e[2]]));p.length>2&&v(m,A)?(u.pop()(),o(p)):A?(f.update(a),u.forEach((e=>e())),l(n.createZone({id:c.createUUID(),geometry:{planeCoordinates:m,altitude:t,height:i},alpha:r,color:s}))):(f.update(a),g&&g.update(a),o(p.concat(f)))}))}([]),{closeSurface:function(){throw"TODO"},deactivate:function(){h(),u.forEach((e=>e()))}}};class wC extends D{constructor(e,t,i,s){const r=e.plugin.viewer,o=r.scene;super(o);const n=e._geometry.altitude,a=e._geometry.planeCoordinates.map((t=>{const i=o.canvas.canvas.ownerDocument.body,s=new ue(o,{},i,{fillColor:e._color});return s.worldPos=c.vec3([t[0],n,t[1]]),s.on("worldPos",(function(){t[0]=s.worldPos[0],t[1]=s.worldPos[2];try{e._rebuildMesh()}catch(t){e._zoneMesh&&(e._zoneMesh.destroy(),e._zoneMesh=null)}})),s})),l=pe({viewer:r,handleMouseEvents:i,handleTouchEvents:s,pointerLens:t&&t.pointerLens,dots:a,ray2WorldPos:(e,t)=>yC(n,c.vec3([0,1,0]),e,t),onEnd:(t,i)=>(e._zoneMesh&&this.fire("edited"),!!e._zoneMesh)}),A=function(){l(),a.forEach((e=>e.destroy()))},h=e.on("destroyed",A);this._deactivate=function(){e.off("destroyed",h),A()}}deactivate(){this._deactivate(),super.destroy()}}class PC extends D{constructor(e,t,i,s){const r=e.plugin.viewer,o=r.scene,n=o.canvas.canvas;super(o);const a=this,l=e._geometry.altitude,A=t&&t.pointerLens,h=A?function(e){A.visible=!!e,e&&(A.canvasPos=e)}:()=>{},u=e=>{const t=c.vec3(),i=c.vec3();return c.canvasPosToWorldRay(n,o.camera.viewMatrix,o.camera.projMatrix,o.camera.projection,e,t,i),s=t,r=i,yC(l,c.vec3([0,1,0]),s,r);var s,r},d=(e,t)=>(t[0]=e.clientX,t[1]=e.clientY,ce(n.ownerDocument.body,n,t),t),p=function(e,t){const i=e=>{e.preventDefault(),t(e)};return n.addEventListener(e,i),()=>n.removeEventListener(e,i)};let f=()=>{};const g=function(t,i,s,o){const l=o(t),A=d(l,c.vec2()),g=r.scene.pick({canvasPos:A,includeEntities:[e._zoneMesh.id]});if((g&&g.entity&&g.entity.zone)===e){f(),n.style.cursor="move",r.cameraControl.active=!1;const t=function(){const t=e._geometry.planeCoordinates.map((e=>e.slice())),i=u(A),s=c.vec2([i[0],i[2]]),r=c.vec2();return function(i){const o=u(i);r[0]=o[0],r[1]=o[2],c.subVec2(s,r,r),e._geometry.planeCoordinates.forEach(((e,i)=>{c.subVec2(t[i],r,e)}));try{e._rebuildMesh()}catch(t){e._zoneMesh&&(e._zoneMesh.destroy(),e._zoneMesh=null)}}}(),l=p(i,(function(e){const i=o(e);if(i){const e=d(i,c.vec2());t(e),h(e)}})),g=p(s,(function(e){const i=o(e);if(i){const e=d(i,c.vec2());t(e),h(null),f(),a.fire("translated")}}));f=function(){f=()=>{},n.style.cursor="default",r.cameraControl.active=!0,l(),g()}}},m=[];i&&m.push(p("mousedown",(e=>{1===e.which&&g(e,"mousemove","mouseup",(e=>1===e.which&&e))}))),s&&m.push(p("touchstart",(e=>{if(1===e.touches.length){const t=e.touches[0].identifier;g(e,"touchmove","touchend",(e=>[...e.changedTouches].find((e=>e.identifier===t))))}})));const _=function(){f(),m.forEach((e=>e())),h(null)},v=e.on("destroyed",_);this._deactivate=function(){e.off("destroyed",v),_()}}deactivate(){this._deactivate(),super.destroy()}}exports.AlphaFormat=1021,exports.AmbientLight=Dt,exports.AngleMeasurementEditMouseControl=class extends xe{constructor(e,t){super(e,t,!0,!1)}},exports.AngleMeasurementEditTouchControl=class extends xe{constructor(e,t){super(e,t,!1,!0)}},exports.AngleMeasurementsControl=be,exports.AngleMeasurementsMouseControl=ye,exports.AngleMeasurementsPlugin=class extends V{constructor(e,t={}){super("AngleMeasurements",e),this._container=t.container||document.body,this._defaultControl=null,this._measurements={},this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.defaultLabelsVisible=!1!==t.defaultLabelsVisible,this.zIndex=t.zIndex||1e4,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,angleMeasurement:t,measurement:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,angleMeasurement:t,measurement:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,angleMeasurement:t,measurement:t,event:e})}}getContainerElement(){return this._container}send(e,t){}get control(){return this._defaultControl||(this._defaultControl=new ye(this,{})),this._defaultControl}get measurements(){return this._measurements}createMeasurement(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=e.origin,i=e.corner,s=e.target,r=new ve(this,{id:e.id,plugin:this,container:this._container,origin:{entity:t.entity,worldPos:t.worldPos},corner:{entity:i.entity,worldPos:i.worldPos},target:{entity:s.entity,worldPos:s.worldPos},visible:e.visible,originVisible:!0,originWireVisible:!0,cornerVisible:!0,targetWireVisible:!0,targetVisible:!0,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[r.id]=r,r.on("destroyed",(()=>{delete this._measurements[r.id]})),r.clickable=!0,this.fire("measurementCreated",r),r}destroyMeasurement(e){const t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("AngleMeasurement not found: "+e)}setLabelsShown(e){for(const[t,i]of Object.entries(this.measurements))i.labelShown=e}clear(){const e=Object.keys(this._measurements);for(var t=0,i=e.length;t{this.plugin.viewer.cameraControl.active=!1},u=()=>{this.plugin.viewer.cameraControl.active=!0},d=()=>{o&&(clearTimeout(o),o=null),this._currentAngleMeasurement&&(this._currentAngleMeasurement.destroy(),this._currentAngleMeasurement=null),u(),this._touchState=0};i.addEventListener("touchstart",this._onCanvasTouchStart=i=>{const l=i.touches.length;if(1!==l)return void(o&&(clearTimeout(o),o=null));const u=i.touches[0],p=u.clientX,f=u.clientY;switch(n.set([p,f]),a.set([p,f]),this._touchState){case 0:if(1!==l&&null!==o)return void d();const i=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping});if(i&&i.snapped)s.set(i.worldPos),this.pointerCircle.start(i.snappedCanvasPos);else{const e=t.pick({canvasPos:a,pickSurface:!0});if(!e||!e.worldPos)return;s.set(e.worldPos),this.pointerCircle.start(e.canvasPos)}o=setTimeout((()=>{1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{this.pointerCircle.stop();const i=e.touches.length;if(1!==i||1!==e.changedTouches.length)return void(o&&(clearTimeout(o),o=null));const r=e.touches[0],n=r.clientX,l=r.clientY;if(r.identifier!==A)return;let h,c;switch(a.set([n,l]),this._touchState){case 2:this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.snapped?(this.pointerLens&&(this.pointerLens.snappedCanvasPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),s.set(h.worldPos),this._currentAngleMeasurement.origin.worldPos=h.worldPos):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),s.set(c.worldPos),this._currentAngleMeasurement.origin.worldPos=c.worldPos):this.pointerLens&&(this.pointerLens.cursorPos=null,this.pointerLens.snapped=!1)),this._touchState=2;break;case 5:if(1!==i&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentAngleMeasurement.corner.worldPos=h.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),this._currentAngleMeasurement.corner.worldPos=c.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1)),this._touchState=5;break;case 8:if(1!==i&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentAngleMeasurement.target.worldPos=h.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.angleVisible=!0):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),this._currentAngleMeasurement.target.worldPos=c.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.angleVisible=!0)),this._touchState=8}}),{passive:!0}),i.addEventListener("touchend",this._onCanvasTouchEnd=i=>{this.pointerCircle.stop();const s=i.changedTouches.length;if(1!==s)return;const h=i.changedTouches[0],d=h.clientX,p=h.clientY;if(h.identifier===A)switch(o&&(clearTimeout(o),o=null),l.set([d,p]),this._touchState){case 1:{if(1!==s||d>n[0]+r||dn[1]+r||pn[0]+r||dn[1]+r||pn[0]+r||dn[1]+r||p",this._markerHTML=t.markerHTML||"
",this._container=t.container||document.body,this._values=t.values||{},this.annotations={},this.surfaceOffset=t.surfaceOffset}getContainerElement(){return this._container}send(e,t){if("clearAnnotations"===e)this.clear()}set surfaceOffset(e){null==e&&(e=.3),this._surfaceOffset=e}get surfaceOffset(){return this._surfaceOffset}createAnnotation(e){this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);var t=null;e.markerElementId&&((t=document.getElementById(e.markerElementId))||this.error("Can't find DOM element for 'markerElementId' value '"+e.markerElementId+"' - defaulting to internally-generated empty DIV"));var i=null;e.labelElementId&&((i=document.getElementById(e.labelElementId))||this.error("Can't find DOM element for 'labelElementId' value '"+e.labelElementId+"' - defaulting to internally-generated empty DIV"));const s=new Ce(this.viewer.scene,{id:e.id,plugin:this,container:this._container,markerElement:t,labelElement:i,markerHTML:e.markerHTML||this._markerHTML,labelHTML:e.labelHTML||this._labelHTML,occludable:e.occludable,values:_.apply(e.values,_.apply(this._values,{})),markerShown:e.markerShown,labelShown:e.labelShown,eye:e.eye,look:e.look,up:e.up,projection:e.projection,visible:!1!==e.visible});return e.pickResult=e.pickResult||e.pickRecord,e.pickResult?s.setFromPickResult(e.pickResult):(s.entity=e.entity,s.worldPos=e.worldPos),this.annotations[s.id]=s,s.on("destroyed",(()=>{delete this.annotations[s.id],this.fire("annotationDestroyed",s.id)})),this.fire("annotationCreated",s.id),s}destroyAnnotation(e){var t=this.annotations[e];t?t.destroy():this.log("Annotation not found: "+e)}clear(){const e=Object.keys(this.annotations);for(var t=0,i=e.length;tp.has(e.id)||g.has(e.id)||f.has(e.id))).reduce(((e,i)=>{let s,r=function(e){let t="";return t+=Math.round(255*e[0]).toString(16).padStart(2,"0"),t+=Math.round(255*e[1]).toString(16).padStart(2,"0"),t+=Math.round(255*e[2]).toString(16).padStart(2,"0"),t}(i.colorize);i.xrayed?(s=0===t.xrayMaterial.fillAlpha&&0!==t.xrayMaterial.edgeAlpha?.1:t.xrayMaterial.fillAlpha,s=Math.round(255*s).toString(16).padStart(2,"0"),r=s+r):p.has(i.id)&&(s=Math.round(255*i.opacity).toString(16).padStart(2,"0"),r=s+r),e[r]||(e[r]=[]);const o=i.id,n=i.originalSystemId,a={ifc_guid:n,originating_system:this.originatingSystem};return n!==o&&(a.authoring_tool_id=o),e[r].push(a),e}),{}),_=Object.entries(m).map((([e,t])=>({color:e,components:t})));o.components.coloring=_;const v=t.objectIds,b=t.visibleObjects,y=t.visibleObjectIds,x=v.filter((e=>!b[e])),B=t.selectedObjectIds;return e.defaultInvisible||y.length0&&e.clipping_planes.forEach((function(e){let t=nh(e.location,th),i=nh(e.direction,th);A&&c.negateVec3(i),c.subVec3(t,l),r.yUp&&(t=lh(t),i=lh(i)),new os(s,{pos:t,dir:i})})),s.clearLines(),e.lines&&e.lines.length>0){const t=[],i=[];let r=0;e.lines.forEach((e=>{e.start_point&&e.end_point&&(t.push(e.start_point.x),t.push(e.start_point.y),t.push(e.start_point.z),t.push(e.end_point.x),t.push(e.end_point.y),t.push(e.end_point.z),i.push(r++),i.push(r++))})),new eh(s,{positions:t,indices:i,clippable:!1,collidable:!0})}if(s.clearBitmaps(),e.bitmaps&&e.bitmaps.length>0&&e.bitmaps.forEach((function(e){const t=e.bitmap_type||"jpg",i=e.bitmap_data;let o=nh(e.location,ih),n=nh(e.normal,sh),a=nh(e.up,rh),l=e.height||1;t&&i&&o&&n&&a&&(r.yUp&&(o=lh(o),n=lh(n),a=lh(a)),new Vs(s,{src:i,type:t,pos:o,normal:n,up:a,clippable:!1,collidable:!0,height:l}))})),a&&(s.setObjectsXRayed(s.xrayedObjectIds,!1),s.setObjectsHighlighted(s.highlightedObjectIds,!1),s.setObjectsSelected(s.selectedObjectIds,!1)),e.components){if(e.components.visibility){e.components.visibility.default_visibility?(s.setObjectsVisible(s.objectIds,!0),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((e=>this._withBCFComponent(t,e,(e=>e.visible=!1))))):(s.setObjectsVisible(s.objectIds,!1),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((e=>this._withBCFComponent(t,e,(e=>e.visible=!0)))));const r=e.components.visibility.view_setup_hints;r&&(!1===r.spaces_visible&&s.setObjectsVisible(i.metaScene.getObjectIDsByType("IfcSpace"),!1),void 0!==r.spaces_translucent&&s.setObjectsXRayed(i.metaScene.getObjectIDsByType("IfcSpace"),!0),r.space_boundaries_visible,!1===r.openings_visible&&s.setObjectsVisible(i.metaScene.getObjectIDsByType("IfcOpening"),!0),r.space_boundaries_translucent,void 0!==r.openings_translucent&&s.setObjectsXRayed(i.metaScene.getObjectIDsByType("IfcOpening"),!0))}e.components.selection&&(s.setObjectsSelected(s.selectedObjectIds,!1),e.components.selection.forEach((e=>this._withBCFComponent(t,e,(e=>e.selected=!0))))),e.components.translucency&&(s.setObjectsXRayed(s.xrayedObjectIds,!1),e.components.translucency.forEach((e=>this._withBCFComponent(t,e,(e=>e.xrayed=!0))))),e.components.coloring&&e.components.coloring.forEach((e=>{let i=e.color,s=0,r=!1;8===i.length&&(s=parseInt(i.substring(0,2),16)/256,s<=1&&s>=.95&&(s=1),i=i.substring(2),r=!0);const o=[parseInt(i.substring(0,2),16)/256,parseInt(i.substring(2,4),16)/256,parseInt(i.substring(4,6),16)/256];e.components.map((e=>this._withBCFComponent(t,e,(e=>{e.colorize=o,r&&(e.opacity=s)}))))}))}if(e.perspective_camera||e.orthogonal_camera){let a,A,h,u;if(e.perspective_camera?(a=nh(e.perspective_camera.camera_view_point,th),A=nh(e.perspective_camera.camera_direction,th),h=nh(e.perspective_camera.camera_up_vector,th),r.perspective.fov=e.perspective_camera.field_of_view,u="perspective"):(a=nh(e.orthogonal_camera.camera_view_point,th),A=nh(e.orthogonal_camera.camera_direction,th),h=nh(e.orthogonal_camera.camera_up_vector,th),r.ortho.scale=e.orthogonal_camera.view_to_world_scale,u="ortho"),c.subVec3(a,l),r.yUp&&(a=lh(a),A=lh(A),h=lh(h)),o){const e=s.pick({pickSurface:!0,origin:a,direction:A});A=e?e.worldPos:c.addVec3(a,A,th)}else A=c.addVec3(a,A,th);n?(r.eye=a,r.look=A,r.up=h,r.projection=u):i.cameraFlight.flyTo({eye:a,look:A,up:h,duration:t.duration,projection:u})}}_withBCFComponent(e,t,i){const s=this.viewer,r=s.scene;if(t.authoring_tool_id&&t.originating_system===this.originatingSystem){const o=t.authoring_tool_id,n=r.objects[o];if(n)return void i(n);if(e.updateCompositeObjects){if(s.metaScene.metaObjects[o])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(o),i)}}if(t.ifc_guid){const o=t.ifc_guid,n=r.objects[o];if(n)return void i(n);if(e.updateCompositeObjects){if(s.metaScene.metaObjects[o])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(o),i)}Object.keys(r.models).forEach((t=>{const n=c.globalizeObjectId(t,o),a=r.objects[n];if(a)i(a);else if(e.updateCompositeObjects){s.metaScene.metaObjects[n]&&r.withObjects(s.metaScene.getObjectIDsInSubtree(n),i)}}))}}destroy(){super.destroy()}},exports.Bitmap=Vs,exports.ByteType=1010,exports.CameraMemento=kh,exports.CameraPath=class extends D{get type(){return"CameraPath"}constructor(e,t={}){super(e,t),this._frames=[],this._eyeCurve=new bh(this),this._lookCurve=new bh(this),this._upCurve=new bh(this),t.frames&&(this.addFrames(t.frames),this.smoothFrameTimes(1))}get frames(){return this._frames}get eyeCurve(){return this._eyeCurve}get lookCurve(){return this._lookCurve}get upCurve(){return this._upCurve}saveFrame(e){const t=this.scene.camera;this.addFrame(e,t.eye,t.look,t.up)}addFrame(e,t,i,s){const r={t:e,eye:t.slice(0),look:i.slice(0),up:s.slice(0)};this._frames.push(r),this._eyeCurve.points.push(r.eye),this._lookCurve.points.push(r.look),this._upCurve.points.push(r.up)}addFrames(e){let t;for(let i=0,s=e.length;i1?1:e,t.eye=this._eyeCurve.getPoint(e,yh),t.look=this._lookCurve.getPoint(e,yh),t.up=this._upCurve.getPoint(e,yh)}sampleFrame(e,t,i,s){e=e<0?0:e>1?1:e,this._eyeCurve.getPoint(e,t),this._lookCurve.getPoint(e,i),this._upCurve.getPoint(e,s)}smoothFrameTimes(e){if(0===this._frames.length)return;const t=c.vec3();var i=0;this._frames[0].t=0;const s=[];for(let e=1,o=this._frames.length;e{this._parseModel(e,t,i,s),r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){if(s.destroyed)return;const r=e.transform?this._transformVertices(e.vertices,e.transform,i.rotateX):e.vertices,o=t.stats||{};o.sourceFormat=e.type||"CityJSON",o.schemaVersion=e.version||"",o.title="",o.author="",o.created="",o.numMetaObjects=0,o.numPropertySets=0,o.numObjects=0,o.numGeometries=0,o.numTriangles=0,o.numVertices=0;const n=!1!==t.loadMetadata,a=n?{id:c.createUUID(),name:"Model",type:"Model"}:null,l=n?{id:"",projectId:"",author:"",createdAt:"",schema:e.version||"",creatingApplication:"",metaObjects:[a],propertySets:[]}:null,A={data:e,vertices:r,sceneModel:s,loadMetadata:n,metadata:l,rootMetaObject:a,nextId:0,stats:o};if(this._parseCityJSON(A),s.finalize(),n){const e=s.id;this.viewer.metaScene.createMetaModel(e,A.metadata,i)}s.scene.once("tick",(()=>{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))}))}_transformVertices(e,t,i){const s=[],r=t.scale||c.vec3([1,1,1]),o=t.translate||c.vec3([0,0,0]);for(let t=0,n=0;t0))return;const o=[];for(let i=0,s=t.geometry.length;i0){const r=t[s[0]];if(void 0!==r.value)n=e[r.value];else{const t=r.values;if(t){a=[];for(let s=0,r=t.length;s0&&(s.createEntity({id:i,meshIds:o,isObject:!0}),e.stats.numObjects++)}_parseGeometrySurfacesWithOwnMaterials(e,t,i,s){switch(t.type){case"MultiPoint":case"MultiLineString":break;case"MultiSurface":case"CompositeSurface":const r=t.boundaries;this._parseSurfacesWithOwnMaterials(e,i,r,s);break;case"Solid":const o=t.boundaries;for(let t=0;t0&&h.push(A.length);const i=this._extractLocalIndices(e,a[t],u,d);A.push(...i)}if(3===A.length)d.indices.push(A[0]),d.indices.push(A[1]),d.indices.push(A[2]);else if(A.length>3){const e=[];for(let t=0;t0&&n.indices.length>0){const t=""+e.nextId++;r.createMesh({id:t,primitive:"triangles",positions:n.positions,indices:n.indices,color:i&&i.diffuseColor?i.diffuseColor:[.8,.8,.8],opacity:1}),s.push(t),e.stats.numGeometries++,e.stats.numVertices+=n.positions.length/3,e.stats.numTriangles+=n.indices.length/3}}_parseSurfacesWithSharedMaterial(e,t,i,s){const r=e.vertices;for(let o=0;o0&&a.push(n.length);const l=this._extractLocalIndices(e,t[o][r],i,s);n.push(...l)}if(3===n.length)s.indices.push(n[0]),s.indices.push(n[1]),s.indices.push(n[2]);else if(n.length>3){let e=[];for(let t=0;t{e.target.classList.contains("xeokit-context-menu-item")||this.hide()})),document.addEventListener("touchstart",this._canvasTouchStartHandler=e=>{e.target.classList.contains("xeokit-context-menu-item")||this.hide()})),e.items&&(this.items=e.items),this._hideOnAction=!1!==e.hideOnAction,this.context=e.context,this.enabled=!1!==e.enabled,this.hide()}on(e,t){let i=this._eventSubs[e];i||(i=[],this._eventSubs[e]=i),i.push(t)}fire(e,t){const i=this._eventSubs[e];if(i)for(let e=0,s=i.length;e{const o=this._getNextId(),n=new i(o);for(let i=0,o=e.length;i0,A=this._getNextId(),h=i.getTitle||(()=>i.title||""),c=i.doAction||i.callback||(()=>{}),u=i.getEnabled||(()=>!0),d=i.getShown||(()=>!0),p=new r(A,h,c,u,d);if(p.parentMenu=n,a.items.push(p),l){const e=t(s);p.subMenu=e,e.parentItem=p}this._itemList.push(p),this._itemMap[p.id]=p}}return this._menuList.push(n),this._menuMap[n.id]=n,n};this._rootMenu=t(e)}_getNextId(){return"ContextMenu_"+this._id+"_"+this._nextId++}_createUI(){const e=t=>{this._createMenuUI(t);const i=t.groups;for(let t=0,s=i.length;t'),i.push("
    "),t)for(let e=0,s=t.length;e'+l+" [MORE]"):i.push('
  • '+l+"
  • ")}}i.push("
"),i.push("");const s=i.join("");document.body.insertAdjacentHTML("beforeend",s);const r=document.querySelector("."+e.id);e.menuElement=r,r.style["border-radius"]="4px",r.style.display="none",r.style["z-index"]=3e5,r.style.background="white",r.style.border="1px solid black",r.style["box-shadow"]="0 4px 5px 0 gray",r.oncontextmenu=e=>{e.preventDefault()};const o=this;let n=null;if(t)for(let e=0,i=t.length;e{e.preventDefault();const i=t.subMenu;if(!i)return void(n&&(o._hideMenu(n.id),n=null));if(n&&n.id!==i.id&&(o._hideMenu(n.id),n=null),!1===t.enabled)return;const s=t.itemElement,r=i.menuElement,a=s.getBoundingClientRect();r.getBoundingClientRect();a.right+200>window.innerWidth?o._showMenu(i.id,a.left-200,a.top-1):o._showMenu(i.id,a.right-5,a.top-1),n=i})),s||(t.itemElement.addEventListener("click",(e=>{e.preventDefault(),o._context&&!1!==t.enabled&&(t.doAction&&t.doAction(o._context),this._hideOnAction?o.hide():(o._updateItemsTitles(),o._updateItemsEnabledStatus()))})),t.itemElement.addEventListener("mouseup",(e=>{3===e.which&&(e.preventDefault(),o._context&&!1!==t.enabled&&(t.doAction&&t.doAction(o._context),this._hideOnAction?o.hide():(o._updateItemsTitles(),o._updateItemsEnabledStatus())))})),t.itemElement.addEventListener("mouseenter",(e=>{e.preventDefault(),!1!==t.enabled&&t.doHover&&t.doHover(o._context)})))):console.error("ContextMenu item element not found: "+t.id)}}}_updateItemsTitles(){if(this._context)for(let e=0,t=this._itemList.length;ewindow.innerHeight&&(i=window.innerHeight-s),t+r>window.innerWidth&&(t=window.innerWidth-r),e.style.left=t+"px",e.style.top=i+"px"}_hideMenuElement(e){e.style.display="none"}},exports.CubicBezierCurve=class extends vh{constructor(e,t={}){super(e,t),this.v0=t.v0,this.v1=t.v1,this.v2=t.v2,this.v3=t.v3,this.t=t.t}set v0(e){this._v0=e||c.vec3([0,0,0])}get v0(){return this._v0}set v1(e){this._v1=e||c.vec3([0,0,0])}get v1(){return this._v1}set v2(e){this._v2=e||c.vec3([0,0,0])}get v2(){return this._v2}set v3(e){this.fire("v3",this._v3=e||c.vec3([0,0,0]))}get v3(){return this._v3}set t(e){e=e||0,this._t=e<0?0:e>1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=c.vec3();return t[0]=c.b3(e,this._v0[0],this._v1[0],this._v2[0],this._v3[0]),t[1]=c.b3(e,this._v0[1],this._v1[1],this._v2[1],this._v3[1]),t[2]=c.b3(e,this._v0[2],this._v1[2],this._v2[2],this._v3[2]),t}getJSON(){return{v0:this._v0,v1:this._v1,v2:this._v2,v3:this._v3,t:this._t}}},exports.Curve=vh,exports.DefaultLoadingManager=_A,exports.DepthFormat=1026,exports.DepthStencilFormat=1027,exports.DirLight=It,exports.DistanceMeasurementEditMouseControl=class extends ph{constructor(e,t){super(e,t,!0,!1)}},exports.DistanceMeasurementEditTouchControl=class extends ph{constructor(e,t){super(e,t,!1,!0)}},exports.DistanceMeasurementsControl=uh,exports.DistanceMeasurementsMouseControl=dh,exports.DistanceMeasurementsPlugin=class extends V{constructor(e,t={}){super("DistanceMeasurements",e),this._pointerLens=t.pointerLens,this._container=t.container||document.body,this._defaultControl=null,this._measurements={},this.labelMinAxisLength=t.labelMinAxisLength,this.defaultVisible=!1!==t.defaultVisible,this.defaultOriginVisible=!1!==t.defaultOriginVisible,this.defaultTargetVisible=!1!==t.defaultTargetVisible,this.defaultWireVisible=!1!==t.defaultWireVisible,this.defaultXLabelEnabled=!1!==t.defaultXLabelEnabled,this.defaultYLabelEnabled=!1!==t.defaultYLabelEnabled,this.defaultZLabelEnabled=!1!==t.defaultZLabelEnabled,this.defaultLengthLabelEnabled=!1!==t.defaultLengthLabelEnabled,this.defaultLabelsVisible=!1!==t.defaultLabelsVisible,this.defaultAxisVisible=!1!==t.defaultAxisVisible,this.defaultXAxisVisible=!1!==t.defaultXAxisVisible,this.defaultYAxisVisible=!1!==t.defaultYAxisVisible,this.defaultZAxisVisible=!1!==t.defaultZAxisVisible,this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.zIndex=t.zIndex||1e4,this.defaultLabelsOnWires=!1!==t.defaultLabelsOnWires,this.useRotationAdjustment=void 0!==t.useRotationAdjustment&&!1!==t.useRotationAdjustment,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,distanceMeasurement:t,measurement:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,distanceMeasurement:t,measurement:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,distanceMeasurement:t,measurement:t,event:e})}}getContainerElement(){return this._container}send(e,t){}get pointerLens(){return this._pointerLens}get control(){return this._defaultControl||(this._defaultControl=new dh(this,{})),this._defaultControl}get measurements(){return this._measurements}set labelMinAxisLength(e){e<1&&(this.error("labelMinAxisLength must be >= 1; defaulting to 25"),e=25),this._labelMinAxisLength=e||25}get labelMinAxisLength(){return this._labelMinAxisLength}set useRotationAdjustment(e){e=void 0!==e&&Boolean(e),this._useRotationAdjustment=e}get useRotationAdjustment(){return this._useRotationAdjustment}createMeasurement(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=e.origin,i=e.target,s=new ch(this,{id:e.id,plugin:this,container:this._container,origin:{entity:t.entity,worldPos:t.worldPos},target:{entity:i.entity,worldPos:i.worldPos},visible:e.visible,wireVisible:e.wireVisible,axisVisible:!1!==e.axisVisible&&!1!==this.defaultAxisVisible,xAxisVisible:!1!==e.xAxisVisible&&!1!==this.defaultXAxisVisible,yAxisVisible:!1!==e.yAxisVisible&&!1!==this.defaultYAxisVisible,zAxisVisible:!1!==e.zAxisVisible&&!1!==this.defaultZAxisVisible,xLabelEnabled:!1!==e.xLabelEnabled&&!1!==this.defaultXLabelEnabled,yLabelEnabled:!1!==e.yLabelEnabled&&!1!==this.defaultYLabelEnabled,zLabelEnabled:!1!==e.zLabelEnabled&&!1!==this.defaultZLabelEnabled,lengthLabelEnabled:!1!==e.lengthLabelEnabled&&!1!==this.defaultLengthLabelEnabled,labelsVisible:!1!==e.labelsVisible&&!1!==this.defaultLabelsVisible,useRotationAdjustment:this.useRotationAdjustment,originVisible:e.originVisible,targetVisible:e.targetVisible,color:e.color,labelsOnWires:!1!==e.labelsOnWires&&!1!==this.defaultLabelsOnWires,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[s.id]=s,s.clickable=!0,s.on("destroyed",(()=>{delete this._measurements[s.id]})),this.fire("measurementCreated",s),s}destroyMeasurement(e){const t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("DistanceMeasurement not found: "+e)}setLabelsShown(e){for(const[t,i]of Object.entries(this.measurements))i.labelShown=e}setAxisVisible(e){for(const[t,i]of Object.entries(this.measurements))i.axisVisible=e;this.defaultAxisVisible=e}getAxisVisible(){return this.defaultAxisVisible}clear(){const e=Object.keys(this._measurements);for(var t=0,i=e.length;t{this.plugin.viewer.cameraControl.active=!1},u=()=>{this.plugin.viewer.cameraControl.active=!0},d=()=>{o&&(clearTimeout(o),o=null),this._currentDistanceMeasurement&&(this._currentDistanceMeasurement.destroy(),this._currentDistanceMeasurement=null),u(),this._touchState=0};i.addEventListener("touchstart",this._onCanvasTouchStart=i=>{const l=i.touches.length;if(1!==l)return void(o&&(clearTimeout(o),o=null));const u=i.touches[0],p=u.clientX,f=u.clientY;switch(n.set([p,f]),a.set([p,f]),this._touchState){case 0:if(1!==l&&null!==o)return void d();const i=t.pick({canvasPos:a,snapping:this._snapping,snapToEdge:this._snapping});if(i&&i.snapped)s.set(i.worldPos),this.pointerCircle.start(i.snappedCanvasPos);else{const e=t.pick({canvasPos:a,pickSurface:!0});if(!e||!e.worldPos)return;s.set(e.worldPos),this.pointerCircle.start(e.canvasPos)}o=setTimeout((()=>{1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{this.pointerCircle.stop();const r=i.touches.length;if(1!==r||1!==i.changedTouches.length)return void(o&&(clearTimeout(o),o=null));const n=i.touches[0],l=n.clientX,h=n.clientY;if(n.identifier!==A)return;let u,d;switch(a.set([l,h]),this._touchState){case 2:this.pointerLens&&(this.pointerLens.canvasPos=a),u=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),u&&u.snapped?(this.pointerLens&&(this.pointerLens.snappedCanvasPos=u.snappedCanvasPos,this.pointerLens.snapped=!0),s.set(u.worldPos),this._currentDistanceMeasurement?this._currentDistanceMeasurement.origin.worldPos=u.worldPos:(this._currentDistanceMeasurement=e.createMeasurement({id:c.createUUID(),origin:{worldPos:u.worldPos,entity:u.entity},target:{worldPos:u.worldPos,entity:u.entity}}),this._currentDistanceMeasurement.labelsVisible=!1,this._currentDistanceMeasurement.xAxisVisible=!1,this._currentDistanceMeasurement.yAxisVisible=!1,this._currentDistanceMeasurement.zAxisVisible=!1,this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.originVisible=!0,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.clickable=!1),this.distanceMeasurementsPlugin.fire("measurementStart",this._currentDistanceMeasurement)):(d=t.pick({canvasPos:a,pickSurface:!0}),d&&d.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=d.canvasPos,this.pointerLens.snapped=!1),s.set(d.worldPos),this._currentDistanceMeasurement?this._currentDistanceMeasurement.origin.worldPos=d.worldPos:(this._currentDistanceMeasurement=e.createMeasurement({id:c.createUUID(),origin:{worldPos:d.worldPos,entity:d.entity},target:{worldPos:d.worldPos,entity:d.entity}}),this._currentDistanceMeasurement.labelsVisible=!1,this._currentDistanceMeasurement.xAxisVisible=!1,this._currentDistanceMeasurement.yAxisVisible=!1,this._currentDistanceMeasurement.zAxisVisible=!1,this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.originVisible=!0,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.clickable=!1),this.distanceMeasurementsPlugin.fire("measurementStart",this._currentDistanceMeasurement)):this.pointerLens&&(this.pointerLens.cursorPos=null,this.pointerLens.snapped=!1)),this._touchState=2;break;case 5:if(1!==r&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),u=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),u&&u.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=u.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentDistanceMeasurement.target.worldPos=u.worldPos,this._currentDistanceMeasurement.target.entity=u.entity,this._currentDistanceMeasurement.targetVisible=!0,this._currentDistanceMeasurement.wireVisible=!0,this._currentDistanceMeasurement.labelsVisible=!0):(d=t.pick({canvasPos:a,pickSurface:!0}),d&&d.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=d.canvasPos,this.pointerLens.snapped=!1),this._currentDistanceMeasurement.target.worldPos=d.worldPos,this._currentDistanceMeasurement.target.entity=d.entity,this._currentDistanceMeasurement.targetVisible=!0,this._currentDistanceMeasurement.wireVisible=!0,this._currentDistanceMeasurement.labelsVisible=!0)),this._touchState=5}}),{passive:!0}),i.addEventListener("touchend",this._onCanvasTouchEnd=i=>{this.pointerCircle.stop();const s=i.changedTouches.length;if(1!==s)return;const h=i.changedTouches[0],d=h.clientX,p=h.clientY;if(h.identifier===A)switch(o&&(clearTimeout(o),o=null),l.set([d,p]),this._touchState){case 1:{if(1!==s||d>n[0]+r||dn[1]+r||pn[0]+r||dn[1]+r||p{const t=e.fileData,n=e.sceneModel,a={},l={},A=c.createUUID(),h=c.createUUID(),u=c.createUUID(),d=c.createUUID(),p={metaObjects:[{id:A,name:"IfcProject",type:"IfcProject",parent:null},{id:h,name:"IfcSite",type:"IfcSite",parent:A},{id:u,name:"IfcBuilding",type:"IfcBuilding",parent:h},{id:d,name:"IfcBuildingStorey",type:"IfcBuildingStorey",parent:u}],propertySets:[]};for(let e=0,i=t.meshes.length;e{if(l[e])return;const i=a[e],s=t.meshes[i];n.createGeometry({id:e,primitive:"triangles",positions:s.coordinates,indices:s.indices}),l[e]=!0},g=t.elements;for(let e=0,t=g.length;e{n.destroyed||(n.scene.fire("modelLoaded",n.id),n.fire("loaded",!0,!1))}))};if(e.src){const i=e.src;this.viewer.scene.canvas.spinner.processes++,this._dataSource.getDotBIM(i,(e=>{n({fileData:e,sceneModel:t,nextId:0,error:function(e){}}),this.viewer.scene.canvas.spinner.processes--}),(e=>{this.viewer.scene.canvas.spinner.processes--,this.error(e)}))}else if(e.dotBIM){const i={fileData:e.dotBIM,sceneModel:t,nextId:0,error:function(e){}};n(i)}return t.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(i)})),t}destroy(){super.destroy()}},exports.EdgeMaterial=qt,exports.EmphasisMaterial=Yt,exports.FaceAlignedSectionPlanesPlugin=class extends V{constructor(e,t={}){if(super("FaceAlignedSectionPlanesPlugin",e),this._freeControls=[],this._sectionPlanes=e.scene.sectionPlanes,this._controls={},this._shownControlId=null,this._dragSensitivity=t.dragSensitivity||1,null!==t.overviewCanvasId&&void 0!==t.overviewCanvasId){const e=document.getElementById(t.overviewCanvasId);e?this._overview=new lw(this,{overviewCanvas:e,visible:t.overviewVisible,onHoverEnterPlane:e=>{this._overview.setPlaneHighlighted(e,!0)},onHoverLeavePlane:e=>{this._overview.setPlaneHighlighted(e,!1)},onClickedPlane:e=>{if(this.getShownControl()===e)return void this.hideControl();this.showControl(e);const t=this.sectionPlanes[e].pos;Aw.set(this.viewer.scene.aabb),c.getAABB3Center(Aw,hw),Aw[0]+=t[0]-hw[0],Aw[1]+=t[1]-hw[1],Aw[2]+=t[2]-hw[2],Aw[3]+=t[0]-hw[0],Aw[4]+=t[1]-hw[1],Aw[5]+=t[2]-hw[2],this.viewer.cameraFlight.flyTo({aabb:Aw,fitFOV:65})},onClickedNothing:()=>{this.hideControl()}}):this.warn("Can't find overview canvas: '"+t.overviewCanvasId+"' - will create plugin without overview")}null===t.controlElementId||void 0===t.controlElementId?this.error("Parameter expected: controlElementId"):(this._controlElement=document.getElementById(t.controlElementId),this._controlElement||this.warn("Can't find control element: '"+t.controlElementId+"' - will create plugin without control element")),this._onSceneSectionPlaneCreated=e.scene.on("sectionPlaneCreated",(e=>{this._sectionPlaneCreated(e)}))}setDragSensitivity(e){this._dragSensitivity=e||1}getDragSensitivity(){return this._dragSensitivity}setOverviewVisible(e){this._overview&&this._overview.setVisible(e)}getOverviewVisible(){if(this._overview)return this._overview.getVisible()}get sectionPlanes(){return this._sectionPlanes}createSectionPlane(e={}){void 0!==e.id&&null!==e.id&&this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);return new os(this.viewer.scene,{id:e.id,pos:e.pos,dir:e.dir,active:!0})}_sectionPlaneCreated(e){const t=this._freeControls.length>0?this._freeControls.pop():new nw(this);t._setSectionPlane(e),t.setVisible(!1),this._controls[e.id]=t,this._overview&&this._overview.addSectionPlane(e),e.once("destroyed",(()=>{this._sectionPlaneDestroyed(e)}))}flipSectionPlanes(){const e=this.viewer.scene.sectionPlanes;for(let t in e){e[t].flipDir()}}showControl(e){const t=this._controls[e];t?(this.hideControl(),t.setVisible(!0),this._overview&&this._overview.setPlaneSelected(e,!0),this._shownControlId=e):this.error("Control not found: "+e)}getShownControl(){return this._shownControlId}hideControl(){for(let e in this._controls)this._controls.hasOwnProperty(e)&&(this._controls[e].setVisible(!1),this._overview&&this._overview.setPlaneSelected(e,!1));this._shownControlId=null}destroySectionPlane(e){let t=this.viewer.scene.sectionPlanes[e];t?(this._sectionPlaneDestroyed(t),t.destroy(),e===this._shownControlId&&(this._shownControlId=null)):this.error("SectionPlane not found: "+e)}_sectionPlaneDestroyed(e){this._overview&&this._overview.removeSectionPlane(e);const t=this._controls[e.id];t&&(t.setVisible(!1),t._setSectionPlane(null),delete this._controls[e.id],this._freeControls.push(t))}clear(){const e=Object.keys(this._sectionPlanes);for(let t=0,i=e.length;t{i=1e3*this._delayBeforeRestoreSeconds,s||(e.scene._renderer.setColorTextureEnabled(!this._hideColorTexture),e.scene._renderer.setPBREnabled(!this._hidePBR),e.scene._renderer.setSAOEnabled(!this._hideSAO),e.scene._renderer.setTransparentEnabled(!this._hideTransparentObjects),e.scene._renderer.setEdgesEnabled(!this._hideEdges),this._scaleCanvasResolution?e.scene.canvas.resolutionScale=this._scaleCanvasResolutionFactor:e.scene.canvas.resolutionScale=this._defaultScaleCanvasResolutionFactor,s=!0)},o=()=>{e.scene.canvas.resolutionScale=this._defaultScaleCanvasResolutionFactor,e.scene._renderer.setEdgesEnabled(!0),e.scene._renderer.setColorTextureEnabled(!0),e.scene._renderer.setPBREnabled(!0),e.scene._renderer.setSAOEnabled(!0),e.scene._renderer.setTransparentEnabled(!0),s=!1};this._onCanvasBoundary=e.scene.canvas.on("boundary",r),this._onCameraMatrix=e.scene.camera.on("matrix",r),this._onSceneTick=e.scene.on("tick",(e=>{s&&(i-=e.deltaTime,(!this._delayBeforeRestore||i<=0)&&o())}));let n=!1;this._onSceneMouseDown=e.scene.input.on("mousedown",(()=>{n=!0})),this._onSceneMouseUp=e.scene.input.on("mouseup",(()=>{n=!1})),this._onSceneMouseMove=e.scene.input.on("mousemove",(()=>{n&&r()}))}get hideColorTexture(){return this._hideColorTexture}set hideColorTexture(e){this._hideColorTexture=e}get hidePBR(){return this._hidePBR}set hidePBR(e){this._hidePBR=e}get hideSAO(){return this._hideSAO}set hideSAO(e){this._hideSAO=e}get hideEdges(){return this._hideEdges}set hideEdges(e){this._hideEdges=e}get hideTransparentObjects(){return this._hideTransparentObjects}set hideTransparentObjects(e){this._hideTransparentObjects=!1!==e}get scaleCanvasResolution(){return this._scaleCanvasResolution}set scaleCanvasResolution(e){this._scaleCanvasResolution=e}get defaultScaleCanvasResolutionFactor(){return this._defaultScaleCanvasResolutionFactor}set defaultScaleCanvasResolutionFactor(e){this._defaultScaleCanvasResolutionFactor=e||1}get scaleCanvasResolutionFactor(){return this._scaleCanvasResolutionFactor}set scaleCanvasResolutionFactor(e){this._scaleCanvasResolutionFactor=e||.6}get delayBeforeRestore(){return this._delayBeforeRestore}set delayBeforeRestore(e){this._delayBeforeRestore=e}get delayBeforeRestoreSeconds(){return this._delayBeforeRestoreSeconds}set delayBeforeRestoreSeconds(e){this._delayBeforeRestoreSeconds=null!=e?e:.5}send(e,t){}destroy(){this.viewer.scene.camera.off(this._onCameraMatrix),this.viewer.scene.canvas.off(this._onCanvasBoundary),this.viewer.scene.input.off(this._onSceneMouseDown),this.viewer.scene.input.off(this._onSceneMouseUp),this.viewer.scene.input.off(this._onSceneMouseMove),this.viewer.scene.off(this._onSceneTick),super.destroy()}},exports.FloatType=1015,exports.Fresnel=class extends D{get type(){return"Fresnel"}constructor(e,t={}){super(e,t),this._state=new at({edgeColor:c.vec3([0,0,0]),centerColor:c.vec3([1,1,1]),edgeBias:0,centerBias:1,power:1}),this.edgeColor=t.edgeColor,this.centerColor=t.centerColor,this.edgeBias=t.edgeBias,this.centerBias=t.centerBias,this.power=t.power}set edgeColor(e){this._state.edgeColor.set(e||[0,0,0]),this.glRedraw()}get edgeColor(){return this._state.edgeColor}set centerColor(e){this._state.centerColor.set(e||[1,1,1]),this.glRedraw()}get centerColor(){return this._state.centerColor}set edgeBias(e){this._state.edgeBias=e||0,this.glRedraw()}get edgeBias(){return this._state.edgeBias}set centerBias(e){this._state.centerBias=null!=e?e:1,this.glRedraw()}get centerBias(){return this._state.centerBias}set power(e){this._state.power=null!=e?e:1,this.glRedraw()}get power(){return this._state.power}destroy(){super.destroy(),this._state.destroy()}},exports.Frustum=U,exports.FrustumPlane=R,exports.GIFMediaType=1e4,exports.GLTFDefaultDataSource=fh,exports.GLTFLoaderPlugin=class extends V{constructor(e,t={}){super("GLTFLoader",e,t),this._sceneModelLoader=new wB(this,t),this.dataSource=t.dataSource,this.objectDefaults=t.objectDefaults}set dataSource(e){this._dataSource=e||new fh}get dataSource(){return this._dataSource}set objectDefaults(e){this._objectDefaults=e||RB}get objectDefaults(){return this._objectDefaults}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new qA(this.viewer.scene,_.apply(e,{isModel:!0,dtxEnabled:e.dtxEnabled})),i=t.id;if(!e.src&&!e.gltf)return this.error("load() param expected: src or gltf"),t;if(e.metaModelSrc||e.metaModelJSON){const s=e.objectDefaults||this._objectDefaults||RB,r=r=>{let o;if(this.viewer.metaScene.createMetaModel(i,r,{includeTypes:e.includeTypes,excludeTypes:e.excludeTypes}),this.viewer.scene.canvas.spinner.processes--,e.includeTypes){o={};for(let t=0,i=e.includeTypes.length;t{const r=t.name;if(!r)return!0;const o=r,n=this.viewer.metaScene.metaObjects[o],a=(n?n.type:"DEFAULT")||"DEFAULT";i.createEntity={id:o,isObject:!0};const l=s[a];return l&&(!1===l.visible&&(i.createEntity.visible=!1),l.colorize&&(i.createEntity.colorize=l.colorize),!1===l.pickable&&(i.createEntity.pickable=!1),void 0!==l.opacity&&null!==l.opacity&&(i.createEntity.opacity=l.opacity)),!0},e.src?this._sceneModelLoader.load(this,e.src,r,e,t):this._sceneModelLoader.parse(this,e.gltf,r,e,t)};if(e.metaModelSrc){const t=e.metaModelSrc;this.viewer.scene.canvas.spinner.processes++,this._dataSource.getMetaModel(t,(e=>{this.viewer.scene.canvas.spinner.processes--,r(e)}),(e=>{this.error(`load(): Failed to load model metadata for model '${i} from '${t}' - ${e}`),this.viewer.scene.canvas.spinner.processes--}))}else e.metaModelJSON&&r(e.metaModelJSON)}else e.handleGLTFNode=(e,t,i)=>{const s=t.name;if(!s)return!0;const r=s;return i.createEntity={id:r,isObject:!0},!0},e.src?this._sceneModelLoader.load(this,e.src,null,e,t):this._sceneModelLoader.parse(this,e.gltf,null,e,t);return t.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(i)})),t}destroy(){super.destroy()}},exports.HalfFloatType=1016,exports.ImagePlane=class extends D{constructor(e,t={}){super(e,t),this._src=null,this._image=null,this._pos=c.vec3(),this._origin=c.vec3(),this._rtcPos=c.vec3(),this._dir=c.vec3(),this._size=1,this._imageSize=c.vec2(),this._texture=new Ds(this),this._plane=new $i(this,{geometry:new jt(this,Os({center:[0,0,0],xSize:1,zSize:1,xSegments:10,zSegments:10})),material:new Xt(this,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:this._texture,emissiveMap:this._texture,backfaces:!0}),clippable:t.clippable}),this._grid=new $i(this,{geometry:new jt(this,ks({size:1,divisions:10})),material:new Xt(this,{diffuse:[0,0,0],ambient:[0,0,0],emissive:[.2,.8,.2]}),position:[0,.001,0],clippable:t.clippable}),this._node=new fs(this,{rotation:[0,0,0],position:[0,0,0],scale:[1,1,1],clippable:!1,children:[this._plane,this._grid]}),this._gridVisible=!1,this.visible=!0,this.gridVisible=t.gridVisible,this.position=t.position,this.rotation=t.rotation,this.dir=t.dir,this.size=t.size,this.collidable=t.collidable,this.clippable=t.clippable,this.pickable=t.pickable,this.opacity=t.opacity,t.image?this.image=t.image:this.src=t.src}set visible(e){this._plane.visible=e,this._grid.visible=this._gridVisible&&e}get visible(){return this._plane.visible}set gridVisible(e){e=!1!==e,this._gridVisible=e,this._grid.visible=this._gridVisible&&this.visible}get gridVisible(){return this._gridVisible}set image(e){this._image=e,this._image&&(this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage(),this._src=null,this._texture.image=this._image)}get image(){return this._image}set src(e){if(this._src=e,this._src){this._image=null;const e=new Image;e.onload=()=>{this._texture.image=e,this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage()},e.src=this._src}}get src(){return this._src}set position(e){this._pos.set(e||[0,0,0]),W(this._pos,this._origin,this._rtcPos),this._node.origin=this._origin,this._node.position=this._rtcPos}get position(){return this._pos}set rotation(e){this._node.rotation=e}get rotation(){return this._node.rotation}set size(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}get size(){return this._size}set dir(e){if(this._dir.set(e||[0,0,-1]),e){const t=this.scene.center,i=[-this._dir[0],-this._dir[1],-this._dir[2]];c.subVec3(t,this.position,Fh);const s=-c.dotVec3(i,Fh);c.normalizeVec3(i),c.mulVec3Scalar(i,s,Ih),c.vec3PairToQuaternion(Dh,e,Sh),this._node.quaternion=Sh}}get dir(){return this._dir}set collidable(e){this._node.collidable=!1!==e}get collidable(){return this._node.collidable}set clippable(e){this._node.clippable=!1!==e}get clippable(){return this._node.clippable}set pickable(e){this._node.pickable=!1!==e}get pickable(){return this._node.pickable}set opacity(e){this._node.opacity=e}get opacity(){return this._node.opacity}destroy(){super.destroy()}_updatePlaneSizeFromImage(){const e=this._size,t=this._imageSize[0],i=this._imageSize[1];if(t>i){const s=i/t;this._node.scale=[e,1,e*s]}else{const s=t/i;this._node.scale=[e*s,1,e]}}},exports.IntType=1013,exports.JPEGMediaType=10001,exports.KTX2TextureTranscoder=wA,exports.LASLoaderPlugin=class extends V{constructor(e,t={}){super("lasLoader",e,t),this.dataSource=t.dataSource,this.skip=t.skip,this.fp64=t.fp64,this.colorDepth=t.colorDepth}get dataSource(){return this._dataSource}set dataSource(e){this._dataSource=e||new EP}get skip(){return this._skip}set skip(e){this._skip=e||1}get fp64(){return this._fp64}set fp64(e){this._fp64=!!e}get colorDepth(){return this._colorDepth}set colorDepth(e){this._colorDepth=e||"auto"}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new qA(this.viewer.scene,_.apply(e,{isModel:!0}));if(!e.src&&!e.las)return this.error("load() param expected: src or las"),t;const i={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(e.src)this._loadModel(e.src,e,i,t);else{const s=this.viewer.scene.canvas.spinner;s.processes++,this._parseModel(e.las,e,i,t).then((()=>{s.processes--}),(e=>{s.processes--,this.error(e),t.fire("error",e)}))}return t}_loadModel(e,t,i,s){const r=this.viewer.scene.canvas.spinner;r.processes++,this._dataSource.getLAS(t.src,(e=>{this._parseModel(e,t,i,s).then((()=>{r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){function r(e){const i=e.value;if(t.rotateX&&i)for(let e=0,t=i.length;e{if(s.destroyed)return void l();const A=t.stats||{};A.sourceFormat="LAS",A.schemaVersion="",A.title="",A.author="",A.created="",A.numMetaObjects=0,A.numPropertySets=0,A.numObjects=0,A.numGeometries=0,A.numTriangles=0,A.numVertices=0;try{const A=SP(e);Hb(e,FP,i).then((e=>{const h=e.attributes,u=e.loaderData,d=void 0!==u.pointsFormatId?u.pointsFormatId:-1;if(!h.POSITION)return s.finalize(),void l("No positions found in file");let p,f;switch(d){case 0:p=r(h.POSITION),f=n(h.intensity);break;case 1:if(!h.intensity)return s.finalize(),void l("No positions found in file");p=r(h.POSITION),f=n(h.intensity);break;case 2:case 3:if(!h.intensity)return s.finalize(),void l("No positions found in file");p=r(h.POSITION),f=o(h.COLOR_0,h.intensity)}const g=RP(p,15e5),m=RP(f,2e6),_=[];for(let e=0,t=g.length;e{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))})),a()}))}catch(e){s.finalize(),l(e)}}))}},exports.LambertMaterial=gs,exports.LightMap=class extends Uh{get type(){return"LightMap"}constructor(e,t={}){super(e,t),this.scene._lightMapCreated(this)}destroy(){super.destroy(),this.scene._lightMapDestroyed(this)}},exports.LineSet=eh,exports.LinearEncoding=3e3,exports.LinearFilter=1006,exports.LinearMipMapLinearFilter=1008,exports.LinearMipMapNearestFilter=1007,exports.LinearMipmapLinearFilter=1008,exports.LinearMipmapNearestFilter=1007,exports.Loader=vA,exports.LoadingManager=mA,exports.LocaleService=gh,exports.LuminanceAlphaFormat=1025,exports.LuminanceFormat=1024,exports.Map=e,exports.Marker=Ae,exports.MarqueePicker=N,exports.MarqueePickerMouseControl=class extends D{constructor(e){super(e.marqueePicker,e);const t=e.marqueePicker,i=t.viewer.scene.canvas.canvas;let s,r,o,n,a,l,A,h=!1,c=!1,u=!1;i.addEventListener("mousedown",(e=>{this.getActive()&&0===e.button&&(A=setTimeout((function(){const o=t.viewer.scene.input;o.keyDown[o.KEY_CTRL]||t.clear(),s=e.pageX,r=e.pageY,a=e.offsetX,t.setMarqueeCorner1([s,r]),h=!0,t.viewer.cameraControl.pointerEnabled=!1,t.setMarqueeVisible(!0),i.style.cursor="crosshair"}),400),c=!0)})),i.addEventListener("mouseup",(e=>{if(!this.getActive())return;if(!h&&!u)return;if(0!==e.button)return;clearTimeout(A),o=e.pageX,n=e.pageY;const i=Math.abs(o-s),a=Math.abs(n-r);h=!1,t.viewer.cameraControl.pointerEnabled=!0,u&&(u=!1),(i>3||a>3)&&t.pick()})),document.addEventListener("mouseup",(e=>{this.getActive()&&0===e.button&&(clearTimeout(A),h&&(t.setMarqueeVisible(!1),h=!1,c=!1,u=!0,t.viewer.cameraControl.pointerEnabled=!0))}),!0),i.addEventListener("mousemove",(e=>{this.getActive()&&0===e.button&&c&&(clearTimeout(A),h&&(o=e.pageX,n=e.pageY,l=e.offsetX,t.setMarqueeVisible(!0),t.setMarqueeCorner2([o,n]),t.setPickMode(a{e.camera.zUp?(this._zUp=!0,this._cubeTextureCanvas.setZUp(),this._repaint(),this._synchCamera()):e.camera.yUp&&(this._zUp=!1,this._cubeTextureCanvas.setYUp(),this._repaint(),this._synchCamera())})),this._onCameraFOV=e.camera.perspective.on("fov",(e=>{this._synchProjection&&(this._navCubeCamera.perspective.fov=e)})),this._onCameraProjection=e.camera.on("projection",(e=>{this._synchProjection&&(this._navCubeCamera.projection="ortho"===e||"perspective"===e?e:"perspective")}));var o=-1;function n(e){var t=[0,0];if(e){for(var i=e.target,s=0,r=0;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;t[0]=e.pageX-s,t[1]=e.pageY-r}else e=window.event,t[0]=e.x,t[1]=e.y;return t}var a,l,A=null,h=null,u=!1,d=!1,p=.5;s._navCubeCanvas.addEventListener("mouseenter",s._onMouseEnter=function(e){d=!0}),s._navCubeCanvas.addEventListener("mouseleave",s._onMouseLeave=function(e){d=!1}),s._navCubeCanvas.addEventListener("mousedown",s._onMouseDown=function(e){if(1===e.which){A=e.x,h=e.y,a=e.clientX,l=e.clientY;var t=n(e),s=i.pick({canvasPos:t});u=!!s}}),document.addEventListener("mouseup",s._onMouseUp=function(e){if(1===e.which&&(u=!1,null!==A)){var t=n(e),a=i.pick({canvasPos:t,pickSurface:!0});if(a&&a.uv){var l=s._cubeTextureCanvas.getArea(a.uv);if(l>=0&&(document.body.style.cursor="pointer",o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),l>=0)){if(s._cubeTextureCanvas.setAreaHighlighted(l,!0),o=l,s._repaint(),e.xA+3||e.yh+3)return;var c=s._cubeTextureCanvas.getAreaDir(l);if(c){var d=s._cubeTextureCanvas.getAreaUp(l);s._isProjectNorth&&s._projectNorthOffsetAngle&&(c=r(1,c,kB),d=r(1,d,OB)),f(c,d,(function(){o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),document.body.style.cursor="pointer",o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),l>=0&&(s._cubeTextureCanvas.setAreaHighlighted(l,!1),o=-1,s._repaint())}))}}}}}),document.addEventListener("mousemove",s._onMouseMove=function(t){if(o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),1!==t.buttons||u){if(u){var r=t.clientX,A=t.clientY;return document.body.style.cursor="move",void function(t,i){var s=(t-a)*-p,r=(i-l)*-p;e.camera.orbitYaw(s),e.camera.orbitPitch(-r),a=t,l=i}(r,A)}if(d){var h=n(t),c=i.pick({canvasPos:h,pickSurface:!0});if(c){if(c.uv){document.body.style.cursor="pointer";var f=s._cubeTextureCanvas.getArea(c.uv);if(f===o)return;o>=0&&s._cubeTextureCanvas.setAreaHighlighted(o,!1),f>=0&&(s._cubeTextureCanvas.setAreaHighlighted(f,!0),s._repaint(),o=f)}}else document.body.style.cursor="default",o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1)}}});var f=function(){var t=c.vec3();return function(i,r,o){var n=s._fitVisible?e.scene.getAABB(e.scene.visibleObjectIds):e.scene.aabb,a=c.getAABB3Diag(n);c.getAABB3Center(n,t);var l=Math.abs(a/Math.tan(s._cameraFitFOV*c.DEGTORAD));e.cameraControl.pivotPos=t,s._cameraFly?e.cameraFlight.flyTo({look:t,eye:[t[0]-l*i[0],t[1]-l*i[1],t[2]-l*i[2]],up:r||[0,1,0],orthoScale:1.1*a,fitFOV:s._cameraFitFOV,duration:s._cameraFlyDuration},o):e.cameraFlight.jumpTo({look:t,eye:[t[0]-l*i[0],t[1]-l*i[1],t[2]-l*i[2]],up:r||[0,1,0],orthoScale:1.1*a,fitFOV:s._cameraFitFOV},o)}}();this._onUpdated=e.localeService.on("updated",(()=>{this._cubeTextureCanvas.clear(),this._repaint()})),this.setVisible(t.visible),this.setCameraFitFOV(t.cameraFitFOV),this.setCameraFly(t.cameraFly),this.setCameraFlyDuration(t.cameraFlyDuration),this.setFitVisible(t.fitVisible),this.setSynchProjection(t.synchProjection)}send(e,t){if("language"===e)this._cubeTextureCanvas.clear(),this._repaint()}_repaint(){const e=this._cubeTextureCanvas.getImage();this._cubeMesh.material.diffuseMap.image=e,this._cubeMesh.material.emissiveMap.image=e}setVisible(e=!0){this._navCubeCanvas&&(this._cubeMesh.visible=e,this._shadow&&(this._shadow.visible=e),this._navCubeCanvas.style.visibility=e?"visible":"hidden")}getVisible(){return!!this._navCubeCanvas&&this._cubeMesh.visible}setFitVisible(e=!1){this._fitVisible=e}getFitVisible(){return this._fitVisible}setCameraFly(e=!0){this._cameraFly=e}getCameraFly(){return this._cameraFly}setCameraFitFOV(e=45){this._cameraFitFOV=e}getCameraFitFOV(){return this._cameraFitFOV}setCameraFlyDuration(e=.5){this._cameraFlyDuration=e}getCameraFlyDuration(){return this._cameraFlyDuration}setSynchProjection(e=!1){this._synchProjection=e}getSynchProjection(){return this._synchProjection}setIsProjectNorth(e=!1){this._isProjectNorth=e}getIsProjectNorth(){return this._isProjectNorth}setProjectNorthOffsetAngle(e){this._projectNorthOffsetAngle=e}getProjectNorthOffsetAngle(){return this._projectNorthOffsetAngle}destroy(){this._navCubeCanvas&&(this.viewer.localeService.off(this._onUpdated),this.viewer.camera.off(this._onCameraMatrix),this.viewer.camera.off(this._onCameraWorldAxis),this.viewer.camera.perspective.off(this._onCameraFOV),this.viewer.camera.off(this._onCameraProjection),this._navCubeCanvas.removeEventListener("mouseenter",this._onMouseEnter),this._navCubeCanvas.removeEventListener("mouseleave",this._onMouseLeave),this._navCubeCanvas.removeEventListener("mousedown",this._onMouseDown),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._navCubeCanvas=null,this._cubeTextureCanvas.destroy(),this._cubeTextureCanvas=null,this._onMouseEnter=null,this._onMouseLeave=null,this._onMouseDown=null,this._onMouseMove=null,this._onMouseUp=null),this._navCubeScene.destroy(),this._navCubeScene=null,this._cubeMesh=null,this._shadow=null,super.destroy()}},exports.NearestFilter=1003,exports.NearestMipMapLinearFilter=1005,exports.NearestMipMapNearestFilter=1004,exports.NearestMipmapLinearFilter=1005,exports.NearestMipmapNearestFilter=1004,exports.Node=fs,exports.OBJLoaderPlugin=class extends V{constructor(e,t){super("OBJLoader",e,t),this._sceneGraphLoader=new QB}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);var t=new fs(this.viewer.scene,_.apply(e,{isModel:!0}));const i=t.id,s=e.src;if(!s)return this.error("load() param expected: src"),t;if(e.metaModelSrc){const r=e.metaModelSrc;_.loadJSON(r,(r=>{this.viewer.metaScene.createMetaModel(i,r),this._sceneGraphLoader.load(t,s,e)}),(e=>{this.error(`load(): Failed to load model modelMetadata for model '${i} from '${r}' - ${e}`)}))}else this._sceneGraphLoader.load(t,s,e);return t.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(i)})),t}destroy(){super.destroy()}},exports.ObjectsKdTree3=class{constructor(e){if(!e)throw"Parameter expected: cfg";if(!e.viewer)throw"Parameter expected: cfg.viewer";this.viewer=e.viewer,this._maxTreeDepth=e.maxTreeDepth||15,this._root=null,this._needsRebuild=!0,this._onModelLoaded=this.viewer.scene.on("modelLoaded",(e=>{this._needsRebuild=!0})),this._onModelUnloaded=this.viewer.scene.on("modelUnloaded",(e=>{this._needsRebuild=!0}))}get root(){return this._needsRebuild&&this._rebuild(),this._root}_rebuild(){const e=this.viewer.scene;this._root={aabb:e.getAABB()};for(let t in e.objects){const i=e.objects[t];this._insertEntity(this._root,i,1)}this._needsRebuild=!1}_insertEntity(e,t,i){const s=t.aabb;if(i>=this._maxTreeDepth)return e.entities=e.entities||[],void e.entities.push(t);if(e.left&&c.containsAABB3(e.left.aabb,s))return void this._insertEntity(e.left,t,i+1);if(e.right&&c.containsAABB3(e.right.aabb,s))return void this._insertEntity(e.right,t,i+1);const r=e.aabb;u[0]=r[3]-r[0],u[1]=r[4]-r[1],u[2]=r[5]-r[2];let o=0;if(u[1]>u[o]&&(o=1),u[2]>u[o]&&(o=2),!e.left){const n=r.slice();if(n[o+3]=(r[o]+r[o+3])/2,e.left={aabb:n},c.containsAABB3(n,s))return void this._insertEntity(e.left,t,i+1)}if(!e.right){const n=r.slice();if(n[o]=(r[o]+r[o+3])/2,e.right={aabb:n},c.containsAABB3(n,s))return void this._insertEntity(e.right,t,i+1)}e.entities=e.entities||[],e.entities.push(t)}destroy(){const e=this.viewer.scene;e.off(this._onModelLoaded),e.off(this._onModelUnloaded),this._root=null,this._needsRebuild=!0}},exports.ObjectsMemento=Qh,exports.PNGMediaType=10002,exports.Path=class extends vh{constructor(e,t={}){super(e,t),this._cachedLengths=[],this._dirty=!0,this._curves=[],this._t=0,this._dirtySubs=[],this._destroyedSubs=[],this.curves=t.curves||[],this.t=t.t}addCurve(e){this._curves.push(e),this._dirty=!0}set curves(e){var t,i,s;for(e=e||[],i=0,s=this._curves.length;i1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}get length(){var e=this._getCurveLengths();return e[e.length-1]}getPoint(e){for(var t,i=e*this.length,s=this._getCurveLengths(),r=0;r=i){var o=1-(s[r]-i)/(t=this._curves[r]).length;return t.getPointAt(o)}r++}return null}_getCurveLengths(){if(!this._dirty)return this._cachedLengths;var e,t=[],i=0,s=this._curves.length;for(e=0;e{this._shadowViewMatrixDirty=!0})),this._onCameraProjMatrix=s.on("projMatrix",(()=>{this._shadowProjMatrixDirty=!0})),this._onCanvasBoundary=r.on("boundary",(()=>{this._shadowProjMatrixDirty=!0})),this._state=new at({type:"point",pos:c.vec3([1,1,1]),color:c.vec3([.7,.7,.8]),intensity:1,attenuation:[0,0,0],space:t.space||"view",castsShadow:!1,getShadowViewMatrix:()=>{if(i._shadowViewMatrixDirty){i._shadowViewMatrix||(i._shadowViewMatrix=c.identityMat4());const e=i._state.pos,t=s.look,r=s.up;c.lookAtMat4v(e,t,r,i._shadowViewMatrix),i._shadowViewMatrixDirty=!1}return i._shadowViewMatrix},getShadowProjMatrix:()=>{if(i._shadowProjMatrixDirty){i._shadowProjMatrix||(i._shadowProjMatrix=c.identityMat4());const e=i.scene.canvas.canvas;c.perspectiveMat4(Math.PI/180*70,e.clientWidth/e.clientHeight,.1,500,i._shadowProjMatrix),i._shadowProjMatrixDirty=!1}return i._shadowProjMatrix},getShadowRenderBuf:()=>(i._shadowRenderBuf||(i._shadowRenderBuf=new tt(i.scene.canvas.canvas,i.scene.canvas.gl,{size:[1024,1024]})),i._shadowRenderBuf)}),this.pos=t.pos,this.color=t.color,this.intensity=t.intensity,this.constantAttenuation=t.constantAttenuation,this.linearAttenuation=t.linearAttenuation,this.quadraticAttenuation=t.quadraticAttenuation,this.castsShadow=t.castsShadow,this.scene._lightCreated(this)}set pos(e){this._state.pos.set(e||[1,1,1]),this._shadowViewMatrixDirty=!0,this.glRedraw()}get pos(){return this._state.pos}set color(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}get color(){return this._state.color}set intensity(e){e=void 0!==e?e:1,this._state.intensity=e,this.glRedraw()}get intensity(){return this._state.intensity}set constantAttenuation(e){this._state.attenuation[0]=e||0,this.glRedraw()}get constantAttenuation(){return this._state.attenuation[0]}set linearAttenuation(e){this._state.attenuation[1]=e||0,this.glRedraw()}get linearAttenuation(){return this._state.attenuation[1]}set quadraticAttenuation(e){this._state.attenuation[2]=e||0,this.glRedraw()}get quadraticAttenuation(){return this._state.attenuation[2]}set castsShadow(e){e=!!e,this._state.castsShadow!==e&&(this._state.castsShadow=e,this._shadowViewMatrixDirty=!0,this.glRedraw())}get castsShadow(){return this._state.castsShadow}destroy(){const e=this.scene.camera,t=this.scene.canvas;e.off(this._onCameraViewMatrix),e.off(this._onCameraProjMatrix),t.off(this._onCanvasBoundary),super.destroy(),this._state.destroy(),this._shadowRenderBuf&&this._shadowRenderBuf.destroy(),this.scene._lightDestroyed(this),this.glRedraw()}},exports.PointerCircle=Q,exports.PointerLens=class{constructor(e,t={}){this.viewer=e,this.scene=this.viewer.scene,this._lensCursorDiv=document.createElement("div"),this.viewer.scene.canvas.canvas.parentNode.insertBefore(this._lensCursorDiv,this.viewer.scene.canvas.canvas),this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red",this._lensCursorDiv.style.borderRadius="20px",this._lensCursorDiv.style.width="10px",this._lensCursorDiv.style.height="10px",this._lensCursorDiv.style.margin="-200px -200px",this._lensCursorDiv.style.zIndex="100000",this._lensCursorDiv.style.position="absolute",this._lensCursorDiv.style.pointerEvents="none",this._lensContainer=document.createElement("div"),this._lensContainer.style.border="1px solid black",this._lensContainer.style.background="white",this._lensContainer.style.borderRadius="50%",this._lensContainer.style.width="300px",this._lensContainer.style.height="300px",this._lensContainer.style.marginTop="85px",this._lensContainer.style.marginLeft="25px",this._lensContainer.style.zIndex="15000",this._lensContainer.style.position="absolute",this._lensContainer.style.pointerEvents="none",this._lensContainer.style.visibility="hidden",this._lensCanvas=document.createElement("canvas"),this._lensCanvas.style.borderRadius="50%",this._lensCanvas.style.width="300px",this._lensCanvas.style.height="300px",this._lensCanvas.style.zIndex="15000",this._lensCanvas.style.pointerEvents="none",document.body.appendChild(this._lensContainer),this._lensContainer.appendChild(this._lensCanvas),this._lensCanvasContext=this._lensCanvas.getContext("2d"),this._canvasElement=this.viewer.scene.canvas.canvas,this._canvasPos=null,this._snappedCanvasPos=null,this._lensPosToggle=!0,this._zoomLevel=t.zoomLevel||2,this._active=!1!==t.active,this._visible=!1,this._snapped=!1,this._onViewerRendering=this.viewer.scene.on("rendering",(()=>{this._active&&this._visible&&this.update()}))}update(){if(!this._active||!this._visible)return;if(!this._canvasPos)return;const e=this._lensContainer.getBoundingClientRect(),t=this._canvasElement.getBoundingClientRect(),i=this._canvasPos[0]e.left&&this._canvasPos[1]e.top;this._lensContainer.style.marginLeft="25px",i&&(this._lensPosToggle?this._lensContainer.style.marginTop=t.bottom-t.top-this._lensCanvas.height-85+"px":this._lensContainer.style.marginTop="85px",this._lensPosToggle=!this._lensPosToggle),this._lensCanvasContext.clearRect(0,0,this._lensCanvas.width,this._lensCanvas.height);const s=Math.max(this._lensCanvas.width,this._lensCanvas.height)/this._zoomLevel;this._lensCanvasContext.drawImage(this._canvasElement,this._canvasPos[0]-s/2,this._canvasPos[1]-s/2,s,s,0,0,this._lensCanvas.width,this._lensCanvas.height);const r=[(e.left+e.right)/2-t.left,(e.top+e.bottom)/2-t.top];if(this._snappedCanvasPos){const e=this._snappedCanvasPos[0]-this._canvasPos[0],t=this._snappedCanvasPos[1]-this._canvasPos[1];this._lensCursorDiv.style.marginLeft=r[0]+e*this._zoomLevel-10+"px",this._lensCursorDiv.style.marginTop=r[1]+t*this._zoomLevel-10+"px"}else this._lensCursorDiv.style.marginLeft=r[0]-10+"px",this._lensCursorDiv.style.marginTop=r[1]-10+"px"}set zoomFactor(e){this._zoomFactor=e,this.update()}get zoomFactor(){return this._zoomFactor}set canvasPos(e){this._canvasPos=e,this.update()}get canvasPos(){return this._canvasPos}set snappedCanvasPos(e){this._snappedCanvasPos=e,this.update()}get snappedCanvasPos(){return this._snappedCanvasPos}set snapped(e){this._snapped=e,e?(this._lensCursorDiv.style.background="greenyellow",this._lensCursorDiv.style.border="2px solid green"):(this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red")}get snapped(){return this._snapped}set active(e){this._active=e,this._lensContainer.style.visibility=e&&this._visible?"visible":"hidden",e&&this._visible||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}get active(){return this._active}set visible(e){this._visible=e,this._lensContainer.style.visibility=e&&this._active?"visible":"hidden",e&&this._active||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}get visible(){return this._visible}destroy(){this._destroyed||(this.viewer.scene.off(this._onViewerRendering),this._lensContainer.removeChild(this._lensCanvas),document.body.removeChild(this._lensContainer),this._destroyed=!0)}},exports.QuadraticBezierCurve=class extends vh{constructor(e,t={}){super(e,t),this.v0=t.v0,this.v1=t.v1,this.v2=t.v2,this.t=t.t}set v0(e){this._v0=e||c.vec3([0,0,0])}get v0(){return this._v0}set v1(e){this._v1=e||c.vec3([0,0,0])}get v1(){return this._v1}set v2(e){this._v2=e||c.vec3([0,0,0])}get v2(){return this._v2}set t(e){e=e||0,this._t=e<0?0:e>1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=c.vec3();return t[0]=c.b2(e,this._v0[0],this._v1[0],this._v2[0]),t[1]=c.b2(e,this._v0[1],this._v1[1],this._v2[1]),t[2]=c.b2(e,this._v0[2],this._v1[2],this._v2[2]),t}getJSON(){return{v0:this._v0,v1:this._v1,v2:this._v2,t:this._t}}},exports.Queue=d,exports.RGBAFormat=1023,exports.RGBAIntegerFormat=1033,exports.RGBA_ASTC_10x10_Format=37819,exports.RGBA_ASTC_10x5_Format=37816,exports.RGBA_ASTC_10x6_Format=37817,exports.RGBA_ASTC_10x8_Format=37818,exports.RGBA_ASTC_12x10_Format=37820,exports.RGBA_ASTC_12x12_Format=37821,exports.RGBA_ASTC_4x4_Format=37808,exports.RGBA_ASTC_5x4_Format=37809,exports.RGBA_ASTC_5x5_Format=37810,exports.RGBA_ASTC_6x5_Format=37811,exports.RGBA_ASTC_6x6_Format=37812,exports.RGBA_ASTC_8x5_Format=37813,exports.RGBA_ASTC_8x6_Format=37814,exports.RGBA_ASTC_8x8_Format=37815,exports.RGBA_BPTC_Format=36492,exports.RGBA_ETC2_EAC_Format=37496,exports.RGBA_PVRTC_2BPPV1_Format=35843,exports.RGBA_PVRTC_4BPPV1_Format=35842,exports.RGBA_S3TC_DXT1_Format=33777,exports.RGBA_S3TC_DXT3_Format=33778,exports.RGBA_S3TC_DXT5_Format=33779,exports.RGBFormat=1022,exports.RGB_ETC1_Format=36196,exports.RGB_ETC2_Format=37492,exports.RGB_PVRTC_2BPPV1_Format=35841,exports.RGB_PVRTC_4BPPV1_Format=35840,exports.RGB_S3TC_DXT1_Format=33776,exports.RGFormat=1030,exports.RGIntegerFormat=1031,exports.ReadableGeometry=jt,exports.RedFormat=1028,exports.RedIntegerFormat=1029,exports.ReflectionMap=class extends Uh{get type(){return"ReflectionMap"}constructor(e,t={}){super(e,t),this.scene._lightsState.addReflectionMap(this._state),this.scene._reflectionMapCreated(this)}destroy(){super.destroy(),this.scene._reflectionMapDestroyed(this)}},exports.RepeatWrapping=1e3,exports.STLDefaultDataSource=cw,exports.STLLoaderPlugin=class extends V{constructor(e,t={}){super("STLLoader",e,t),this._sceneGraphLoader=new dw,this.dataSource=t.dataSource}set dataSource(e){this._dataSource=e||new cw}get dataSource(){return this._dataSource}load(e){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new fs(this.viewer.scene,_.apply(e,{isModel:!0})),i=e.src,s=e.stl;return i||s?(i?this._sceneGraphLoader.load(this,t,i,e):this._sceneGraphLoader.parse(this,t,s,e),t):(this.error("load() param expected: either 'src' or 'stl'"),t)}},exports.SceneModel=qA,exports.SceneModelMesh=zs,exports.SceneModelTransform=jA,exports.SectionPlane=os,exports.SectionPlanesPlugin=class extends V{constructor(e,t={}){if(super("SectionPlanes",e),this._freeControls=[],this._sectionPlanes=e.scene.sectionPlanes,this._controls={},this._shownControlId=null,null!==t.overviewCanvasId&&void 0!==t.overviewCanvasId){const e=document.getElementById(t.overviewCanvasId);e?this._overview=new ZB(this,{overviewCanvas:e,visible:t.overviewVisible,onHoverEnterPlane:e=>{this._overview.setPlaneHighlighted(e,!0)},onHoverLeavePlane:e=>{this._overview.setPlaneHighlighted(e,!1)},onClickedPlane:e=>{if(this.getShownControl()===e)return void this.hideControl();this.showControl(e);const t=this.sectionPlanes[e].pos;qB.set(this.viewer.scene.aabb),c.getAABB3Center(qB,$B),qB[0]+=t[0]-$B[0],qB[1]+=t[1]-$B[1],qB[2]+=t[2]-$B[2],qB[3]+=t[0]-$B[0],qB[4]+=t[1]-$B[1],qB[5]+=t[2]-$B[2],this.viewer.cameraFlight.flyTo({aabb:qB,fitFOV:65})},onClickedNothing:()=>{this.hideControl()}}):this.warn("Can't find overview canvas: '"+t.overviewCanvasId+"' - will create plugin without overview")}this._onSceneSectionPlaneCreated=e.scene.on("sectionPlaneCreated",(e=>{this._sectionPlaneCreated(e)}))}setOverviewVisible(e){this._overview&&this._overview.setVisible(e)}getOverviewVisible(){if(this._overview)return this._overview.getVisible()}get sectionPlanes(){return this._sectionPlanes}createSectionPlane(e={}){void 0!==e.id&&null!==e.id&&this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);return new os(this.viewer.scene,{id:e.id,pos:e.pos,dir:e.dir,active:!0})}_sectionPlaneCreated(e){const t=this._freeControls.length>0?this._freeControls.pop():new JB(this);t._setSectionPlane(e),t.setVisible(!1),this._controls[e.id]=t,this._overview&&this._overview.addSectionPlane(e),e.once("destroyed",(()=>{this._sectionPlaneDestroyed(e)}))}flipSectionPlanes(){const e=this.viewer.scene.sectionPlanes;for(let t in e){e[t].flipDir()}}showControl(e){const t=this._controls[e];t?(this.hideControl(),t.setVisible(!0),this._overview&&this._overview.setPlaneSelected(e,!0),this._shownControlId=e):this.error("Control not found: "+e)}getShownControl(){return this._shownControlId}hideControl(){for(var e in this._controls)this._controls.hasOwnProperty(e)&&(this._controls[e].setVisible(!1),this._overview&&this._overview.setPlaneSelected(e,!1));this._shownControlId=null}destroySectionPlane(e){var t=this.viewer.scene.sectionPlanes[e];t?(this._sectionPlaneDestroyed(t),t.destroy(),e===this._shownControlId&&(this._shownControlId=null)):this.error("SectionPlane not found: "+e)}_sectionPlaneDestroyed(e){this._overview&&this._overview.removeSectionPlane(e);const t=this._controls[e.id];t&&(t.setVisible(!1),t._setSectionPlane(null),delete this._controls[e.id],this._freeControls.push(t))}clear(){const e=Object.keys(this._sectionPlanes);for(var t=0,i=e.length;t{this._texture.image=e,this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage()},e.src=this._src}}get src(){return this._src}set size(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}get size(){return this._size}set collidable(e){this._mesh.collidable=!1!==e}get collidable(){return this._mesh.collidable}set clippable(e){this._mesh.clippable=!1!==e}get clippable(){return this._mesh.clippable}set pickable(e){this._mesh.pickable=!1!==e}get pickable(){return this._mesh.pickable}set opacity(e){this._mesh.opacity=e}get opacity(){return this._mesh.opacity}_updatePlaneSizeFromImage(){const e=.5*this._size,t=this._imageSize[0],i=this._imageSize[1],s=i/t;this._geometry.positions=t>i?[e,e*s,0,-e,e*s,0,-e,-e*s,0,e,-e*s,0]:[e/s,e,0,-e/s,e,0,-e/s,-e,0,e/s,-e,0]}},exports.StoreyViewsPlugin=class extends V{constructor(e,t={}){super("StoreyViews",e),this._objectsMemento=new Qh,this._cameraMemento=new kh,this.storeys={},this.modelStoreys={},this._fitStoreyMaps=!!t.fitStoreyMaps,this._onModelLoaded=this.viewer.scene.on("modelLoaded",(e=>{this._registerModelStoreys(e),this.fire("storeys",this.storeys)}))}_registerModelStoreys(e){const t=this.viewer,i=t.scene,s=t.metaScene,r=s.metaModels[e],o=i.models[e];if(!r||!r.rootMetaObjects)return;const n=r.rootMetaObjects;for(let t=0,r=n.length;t.5?a.length:0,h=new ew(this,o.aabb,l,e,n,A);h._onModelDestroyed=o.once("destroyed",(()=>{this._deregisterModelStoreys(e),this.fire("storeys",this.storeys)})),this.storeys[n]=h,this.modelStoreys[e]||(this.modelStoreys[e]={}),this.modelStoreys[e][n]=h}}}_deregisterModelStoreys(e){const t=this.modelStoreys[e];if(t){const i=this.viewer.scene;for(let e in t)if(t.hasOwnProperty(e)){const s=t[e],r=i.models[s.modelId];r&&r.off(s._onModelDestroyed),delete this.storeys[e]}delete this.modelStoreys[e]}}get fitStoreyMaps(){return this._fitStoreyMaps}gotoStoreyCamera(e,t={}){const i=this.storeys[e];if(!i)return this.error("IfcBuildingStorey not found with this ID: "+e),void(t.done&&t.done());const s=this.viewer,r=s.scene.camera,o=i.storeyAABB;if(o[3]{t.done()})):(s.cameraFlight.jumpTo(_.apply(t,{eye:h,look:n,up:u,orthoScale:A})),s.camera.ortho.scale=A)}showStoreyObjects(e,t={}){if(!this.storeys[e])return void this.error("IfcBuildingStorey not found with this ID: "+e);const i=this.viewer,s=i.scene;i.metaScene.metaObjects[e]&&(t.hideOthers&&s.setObjectsVisible(i.scene.visibleObjectIds,!1),this.withStoreyObjects(e,((e,t)=>{e&&(e.visible=!0)})))}withStoreyObjects(e,t){const i=this.viewer,s=i.scene,r=i.metaScene,o=r.metaObjects[e];if(!o)return;const n=o.getObjectIDsInSubtree();for(var a=0,l=n.length;au[1]&&u[0]>u[2],p=!d&&u[1]>u[0]&&u[1]>u[2];!d&&!p&&u[2]>u[0]&&(u[2],u[1]);const f=e.width/A,g=p?e.height/c:e.height/h;return i[0]=Math.floor(e.width-(t[0]-n)*f),i[1]=Math.floor(e.height-(t[2]-l)*g),i[0]>=0&&i[0]=0&&i[1]<=e.height}worldDirToStoreyMap(e,t,i){const s=this.viewer.camera,r=s.eye,o=s.look,n=c.subVec3(o,r,iw),a=s.worldUp,l=a[0]>a[1]&&a[0]>a[2],A=!l&&a[1]>a[0]&&a[1]>a[2];!l&&!A&&a[2]>a[0]&&(a[2],a[1]),l?(i[0]=n[1],i[1]=n[2]):A?(i[0]=n[0],i[1]=n[2]):(i[0]=n[0],i[1]=n[1]),c.normalizeVec2(i)}destroy(){this.viewer.scene.off(this._onModelLoaded),super.destroy()}},exports.Texture=Ds,exports.TextureTranscoder=class{transcode(e,t,i={}){}destroy(){}},exports.TreeViewPlugin=class extends V{constructor(e,t={}){super("TreeViewPlugin",e),this.errors=[],this.valid=!0;const i=t.containerElement||document.getElementById(t.containerElementId);if(i instanceof HTMLElement){for(let e=0;;e++)if(!yw[e]){yw[e]=this,this._index=e,this._id=`tree-${e}`;break}if(this._containerElement=i,this._metaModels={},this._autoAddModels=!1!==t.autoAddModels,this._autoExpandDepth=t.autoExpandDepth||0,this._sortNodes=!1!==t.sortNodes,this._viewer=e,this._rootElement=null,this._muteSceneEvents=!1,this._muteTreeEvents=!1,this._rootNodes=[],this._objectNodes={},this._nodeNodes={},this._rootNames={},this._sortNodes=t.sortNodes,this._pruneEmptyNodes=t.pruneEmptyNodes,this._showListItemElementId=null,this._renderService=t.renderService||new bw,!this._renderService)throw new Error("TreeViewPlugin: no render service set");if(this._containerElement.oncontextmenu=e=>{e.preventDefault()},this._onObjectVisibility=this._viewer.scene.on("objectVisibility",(e=>{if(this._muteSceneEvents)return;const t=e.id,i=this._objectNodes[t];if(!i)return;const s=e.visible;if(!(s!==i.checked))return;this._muteTreeEvents=!0,i.checked=s,s?i.numVisibleEntities++:i.numVisibleEntities--,this._renderService.setCheckbox(i.nodeId,s);let r=i.parent;for(;r;)r.checked=s,s?r.numVisibleEntities++:r.numVisibleEntities--,this._renderService.setCheckbox(r.nodeId,r.numVisibleEntities>0),r=r.parent;this._muteTreeEvents=!1})),this._onObjectXrayed=this._viewer.scene.on("objectXRayed",(e=>{if(this._muteSceneEvents)return;const t=e.id,i=this._objectNodes[t];if(!i)return;this._muteTreeEvents=!0;const s=e.xrayed;s!==i.xrayed&&(i.xrayed=s,this._renderService.setXRayed(i.nodeId,s),this._muteTreeEvents=!1)})),this._switchExpandHandler=e=>{e.preventDefault(),e.stopPropagation();const t=e.target;this._expandSwitchElement(t)},this._switchCollapseHandler=e=>{e.preventDefault(),e.stopPropagation();const t=e.target;this._collapseSwitchElement(t)},this._checkboxChangeHandler=e=>{if(this._muteTreeEvents)return;this._muteSceneEvents=!0;const t=e.target,i=this._renderService.isChecked(t),s=this._renderService.getIdFromCheckbox(t),r=this._nodeNodes[s],o=this._viewer.scene.objects;let n=0;this._withNodeTree(r,(e=>{const t=e.objectId,s=o[t],r=0===e.children.length;e.numVisibleEntities=i?e.numEntities:0,r&&i!==e.checked&&n++,e.checked=i,this._renderService.setCheckbox(e.nodeId,i),s&&(s.visible=i)}));let a=r.parent;for(;a;)a.checked=i,i?a.numVisibleEntities+=n:a.numVisibleEntities-=n,this._renderService.setCheckbox(a.nodeId,a.numVisibleEntities>0),a=a.parent;this._muteSceneEvents=!1},this._hierarchy=t.hierarchy||"containment",this._autoExpandDepth=t.autoExpandDepth||0,this._autoAddModels){const e=Object.keys(this.viewer.metaScene.metaModels);for(let t=0,i=e.length;t{this.viewer.metaScene.metaModels[e]&&this.addModel(e)}))}this.hierarchy=t.hierarchy}else this.error("Mandatory config expected: valid containerElementId or containerElement")}set hierarchy(e){"containment"!==(e=e||"containment")&&"storeys"!==e&&"types"!==e&&(this.error("Unsupported value for `hierarchy' - defaulting to 'containment'"),e="containment"),this._hierarchy!==e&&(this._hierarchy=e,this._createNodes())}get hierarchy(){return this._hierarchy}addModel(e,t={}){if(!this._containerElement)return;const i=this.viewer.scene.models[e];if(!i)throw"Model not found: "+e;const s=this.viewer.metaScene.metaModels[e];s?this._metaModels[e]?this.warn("Model already added: "+e):(this._metaModels[e]=s,t&&t.rootName&&(this._rootNames[e]=t.rootName),i.on("destroyed",(()=>{this.removeModel(i.id)})),this._createNodes()):this.error("MetaModel not found: "+e)}removeModel(e){if(!this._containerElement)return;this._metaModels[e]&&(this._rootNames[e]&&delete this._rootNames[e],delete this._metaModels[e],this._createNodes())}showNode(e){this.unShowNode();const t=this._objectNodes[e];if(!t)return;const i=t.nodeId,s=this._renderService.getSwitchElement(i);if(s)return this._expandSwitchElement(s),s.scrollIntoView(),!0;const r=[];r.unshift(t);let o=t.parent;for(;o;)r.unshift(o),o=o.parent;for(let e=0,t=r.length;e{if(s===e)return;const r=this._renderService.getSwitchElement(i.nodeId);if(r){this._expandSwitchElement(r);const e=i.children;for(var o=0,n=e.length;o0;return this.valid}_validateMetaModelForStoreysHierarchy(e=0,t,i){return!0}_createEnabledNodes(){switch(this._pruneEmptyNodes&&this._findEmptyNodes(),this._hierarchy){case"storeys":this._createStoreysNodes(),0===this._rootNodes.length&&this.error("Failed to build storeys hierarchy");break;case"types":this._createTypesNodes();break;default:this._createContainmentNodes()}this._sortNodes&&this._doSortNodes(),this._synchNodesToEntities(),this._createTrees(),this.expandToDepth(this._autoExpandDepth)}_createDisabledNodes(){const e=this._renderService.createRootNode();this._rootElement=e,this._containerElement.appendChild(e);const t=this._viewer.metaScene.rootMetaObjects;for(let i in t){const s=t[i],r=s.type,o=s.name,n=o&&""!==o&&"Undefined"!==o&&"Default"!==o?o:r,a=this._renderService.createDisabledNodeElement(n);e.appendChild(a)}}_findEmptyNodes(){const e=this._viewer.metaScene.rootMetaObjects;for(let t in e)this._findEmptyNodes2(e[t])}_findEmptyNodes2(e,t=0){const i=this.viewer.scene,s=e.children,r=e.id,o=i.objects[r];if(e._countEntities=0,o&&e._countEntities++,s)for(let t=0,i=s.length;t{e.aabb&&r.aabb||(e.aabb||(e.aabb=t.getAABB(s.getObjectIDsInSubtree(e.objectId))),r.aabb||(r.aabb=t.getAABB(s.getObjectIDsInSubtree(r.objectId))));let o=0;return o=i.xUp?0:i.yUp?1:2,e.aabb[o]>r.aabb[o]?-1:e.aabb[o]s?1:0}_synchNodesToEntities(){const e=Object.keys(this.viewer.metaScene.metaObjects),t=this._viewer.metaScene.metaObjects,i=this._viewer.scene.objects;for(let s=0,r=e.length;sthis._createNodeElement(e))),t=this._renderService.createRootNode();e.forEach((e=>{t.appendChild(e)})),this._containerElement.appendChild(t),this._rootElement=t}_createNodeElement(e){return this._renderService.createNodeElement(e,this._switchExpandHandler,this._checkboxChangeHandler,(t=>{this.fire("contextmenu",{event:t,viewer:this._viewer,treeViewPlugin:this,treeViewNode:e}),t.preventDefault()}),(t=>{this.fire("nodeTitleClicked",{event:t,viewer:this._viewer,treeViewPlugin:this,treeViewNode:e}),t.preventDefault()}))}_expandSwitchElement(e){if(this._renderService.isExpanded(e))return;const t=this._renderService.getId(e),i=this._nodeNodes[t].children.map((e=>this._createNodeElement(e)));this._renderService.addChildren(e,i),this._renderService.expand(e,this._switchExpandHandler,this._switchCollapseHandler)}_collapseNode(e){const t=this._renderService.getSwitchElement(e);this._collapseSwitchElement(t)}_collapseSwitchElement(e){this._renderService.collapse(e,this._switchExpandHandler,this._switchCollapseHandler)}},exports.UnsignedByteType=1009,exports.UnsignedInt248Type=1020,exports.UnsignedIntType=1014,exports.UnsignedShort4444Type=1017,exports.UnsignedShort5551Type=1018,exports.UnsignedShortType=1012,exports.VBOGeometry=Ls,exports.ViewCullPlugin=class extends V{constructor(e,t={}){super("ViewCull",e),this._objectCullStates=function(e){const t=e.id;let i=Bw[t];return i||(i=new xw(e),Bw[t]=i,e.on("destroyed",(()=>{delete Bw[t],i._destroy()}))),i}(e.scene),this._maxTreeDepth=t.maxTreeDepth||8,this._modelInfos={},this._frustum=new U,this._kdRoot=null,this._frustumDirty=!1,this._kdTreeDirty=!1,this._onViewMatrix=e.scene.camera.on("viewMatrix",(()=>{this._frustumDirty=!0})),this._onProjMatrix=e.scene.camera.on("projMatMatrix",(()=>{this._frustumDirty=!0})),this._onModelLoaded=e.scene.on("modelLoaded",(e=>{const t=this.viewer.scene.models[e];t&&this._addModel(t)})),this._onSceneTick=e.scene.on("tick",(()=>{this._doCull()}))}set enabled(e){this._enabled=e}get enabled(){return this._enabled}_addModel(e){const t={model:e,onDestroyed:e.on("destroyed",(()=>{this._removeModel(e)}))};this._modelInfos[e.id]=t,this._kdTreeDirty=!0}_removeModel(e){const t=this._modelInfos[e.id];t&&(t.model.off(t.onDestroyed),delete this._modelInfos[e.id],this._kdTreeDirty=!0)}_doCull(){const e=this._frustumDirty||this._kdTreeDirty;if(this._frustumDirty&&this._buildFrustum(),this._kdTreeDirty&&this._buildKDTree(),e){const e=this._kdRoot;e&&this._visitKDNode(e)}}_buildFrustum(){const e=this.viewer.scene.camera;k(this._frustum,e.viewMatrix,e.projMatrix),this._frustumDirty=!1}_buildKDTree(){const e=this.viewer.scene;this._kdRoot,this._kdRoot={aabb:e.getAABB(),intersection:U.INTERSECT};for(let e=0,t=this._objectCullStates.numObjects;e=this._maxTreeDepth)return e.objects=e.objects||[],e.objects.push(i),void c.expandAABB3(e.aabb,r);if(e.left&&c.containsAABB3(e.left.aabb,r))return void this._insertEntityIntoKDTree(e.left,t,i,s+1);if(e.right&&c.containsAABB3(e.right.aabb,r))return void this._insertEntityIntoKDTree(e.right,t,i,s+1);const o=e.aabb;ww[0]=o[3]-o[0],ww[1]=o[4]-o[1],ww[2]=o[5]-o[2];let n=0;if(ww[1]>ww[n]&&(n=1),ww[2]>ww[n]&&(n=2),!e.left){const a=o.slice();if(a[n+3]=(o[n]+o[n+3])/2,e.left={aabb:a,intersection:U.INTERSECT},c.containsAABB3(a,r))return void this._insertEntityIntoKDTree(e.left,t,i,s+1)}if(!e.right){const a=o.slice();if(a[n]=(o[n]+o[n+3])/2,e.right={aabb:a,intersection:U.INTERSECT},c.containsAABB3(a,r))return void this._insertEntityIntoKDTree(e.right,t,i,s+1)}e.objects=e.objects||[],e.objects.push(i),c.expandAABB3(e.aabb,r)}_visitKDNode(e,t=U.INTERSECT){if(t!==U.INTERSECT&&e.intersects===t)return;t===U.INTERSECT&&(t=O(this._frustum,e.aabb),e.intersects=t);const i=t===U.OUTSIDE,s=e.objects;if(s&&s.length>0)for(let e=0,t=s.length;e{this._parseModel(e,t,i,s),r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){if(s.destroyed)return;const r=t.stats||{};if(r.sourceFormat="IFC",r.schemaVersion="",r.title="",r.author="",r.created="",r.numMetaObjects=0,r.numPropertySets=0,r.numObjects=0,r.numGeometries=0,r.numTriangles=0,r.numVertices=0,!this._ifcAPI)throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";const o=new Uint8Array(e),n=this._ifcAPI.OpenModel(o),a=this._ifcAPI.GetModelSchema(n),l=this._ifcAPI.GetLineIDsWithType(n,this._webIFC.IFCPROJECT).get(0),A=!1!==t.loadMetadata,h={modelID:n,modelSchema:a,sceneModel:s,loadMetadata:A,metadata:A?{id:"",projectId:""+l,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:null,metaObjects:{},options:i,log:function(e){},nextId:0,stats:r};if(A){if(i.includeTypes){h.includeTypes={};for(let e=0,t=i.includeTypes.length;e{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))}))}_parseMetaObjects(e){const t=this._ifcAPI.GetLineIDsWithType(e.modelID,this._webIFC.IFCPROJECT).get(0),i=this._ifcAPI.GetLine(e.modelID,t);this._parseSpatialChildren(e,i)}_parseSpatialChildren(e,t,i){const s=this._ifcAPI.GetNameFromTypeCode(t.type);if(e.includeTypes&&!e.includeTypes[s])return;if(e.excludeTypes&&e.excludeTypes[s])return;this._createMetaObject(e,t,i);const r=t.GlobalId.value;this._parseRelatedItemsOfType(e,t.expressID,"RelatingObject","RelatedObjects",this._webIFC.IFCRELAGGREGATES,r),this._parseRelatedItemsOfType(e,t.expressID,"RelatingStructure","RelatedElements",this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,r)}_createMetaObject(e,t,i){const s=t.GlobalId.value,r=this._ifcAPI.GetNameFromTypeCode(t.type),o={id:s,name:t.Name&&""!==t.Name.value?t.Name.value:r,type:r,parent:i};e.metadata.metaObjects.push(o),e.metaObjects[s]=o,e.stats.numMetaObjects++}_parseRelatedItemsOfType(e,t,i,s,r,o){const n=this._ifcAPI.GetLineIDsWithType(e.modelID,r);for(let r=0;re.value)).includes(t)}else h=A.value===t;if(h){const t=l[s];if(Array.isArray(t))t.forEach((t=>{const i=this._ifcAPI.GetLine(e.modelID,t.value);this._parseSpatialChildren(e,i,o)}));else{const i=this._ifcAPI.GetLine(e.modelID,t.value);this._parseSpatialChildren(e,i,o)}}}}_parsePropertySets(e){const t=this._ifcAPI.GetLineIDsWithType(e.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(let i=0;i0){const o="Default",n=t.Name.value,a=[];for(let e=0,t=s.length;e{const i=t.expressID,s=t.geometries,r=[],o=this._ifcAPI.GetLine(e.modelID,i).GlobalId.value;if(e.loadMetadata){const t=o,i=e.metaObjects[t];if(e.includeTypes&&(!i||!e.includeTypes[i.type]))return;if(e.excludeTypes&&(!i||e.excludeTypes[i.type]))return}const n=c.mat4(),a=c.vec3();for(let t=0,i=s.size();t{o.finalize(),a.finalize(),this.viewer.scene.canvas.spinner.processes--,o.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(a.id)})),this.scheduleTask((()=>{o.destroyed||(o.scene.fire("modelLoaded",o.id),o.fire("loaded",!0,!1))}))},A=e=>{this.viewer.scene.canvas.spinner.processes--,this.error(e),o.fire("error",e)};let h=0;const c={getNextId:()=>`${n}.${h++}`};if(e.metaModelSrc||e.metaModelData)if(e.metaModelSrc){const r=e.metaModelSrc;this._dataSource.getMetaModel(r,(r=>{o.destroyed||(a.loadData(r,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),e.src?this._loadModel(e.src,e,t,o,null,c,l,A):(this._parseModel(e.xkt,e,t,o,null,c),l()))}),(e=>{A(`load(): Failed to load model metadata for model '${n} from '${r}' - ${e}`)}))}else e.metaModelData&&(a.loadData(e.metaModelData,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),e.src?this._loadModel(e.src,e,t,o,null,c,l,A):(this._parseModel(e.xkt,e,t,o,null,c),l()));else if(e.src)this._loadModel(e.src,e,t,o,a,c,l,A);else if(e.xkt)this._parseModel(e.xkt,e,t,o,a,c),l();else if(e.manifestSrc||e.manifest){const r=e.manifestSrc?function(e){const t=e.split("/");return t.pop(),t.join("/")+"/"}(e.manifestSrc):"",n=(e,o,n)=>{let l=0;const A=()=>{l>=e.length?o():this._dataSource.getMetaModel(`${r}${e[l]}`,(e=>{a.loadData(e,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),l++,this.scheduleTask(A,100)}),n)};A()},h=(i,s,n)=>{let a=0;const l=()=>{a>=i.length?s():this._dataSource.getXKT(`${r}${i[a]}`,(i=>{this._parseModel(i,e,t,o,null,c),a++,this.scheduleTask(l,100)}),n)};l()},u=(i,s,n)=>{let l=0;const A=()=>{l>=i.length?s():this._dataSource.getXKT(`${r}${i[l]}`,(i=>{this._parseModel(i,e,t,o,a,c),l++,this.scheduleTask(A,100)}),n)};A()};if(e.manifest){const t=e.manifest,i=t.xktFiles;if(!i||0===i.length)return void A("load(): Failed to load model manifest - manifest not valid");const s=t.metaModelFiles;s?n(s,(()=>{h(i,l,A)}),A):u(i,l,A)}else this._dataSource.getManifest(e.manifestSrc,(e=>{if(o.destroyed)return;const t=e.xktFiles;if(!t||0===t.length)return void A("load(): Failed to load model manifest - manifest not valid");const i=e.metaModelFiles;i?n(i,(()=>{h(t,l,A)}),A):u(t,l,A)}),A)}return o}_loadModel(e,t,i,s,r,o,n,a){this._dataSource.getXKT(t.src,(e=>{this._parseModel(e,t,i,s,r,o),n()}),a)}_parseModel(e,t,i,s,r,o){if(s.destroyed)return;const n=new DataView(e),a=new Uint8Array(e),l=n.getUint32(0,!0),A=uP[l];if(!A)return void this.error("Unsupported .XKT file version: "+l+" - this XKTLoaderPlugin supports versions "+Object.keys(uP));this.log("Loading .xkt V"+l);const h=n.getUint32(4,!0),c=[];let u=4*(h+2);for(let e=0;e{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=vC(o,(function(t,i){return yC(e,c.vec3([0,1,0]),t,i)}));!function o(){a._deactivate=_C(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._deactivate=()=>{t=!1},a.fire("zoneEnd",e),t&&o()})).deactivate}()}deactivate(){this._deactivate&&(this._deactivate(),this._deactivate=null)}destroy(){this.deactivate(),super.destroy()}},exports.ZonesPlugin=class extends V{constructor(e,t={}){super("Zones",e),this._pointerLens=t.pointerLens,this._container=t.container||document.body,this._zones=[],this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.zIndex=t.zIndex||1e4,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,zone:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,zone:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,zone:t,event:e})}}createZone(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=new xC(this,{id:e.id,plugin:this,container:this._container,geometry:e.geometry,alpha:e.alpha,color:e.color,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._zones.push(t),t.on("destroyed",(()=>{const e=this._zones.indexOf(t);e>=0&&this._zones.splice(e,1)})),this.fire("zoneCreated",t),t}get zones(){return this._zones}destroy(){super.destroy()}},exports.ZonesPolysurfaceMouseControl=class extends D{constructor(e,t={}){super(e.viewer.scene),this.zonesPlugin=e,this.pointerLens=t.pointerLens,this._action=null}get active(){return!!this._action}activate(e,t,i,s){if("object"==typeof e&&null!==e){const r=e,o=(e,t)=>{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}if(this._action)return;const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=vC(o,(function(t,i){return yC(e,c.vec3([0,1,0]),t,i)}));!function o(){a._action=BC(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._action={deactivate:()=>{t=!1}},a.fire("zoneEnd",e),t&&o()}))}()}deactivate(){this._action&&(this._action.deactivate(),this._action=null)}destroy(){this.deactivate(),super.destroy()}},exports.ZonesPolysurfaceTouchControl=class extends D{constructor(e,t={}){super(e.viewer.scene),this.zonesPlugin=e,this.pointerLens=t.pointerLens,this.pointerCircle=new Q(e.viewer),this._action=null}get active(){return!!this._action}activate(e,t,i,s){if("object"==typeof e&&null!==e){const r=e,o=(e,t)=>{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}if(this._action)return;const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=bC(o,this.pointerCircle,(function(t,i){return yC(e,c.vec3([0,1,0]),t,i)}));!function o(){a._action=BC(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._action={deactivate:()=>{t=!1}},a.fire("zoneEnd",e),t&&o()}))}()}deactivate(){this._action&&(this._action.deactivate(),this._action=null)}destroy(){this.deactivate(),super.destroy()}},exports.ZonesTouchControl=class extends D{constructor(e,t={}){super(e.viewer.scene),this.zonesPlugin=e,this.pointerLens=t.pointerLens,this.pointerCircle=new Q(e.viewer),this._deactivate=null}get active(){return!!this._deactivate}activate(e,t,i,s){if("object"==typeof e&&null!==e){const r=e,o=(e,t)=>{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}if(this._deactivate)return;const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=bC(o,this.pointerCircle,(function(t,i){return yC(e,c.vec3([0,1,0]),t,i)}));!function o(){a._deactivate=_C(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._deactivate=()=>{t=!1},a.fire("zoneEnd",e),t&&o()})).deactivate}()}deactivate(){this._deactivate&&(this._deactivate(),this._deactivate=null)}destroy(){this.deactivate(),super.destroy()}},exports.buildBoxGeometry=Gt,exports.buildBoxLinesGeometry=Us,exports.buildBoxLinesGeometryFromAABB=function(e={}){return Us({id:e.id,center:[(e.aabb[0]+e.aabb[3])/2,(e.aabb[1]+e.aabb[4])/2,(e.aabb[2]+e.aabb[5])/2],xSize:Math.abs(e.aabb[3]-e.aabb[0])/2,ySize:Math.abs(e.aabb[4]-e.aabb[1])/2,zSize:Math.abs(e.aabb[5]-e.aabb[2])/2})},exports.buildCylinderGeometry=ts,exports.buildGridGeometry=ks,exports.buildLineGeometry=function(e={}){if(3!==e.startPoint.length)throw"Start point should contain 3 elements in array: x, y and z";if(3!==e.endPoint.length)throw"End point should contain 3 elements in array: x, y and z";let t=[],i=[],s=e.startPoint[0],r=e.startPoint[1],o=e.startPoint[2],n=e.endPoint[0],a=e.endPoint[1],l=e.endPoint[2],A=Math.sqrt((n-s)**2+(a-r)**2+(l-o)**2),h=[(n-s)/A,(a-r)/A,(l-o)/A];if(e.pattern){let c=e.pattern.length,u=!1,d=0,p=0,f=0,g=[s,r,o],m=e.pattern[p];for(i.push(g[0],g[1],g[2]);m<=A-d;){let s=[h[0]*m,h[1]*m,h[2]*m],r=[g[0]+s[0],g[1]+s[1],g[2]+s[2]];i.push(r[0],r[1],r[2]),u||(t.push(f),t.push(f+1)),u=!u,f+=1,g=r,p+=1,p>=c&&(p=0),d+=m,m=e.pattern[p]}e.extendToEnd&&(i.push(n,a,l),t.push(t.length-2),t.push(t.length-1))}else t.push(0),t.push(1),i.push(s,r,o,n,a,l);return _.apply(e,{primitive:"lines",positions:i,indices:t})},exports.buildPlaneGeometry=Os,exports.buildPolylineGeometry=Qs,exports.buildPolylineGeometryFromCurve=function(e={}){let t=e.curve.getPoints(e.divisions).map((e=>[...e])).flat();return Qs({id:e.id,points:t})},exports.buildSphereGeometry=is,exports.buildTorusGeometry=Ns,exports.buildVectorTextGeometry=rs,exports.createRTCViewMat=z,exports.frustumIntersectsAABB3=O,exports.getKTX2TextureTranscoder=CA,exports.getPlaneRTCPos=X,exports.load3DSGeometry=function(e,t={}){return new Promise((function(i,s){t.src||(console.error("load3DSGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,_.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("load3DSGeometry: no data loaded"),r.processes--,s());var o=Rs.parse.from3DS(e).edit.objects[0].mesh,n=o.vertices,a=o.uvt,l=o.indices;r.processes--,i(_.apply(t,{primitive:"triangles",positions:n,normals:null,uv:a,indices:l}))}),(function(e){console.error("load3DSGeometry: "+e),r.processes--,s()}))}))},exports.loadOBJGeometry=function(e,t={}){return new Promise((function(i,s){t.src||(console.error("loadOBJGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,_.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("loadOBJGeometry: no data loaded"),r.processes--,s());for(var o=Rs.parse.fromOBJ(e),n=Rs.edit.unwrap(o.i_verts,o.c_verts,3),a=Rs.edit.unwrap(o.i_norms,o.c_norms,3),l=Rs.edit.unwrap(o.i_uvt,o.c_uvt,2),A=new Int32Array(o.i_verts.length),h=0;h0?a:null,autoNormals:0===a.length,uv:l,indices:A}))}),(function(e){console.error("loadOBJGeometry: "+e),r.processes--,s()}))}))},exports.math=c,exports.rtcToWorldPos=function(e,t,i){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i},exports.sRGBEncoding=3001,exports.setFrustum=k,exports.stats=p,exports.utils=_,exports.worldToRTCPos=W,exports.worldToRTCPositions=K; +/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).pako={})}(void 0,(function(e){function t(e){let t=e.length;for(;--t>=0;)e[t]=0}const i=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]),s=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]),r=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),n=new Array(576);t(n);const a=new Array(60);t(a);const l=new Array(512);t(l);const A=new Array(256);t(A);const h=new Array(29);t(h);const c=new Array(30);function u(e,t,i,s,r){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=s,this.max_length=r,this.has_stree=e&&e.length}let d,p,f;function g(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}t(c);const m=e=>e<256?l[e]:l[256+(e>>>7)],_=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},v=(e,t,i)=>{e.bi_valid>16-i?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<{v(e,i[2*t],i[2*t+1])},y=(e,t)=>{let i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1},x=(e,t,i)=>{const s=new Array(16);let r,o,n=0;for(r=1;r<=15;r++)n=n+i[r-1]<<1,s[r]=n;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=y(s[t]++,t))}},B=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},w=e=>{e.bi_valid>8?_(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},P=(e,t,i,s)=>{const r=2*t,o=2*i;return e[r]{const s=e.heap[i];let r=i<<1;for(;r<=e.heap_len&&(r{let o,n,a,l,u=0;if(0!==e.sym_next)do{o=255&e.pending_buf[e.sym_buf+u++],o+=(255&e.pending_buf[e.sym_buf+u++])<<8,n=e.pending_buf[e.sym_buf+u++],0===o?b(e,n,t):(a=A[n],b(e,a+256+1,t),l=i[a],0!==l&&(n-=h[a],v(e,n,l)),o--,a=m(o),b(e,a,r),l=s[a],0!==l&&(o-=c[a],v(e,o,l)))}while(u{const i=t.dyn_tree,s=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.elems;let n,a,l,A=-1;for(e.heap_len=0,e.heap_max=573,n=0;n>1;n>=1;n--)C(e,i,n);l=o;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],C(e,i,1),a=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=a,i[2*l]=i[2*n]+i[2*a],e.depth[l]=(e.depth[n]>=e.depth[a]?e.depth[n]:e.depth[a])+1,i[2*n+1]=i[2*a+1]=l,e.heap[1]=l++,C(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const i=t.dyn_tree,s=t.max_code,r=t.stat_desc.static_tree,o=t.stat_desc.has_stree,n=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,l=t.stat_desc.max_length;let A,h,c,u,d,p,f=0;for(u=0;u<=15;u++)e.bl_count[u]=0;for(i[2*e.heap[e.heap_max]+1]=0,A=e.heap_max+1;A<573;A++)h=e.heap[A],u=i[2*i[2*h+1]+1]+1,u>l&&(u=l,f++),i[2*h+1]=u,h>s||(e.bl_count[u]++,d=0,h>=a&&(d=n[h-a]),p=i[2*h],e.opt_len+=p*(u+d),o&&(e.static_len+=p*(r[2*h+1]+d)));if(0!==f){do{for(u=l-1;0===e.bl_count[u];)u--;e.bl_count[u]--,e.bl_count[u+1]+=2,e.bl_count[l]--,f-=2}while(f>0);for(u=l;0!==u;u--)for(h=e.bl_count[u];0!==h;)c=e.heap[--A],c>s||(i[2*c+1]!==u&&(e.opt_len+=(u-i[2*c+1])*i[2*c],i[2*c+1]=u),h--)}})(e,t),x(i,A,e.bl_count)},F=(e,t,i)=>{let s,r,o=-1,n=t[1],a=0,l=7,A=4;for(0===n&&(l=138,A=3),t[2*(i+1)+1]=65535,s=0;s<=i;s++)r=n,n=t[2*(s+1)+1],++a{let s,r,o=-1,n=t[1],a=0,l=7,A=4;for(0===n&&(l=138,A=3),s=0;s<=i;s++)if(r=n,n=t[2*(s+1)+1],!(++a{v(e,0+(s?1:0),3),w(e),_(e,i),_(e,~i),i&&e.pending_buf.set(e.window.subarray(t,t+i),e.pending),e.pending+=i};var T={_tr_init:e=>{D||((()=>{let e,t,o,g,m;const _=new Array(16);for(o=0,g=0;g<28;g++)for(h[g]=o,e=0;e<1<>=7;g<30;g++)for(c[g]=m<<7,e=0;e<1<{let r,l,A=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),E(e,e.l_desc),E(e,e.d_desc),A=(e=>{let t;for(F(e,e.dyn_ltree,e.l_desc.max_code),F(e,e.dyn_dtree,e.d_desc.max_code),E(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*o[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,l=e.static_len+3+7>>>3,l<=r&&(r=l)):r=l=i+5,i+4<=r&&-1!==t?S(e,t,i,s):4===e.strategy||l===r?(v(e,2+(s?1:0),3),M(e,n,a)):(v(e,4+(s?1:0),3),((e,t,i,s)=>{let r;for(v(e,t-257,5),v(e,i-1,5),v(e,s-4,4),r=0;r(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=i,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(A[i]+256+1)]++,e.dyn_dtree[2*m(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{v(e,2,3),b(e,256,n),(e=>{16===e.bi_valid?(_(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}},L=(e,t,i,s)=>{let r=65535&e|0,o=e>>>16&65535|0,n=0;for(;0!==i;){n=i>2e3?2e3:i,i-=n;do{r=r+t[s++]|0,o=o+r|0}while(--n);r%=65521,o%=65521}return r|o<<16|0};const R=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var U=(e,t,i,s)=>{const r=R,o=s+i;e^=-1;for(let i=s;i>>8^r[255&(e^t[i])];return-1^e},k={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"},O={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};const{_tr_init:N,_tr_stored_block:Q,_tr_flush_block:V,_tr_tally:H,_tr_align:j}=T,{Z_NO_FLUSH:G,Z_PARTIAL_FLUSH:z,Z_FULL_FLUSH:W,Z_FINISH:K,Z_BLOCK:X,Z_OK:J,Z_STREAM_END:Y,Z_STREAM_ERROR:Z,Z_DATA_ERROR:q,Z_BUF_ERROR:$,Z_DEFAULT_COMPRESSION:ee,Z_FILTERED:te,Z_HUFFMAN_ONLY:ie,Z_RLE:se,Z_FIXED:re,Z_DEFAULT_STRATEGY:oe,Z_UNKNOWN:ne,Z_DEFLATED:ae}=O,le=258,Ae=262,he=42,ce=113,ue=666,de=(e,t)=>(e.msg=k[t],t),pe=e=>2*e-(e>4?9:0),fe=e=>{let t=e.length;for(;--t>=0;)e[t]=0},ge=e=>{let t,i,s,r=e.w_size;t=e.hash_size,s=t;do{i=e.head[--s],e.head[s]=i>=r?i-r:0}while(--t);t=r,s=t;do{i=e.prev[--s],e.prev[s]=i>=r?i-r:0}while(--t)};let me=(e,t,i)=>(t<{const t=e.state;let i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+i),e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))},ve=(e,t)=>{V(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,_e(e.strm)},be=(e,t)=>{e.pending_buf[e.pending++]=t},ye=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},xe=(e,t,i,s)=>{let r=e.avail_in;return r>s&&(r=s),0===r?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),i),1===e.state.wrap?e.adler=L(e.adler,t,r,i):2===e.state.wrap&&(e.adler=U(e.adler,t,r,i)),e.next_in+=r,e.total_in+=r,r)},Be=(e,t)=>{let i,s,r=e.max_chain_length,o=e.strstart,n=e.prev_length,a=e.nice_match;const l=e.strstart>e.w_size-Ae?e.strstart-(e.w_size-Ae):0,A=e.window,h=e.w_mask,c=e.prev,u=e.strstart+le;let d=A[o+n-1],p=A[o+n];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do{if(i=t,A[i+n]===p&&A[i+n-1]===d&&A[i]===A[o]&&A[++i]===A[o+1]){o+=2,i++;do{}while(A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&on){if(e.match_start=t,n=s,s>=a)break;d=A[o+n-1],p=A[o+n]}}}while((t=c[t&h])>l&&0!=--r);return n<=e.lookahead?n:e.lookahead},we=e=>{const t=e.w_size;let i,s,r;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ae)&&(e.window.set(e.window.subarray(t,t+t-s),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),ge(e),s+=t),0===e.strm.avail_in)break;if(i=xe(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=i,e.lookahead+e.insert>=3)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=me(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=me(e,e.ins_h,e.window[r+3-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead{let i,s,r,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,n=0,a=e.strm.avail_in;do{if(i=65535,r=e.bi_valid+42>>3,e.strm.avail_outs+e.strm.avail_in&&(i=s+e.strm.avail_in),i>r&&(i=r),i>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,_e(e.strm),s&&(s>i&&(s=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+s),e.strm.next_out),e.strm.next_out+=s,e.strm.avail_out-=s,e.strm.total_out+=s,e.block_start+=s,i-=s),i&&(xe(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(0===n);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_waterr&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,r+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),r>e.strm.avail_in&&(r=e.strm.avail_in),r&&(xe(e.strm,e.window,e.strstart,r),e.strstart+=r,e.insert+=r>e.w_size-e.insert?e.w_size-e.insert:r),e.high_water>3,r=e.pending_buf_size-r>65535?65535:e.pending_buf_size-r,o=r>e.w_size?e.w_size:r,s=e.strstart-e.block_start,(s>=o||(s||t===K)&&t!==G&&0===e.strm.avail_in&&s<=r)&&(i=s>r?r:s,n=t===K&&0===e.strm.avail_in&&i===s?1:0,Q(e,e.block_start,i,n),e.block_start+=i,_e(e.strm)),n?3:1)},Ce=(e,t)=>{let i,s;for(;;){if(e.lookahead=3&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-Ae&&(e.match_length=Be(e,i)),e.match_length>=3)if(s=H(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=me(e,e.ins_h,e.window[e.strstart+1]);else s=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2},Me=(e,t)=>{let i,s,r;for(;;){if(e.lookahead=3&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,s=H(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=r&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,s&&(ve(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(s=H(e,0,e.window[e.strstart-1]),s&&ve(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(s=H(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2};function Ee(e,t,i,s,r){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=s,this.func=r}const Fe=[new Ee(0,0,0,0,Pe),new Ee(4,4,8,4,Ce),new Ee(4,5,16,8,Ce),new Ee(4,6,32,32,Ce),new Ee(4,4,16,16,Me),new Ee(8,16,32,32,Me),new Ee(8,16,128,128,Me),new Ee(8,32,128,256,Me),new Ee(32,128,258,1024,Me),new Ee(32,258,258,4096,Me)];function Ie(){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=ae,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),fe(this.dyn_ltree),fe(this.dyn_dtree),fe(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),fe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),fe(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}const De=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==he&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==ce&&t.status!==ue?1:0},Se=e=>{if(De(e))return de(e,Z);e.total_in=e.total_out=0,e.data_type=ne;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?he:ce,e.adler=2===t.wrap?0:1,t.last_flush=-2,N(t),J},Te=e=>{const t=Se(e);var i;return t===J&&((i=e.state).window_size=2*i.w_size,fe(i.head),i.max_lazy_match=Fe[i.level].max_lazy,i.good_match=Fe[i.level].good_length,i.nice_match=Fe[i.level].nice_length,i.max_chain_length=Fe[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),t},Le=(e,t,i,s,r,o)=>{if(!e)return Z;let n=1;if(t===ee&&(t=6),s<0?(n=0,s=-s):s>15&&(n=2,s-=16),r<1||r>9||i!==ae||s<8||s>15||t<0||t>9||o<0||o>re||8===s&&1!==n)return de(e,Z);8===s&&(s=9);const a=new Ie;return e.state=a,a.strm=e,a.status=he,a.wrap=n,a.gzhead=null,a.w_bits=s,a.w_size=1<De(e)||2!==e.state.wrap?Z:(e.state.gzhead=t,J),ke=(e,t)=>{if(De(e)||t>X||t<0)return e?de(e,Z):Z;const i=e.state;if(!e.output||0!==e.avail_in&&!e.input||i.status===ue&&t!==K)return de(e,0===e.avail_out?$:Z);const s=i.last_flush;if(i.last_flush=t,0!==i.pending){if(_e(e),0===e.avail_out)return i.last_flush=-1,J}else if(0===e.avail_in&&pe(t)<=pe(s)&&t!==K)return de(e,$);if(i.status===ue&&0!==e.avail_in)return de(e,$);if(i.status===he&&0===i.wrap&&(i.status=ce),i.status===he){let t=ae+(i.w_bits-8<<4)<<8,s=-1;if(s=i.strategy>=ie||i.level<2?0:i.level<6?1:6===i.level?2:3,t|=s<<6,0!==i.strstart&&(t|=32),t+=31-t%31,ye(i,t),0!==i.strstart&&(ye(i,e.adler>>>16),ye(i,65535&e.adler)),e.adler=1,i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J}if(57===i.status)if(e.adler=0,be(i,31),be(i,139),be(i,8),i.gzhead)be(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),be(i,255&i.gzhead.time),be(i,i.gzhead.time>>8&255),be(i,i.gzhead.time>>16&255),be(i,i.gzhead.time>>24&255),be(i,9===i.level?2:i.strategy>=ie||i.level<2?4:0),be(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(be(i,255&i.gzhead.extra.length),be(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=U(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(be(i,0),be(i,0),be(i,0),be(i,0),be(i,0),be(i,9===i.level?2:i.strategy>=ie||i.level<2?4:0),be(i,3),i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J;if(69===i.status){if(i.gzhead.extra){let t=i.pending,s=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+s>i.pending_buf_size;){let r=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+r),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>t&&(e.adler=U(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex+=r,_e(e),0!==i.pending)return i.last_flush=-1,J;t=0,s-=r}let r=new Uint8Array(i.gzhead.extra);i.pending_buf.set(r.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending+=s,i.gzhead.hcrc&&i.pending>t&&(e.adler=U(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),_e(e),0!==i.pending)return i.last_flush=-1,J;s=0}t=i.gzindexs&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),_e(e),0!==i.pending)return i.last_flush=-1,J;s=0}t=i.gzindexs&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(_e(e),0!==i.pending))return i.last_flush=-1,J;be(i,255&e.adler),be(i,e.adler>>8&255),e.adler=0}if(i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J}if(0!==e.avail_in||0!==i.lookahead||t!==G&&i.status!==ue){let s=0===i.level?Pe(i,t):i.strategy===ie?((e,t)=>{let i;for(;;){if(0===e.lookahead&&(we(e),0===e.lookahead)){if(t===G)return 1;break}if(e.match_length=0,i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2})(i,t):i.strategy===se?((e,t)=>{let i,s,r,o;const n=e.window;for(;;){if(e.lookahead<=le){if(we(e),e.lookahead<=le&&t===G)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,s=n[r],s===n[++r]&&s===n[++r]&&s===n[++r])){o=e.strstart+le;do{}while(s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&re.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=H(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2})(i,t):Fe[i.level].func(i,t);if(3!==s&&4!==s||(i.status=ue),1===s||3===s)return 0===e.avail_out&&(i.last_flush=-1),J;if(2===s&&(t===z?j(i):t!==X&&(Q(i,0,0,!1),t===W&&(fe(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),_e(e),0===e.avail_out))return i.last_flush=-1,J}return t!==K?J:i.wrap<=0?Y:(2===i.wrap?(be(i,255&e.adler),be(i,e.adler>>8&255),be(i,e.adler>>16&255),be(i,e.adler>>24&255),be(i,255&e.total_in),be(i,e.total_in>>8&255),be(i,e.total_in>>16&255),be(i,e.total_in>>24&255)):(ye(i,e.adler>>>16),ye(i,65535&e.adler)),_e(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?J:Y)},Oe=e=>{if(De(e))return Z;const t=e.state.status;return e.state=null,t===ce?de(e,q):J},Ne=(e,t)=>{let i=t.length;if(De(e))return Z;const s=e.state,r=s.wrap;if(2===r||1===r&&s.status!==he||s.lookahead)return Z;if(1===r&&(e.adler=L(e.adler,t,i,0)),s.wrap=0,i>=s.w_size){0===r&&(fe(s.head),s.strstart=0,s.block_start=0,s.insert=0);let e=new Uint8Array(s.w_size);e.set(t.subarray(i-s.w_size,i),0),t=e,i=s.w_size}const o=e.avail_in,n=e.next_in,a=e.input;for(e.avail_in=i,e.next_in=0,e.input=t,we(s);s.lookahead>=3;){let e=s.strstart,t=s.lookahead-2;do{s.ins_h=me(s,s.ins_h,s.window[e+3-1]),s.prev[e&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=e,e++}while(--t);s.strstart=e,s.lookahead=2,we(s)}return s.strstart+=s.lookahead,s.block_start=s.strstart,s.insert=s.lookahead,s.lookahead=0,s.match_length=s.prev_length=2,s.match_available=0,e.next_in=n,e.input=a,e.avail_in=o,s.wrap=r,J};const Qe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ve=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)Qe(i,t)&&(e[t]=i[t])}}return e},He=e=>{let t=0;for(let i=0,s=e.length;i=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Ge[254]=Ge[254]=1;var ze=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,s,r,o,n=e.length,a=0;for(r=0;r>>6,t[o++]=128|63&i):i<65536?(t[o++]=224|i>>>12,t[o++]=128|i>>>6&63,t[o++]=128|63&i):(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63,t[o++]=128|i>>>6&63,t[o++]=128|63&i);return t},We=(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let s,r;const o=new Array(2*i);for(r=0,s=0;s4)o[r++]=65533,s+=n-1;else{for(t&=2===n?31:3===n?15:7;n>1&&s1?o[r++]=65533:t<65536?o[r++]=t:(t-=65536,o[r++]=55296|t>>10&1023,o[r++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&je)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let s=0;s{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+Ge[e[i]]>t?i:t},Xe=function(){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};const Je=Object.prototype.toString,{Z_NO_FLUSH:Ye,Z_SYNC_FLUSH:Ze,Z_FULL_FLUSH:qe,Z_FINISH:$e,Z_OK:et,Z_STREAM_END:tt,Z_DEFAULT_COMPRESSION:it,Z_DEFAULT_STRATEGY:st,Z_DEFLATED:rt}=O;function ot(e){this.options=Ve({level:it,method:rt,chunkSize:16384,windowBits:15,memLevel:8,strategy:st},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xe,this.strm.avail_out=0;let i=Re(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==et)throw new Error(k[i]);if(t.header&&Ue(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?ze(t.dictionary):"[object ArrayBuffer]"===Je.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,i=Ne(this.strm,e),i!==et)throw new Error(k[i]);this._dict_set=!0}}function nt(e,t){const i=new ot(t);if(i.push(e,!0),i.err)throw i.msg||k[i.err];return i.result}ot.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize;let r,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?$e:Ye,"string"==typeof e?i.input=ze(e):"[object ArrayBuffer]"===Je.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),(o===Ze||o===qe)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(r=ke(i,o),r===tt)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),r=Oe(this.strm),this.onEnd(r),this.ended=!0,r===et;if(0!==i.avail_out){if(o>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},ot.prototype.onData=function(e){this.chunks.push(e)},ot.prototype.onEnd=function(e){e===et&&(this.result=He(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var at={Deflate:ot,deflate:nt,deflateRaw:function(e,t){return(t=t||{}).raw=!0,nt(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,nt(e,t)},constants:O};const lt=16209;var At=function(e,t){let i,s,r,o,n,a,l,A,h,c,u,d,p,f,g,m,_,v,b,y,x,B,w,P;const C=e.state;i=e.next_in,w=e.input,s=i+(e.avail_in-5),r=e.next_out,P=e.output,o=r-(t-e.avail_out),n=r+(e.avail_out-257),a=C.dmax,l=C.wsize,A=C.whave,h=C.wnext,c=C.window,u=C.hold,d=C.bits,p=C.lencode,f=C.distcode,g=(1<>>24,u>>>=v,d-=v,v=_>>>16&255,0===v)P[r++]=65535&_;else{if(!(16&v)){if(0==(64&v)){_=p[(65535&_)+(u&(1<>>=v,d-=v),d<15&&(u+=w[i++]<>>24,u>>>=v,d-=v,v=_>>>16&255,!(16&v)){if(0==(64&v)){_=f[(65535&_)+(u&(1<a){e.msg="invalid distance too far back",C.mode=lt;break e}if(u>>>=v,d-=v,v=r-o,y>v){if(v=y-v,v>A&&C.sane){e.msg="invalid distance too far back",C.mode=lt;break e}if(x=0,B=c,0===h){if(x+=l-v,v2;)P[r++]=B[x++],P[r++]=B[x++],P[r++]=B[x++],b-=3;b&&(P[r++]=B[x++],b>1&&(P[r++]=B[x++]))}else{x=r-y;do{P[r++]=P[x++],P[r++]=P[x++],P[r++]=P[x++],b-=3}while(b>2);b&&(P[r++]=P[x++],b>1&&(P[r++]=P[x++]))}break}}break}}while(i>3,i-=b,d-=b<<3,u&=(1<{const l=a.bits;let A,h,c,u,d,p,f=0,g=0,m=0,_=0,v=0,b=0,y=0,x=0,B=0,w=0,P=null;const C=new Uint16Array(16),M=new Uint16Array(16);let E,F,I,D=null;for(f=0;f<=15;f++)C[f]=0;for(g=0;g=1&&0===C[_];_--);if(v>_&&(v=_),0===_)return r[o++]=20971520,r[o++]=20971520,a.bits=1,0;for(m=1;m<_&&0===C[m];m++);for(v0&&(0===e||1!==_))return-1;for(M[1]=0,f=1;f<15;f++)M[f+1]=M[f]+C[f];for(g=0;g852||2===e&&B>592)return 1;for(;;){E=f-y,n[g]+1=p?(F=D[n[g]-p],I=P[n[g]-p]):(F=96,I=0),A=1<>y)+h]=E<<24|F<<16|I|0}while(0!==h);for(A=1<>=1;if(0!==A?(w&=A-1,w+=A):w=0,g++,0==--C[f]){if(f===_)break;f=t[i+n[g]]}if(f>v&&(w&u)!==c){for(0===y&&(y=v),d+=m,b=f-y,x=1<852||2===e&&B>592)return 1;c=w&u,r[c]=v<<24|b<<16|d-o|0}}return 0!==w&&(r[d+w]=f-y<<24|64<<16|0),a.bits=v,0};const{Z_FINISH:ft,Z_BLOCK:gt,Z_TREES:mt,Z_OK:_t,Z_STREAM_END:vt,Z_NEED_DICT:bt,Z_STREAM_ERROR:yt,Z_DATA_ERROR:xt,Z_MEM_ERROR:Bt,Z_BUF_ERROR:wt,Z_DEFLATED:Pt}=O,Ct=16180,Mt=16190,Et=16191,Ft=16192,It=16194,Dt=16199,St=16200,Tt=16206,Lt=16209,Rt=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Ut(){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}const kt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode16211?1:0},Ot=e=>{if(kt(e))return yt;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Ct,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,_t},Nt=e=>{if(kt(e))return yt;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Ot(e)},Qt=(e,t)=>{let i;if(kt(e))return yt;const s=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?yt:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=i,s.wbits=t,Nt(e))},Vt=(e,t)=>{if(!e)return yt;const i=new Ut;e.state=i,i.strm=e,i.window=null,i.mode=Ct;const s=Qt(e,t);return s!==_t&&(e.state=null),s};let Ht,jt,Gt=!0;const zt=e=>{if(Gt){Ht=new Int32Array(512),jt=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(pt(1,e.lens,0,288,Ht,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;pt(2,e.lens,0,32,jt,0,e.work,{bits:5}),Gt=!1}e.lencode=Ht,e.lenbits=9,e.distcode=jt,e.distbits=5},Wt=(e,t,i,s)=>{let r;const o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(o.window.set(t.subarray(i-o.wsize,i),0),o.wnext=0,o.whave=o.wsize):(r=o.wsize-o.wnext,r>s&&(r=s),o.window.set(t.subarray(i-s,i-s+r),o.wnext),(s-=r)?(o.window.set(t.subarray(i-s,i),0),o.wnext=s,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave{let i,s,r,o,n,a,l,A,h,c,u,d,p,f,g,m,_,v,b,y,x,B,w=0;const P=new Uint8Array(4);let C,M;const E=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(kt(e)||!e.output||!e.input&&0!==e.avail_in)return yt;i=e.state,i.mode===Et&&(i.mode=Ft),n=e.next_out,r=e.output,l=e.avail_out,o=e.next_in,s=e.input,a=e.avail_in,A=i.hold,h=i.bits,c=a,u=l,B=_t;e:for(;;)switch(i.mode){case Ct:if(0===i.wrap){i.mode=Ft;break}for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>>8&255,i.check=U(i.check,P,2,0),A=0,h=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&A)<<8)+(A>>8))%31){e.msg="incorrect header check",i.mode=Lt;break}if((15&A)!==Pt){e.msg="unknown compression method",i.mode=Lt;break}if(A>>>=4,h-=4,x=8+(15&A),0===i.wbits&&(i.wbits=x),x>15||x>i.wbits){e.msg="invalid window size",i.mode=Lt;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(P[0]=255&A,P[1]=A>>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0,i.mode=16182;case 16182:for(;h<32;){if(0===a)break e;a--,A+=s[o++]<>>8&255,P[2]=A>>>16&255,P[3]=A>>>24&255,i.check=U(i.check,P,4,0)),A=0,h=0,i.mode=16183;case 16183:for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>8),512&i.flags&&4&i.wrap&&(P[0]=255&A,P[1]=A>>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0,i.mode=16184;case 16184:if(1024&i.flags){for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(d=i.length,d>a&&(d=a),d&&(i.head&&(x=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(s.subarray(o,o+d),x)),512&i.flags&&4&i.wrap&&(i.check=U(i.check,s,d,o)),a-=d,o+=d,i.length-=d),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break e;d=0;do{x=s[o+d++],i.head&&x&&i.length<65536&&(i.head.name+=String.fromCharCode(x))}while(x&&d>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Et;break;case 16189:for(;h<32;){if(0===a)break e;a--,A+=s[o++]<>>=7&h,h-=7&h,i.mode=Tt;break}for(;h<3;){if(0===a)break e;a--,A+=s[o++]<>>=1,h-=1,3&A){case 0:i.mode=16193;break;case 1:if(zt(i),i.mode=Dt,t===mt){A>>>=2,h-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=Lt}A>>>=2,h-=2;break;case 16193:for(A>>>=7&h,h-=7&h;h<32;){if(0===a)break e;a--,A+=s[o++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=Lt;break}if(i.length=65535&A,A=0,h=0,i.mode=It,t===mt)break e;case It:i.mode=16195;case 16195:if(d=i.length,d){if(d>a&&(d=a),d>l&&(d=l),0===d)break e;r.set(s.subarray(o,o+d),n),a-=d,o+=d,l-=d,n+=d,i.length-=d;break}i.mode=Et;break;case 16196:for(;h<14;){if(0===a)break e;a--,A+=s[o++]<>>=5,h-=5,i.ndist=1+(31&A),A>>>=5,h-=5,i.ncode=4+(15&A),A>>>=4,h-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=Lt;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,h-=3}for(;i.have<19;)i.lens[E[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,C={bits:i.lenbits},B=pt(0,i.lens,0,19,i.lencode,0,i.work,C),i.lenbits=C.bits,B){e.msg="invalid code lengths set",i.mode=Lt;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=w>>>16&255,_=65535&w,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=g,h-=g,i.lens[i.have++]=_;else{if(16===_){for(M=g+2;h>>=g,h-=g,0===i.have){e.msg="invalid bit length repeat",i.mode=Lt;break}x=i.lens[i.have-1],d=3+(3&A),A>>>=2,h-=2}else if(17===_){for(M=g+3;h>>=g,h-=g,x=0,d=3+(7&A),A>>>=3,h-=3}else{for(M=g+7;h>>=g,h-=g,x=0,d=11+(127&A),A>>>=7,h-=7}if(i.have+d>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=Lt;break}for(;d--;)i.lens[i.have++]=x}}if(i.mode===Lt)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=Lt;break}if(i.lenbits=9,C={bits:i.lenbits},B=pt(1,i.lens,0,i.nlen,i.lencode,0,i.work,C),i.lenbits=C.bits,B){e.msg="invalid literal/lengths set",i.mode=Lt;break}if(i.distbits=6,i.distcode=i.distdyn,C={bits:i.distbits},B=pt(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,C),i.distbits=C.bits,B){e.msg="invalid distances set",i.mode=Lt;break}if(i.mode=Dt,t===mt)break e;case Dt:i.mode=St;case St:if(a>=6&&l>=258){e.next_out=n,e.avail_out=l,e.next_in=o,e.avail_in=a,i.hold=A,i.bits=h,At(e,u),n=e.next_out,r=e.output,l=e.avail_out,o=e.next_in,s=e.input,a=e.avail_in,A=i.hold,h=i.bits,i.mode===Et&&(i.back=-1);break}for(i.back=0;w=i.lencode[A&(1<>>24,m=w>>>16&255,_=65535&w,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>v)],g=w>>>24,m=w>>>16&255,_=65535&w,!(v+g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=v,h-=v,i.back+=v}if(A>>>=g,h-=g,i.back+=g,i.length=_,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=Et;break}if(64&m){e.msg="invalid literal/length code",i.mode=Lt;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;w=i.distcode[A&(1<>>24,m=w>>>16&255,_=65535&w,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>v)],g=w>>>24,m=w>>>16&255,_=65535&w,!(v+g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=v,h-=v,i.back+=v}if(A>>>=g,h-=g,i.back+=g,64&m){e.msg="invalid distance code",i.mode=Lt;break}i.offset=_,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=Lt;break}i.mode=16204;case 16204:if(0===l)break e;if(d=u-l,i.offset>d){if(d=i.offset-d,d>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=Lt;break}d>i.wnext?(d-=i.wnext,p=i.wsize-d):p=i.wnext-d,d>i.length&&(d=i.length),f=i.window}else f=r,p=n-i.offset,d=i.length;d>l&&(d=l),l-=d,i.length-=d;do{r[n++]=f[p++]}while(--d);0===i.length&&(i.mode=St);break;case 16205:if(0===l)break e;r[n++]=i.length,l--,i.mode=St;break;case Tt:if(i.wrap){for(;h<32;){if(0===a)break e;a--,A|=s[o++]<{if(kt(e))return yt;let t=e.state;return t.window&&(t.window=null),e.state=null,_t},Zt=(e,t)=>{if(kt(e))return yt;const i=e.state;return 0==(2&i.wrap)?yt:(i.head=t,t.done=!1,_t)},qt=(e,t)=>{const i=t.length;let s,r,o;return kt(e)?yt:(s=e.state,0!==s.wrap&&s.mode!==Mt?yt:s.mode===Mt&&(r=1,r=L(r,t,i,0),r!==s.check)?xt:(o=Wt(e,t,i,i),o?(s.mode=16210,Bt):(s.havedict=1,_t)))},$t=function(){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};const ei=Object.prototype.toString,{Z_NO_FLUSH:ti,Z_FINISH:ii,Z_OK:si,Z_STREAM_END:ri,Z_NEED_DICT:oi,Z_STREAM_ERROR:ni,Z_DATA_ERROR:ai,Z_MEM_ERROR:li}=O;function Ai(e){this.options=Ve({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xe,this.strm.avail_out=0;let i=Xt(this.strm,t.windowBits);if(i!==si)throw new Error(k[i]);if(this.header=new $t,Zt(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=ze(t.dictionary):"[object ArrayBuffer]"===ei.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=qt(this.strm,t.dictionary),i!==si)))throw new Error(k[i])}function hi(e,t){const i=new Ai(t);if(i.push(e),i.err)throw i.msg||k[i.err];return i.result}Ai.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize,r=this.options.dictionary;let o,n,a;if(this.ended)return!1;for(n=t===~~t?t:!0===t?ii:ti,"[object ArrayBuffer]"===ei.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),o=Jt(i,n),o===oi&&r&&(o=qt(i,r),o===si?o=Jt(i,n):o===ai&&(o=oi));i.avail_in>0&&o===ri&&i.state.wrap>0&&0!==e[i.next_in];)Kt(i),o=Jt(i,n);switch(o){case ni:case ai:case oi:case li:return this.onEnd(o),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||o===ri))if("string"===this.options.to){let e=Ke(i.output,i.next_out),t=i.next_out-e,r=We(i.output,e);i.next_out=t,i.avail_out=s-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(r)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(o!==si||0!==a){if(o===ri)return o=Yt(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ai.prototype.onData=function(e){this.chunks.push(e)},Ai.prototype.onEnd=function(e){e===si&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=He(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ci={Inflate:Ai,inflate:hi,inflateRaw:function(e,t){return(t=t||{}).raw=!0,hi(e,t)},ungzip:hi,constants:O};const{Deflate:ui,deflate:di,deflateRaw:pi,gzip:fi}=at,{Inflate:gi,inflate:mi,inflateRaw:_i,ungzip:vi}=ci;var bi=ui,yi=di,xi=pi,Bi=fi,wi=gi,Pi=mi,Ci=_i,Mi=vi,Ei=O,Fi={Deflate:bi,deflate:yi,deflateRaw:xi,gzip:Bi,Inflate:wi,inflate:Pi,inflateRaw:Ci,ungzip:Mi,constants:Ei};e.Deflate=bi,e.Inflate=wi,e.constants=Ei,e.default=Fi,e.deflate=yi,e.deflateRaw=xi,e.gzip=Bi,e.inflate=Pi,e.inflateRaw=Ci,e.ungzip=Mi,Object.defineProperty(e,"__esModule",{value:!0})}));var Cw=Object.freeze({__proto__:null});let Mw=window.pako||Cw;Mw.inflate||(Mw=Mw.default);const Ew=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const Fw={version:1,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],meshPositions:e[4],meshIndices:e[5],meshEdgesIndices:e[6],meshColors:e[7],entityIDs:e[8],entityMeshes:e[9],entityIsObjects:e[10],positionsDecodeMatrix:e[11]}}(i),a=function(e){return{positions:new Uint16Array(Mw.inflate(e.positions).buffer),normals:new Int8Array(Mw.inflate(e.normals).buffer),indices:new Uint32Array(Mw.inflate(e.indices).buffer),edgeIndices:new Uint32Array(Mw.inflate(e.edgeIndices).buffer),meshPositions:new Uint32Array(Mw.inflate(e.meshPositions).buffer),meshIndices:new Uint32Array(Mw.inflate(e.meshIndices).buffer),meshEdgesIndices:new Uint32Array(Mw.inflate(e.meshEdgesIndices).buffer),meshColors:new Uint8Array(Mw.inflate(e.meshColors).buffer),entityIDs:Mw.inflate(e.entityIDs,{to:"string"}),entityMeshes:new Uint32Array(Mw.inflate(e.entityMeshes).buffer),entityIsObjects:new Uint8Array(Mw.inflate(e.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(Mw.inflate(e.positionsDecodeMatrix).buffer)}}(n);!function(e,t,i,s,r,o){o.getNextId(),s.positionsCompression="precompressed",s.normalsCompression="precompressed";const n=i.positions,a=i.normals,l=i.indices,A=i.edgeIndices,h=i.meshPositions,u=i.meshIndices,d=i.meshEdgesIndices,p=i.meshColors,f=JSON.parse(i.entityIDs),g=i.entityMeshes,m=i.entityIsObjects,v=h.length,b=g.length;for(let r=0;rg[e]g[t]?1:0));for(let e=0;e1||(E[i]=e)}}for(let e=0;e1,o=kw(m.subarray(4*t,4*t+3)),u=m[4*t+3]/255,v=a.subarray(d[t],i?a.length:d[t+1]),y=l.subarray(d[t],i?l.length:d[t+1]),x=A.subarray(p[t],i?A.length:p[t+1]),w=h.subarray(f[t],i?h.length:f[t+1]),M=c.subarray(g[t],g[t]+16);if(r){const e=`${n}-geometry.${t}`;s.createGeometry({id:e,primitive:"triangles",positionsCompressed:v,normalsCompressed:y,indices:x,edgeIndices:w,positionsDecodeMatrix:M})}else{const e=`${n}-${t}`;b[E[t]];const i={};s.createMesh(_.apply(i,{id:e,primitive:"triangles",positionsCompressed:v,normalsCompressed:y,indices:x,edgeIndices:w,positionsDecodeMatrix:M,color:o,opacity:u}))}}let F=0;for(let e=0;e1){const t={},r=`${n}-instance.${F++}`,o=`${n}-geometry.${i}`,a=16*x[e],A=u.subarray(a,a+16);s.createMesh(_.apply(t,{id:r,geometryId:o,matrix:A})),l.push(r)}else l.push(i)}if(l.length>0){const e={};s.createEntity(_.apply(e,{id:r,isObject:!0,meshIds:l}))}}}(0,0,a,s,0,o)}};let Nw=window.pako||Cw;Nw.inflate||(Nw=Nw.default);const Qw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const Vw={version:5,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],eachPrimitivePositionsAndNormalsPortion:e[5],eachPrimitiveIndicesPortion:e[6],eachPrimitiveEdgeIndicesPortion:e[7],eachPrimitiveColor:e[8],primitiveInstances:e[9],eachEntityId:e[10],eachEntityPrimitiveInstancesPortion:e[11],eachEntityMatricesPortion:e[12]}}(i),a=function(e){return{positions:new Float32Array(Nw.inflate(e.positions).buffer),normals:new Int8Array(Nw.inflate(e.normals).buffer),indices:new Uint32Array(Nw.inflate(e.indices).buffer),edgeIndices:new Uint32Array(Nw.inflate(e.edgeIndices).buffer),matrices:new Float32Array(Nw.inflate(e.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(Nw.inflate(e.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(Nw.inflate(e.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(Nw.inflate(e.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveColor:new Uint8Array(Nw.inflate(e.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(Nw.inflate(e.primitiveInstances).buffer),eachEntityId:Nw.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(Nw.inflate(e.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(Nw.inflate(e.eachEntityMatricesPortion).buffer)}}(n);!function(e,t,i,s,r,o){const n=o.getNextId();s.positionsCompression="disabled",s.normalsCompression="precompressed";const a=i.positions,l=i.normals,A=i.indices,h=i.edgeIndices,c=i.matrices,u=i.eachPrimitivePositionsAndNormalsPortion,d=i.eachPrimitiveIndicesPortion,p=i.eachPrimitiveEdgeIndicesPortion,f=i.eachPrimitiveColor,g=i.primitiveInstances,m=JSON.parse(i.eachEntityId),v=i.eachEntityPrimitiveInstancesPortion,b=i.eachEntityMatricesPortion,y=u.length,x=g.length,B=new Uint8Array(y),w=m.length;for(let e=0;e1||(P[i]=e)}}for(let e=0;e1,r=Qw(f.subarray(4*e,4*e+3)),o=f[4*e+3]/255,c=a.subarray(u[e],t?a.length:u[e+1]),g=l.subarray(u[e],t?l.length:u[e+1]),v=A.subarray(d[e],t?A.length:d[e+1]),b=h.subarray(p[e],t?h.length:p[e+1]);if(i){const t=`${n}-geometry.${e}`;s.createGeometry({id:t,primitive:"triangles",positionsCompressed:c,normalsCompressed:g,indices:v,edgeIndices:b})}else{const t=e;m[P[e]];const i={};s.createMesh(_.apply(i,{id:t,primitive:"triangles",positionsCompressed:c,normalsCompressed:g,indices:v,edgeIndices:b,color:r,opacity:o}))}}let C=0;for(let e=0;e1){const t={},r="instance."+C++,o="geometry"+i,n=16*b[e],l=c.subarray(n,n+16);s.createMesh(_.apply(t,{id:r,geometryId:o,matrix:l})),a.push(r)}else a.push(i)}if(a.length>0){const e={};s.createEntity(_.apply(e,{id:r,isObject:!0,meshIds:a}))}}}(0,0,a,s,0,o)}};let Hw=window.pako||Cw;Hw.inflate||(Hw=Hw.default);const jw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const Gw={version:6,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],reusedPrimitivesDecodeMatrix:e[5],eachPrimitivePositionsAndNormalsPortion:e[6],eachPrimitiveIndicesPortion:e[7],eachPrimitiveEdgeIndicesPortion:e[8],eachPrimitiveColorAndOpacity:e[9],primitiveInstances:e[10],eachEntityId:e[11],eachEntityPrimitiveInstancesPortion:e[12],eachEntityMatricesPortion:e[13],eachTileAABB:e[14],eachTileEntitiesPortion:e[15]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:Hw.inflate(e,t).buffer}return{positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedPrimitivesDecodeMatrix:new Float32Array(t(e.reusedPrimitivesDecodeMatrix)),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(t(e.eachPrimitivePositionsAndNormalsPortion)),eachPrimitiveIndicesPortion:new Uint32Array(t(e.eachPrimitiveIndicesPortion)),eachPrimitiveEdgeIndicesPortion:new Uint32Array(t(e.eachPrimitiveEdgeIndicesPortion)),eachPrimitiveColorAndOpacity:new Uint8Array(t(e.eachPrimitiveColorAndOpacity)),primitiveInstances:new Uint32Array(t(e.primitiveInstances)),eachEntityId:Hw.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(t(e.eachEntityPrimitiveInstancesPortion)),eachEntityMatricesPortion:new Uint32Array(t(e.eachEntityMatricesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(n);!function(e,t,i,s,r,o){const n=o.getNextId(),a=i.positions,l=i.normals,A=i.indices,h=i.edgeIndices,u=i.matrices,d=i.reusedPrimitivesDecodeMatrix,p=i.eachPrimitivePositionsAndNormalsPortion,f=i.eachPrimitiveIndicesPortion,g=i.eachPrimitiveEdgeIndicesPortion,m=i.eachPrimitiveColorAndOpacity,v=i.primitiveInstances,b=JSON.parse(i.eachEntityId),y=i.eachEntityPrimitiveInstancesPortion,x=i.eachEntityMatricesPortion,B=i.eachTileAABB,w=i.eachTileEntitiesPortion,P=p.length,C=v.length,M=b.length,E=w.length,F=new Uint32Array(P);for(let e=0;e1,c=t===P-1,u=a.subarray(p[t],c?a.length:p[t+1]),b=l.subarray(p[t],c?l.length:p[t+1]),y=A.subarray(f[t],c?A.length:f[t+1]),x=h.subarray(g[t],c?h.length:g[t+1]),B=jw(m.subarray(4*t,4*t+3)),w=m[4*t+3]/255,C=o.getNextId();if(r){const e=`${n}-geometry.${i}.${t}`;U[e]||(s.createGeometry({id:e,primitive:"triangles",positionsCompressed:u,indices:y,edgeIndices:x,positionsDecodeMatrix:d}),U[e]=!0),s.createMesh(_.apply(N,{id:C,geometryId:e,origin:I,matrix:E,color:B,opacity:w})),L.push(C)}else s.createMesh(_.apply(N,{id:C,origin:I,primitive:"triangles",positionsCompressed:u,normalsCompressed:b,indices:y,edgeIndices:x,positionsDecodeMatrix:R,color:B,opacity:w})),L.push(C)}L.length>0&&s.createEntity(_.apply(O,{id:w,isObject:!0,meshIds:L}))}}}(e,t,a,s,0,o)}};let zw=window.pako||Cw;zw.inflate||(zw=zw.default);const Ww=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function Kw(e){const t=[];for(let i=0,s=e.length;i1,c=t===F-1,P=Ww(w.subarray(6*e,6*e+3)),C=w[6*e+3]/255,M=w[6*e+4]/255,E=w[6*e+5]/255,I=o.getNextId();if(r){const r=B[e],o=d.slice(r,r+16),x=`${n}-geometry.${i}.${t}`;if(!Q[x]){let e,i,r,o,n,d;switch(f[t]){case 0:e="solid",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 1:e="surface",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 2:e="points",i=a.subarray(g[t],c?a.length:g[t+1]),o=Kw(A.subarray(v[t],c?A.length:v[t+1]));break;case 3:e="lines",i=a.subarray(g[t],c?a.length:g[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]);break;default:continue}s.createGeometry({id:x,primitive:e,positionsCompressed:i,normalsCompressed:r,colors:o,indices:n,edgeIndices:d,positionsDecodeMatrix:p}),Q[x]=!0}s.createMesh(_.apply(V,{id:I,geometryId:x,origin:L,matrix:o,color:P,metallic:M,roughness:E,opacity:C})),U.push(I)}else{let e,i,r,o,n,d;switch(f[t]){case 0:e="solid",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 1:e="surface",i=a.subarray(g[t],c?a.length:g[t+1]),r=l.subarray(m[t],c?l.length:m[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]),d=u.subarray(y[t],c?u.length:y[t+1]);break;case 2:e="points",i=a.subarray(g[t],c?a.length:g[t+1]),o=Kw(A.subarray(v[t],c?A.length:v[t+1]));break;case 3:e="lines",i=a.subarray(g[t],c?a.length:g[t+1]),n=h.subarray(b[t],c?h.length:b[t+1]);break;default:continue}s.createMesh(_.apply(V,{id:I,origin:L,primitive:e,positionsCompressed:i,normalsCompressed:r,colors:o,indices:n,edgeIndices:d,positionsDecodeMatrix:N,color:P,metallic:M,roughness:E,opacity:C})),U.push(I)}}U.length>0&&s.createEntity(_.apply(O,{id:E,isObject:!0,meshIds:U}))}}}(e,t,a,s,0,o)}};let Jw=window.pako||Cw;Jw.inflate||(Jw=Jw.default);const Yw=c.vec4(),Zw=c.vec4();const qw=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function $w(e){const t=[];for(let i=0,s=e.length;i1,l=r===R-1,A=qw(F.subarray(6*e,6*e+3)),h=F[6*e+3]/255,u=F[6*e+4]/255,I=F[6*e+5]/255,D=o.getNextId();if(a){const o=E[e],a=v.slice(o,o+16),M=`${n}-geometry.${i}.${r}`;let F=H[M];if(!F){F={batchThisMesh:!t.reuseGeometries};let e=!1;switch(y[r]){case 0:F.primitiveName="solid",F.geometryPositions=d.subarray(x[r],l?d.length:x[r+1]),F.geometryNormals=p.subarray(B[r],l?p.length:B[r+1]),F.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),F.geometryEdgeIndices=m.subarray(C[r],l?m.length:C[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 1:F.primitiveName="surface",F.geometryPositions=d.subarray(x[r],l?d.length:x[r+1]),F.geometryNormals=p.subarray(B[r],l?p.length:B[r+1]),F.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),F.geometryEdgeIndices=m.subarray(C[r],l?m.length:C[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 2:F.primitiveName="points",F.geometryPositions=d.subarray(x[r],l?d.length:x[r+1]),F.geometryColors=$w(f.subarray(w[r],l?f.length:w[r+1])),e=F.geometryPositions.length>0;break;case 3:F.primitiveName="lines",F.geometryPositions=d.subarray(x[r],l?d.length:x[r+1]),F.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;default:continue}if(e||(F=null),F&&(F.geometryPositions.length,F.batchThisMesh)){F.decompressedPositions=new Float32Array(F.geometryPositions.length);const e=F.geometryPositions,t=F.decompressedPositions;for(let i=0,s=e.length;i0&&n.length>0;break;case 1:e="surface",t=d.subarray(x[r],l?d.length:x[r+1]),i=p.subarray(B[r],l?p.length:B[r+1]),n=g.subarray(P[r],l?g.length:P[r+1]),a=m.subarray(C[r],l?m.length:C[r+1]),c=t.length>0&&n.length>0;break;case 2:e="points",t=d.subarray(x[r],l?d.length:x[r+1]),o=$w(f.subarray(w[r],l?f.length:w[r+1])),c=t.length>0;break;case 3:e="lines",t=d.subarray(x[r],l?d.length:x[r+1]),n=g.subarray(P[r],l?g.length:P[r+1]),c=t.length>0&&n.length>0;break;default:continue}c&&(s.createMesh(_.apply(G,{id:D,origin:Q,primitive:e,positionsCompressed:t,normalsCompressed:i,colorsCompressed:o,indices:n,edgeIndices:a,positionsDecodeMatrix:L,color:A,metallic:u,roughness:I,opacity:h})),T.push(D))}}T.length>0&&s.createEntity(_.apply(j,{id:A,isObject:!0,meshIds:T}))}}}(e,t,a,s,r,o)}};let tP=window.pako||Cw;tP.inflate||(tP=tP.default);const iP=c.vec4(),sP=c.vec4();const rP=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const oP={version:9,parse:function(e,t,i,s,r,o){const n=function(e){return{metadata:e[0],positions:e[1],normals:e[2],colors:e[3],indices:e[4],edgeIndices:e[5],matrices:e[6],reusedGeometriesDecodeMatrix:e[7],eachGeometryPrimitiveType:e[8],eachGeometryPositionsPortion:e[9],eachGeometryNormalsPortion:e[10],eachGeometryColorsPortion:e[11],eachGeometryIndicesPortion:e[12],eachGeometryEdgeIndicesPortion:e[13],eachMeshGeometriesPortion:e[14],eachMeshMatricesPortion:e[15],eachMeshMaterial:e[16],eachEntityId:e[17],eachEntityMeshesPortion:e[18],eachTileAABB:e[19],eachTileEntitiesPortion:e[20]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:tP.inflate(e,t).buffer}return{metadata:JSON.parse(tP.inflate(e.metadata,{to:"string"})),positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),colors:new Uint8Array(t(e.colors)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(t(e.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(t(e.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(t(e.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(t(e.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(t(e.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(t(e.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(t(e.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(t(e.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(t(e.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(t(e.eachMeshMaterial)),eachEntityId:JSON.parse(tP.inflate(e.eachEntityId,{to:"string"})),eachEntityMeshesPortion:new Uint32Array(t(e.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(n);!function(e,t,i,s,r,o){const n=o.getNextId(),a=i.metadata,l=i.positions,A=i.normals,h=i.colors,u=i.indices,d=i.edgeIndices,p=i.matrices,f=i.reusedGeometriesDecodeMatrix,g=i.eachGeometryPrimitiveType,m=i.eachGeometryPositionsPortion,v=i.eachGeometryNormalsPortion,b=i.eachGeometryColorsPortion,y=i.eachGeometryIndicesPortion,x=i.eachGeometryEdgeIndicesPortion,B=i.eachMeshGeometriesPortion,w=i.eachMeshMatricesPortion,P=i.eachMeshMaterial,C=i.eachEntityId,M=i.eachEntityMeshesPortion,E=i.eachTileAABB,F=i.eachTileEntitiesPortion,I=m.length,D=B.length,S=M.length,T=F.length;r&&r.loadData(a,{includeTypes:t.includeTypes,excludeTypes:t.excludeTypes,globalizeObjectIds:t.globalizeObjectIds});const L=new Uint32Array(I);for(let e=0;e1,C=r===I-1,M=rP(P.subarray(6*e,6*e+3)),E=P[6*e+3]/255,F=P[6*e+4]/255,D=P[6*e+5]/255,S=o.getNextId();if(a){const o=w[e],a=p.slice(o,o+16),B=`${n}-geometry.${i}.${r}`;let P=k[B];if(!P){P={batchThisMesh:!t.reuseGeometries};let e=!1;switch(g[r]){case 0:P.primitiveName="solid",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryNormals=A.subarray(v[r],C?A.length:v[r+1]),P.geometryIndices=u.subarray(y[r],C?u.length:y[r+1]),P.geometryEdgeIndices=d.subarray(x[r],C?d.length:x[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;case 1:P.primitiveName="surface",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryNormals=A.subarray(v[r],C?A.length:v[r+1]),P.geometryIndices=u.subarray(y[r],C?u.length:y[r+1]),P.geometryEdgeIndices=d.subarray(x[r],C?d.length:x[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;case 2:P.primitiveName="points",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryColors=h.subarray(b[r],C?h.length:b[r+1]),e=P.geometryPositions.length>0;break;case 3:P.primitiveName="lines",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryIndices=u.subarray(y[r],C?u.length:y[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;default:continue}if(e||(P=null),P&&(P.geometryPositions.length,P.batchThisMesh)){P.decompressedPositions=new Float32Array(P.geometryPositions.length),P.transformedAndRecompressedPositions=new Uint16Array(P.geometryPositions.length);const e=P.geometryPositions,t=P.decompressedPositions;for(let i=0,s=e.length;i0&&n.length>0;break;case 1:e="surface",t=l.subarray(m[r],C?l.length:m[r+1]),i=A.subarray(v[r],C?A.length:v[r+1]),n=u.subarray(y[r],C?u.length:y[r+1]),a=d.subarray(x[r],C?d.length:x[r+1]),c=t.length>0&&n.length>0;break;case 2:e="points",t=l.subarray(m[r],C?l.length:m[r+1]),o=h.subarray(b[r],C?h.length:b[r+1]),c=t.length>0;break;case 3:e="lines",t=l.subarray(m[r],C?l.length:m[r+1]),n=u.subarray(y[r],C?u.length:y[r+1]),c=t.length>0&&n.length>0;break;default:continue}c&&(s.createMesh(_.apply(j,{id:S,origin:R,primitive:e,positionsCompressed:t,normalsCompressed:i,colorsCompressed:o,indices:n,edgeIndices:a,positionsDecodeMatrix:Q,color:M,metallic:F,roughness:D,opacity:E})),O.push(S))}}O.length>0&&s.createEntity(_.apply(H,{id:E,isObject:!0,meshIds:O}))}}}(e,t,a,s,r,o)}};let nP=window.pako||Cw;nP.inflate||(nP=nP.default);const aP=c.vec4(),lP=c.vec4();const AP=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function hP(e,t){const i=[];if(t.length>1)for(let e=0,s=t.length-1;e1)for(let t=0,s=e.length/3-1;t0,a=9*e,c=1===h[a+0],u=h[a+1];h[a+2],h[a+3];const d=h[a+4],p=h[a+5],f=h[a+6],g=h[a+7],m=h[a+8];if(o){const t=new Uint8Array(l.subarray(i,r)).buffer,o=`${n}-texture-${e}`;if(c)s.createTexture({id:o,buffers:[t],minFilter:d,magFilter:p,wrapS:f,wrapT:g,wrapR:m});else{const e=new Blob([t],{type:10001===u?"image/jpeg":10002===u?"image/png":"image/gif"}),i=(window.URL||window.webkitURL).createObjectURL(e),r=document.createElement("img");r.src=i,s.createTexture({id:o,image:r,minFilter:d,magFilter:p,wrapS:f,wrapT:g,wrapR:m})}}}for(let e=0;e=0?`${n}-texture-${r}`:null,normalsTextureId:a>=0?`${n}-texture-${a}`:null,metallicRoughnessTextureId:o>=0?`${n}-texture-${o}`:null,emissiveTextureId:l>=0?`${n}-texture-${l}`:null,occlusionTextureId:A>=0?`${n}-texture-${A}`:null})}const j=new Uint32Array(N);for(let e=0;e1,l=r===N-1,A=D[e],h=A>=0?`${n}-textureSet-${A}`:null,T=AP(S.subarray(6*e,6*e+3)),L=S[6*e+3]/255,R=S[6*e+4]/255,O=S[6*e+5]/255,Q=o.getNextId();if(a){const o=I[e],a=b.slice(o,o+16),A=`${n}-geometry.${i}.${r}`;let F=W[A];if(!F){F={batchThisMesh:!t.reuseGeometries};let e=!1;switch(x[r]){case 0:F.primitiveName="solid",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryNormals=d.subarray(w[r],l?d.length:w[r+1]),F.geometryUVs=f.subarray(C[r],l?f.length:C[r+1]),F.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),F.geometryEdgeIndices=m.subarray(E[r],l?m.length:E[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 1:F.primitiveName="surface",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryNormals=d.subarray(w[r],l?d.length:w[r+1]),F.geometryUVs=f.subarray(C[r],l?f.length:C[r+1]),F.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),F.geometryEdgeIndices=m.subarray(E[r],l?m.length:E[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 2:F.primitiveName="points",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryColors=p.subarray(P[r],l?p.length:P[r+1]),e=F.geometryPositions.length>0;break;case 3:F.primitiveName="lines",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 4:F.primitiveName="lines",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryIndices=hP(F.geometryPositions,g.subarray(M[r],l?g.length:M[r+1])),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;default:continue}if(e||(F=null),F&&(F.geometryPositions.length,F.batchThisMesh)){F.decompressedPositions=new Float32Array(F.geometryPositions.length),F.transformedAndRecompressedPositions=new Uint16Array(F.geometryPositions.length);const e=F.geometryPositions,t=F.decompressedPositions;for(let i=0,s=e.length;i0&&a.length>0;break;case 1:e="surface",t=u.subarray(B[r],l?u.length:B[r+1]),i=d.subarray(w[r],l?d.length:w[r+1]),o=f.subarray(C[r],l?f.length:C[r+1]),a=g.subarray(M[r],l?g.length:M[r+1]),A=m.subarray(E[r],l?m.length:E[r+1]),c=t.length>0&&a.length>0;break;case 2:e="points",t=u.subarray(B[r],l?u.length:B[r+1]),n=p.subarray(P[r],l?p.length:P[r+1]),c=t.length>0;break;case 3:e="lines",t=u.subarray(B[r],l?u.length:B[r+1]),a=g.subarray(M[r],l?g.length:M[r+1]),c=t.length>0&&a.length>0;break;case 4:e="lines",t=u.subarray(B[r],l?u.length:B[r+1]),a=hP(t,g.subarray(M[r],l?g.length:M[r+1])),c=t.length>0&&a.length>0;break;default:continue}c&&(s.createMesh(_.apply(H,{id:Q,textureSetId:h,origin:G,primitive:e,positionsCompressed:t,normalsCompressed:i,uv:o&&o.length>0?o:null,colorsCompressed:n,indices:a,edgeIndices:A,positionsDecodeMatrix:v,color:T,metallic:R,roughness:O,opacity:L})),U.push(Q))}}U.length>0&&s.createEntity(_.apply(Q,{id:l,isObject:!0,meshIds:U}))}}}(e,t,a,s,r,o)}},uP={};uP[Fw.version]=Fw,uP[Sw.version]=Sw,uP[Rw.version]=Rw,uP[Ow.version]=Ow,uP[Vw.version]=Vw,uP[Gw.version]=Gw,uP[Xw.version]=Xw,uP[eP.version]=eP,uP[oP.version]=oP,uP[cP.version]=cP;var dP={};!function(e){var t,i="File format is not recognized.",s="Error while reading zip file.",r="Error while reading file data.",o=524288,n="text/plain";try{t=0===new Blob([new DataView(new ArrayBuffer(0))]).size}catch(e){}function a(){this.crc=-1}function l(){}function A(e,t){var i,s;return i=new ArrayBuffer(e),s=new Uint8Array(i),t&&s.set(t,0),{buffer:i,array:s,view:new DataView(i)}}function h(){}function c(e){var t,i=this;i.size=0,i.init=function(s,r){var o=new Blob([e],{type:n});(t=new d(o)).init((function(){i.size=t.size,s()}),r)},i.readUint8Array=function(e,i,s,r){t.readUint8Array(e,i,s,r)}}function u(t){var i,s=this;s.size=0,s.init=function(e){for(var r=t.length;"="==t.charAt(r-1);)r--;i=t.indexOf(",")+1,s.size=Math.floor(.75*(r-i)),e()},s.readUint8Array=function(s,r,o){var n,a=A(r),l=4*Math.floor(s/3),h=4*Math.ceil((s+r)/3),c=e.atob(t.substring(l+i,h+i)),u=s-3*Math.floor(l/4);for(n=u;ne.size)throw new RangeError("offset:"+t+", length:"+i+", size:"+e.size);return e.slice?e.slice(t,t+i):e.webkitSlice?e.webkitSlice(t,t+i):e.mozSlice?e.mozSlice(t,t+i):e.msSlice?e.msSlice(t,t+i):void 0}(e,t,i))}catch(e){r(e)}}}function p(){}function f(e){var i,s=this;s.init=function(e){i=new Blob([],{type:n}),e()},s.writeUint8Array=function(e,s){i=new Blob([i,t?e:e.buffer],{type:n}),s()},s.getData=function(t,s){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=s,r.readAsText(i,e)}}function g(t){var i=this,s="",r="";i.init=function(e){s+="data:"+(t||"")+";base64,",e()},i.writeUint8Array=function(t,i){var o,n=r.length,a=r;for(r="",o=0;o<3*Math.floor((n+t.length)/3)-n;o++)a+=String.fromCharCode(t[o]);for(;o2?s+=e.btoa(a):r=a,i()},i.getData=function(t){t(s+e.btoa(r))}}function m(e){var i,s=this;s.init=function(t){i=new Blob([],{type:e}),t()},s.writeUint8Array=function(s,r){i=new Blob([i,t?s:s.buffer],{type:e}),r()},s.getData=function(e){e(i)}}function _(e,t,i,s,r,n,a,l,A,h){var c,u,d,p=0,f=t.sn;function g(){e.removeEventListener("message",m,!1),l(u,d)}function m(t){var i=t.data,r=i.data,o=i.error;if(o)return o.toString=function(){return"Error: "+this.message},void A(o);if(i.sn===f)switch("number"==typeof i.codecTime&&(e.codecTime+=i.codecTime),"number"==typeof i.crcTime&&(e.crcTime+=i.crcTime),i.type){case"append":r?(u+=r.length,s.writeUint8Array(r,(function(){_()}),h)):_();break;case"flush":d=i.crc,r?(u+=r.length,s.writeUint8Array(r,(function(){g()}),h)):g();break;case"progress":a&&a(c+i.loaded,n);break;case"importScripts":case"newTask":case"echo":break;default:console.warn("zip.js:launchWorkerProcess: unknown message: ",i)}}function _(){(c=p*o)<=n?i.readUint8Array(r+c,Math.min(o,n-c),(function(i){a&&a(c,n);var s=0===c?t:{sn:f};s.type="append",s.data=i;try{e.postMessage(s,[i.buffer])}catch(t){e.postMessage(s)}p++}),A):e.postMessage({sn:f,type:"flush"})}u=0,e.addEventListener("message",m,!1),_()}function v(e,t,i,s,r,n,l,A,h,c){var u,d=0,p=0,f="input"===n,g="output"===n,m=new a;!function n(){var a;if((u=d*o)127?r[i-128]:String.fromCharCode(i);return s}function x(e){return decodeURIComponent(escape(e))}function B(e){var t,i="";for(t=0;t>16,i=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&i)>>11,(2016&i)>>5,2*(31&i),0)}catch(e){}}(e.lastModDateRaw),1!=(1&e.bitFlag)?((s||8!=(8&e.bitFlag))&&(e.crc32=t.view.getUint32(i+10,!0),e.compressedSize=t.view.getUint32(i+14,!0),e.uncompressedSize=t.view.getUint32(i+18,!0)),4294967295!==e.compressedSize&&4294967295!==e.uncompressedSize?(e.filenameLength=t.view.getUint16(i+22,!0),e.extraFieldLength=t.view.getUint16(i+24,!0)):r("File is using Zip64 (4gb+ file size).")):r("File contains encrypted entry.")}function P(t,o,n){var a=0;function l(){}l.prototype.getData=function(s,o,l,h){var c=this;function u(e,t){h&&!function(e){var t=A(4);return t.view.setUint32(0,e),c.crc32==t.view.getUint32(0)}(t)?n("CRC failed."):s.getData((function(e){o(e)}))}function d(e){n(e||r)}function p(e){n(e||"Error while writing file data.")}t.readUint8Array(c.offset,30,(function(r){var o,f=A(r.length,r);1347093252==f.view.getUint32(0)?(w(c,f,4,!1,n),o=c.offset+30+c.filenameLength+c.extraFieldLength,s.init((function(){0===c.compressionMethod?b(c._worker,a++,t,s,o,c.compressedSize,h,u,l,d,p):function(t,i,s,r,o,n,a,l,A,h,c){var u=a?"output":"none";e.zip.useWebWorkers?_(t,{sn:i,codecClass:"Inflater",crcType:u},s,r,o,n,A,l,h,c):v(new e.zip.Inflater,s,r,o,n,u,A,l,h,c)}(c._worker,a++,t,s,o,c.compressedSize,h,u,l,d,p)}),p)):n(i)}),d)};var h={getEntries:function(e){var r=this._worker;!function(e){t.size<22?n(i):r(22,(function(){r(Math.min(65558,t.size),(function(){n(i)}))}));function r(i,r){t.readUint8Array(t.size-i,i,(function(t){for(var i=t.length-22;i>=0;i--)if(80===t[i]&&75===t[i+1]&&5===t[i+2]&&6===t[i+3])return void e(new DataView(t.buffer,i,22));r()}),(function(){n(s)}))}}((function(o){var a,h;a=o.getUint32(16,!0),h=o.getUint16(8,!0),a<0||a>=t.size?n(i):t.readUint8Array(a,t.size-a,(function(t){var s,o,a,c,u=0,d=[],p=A(t.length,t);for(s=0;s>>8^i[255&(t^e[s])];this.crc=t},a.prototype.get=function(){return~this.crc},a.prototype.table=function(){var e,t,i,s=[];for(e=0;e<256;e++){for(i=e,t=0;t<8;t++)1&i?i=i>>>1^3988292384:i>>>=1;s[e]=i}return s}(),l.prototype.append=function(e,t){return e},l.prototype.flush=function(){},c.prototype=new h,c.prototype.constructor=c,u.prototype=new h,u.prototype.constructor=u,d.prototype=new h,d.prototype.constructor=d,p.prototype.getData=function(e){e(this.data)},f.prototype=new p,f.prototype.constructor=f,g.prototype=new p,g.prototype.constructor=g,m.prototype=new p,m.prototype.constructor=m;var F={deflater:["z-worker.js","deflate.js"],inflater:["z-worker.js","inflate.js"]};function I(t,i,s){if(null===e.zip.workerScripts||null===e.zip.workerScriptsPath){var r;if(e.zip.workerScripts){if(r=e.zip.workerScripts[t],!Array.isArray(r))return void s(new Error("zip.workerScripts."+t+" is not an array!"));r=function(e){var t=document.createElement("a");return e.map((function(e){return t.href=e,t.href}))}(r)}else(r=F[t].slice(0))[0]=(e.zip.workerScriptsPath||"")+r[0];var o=new Worker(r[0]);o.codecTime=o.crcTime=0,o.postMessage({type:"importScripts",scripts:r.slice(1)}),o.addEventListener("message",(function e(t){var r=t.data;if(r.error)return o.terminate(),void s(r.error);"importScripts"===r.type&&(o.removeEventListener("message",e),o.removeEventListener("error",n),i(o))})),o.addEventListener("error",n)}else s(new Error("Either zip.workerScripts or zip.workerScriptsPath may be set, not both."));function n(e){o.terminate(),s(e)}}function D(e){console.error(e)}e.zip={Reader:h,Writer:p,BlobReader:d,Data64URIReader:u,TextReader:c,BlobWriter:m,Data64URIWriter:g,TextWriter:f,createReader:function(e,t,i){i=i||D,e.init((function(){P(e,t,i)}),i)},createWriter:function(e,t,i,s){i=i||D,s=!!s,e.init((function(){E(e,t,i,s)}),i)},useWebWorkers:!0,workerScriptsPath:null,workerScripts:null}}(dP);const pP=dP.zip;!function(e){var t,i,s=e.Reader,r=e.Writer;try{i=0===new Blob([new DataView(new ArrayBuffer(0))]).size}catch(e){}function o(e){var t=this;function i(i,s){var r;t.data?i():((r=new XMLHttpRequest).addEventListener("load",(function(){t.size||(t.size=Number(r.getResponseHeader("Content-Length"))||Number(r.response.byteLength)),t.data=new Uint8Array(r.response),i()}),!1),r.addEventListener("error",s,!1),r.open("GET",e),r.responseType="arraybuffer",r.send())}t.size=0,t.init=function(s,r){if(function(e){var t=document.createElement("a");return t.href=e,"http:"===t.protocol||"https:"===t.protocol}(e)){var o=new XMLHttpRequest;o.addEventListener("load",(function(){t.size=Number(o.getResponseHeader("Content-Length")),t.size?s():i(s,r)}),!1),o.addEventListener("error",r,!1),o.open("HEAD",e),o.send()}else i(s,r)},t.readUint8Array=function(e,s,r,o){i((function(){r(new Uint8Array(t.data.subarray(e,e+s)))}),o)}}function n(e){var t=this;t.size=0,t.init=function(i,s){var r=new XMLHttpRequest;r.addEventListener("load",(function(){t.size=Number(r.getResponseHeader("Content-Length")),"bytes"==r.getResponseHeader("Accept-Ranges")?i():s("HTTP Range not supported.")}),!1),r.addEventListener("error",s,!1),r.open("HEAD",e),r.send()},t.readUint8Array=function(t,i,s,r){!function(t,i,s,r){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="arraybuffer",o.setRequestHeader("Range","bytes="+t+"-"+(t+i-1)),o.addEventListener("load",(function(){s(o.response)}),!1),o.addEventListener("error",r,!1),o.send()}(t,i,(function(e){s(new Uint8Array(e))}),r)}}function a(e){var t=this;t.size=0,t.init=function(i,s){t.size=e.byteLength,i()},t.readUint8Array=function(t,i,s,r){s(new Uint8Array(e.slice(t,t+i)))}}function l(){var e,t=this;t.init=function(t,i){e=new Uint8Array,t()},t.writeUint8Array=function(t,i,s){var r=new Uint8Array(e.length+t.length);r.set(e),r.set(t,e.length),e=r,i()},t.getData=function(t){t(e.buffer)}}function A(e,t){var s,r=this;r.init=function(t,i){e.createWriter((function(e){s=e,t()}),i)},r.writeUint8Array=function(e,r,o){var n=new Blob([i?e:e.buffer],{type:t});s.onwrite=function(){s.onwrite=null,r()},s.onerror=o,s.write(n)},r.getData=function(t){e.file(t)}}o.prototype=new s,o.prototype.constructor=o,n.prototype=new s,n.prototype.constructor=n,a.prototype=new s,a.prototype.constructor=a,l.prototype=new r,l.prototype.constructor=l,A.prototype=new r,A.prototype.constructor=A,e.FileWriter=A,e.HttpReader=o,e.HttpRangeReader=n,e.ArrayBufferReader=a,e.ArrayBufferWriter=l,e.fs&&((t=e.fs.ZipDirectoryEntry).prototype.addHttpContent=function(i,s,r){return function(i,s,r,o){if(i.directory)return o?new t(i.fs,s,r,i):new e.fs.ZipFileEntry(i.fs,s,r,i);throw"Parent entry is not a directory."}(this,i,{data:s,Reader:r?n:o})},t.prototype.importHttpContent=function(e,t,i,s){this.importZip(t?new n(e):new o(e),i,s)},e.fs.FS.prototype.importHttpContent=function(e,i,s,r){this.entries=[],this.root=new t(this),this.root.importHttpContent(e,i,s,r)})}(pP);const fP=["4.2"];class gP{constructor(e,t={}){this.supportedSchemas=fP,this._xrayOpacity=.7,this._src=null,this._options=t,this.viewpoint=null,t.workerScriptsPath?(pP.workerScriptsPath=t.workerScriptsPath,this.src=t.src,this.xrayOpacity=.7,this.displayEffect=t.displayEffect,this.createMetaModel=t.createMetaModel):e.error("Config expected: workerScriptsPath")}load(e,t,i,s,r,o){switch(s.materialType){case"MetallicMaterial":t._defaultMaterial=new vs(t,{baseColor:[1,1,1],metallic:.6,roughness:.6});break;case"SpecularMaterial":t._defaultMaterial=new xs(t,{diffuse:[1,1,1],specular:c.vec3([1,1,1]),glossiness:.5});break;default:t._defaultMaterial=new Xt(t,{reflectivity:.75,shiness:100,diffuse:[1,1,1]})}t._wireframeMaterial=new gs(t,{color:[0,0,0],lineWidth:2});var n=t.scene.canvas.spinner;n.processes++,mP(e,t,i,s,(function(){n.processes--,r&&r(),t.fire("loaded",!0,!1)}),(function(e){n.processes--,t.error(e),o&&o(e),t.fire("error",e)}),(function(e){console.log("Error, Will Robinson: "+e)}))}}var mP=function(e,t,i,s,r,o){!function(e,t,i){var s=new PP;s.load(e,(function(){t(s)}),(function(e){i("Error loading ZIP archive: "+e)}))}(i,(function(i){_P(e,i,s,t,r,o)}),o)},_P=function(){return function(t,i,s,r,o){var n={plugin:t,zip:i,edgeThreshold:30,materialType:s.materialType,scene:r.scene,modelNode:r,info:{references:{}},materials:{}};s.createMetaModel&&(n.metaModelData={modelId:r.id,metaObjects:[{name:r.id,type:"Default",id:r.id}]}),r.scene.loading++,function(t,i){t.zip.getFile("Manifest.xml",(function(s,r){for(var o=r.children,n=0,a=o.length;n0){for(var n=o.trim().split(" "),a=new Int16Array(n.length),l=0,A=0,h=n.length;A0){i.primitive="triangles";for(var o=[],n=0,a=r.length;n=t.length)i();else{var a=t[o].id,l=a.lastIndexOf(":");l>0&&(a=a.substring(l+1));var A=a.lastIndexOf("#");A>0&&(a=a.substring(0,A)),s[a]?r(o+1):function(e,t,i){e.zip.getFile(t,(function(t,s){!function(e,t,i){for(var s,r=t.children,o=0,n=r.length;o0)for(var s=0,r=t.length;s-1?e+"&_="+t:e+"?_="+t}getIFC(e,t,i){e=this._cacheBusterURL(e);var s=()=>{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n-1?e+"&_="+t:e+"?_="+t}getLAS(e,t,i){e=this._cacheBusterURL(e);var s=()=>{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n{let t=0,i=0,s=0;const r=new DataView(e),o=new Uint8Array(6e3),n=({item:s,format:o,size:n})=>{let a,l;switch(o){case"char":return l=new Uint8Array(e,t,n),t+=n,a=LP(l),[s,a];case"uShort":return a=r.getUint16(t,!0),t+=n,[s,a];case"uLong":return a=r.getUint32(t,!0),"NumberOfVariableLengthRecords"===s&&(i=a),t+=n,[s,a];case"uChar":return a=r.getUint8(t),t+=n,[s,a];case"double":return a=r.getFloat64(t,!0),t+=n,[s,a];default:t+=n}};return(()=>{const e={};IP.forEach((t=>{const i=n({...t});if(void 0!==i){if("FileSignature"===i[0]&&"LASF"!==i[1])throw new Error("Ivalid FileSignature. Is this a LAS/LAZ file");e[i[0]]=i[1]}}));const r=[];let a=i;for(;a--;){const e={};DP.forEach((i=>{const r=n({...i});e[r[0]]=r[1],"UserId"===r[0]&&"LASF_Projection"===r[1]&&(s=t-18+54)})),r.push(e)}const l=(e=>{if(void 0===e)return;const t=s+e.RecordLengthAfterHeader,i=o.slice(s,t),r=TP(i),n=new DataView(r);let a=6,l=Number(n.getUint16(a,!0));const A=[];for(;l--;){const e={};e.key=n.getUint16(a+=2,!0),e.tiffTagLocation=n.getUint16(a+=2,!0),e.count=n.getUint16(a+=2,!0),e.valueOffset=n.getUint16(a+=2,!0),A.push(e)}const h=A.find((e=>3072===e.key));if(h&&h.hasOwnProperty("valueOffset"))return h.valueOffset})(r.find((e=>"LASF_Projection"===e.UserId)));return l&&(e.epsg=l),e})()},TP=e=>{let t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let t=0;t{let t="";return e.forEach((e=>{let i=String.fromCharCode(e);"\0"!==i&&(t+=i)})),t.trim()};function RP(e,t){if(t>=e.length)return[e];let i=[];for(let s=0;s-1?e+"&_="+t:e+"?_="+t}getCityJSON(e,t,i){_.loadJSON(this._cacheBusterURL(e),(e=>{t(e)}),(function(e){i(e)}))}}function kP(e,t,i){i=i||2;var s,r,o,n,a,l,A,h=t&&t.length,c=h?t[0]*i:e.length,u=OP(e,0,c,i,!0),d=[];if(!u||u.next===u.prev)return d;if(h&&(u=function(e,t,i,s){var r,o,n,a=[];for(r=0,o=t.length;r80*i){s=o=e[0],r=n=e[1];for(var p=i;po&&(o=a),l>n&&(n=l);A=0!==(A=Math.max(o-s,n-r))?1/A:0}return QP(u,d,i,s,r,A),d}function OP(e,t,i,s,r){var o,n;if(r===lC(e,t,i,s)>0)for(o=t;o=t;o-=s)n=oC(o,e[o],e[o+1],n);return n&&$P(n,n.next)&&(nC(n),n=n.next),n}function NP(e,t){if(!e)return e;t||(t=e);var i,s=e;do{if(i=!1,s.steiner||!$P(s,s.next)&&0!==qP(s.prev,s,s.next))s=s.next;else{if(nC(s),(s=t=s.prev)===s.next)break;i=!0}}while(i||s!==t);return t}function QP(e,t,i,s,r,o,n){if(e){!n&&o&&function(e,t,i,s){var r=e;do{null===r.z&&(r.z=XP(r.x,r.y,t,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,i,s,r,o,n,a,l,A=1;do{for(i=e,e=null,o=null,n=0;i;){for(n++,s=i,a=0,t=0;t0||l>0&&s;)0!==a&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;i=s}o.nextZ=null,A*=2}while(n>1)}(r)}(e,s,r,o);for(var a,l,A=e;e.prev!==e.next;)if(a=e.prev,l=e.next,o?HP(e,s,r,o):VP(e))t.push(a.i/i),t.push(e.i/i),t.push(l.i/i),nC(e),e=l.next,A=l.next;else if((e=l)===A){n?1===n?QP(e=jP(NP(e),t,i),t,i,s,r,o,2):2===n&&GP(e,t,i,s,r,o):QP(NP(e),t,i,s,r,o,1);break}}}function VP(e){var t=e.prev,i=e,s=e.next;if(qP(t,i,s)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(YP(t.x,t.y,i.x,i.y,s.x,s.y,r.x,r.y)&&qP(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function HP(e,t,i,s){var r=e.prev,o=e,n=e.next;if(qP(r,o,n)>=0)return!1;for(var a=r.xo.x?r.x>n.x?r.x:n.x:o.x>n.x?o.x:n.x,h=r.y>o.y?r.y>n.y?r.y:n.y:o.y>n.y?o.y:n.y,c=XP(a,l,t,i,s),u=XP(A,h,t,i,s),d=e.prevZ,p=e.nextZ;d&&d.z>=c&&p&&p.z<=u;){if(d!==e.prev&&d!==e.next&&YP(r.x,r.y,o.x,o.y,n.x,n.y,d.x,d.y)&&qP(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==e.prev&&p!==e.next&&YP(r.x,r.y,o.x,o.y,n.x,n.y,p.x,p.y)&&qP(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==e.prev&&d!==e.next&&YP(r.x,r.y,o.x,o.y,n.x,n.y,d.x,d.y)&&qP(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=u;){if(p!==e.prev&&p!==e.next&&YP(r.x,r.y,o.x,o.y,n.x,n.y,p.x,p.y)&&qP(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function jP(e,t,i){var s=e;do{var r=s.prev,o=s.next.next;!$P(r,o)&&eC(r,s,s.next,o)&&sC(r,o)&&sC(o,r)&&(t.push(r.i/i),t.push(s.i/i),t.push(o.i/i),nC(s),nC(s.next),s=e=o),s=s.next}while(s!==e);return NP(s)}function GP(e,t,i,s,r,o){var n=e;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&ZP(n,a)){var l=rC(n,a);return n=NP(n,n.next),l=NP(l,l.next),QP(n,t,i,s,r,o),void QP(l,t,i,s,r,o)}a=a.next}n=n.next}while(n!==e)}function zP(e,t){return e.x-t.x}function WP(e,t){if(t=function(e,t){var i,s=t,r=e.x,o=e.y,n=-1/0;do{if(o<=s.y&&o>=s.next.y&&s.next.y!==s.y){var a=s.x+(o-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(a<=r&&a>n){if(n=a,a===r){if(o===s.y)return s;if(o===s.next.y)return s.next}i=s.x=s.x&&s.x>=h&&r!==s.x&&YP(oi.x||s.x===i.x&&KP(i,s)))&&(i=s,u=l)),s=s.next}while(s!==A);return i}(e,t),t){var i=rC(t,e);NP(t,t.next),NP(i,i.next)}}function KP(e,t){return qP(e.prev,e,t.prev)<0&&qP(t.next,e,e.next)<0}function XP(e,t,i,s,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-s)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function JP(e){var t=e,i=e;do{(t.x=0&&(e-n)*(s-a)-(i-n)*(t-a)>=0&&(i-n)*(o-a)-(r-n)*(s-a)>=0}function ZP(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&eC(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(sC(e,t)&&sC(t,e)&&function(e,t){var i=e,s=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==e);return s}(e,t)&&(qP(e.prev,e,t.prev)||qP(e,t.prev,t))||$P(e,t)&&qP(e.prev,e,e.next)>0&&qP(t.prev,t,t.next)>0)}function qP(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function $P(e,t){return e.x===t.x&&e.y===t.y}function eC(e,t,i,s){var r=iC(qP(e,t,i)),o=iC(qP(e,t,s)),n=iC(qP(i,s,e)),a=iC(qP(i,s,t));return r!==o&&n!==a||(!(0!==r||!tC(e,i,t))||(!(0!==o||!tC(e,s,t))||(!(0!==n||!tC(i,e,s))||!(0!==a||!tC(i,t,s)))))}function tC(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function iC(e){return e>0?1:e<0?-1:0}function sC(e,t){return qP(e.prev,e,e.next)<0?qP(e,t,e.next)>=0&&qP(e,e.prev,t)>=0:qP(e,t,e.prev)<0||qP(e,e.next,t)<0}function rC(e,t){var i=new aC(e.i,e.x,e.y),s=new aC(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=r,r.prev=i,s.next=i,i.prev=s,o.next=s,s.prev=o,s}function oC(e,t,i,s){var r=new aC(e,t,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function nC(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function aC(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function lC(e,t,i,s){for(var r=0,o=t,n=i-s;o0&&(s+=e[r-1].length,i.holes.push(s))}return i};const AC=c.vec2(),hC=c.vec3(),cC=c.vec3(),uC=c.vec3();class dC{constructor(e={}){this.cacheBuster=!1!==e.cacheBuster}_cacheBusterURL(e){if(!this.cacheBuster)return e;const t=(new Date).getTime();return e.indexOf("?")>-1?e+"&_="+t:e+"?_="+t}getDotBIM(e,t,i){_.loadJSON(this._cacheBusterURL(e),(e=>{t(e)}),(function(e){i(e)}))}}const pC=function(e){const t=t=>parseInt(e.substr(t+1,2),16)/255;return[t(0),t(2),t(4)]},fC=function(e){const t=[];for(let i=0;i=0?h:2*Math.PI-h}return r(e[0]-i[0])*(t[1]-i[1])-(t[0]-i[0])*(e[1]-i[1]);return(t,i,s,r)=>{const o=e(t,i,s),n=e(t,s,r),a=e(t,r,i);return!((o<0||n<0||a<0)&&(o>0||n>0||a>0))}}(),r=[],o=(i?t:t.slice(0).reverse()).map((e=>({idx:e})));o.forEach(((e,t)=>{e.prev=o[(t-1+o.length)%o.length],e.next=o[(t+1)%o.length]}));const n=c.vec2(),a=c.vec2();for(;o.length>2;){let t=0;for(;;){if(t>=o.length)throw`isCCW = ${i}; earIdx = ${t}; len = ${o.length}`;const r=o[t],l=e[r.prev.idx],A=e[r.idx],h=e[r.next.idx];if(c.subVec2(l,A,n),c.subVec2(h,A,a),n[0]*a[1]-n[1]*a[0]>=0&&o.every((t=>t===r||t===r.prev||t===r.next||!s(e[t.idx],l,A,h))))break;++t}const l=o[t];o.splice(t,1),r.push([l.idx,l.next.idx,l.prev.idx]);l.prev.next=l.next;l.next.prev=l.prev}return[e,r]},gC=function(e,t){const i=e.canvas.canvas,s=i.parentNode,r=document.createElement("div");s.insertBefore(r,i);let o=5;r.style.background=t,r.style.border="2px solid white",r.style.margin="0 0",r.style.zIndex="100",r.style.position="absolute",r.style.pointerEvents="none",r.style.display="none";const n=new Ae(e,{}),a=e=>e+"px",l=function(){const e=n.canvasPos.slice();ce(i,s,e),r.style.left=a(e[0]-3-o/2),r.style.top=a(e[1]-3-o/2),r.style.borderRadius=a(2*o),r.style.width=a(o),r.style.height=a(o)},A=e.camera.on("viewMatrix",l),h=e.camera.on("projMatrix",l);return{update:function(e){e&&(n.worldPos=e,l()),r.style.display=e?"":"none"},setHighlighted:function(e){o=e?10:5,l()},getCanvasPos:()=>n.canvasPos,getWorldPos:()=>n.worldPos,destroy:function(){r.parentNode.removeChild(r),e.camera.off(A),e.camera.off(h),n.destroy()}}},mC=function(e,t,i){let s=null;const r=r=>{if(r){s&&s.destroy();try{const[o,n]=fC(r.map((e=>[e[0],e[2]]))),a=[].concat(...o.map((e=>[e[0],r[0][1],e[1]]))),l=[].concat(...n);s=new $i(e,{pickable:!1,geometry:new jt(e,{positions:a,indices:l,normals:c.buildNormals(a,l)}),material:new Xt(e,{alpha:void 0!==i?i:.5,backfaces:!0,diffuse:pC(t)})})}catch(e){s=null}}s&&(s.visible=!!r)};return r(null),{updateBase:r,destroy:()=>s&&s.destroy()}},_C=function(e,t,i,s,r,o,n,a,l){const A=gC(e,s),h=gC(e,s),u=mC(e,s,r),d=o?function(e){o.visible=!!e,e&&(o.canvasPos=e)}:()=>{};let p=a((()=>{d(null),A.update(null)}),((e,t)=>{d(e),A.update(t)}),(function(e,o){A.update(o),p=a((function(){d(null),h.update(null),u.updateBase(null)}),(function(e,t){if(d(e),h.update(t),c.distVec3(o,t)>.01){const e=e=>Math.min(o[e],t[e]),i=e=>Math.max(o[e],t[e]),s=e(0),r=e(1),n=e(2),a=i(0);i(1);const l=i(2);u.updateBase([[s,r,l],[a,r,l],[a,r,n],[s,r,n]])}else u.updateBase(null)}),(function(e,a){h.update(a),A.destroy(),h.destroy(),u.destroy(),d(null);const p=e=>Math.min(o[e],a[e]),f=e=>Math.max(o[e],a[e]),g=p(0),m=p(2),_=f(0),v=f(2),b=n.createZone({id:c.createUUID(),geometry:{planeCoordinates:[[g,v],[_,v],[_,m],[g,m]],altitude:t,height:i},alpha:r,color:s});l(b)}))}));return{deactivate:function(){p(),A.destroy(),h.destroy(),u.destroy(),d(null)}}},vC=function(e,t){return function(i,s,r){const o=e.scene,n=o.canvas.canvas,a=(e,t)=>(t[0]=e.clientX,t[1]=e.clientY,ce(n.ownerDocument.body,n,t),t),l=e=>{const i=c.vec3(),s=c.vec3();return c.canvasPosToWorldRay(n,o.camera.viewMatrix,o.camera.projMatrix,o.camera.projection,e,i,s),t(i,s)};let A=!1;const h=function(){A=!1},u=function(){h(),n.removeEventListener("mousedown",p),n.removeEventListener("mousemove",f),e.cameraControl.off(g),n.removeEventListener("mouseup",m)},d=c.vec2(),p=function(e){1===e.which&&(a(e,d),A=!0)};n.addEventListener("mousedown",p);const f=function(e){const t=a(e,c.vec2());A&&c.distVec2(d,t)>20&&(h(),i())};n.addEventListener("mousemove",f);const g=e.cameraControl.on("rayMove",(e=>{const t=e.canvasPos;s(t,l(t))})),m=function(e){if(1===e.which&&A){u();const t=a(e,c.vec2());r(t,l(t))}};return n.addEventListener("mouseup",m),u}},bC=function(e,t,i){return function(s,r,o){const n=e.scene,a=n.canvas.canvas,l=(e,t)=>(t[0]=e.clientX,t[1]=e.clientY,ce(a.ownerDocument.body,a,t),t),A=e=>{const t=c.vec3(),s=c.vec3();return c.canvasPosToWorldRay(a,n.camera.viewMatrix,n.camera.projMatrix,n.camera.projection,e,t,s),i(t,s)};let h=null;const u=()=>{};let d,p=u;const f=function(){t.stop(),clearTimeout(h),e.cameraControl.active=!0,p=u,d=null},g=function(){f(),a.removeEventListener("touchstart",m),a.removeEventListener("touchmove",_),a.removeEventListener("touchend",v)},m=function(i){const o=i.touches;if(1!==o.length)f(),s();else{const i=o[0],s=l(i,c.vec2());A(s)&&(d=i.identifier,p=e=>{c.distVec2(s,e)>20&&f()},h=setTimeout((function(){t.start(s),h=setTimeout((function(){t.stop(),e.cameraControl.active=!1,p=e=>{r(e,A(e))},p(s)}),300)}),250))}};a.addEventListener("touchstart",m,{passive:!0});const _=function(e){const t=[...e.changedTouches].find((e=>e.identifier===d));t&&p(l(t,c.vec2()))};a.addEventListener("touchmove",_,{passive:!0});const v=function(e){const t=[...e.changedTouches].find((e=>e.identifier===d));if(t){g();const e=l(t,c.vec2());o(e,A(e))}};return a.addEventListener("touchend",v,{passive:!0}),g}},yC=function(e,t,i,s){const r=-(c.dotVec3(i,t)-e)/c.dotVec3(s,t);{const e=c.vec3();return c.mulVec3Scalar(s,r,e),c.addVec3(i,e,e),e}};class xC extends D{constructor(e,t={}){if(super(e.viewer.scene,t),this.plugin=e,this._container=t.container,!this._container)throw"config missing: container";this._eventSubs={},this.plugin.viewer.scene,this._geometry=t.geometry,t.onMouseOver,t.onMouseLeave,t.onContextMenu,this._alpha="alpha"in t&&void 0!==t.alpha?t.alpha:.5,this.color=t.color,this._visible=!0,this._rebuildMesh()}_rebuildMesh(){const e=this.plugin.viewer.scene,t=this._geometry.planeCoordinates.slice(),i=this._geometry.height<0,s=this._geometry.altitude+(i?this._geometry.height:0),r=this._geometry.height*(i?-1:1),[o,n]=fC(t),a=[],l=[],A=e=>{const t=a.length;for(let t of o)a.push([t[0],s+(e?r:0),t[1]]);for(let i of n)l.push(...(e?i:i.slice(0).reverse()).map((e=>e+t)))};A(!1),A(!0);for(let e=0;ee+h)))}this._zoneMesh&&this._zoneMesh.destroy();const h=[].concat(...a);this._zoneMesh=new $i(e,{edges:this._edges,geometry:new jt(e,{positions:h,indices:l,normals:c.buildNormals(h,l)}),material:new Xt(e,{alpha:this._alpha,backfaces:!0,diffuse:pC(this._color)}),visible:this._visible}),this._zoneMesh.highlighted=this._highlighted,this._zoneMesh.zone=this,this._volume=null;const u=e=>Math.min(...a.map((t=>t[e]))),d=e=>Math.max(...a.map((t=>t[e]))),p=u(0),f=u(1),g=u(2),m=d(0),_=d(1),v=d(2);this._center=c.vec3([(p+m)/2,(f+_)/2,(g+v)/2])}get volume(){if(null===this._volume){let e=0;const t=this._zoneMesh.geometry,i=[c.vec3(),c.vec3(),c.vec3()];for(let s=0;s{const s=t.map((t=>[t[0],e?r:o,t[1]]));i.push(e?s:s.slice(0).reverse())};n(!0),n(!1);const a=(e,i)=>[t[e][0],i,t[e][1]];for(let e=0;ei?a:n;h|=A,u.push(A)}switch(h){case n:case a:o.push(t);break;case l:break;case A:const i=[];for(let o=0;o=3&&o.push(i)}}i=o}if(0===i.length)return null;{const e=c.vec3([0,0,0]),t=new Set;for(const s of i)for(const i of s){const s=i.map((e=>e.toFixed(3))).join(":");t.has(s)||(t.add(s),c.addVec3(e,i,e))}return c.mulVec3Scalar(e,1/t.size,e),e}}get center(){return this._center}get altitude(){return this._geometry.altitude}set altitude(e){this._geometry.altitude=e,this._rebuildMesh()}get height(){return this._geometry.height}set height(e){this._geometry.height=e,this._rebuildMesh()}get highlighted(){return this._highlighted}set highlighted(e){this._highlighted=e,this._zoneMesh&&(this._zoneMesh.highlighted=e)}set color(e){this._color=e,this._zoneMesh&&(this._zoneMesh.material.diffuse=pC(this._color))}get color(){return this._color}set alpha(e){this._alpha=e,this._zoneMesh&&(this._zoneMesh.material.alpha=this._alpha)}get alpha(){return this._alpha}get edges(){return this._edges}set edges(e){this._edges=e,this._zoneMesh&&(this._zoneMesh.edges=this._edges)}set visible(e){this._visible=!!e,this._zoneMesh.visible=this._visible,this._needUpdate()}get visible(){return this._visible}getJSON(){return{id:this.id,geometry:this._geometry,alpha:this._alpha,color:this._color}}duplicate(){return this.plugin.createZone({id:c.createUUID(),geometry:{planeCoordinates:this._geometry.planeCoordinates.map((e=>e.slice())),altitude:this._geometry.altitude,height:this._geometry.height},alpha:this._alpha,color:this._color})}destroy(){this._zoneMesh.destroy(),super.destroy()}}const BC=function(e,t,i,s,r,o,n,a,l){const A=o?function(e){o.visible=!!e,e&&(o.canvasPos=e)}:()=>{};let h;const u=[()=>A(null)],d=mC(e,s,r);return u.push((()=>d.destroy())),function o(p){const f=gC(e,s),g=p.length>0&&function(e,t,i){const s=e.canvas.canvas,r=new Ae(e,{});r.worldPos=i;const o=new Ae(e,{}),n=s.ownerDocument.body,a=new fe(n,{color:t,thickness:1,thicknessClickable:6});a.setVisible(!1);const l=function(){const e=r.canvasPos.slice(),t=o.canvasPos.slice();ce(s,n,e),ce(s,n,t),a.setStartAndEnd(e[0],e[1],t[0],t[1])},A=e.camera.on("viewMatrix",l),h=e.camera.on("projMatrix",l);return{update:function(e){e&&(o.worldPos=e,l()),a.setVisible(!!e)},destroy:function(){e.camera.off(A),e.camera.off(h),r.destroy(),o.destroy(),a.destroy()}}}(e,s,p[p.length-1].getWorldPos());u.push((()=>{f.destroy(),g&&g.destroy()}));const m=p.length>0&&p[0],_=function(e){const t=m&&m.getCanvasPos();return t&&c.distVec2(t,e)<10&&{canvasPos:t,worldPos:m.getWorldPos()}},v=function(){const e=(e,t,i)=>t[0]<=Math.max(e[0],i[0])&&t[0]>=Math.min(e[0],i[0])&&t[1]<=Math.max(e[1],i[1])&&t[1]>=Math.min(e[1],i[1]),t=(e,t,i)=>{const s=(t[1]-e[1])*(i[0]-t[0])-(t[0]-e[0])*(i[1]-t[1]);return 0===s?0:s>0?1:2};return function(i,s){const r=i[i.length-2],o=i[i.length-1];for(let n=s?1:0;n{A(null),f.update(null),g&&g.update(null),d.updateBase(p.length>2?p.map((e=>e.getWorldPos())):null)}),((e,t)=>{const i=p.length>2&&_(e);if(m&&m.setHighlighted(!!i),A(i?i.canvasPos:e),f.update(!i&&t),g&&g.update(i?i.worldPos:t),p.length>=2){const e=p.map((e=>e.getWorldPos())).concat(i?[]:[t]),s=v(e.map((e=>[e[0],e[2]])),i);d.updateBase(s?null:e)}else d.updateBase(null)}),(function(e,a){const A=p.length>2&&_(e),h=p.map((e=>e.getWorldPos())).concat(A?[]:[a]);d.updateBase(h);const m=h.map((e=>[e[0],e[2]]));p.length>2&&v(m,A)?(u.pop()(),o(p)):A?(f.update(a),u.forEach((e=>e())),l(n.createZone({id:c.createUUID(),geometry:{planeCoordinates:m,altitude:t,height:i},alpha:r,color:s}))):(f.update(a),g&&g.update(a),o(p.concat(f)))}))}([]),{closeSurface:function(){throw"TODO"},deactivate:function(){h(),u.forEach((e=>e()))}}};class wC extends D{constructor(e,t,i,s){const r=e.plugin.viewer,o=r.scene;super(o);const n=e._geometry.altitude,a=e._geometry.planeCoordinates.map((t=>{const i=o.canvas.canvas.ownerDocument.body,s=new ue(o,{},i,{fillColor:e._color});return s.worldPos=c.vec3([t[0],n,t[1]]),s.on("worldPos",(function(){t[0]=s.worldPos[0],t[1]=s.worldPos[2];try{e._rebuildMesh()}catch(t){e._zoneMesh&&(e._zoneMesh.destroy(),e._zoneMesh=null)}})),s})),l=pe({viewer:r,handleMouseEvents:i,handleTouchEvents:s,pointerLens:t&&t.pointerLens,dots:a,ray2WorldPos:(e,t)=>yC(n,c.vec3([0,1,0]),e,t),onEnd:(t,i)=>(e._zoneMesh&&this.fire("edited"),!!e._zoneMesh)}),A=function(){l(),a.forEach((e=>e.destroy()))},h=e.on("destroyed",A);this._deactivate=function(){e.off("destroyed",h),A()}}deactivate(){this._deactivate(),super.destroy()}}class PC extends D{constructor(e,t,i,s){const r=e.plugin.viewer,o=r.scene,n=o.canvas.canvas;super(o);const a=this,l=e._geometry.altitude,A=t&&t.pointerLens,h=A?function(e){A.visible=!!e,e&&(A.canvasPos=e)}:()=>{},u=e=>{const t=c.vec3(),i=c.vec3();return c.canvasPosToWorldRay(n,o.camera.viewMatrix,o.camera.projMatrix,o.camera.projection,e,t,i),s=t,r=i,yC(l,c.vec3([0,1,0]),s,r);var s,r},d=(e,t)=>(t[0]=e.clientX,t[1]=e.clientY,ce(n.ownerDocument.body,n,t),t),p=function(e,t){const i=e=>{e.preventDefault(),t(e)};return n.addEventListener(e,i),()=>n.removeEventListener(e,i)};let f=()=>{};const g=function(t,i,s,o){const l=o(t),A=d(l,c.vec2()),g=r.scene.pick({canvasPos:A,includeEntities:[e._zoneMesh.id]});if((g&&g.entity&&g.entity.zone)===e){f(),n.style.cursor="move",r.cameraControl.active=!1;const t=function(){const t=e._geometry.planeCoordinates.map((e=>e.slice())),i=u(A),s=c.vec2([i[0],i[2]]),r=c.vec2();return function(i){const o=u(i);r[0]=o[0],r[1]=o[2],c.subVec2(s,r,r),e._geometry.planeCoordinates.forEach(((e,i)=>{c.subVec2(t[i],r,e)}));try{e._rebuildMesh()}catch(t){e._zoneMesh&&(e._zoneMesh.destroy(),e._zoneMesh=null)}}}(),l=p(i,(function(e){const i=o(e);if(i){const e=d(i,c.vec2());t(e),h(e)}})),g=p(s,(function(e){const i=o(e);if(i){const e=d(i,c.vec2());t(e),h(null),f(),a.fire("translated")}}));f=function(){f=()=>{},n.style.cursor="default",r.cameraControl.active=!0,l(),g()}}},m=[];i&&m.push(p("mousedown",(e=>{1===e.which&&g(e,"mousemove","mouseup",(e=>1===e.which&&e))}))),s&&m.push(p("touchstart",(e=>{if(1===e.touches.length){const t=e.touches[0].identifier;g(e,"touchmove","touchend",(e=>[...e.changedTouches].find((e=>e.identifier===t))))}})));const _=function(){f(),m.forEach((e=>e())),h(null)},v=e.on("destroyed",_);this._deactivate=function(){e.off("destroyed",v),_()}}deactivate(){this._deactivate(),super.destroy()}}exports.AlphaFormat=1021,exports.AmbientLight=Dt,exports.AngleMeasurementEditMouseControl=class extends xe{constructor(e,t){super(e,t,!0,!1)}},exports.AngleMeasurementEditTouchControl=class extends xe{constructor(e,t){super(e,t,!1,!0)}},exports.AngleMeasurementsControl=be,exports.AngleMeasurementsMouseControl=ye,exports.AngleMeasurementsPlugin=class extends V{constructor(e,t={}){super("AngleMeasurements",e),this._container=t.container||document.body,this._defaultControl=null,this._measurements={},this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.defaultLabelsVisible=!1!==t.defaultLabelsVisible,this.zIndex=t.zIndex||1e4,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,angleMeasurement:t,measurement:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,angleMeasurement:t,measurement:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,angleMeasurement:t,measurement:t,event:e})}}getContainerElement(){return this._container}send(e,t){}get control(){return this._defaultControl||(this._defaultControl=new ye(this,{})),this._defaultControl}get measurements(){return this._measurements}createMeasurement(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=e.origin,i=e.corner,s=e.target,r=new ve(this,{id:e.id,plugin:this,container:this._container,origin:{entity:t.entity,worldPos:t.worldPos},corner:{entity:i.entity,worldPos:i.worldPos},target:{entity:s.entity,worldPos:s.worldPos},visible:e.visible,originVisible:!0,originWireVisible:!0,cornerVisible:!0,targetWireVisible:!0,targetVisible:!0,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[r.id]=r,r.on("destroyed",(()=>{delete this._measurements[r.id]})),r.clickable=!0,this.fire("measurementCreated",r),r}destroyMeasurement(e){const t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("AngleMeasurement not found: "+e)}setLabelsShown(e){for(const[t,i]of Object.entries(this.measurements))i.labelShown=e}clear(){const e=Object.keys(this._measurements);for(var t=0,i=e.length;t{this.plugin.viewer.cameraControl.active=!1},u=()=>{this.plugin.viewer.cameraControl.active=!0},d=()=>{o&&(clearTimeout(o),o=null),this._currentAngleMeasurement&&(this._currentAngleMeasurement.destroy(),this._currentAngleMeasurement=null),u(),this._touchState=0};i.addEventListener("touchstart",this._onCanvasTouchStart=i=>{const l=i.touches.length;if(1!==l)return void(o&&(clearTimeout(o),o=null));const u=i.touches[0],p=u.clientX,f=u.clientY;switch(n.set([p,f]),a.set([p,f]),this._touchState){case 0:if(1!==l&&null!==o)return void d();const i=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping});if(i&&i.snapped)s.set(i.worldPos),this.pointerCircle.start(i.snappedCanvasPos);else{const e=t.pick({canvasPos:a,pickSurface:!0});if(!e||!e.worldPos)return;s.set(e.worldPos),this.pointerCircle.start(e.canvasPos)}o=setTimeout((()=>{1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{this.pointerCircle.stop();const i=e.touches.length;if(1!==i||1!==e.changedTouches.length)return void(o&&(clearTimeout(o),o=null));const r=e.touches[0],n=r.clientX,l=r.clientY;if(r.identifier!==A)return;let h,c;switch(a.set([n,l]),this._touchState){case 2:this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.snapped?(this.pointerLens&&(this.pointerLens.snappedCanvasPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),s.set(h.worldPos),this._currentAngleMeasurement.origin.worldPos=h.worldPos):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),s.set(c.worldPos),this._currentAngleMeasurement.origin.worldPos=c.worldPos):this.pointerLens&&(this.pointerLens.cursorPos=null,this.pointerLens.snapped=!1)),this._touchState=2;break;case 5:if(1!==i&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentAngleMeasurement.corner.worldPos=h.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),this._currentAngleMeasurement.corner.worldPos=c.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!1,this._currentAngleMeasurement.targetVisible=!1,this._currentAngleMeasurement.targetWireVisible=!1,this._currentAngleMeasurement.angleVisible=!1)),this._touchState=5;break;case 8:if(1!==i&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),h=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),h&&h.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=h.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentAngleMeasurement.target.worldPos=h.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.angleVisible=!0):(c=t.pick({canvasPos:a,pickSurface:!0}),c&&c.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=c.canvasPos,this.pointerLens.snapped=!1),this._currentAngleMeasurement.target.worldPos=c.worldPos,this._currentAngleMeasurement.originVisible=!0,this._currentAngleMeasurement.originWireVisible=!0,this._currentAngleMeasurement.cornerVisible=!0,this._currentAngleMeasurement.cornerWireVisible=!0,this._currentAngleMeasurement.targetVisible=!0,this._currentAngleMeasurement.targetWireVisible=!0,this._currentAngleMeasurement.angleVisible=!0)),this._touchState=8}}),{passive:!0}),i.addEventListener("touchend",this._onCanvasTouchEnd=i=>{this.pointerCircle.stop();const s=i.changedTouches.length;if(1!==s)return;const h=i.changedTouches[0],d=h.clientX,p=h.clientY;if(h.identifier===A)switch(o&&(clearTimeout(o),o=null),l.set([d,p]),this._touchState){case 1:{if(1!==s||d>n[0]+r||dn[1]+r||pn[0]+r||dn[1]+r||pn[0]+r||dn[1]+r||p",this._markerHTML=t.markerHTML||"
",this._container=t.container||document.body,this._values=t.values||{},this.annotations={},this.surfaceOffset=t.surfaceOffset}getContainerElement(){return this._container}send(e,t){if("clearAnnotations"===e)this.clear()}set surfaceOffset(e){null==e&&(e=.3),this._surfaceOffset=e}get surfaceOffset(){return this._surfaceOffset}createAnnotation(e){this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);var t=null;e.markerElementId&&((t=document.getElementById(e.markerElementId))||this.error("Can't find DOM element for 'markerElementId' value '"+e.markerElementId+"' - defaulting to internally-generated empty DIV"));var i=null;e.labelElementId&&((i=document.getElementById(e.labelElementId))||this.error("Can't find DOM element for 'labelElementId' value '"+e.labelElementId+"' - defaulting to internally-generated empty DIV"));const s=new Ce(this.viewer.scene,{id:e.id,plugin:this,container:this._container,markerElement:t,labelElement:i,markerHTML:e.markerHTML||this._markerHTML,labelHTML:e.labelHTML||this._labelHTML,occludable:e.occludable,values:_.apply(e.values,_.apply(this._values,{})),markerShown:e.markerShown,labelShown:e.labelShown,eye:e.eye,look:e.look,up:e.up,projection:e.projection,visible:!1!==e.visible});return e.pickResult=e.pickResult||e.pickRecord,e.pickResult?s.setFromPickResult(e.pickResult):(s.entity=e.entity,s.worldPos=e.worldPos),this.annotations[s.id]=s,s.on("destroyed",(()=>{delete this.annotations[s.id],this.fire("annotationDestroyed",s.id)})),this.fire("annotationCreated",s.id),s}destroyAnnotation(e){var t=this.annotations[e];t?t.destroy():this.log("Annotation not found: "+e)}clear(){const e=Object.keys(this.annotations);for(var t=0,i=e.length;tp.has(e.id)||g.has(e.id)||f.has(e.id))).reduce(((e,i)=>{let s,r=function(e){let t="";return t+=Math.round(255*e[0]).toString(16).padStart(2,"0"),t+=Math.round(255*e[1]).toString(16).padStart(2,"0"),t+=Math.round(255*e[2]).toString(16).padStart(2,"0"),t}(i.colorize);i.xrayed?(s=0===t.xrayMaterial.fillAlpha&&0!==t.xrayMaterial.edgeAlpha?.1:t.xrayMaterial.fillAlpha,s=Math.round(255*s).toString(16).padStart(2,"0"),r=s+r):p.has(i.id)&&(s=Math.round(255*i.opacity).toString(16).padStart(2,"0"),r=s+r),e[r]||(e[r]=[]);const o=i.id,n=i.originalSystemId,a={ifc_guid:n,originating_system:this.originatingSystem};return n!==o&&(a.authoring_tool_id=o),e[r].push(a),e}),{}),_=Object.entries(m).map((([e,t])=>({color:e,components:t})));o.components.coloring=_;const v=t.objectIds,b=t.visibleObjects,y=t.visibleObjectIds,x=v.filter((e=>!b[e])),B=t.selectedObjectIds;return e.defaultInvisible||y.length0&&e.clipping_planes.forEach((function(e){let t=nh(e.location,th),i=nh(e.direction,th);A&&c.negateVec3(i),c.subVec3(t,l),r.yUp&&(t=lh(t),i=lh(i)),new os(s,{pos:t,dir:i})})),s.clearLines(),e.lines&&e.lines.length>0){const t=[],i=[];let r=0;e.lines.forEach((e=>{e.start_point&&e.end_point&&(t.push(e.start_point.x),t.push(e.start_point.y),t.push(e.start_point.z),t.push(e.end_point.x),t.push(e.end_point.y),t.push(e.end_point.z),i.push(r++),i.push(r++))})),new eh(s,{positions:t,indices:i,clippable:!1,collidable:!0})}if(s.clearBitmaps(),e.bitmaps&&e.bitmaps.length>0&&e.bitmaps.forEach((function(e){const t=e.bitmap_type||"jpg",i=e.bitmap_data;let o=nh(e.location,ih),n=nh(e.normal,sh),a=nh(e.up,rh),l=e.height||1;t&&i&&o&&n&&a&&(r.yUp&&(o=lh(o),n=lh(n),a=lh(a)),new Vs(s,{src:i,type:t,pos:o,normal:n,up:a,clippable:!1,collidable:!0,height:l}))})),a&&(s.setObjectsXRayed(s.xrayedObjectIds,!1),s.setObjectsHighlighted(s.highlightedObjectIds,!1),s.setObjectsSelected(s.selectedObjectIds,!1)),e.components){if(e.components.visibility){e.components.visibility.default_visibility?(s.setObjectsVisible(s.objectIds,!0),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((e=>this._withBCFComponent(t,e,(e=>e.visible=!1))))):(s.setObjectsVisible(s.objectIds,!1),e.components.visibility.exceptions&&e.components.visibility.exceptions.forEach((e=>this._withBCFComponent(t,e,(e=>e.visible=!0)))));const r=e.components.visibility.view_setup_hints;r&&(!1===r.spaces_visible&&s.setObjectsVisible(i.metaScene.getObjectIDsByType("IfcSpace"),!1),void 0!==r.spaces_translucent&&s.setObjectsXRayed(i.metaScene.getObjectIDsByType("IfcSpace"),!0),r.space_boundaries_visible,!1===r.openings_visible&&s.setObjectsVisible(i.metaScene.getObjectIDsByType("IfcOpening"),!0),r.space_boundaries_translucent,void 0!==r.openings_translucent&&s.setObjectsXRayed(i.metaScene.getObjectIDsByType("IfcOpening"),!0))}e.components.selection&&(s.setObjectsSelected(s.selectedObjectIds,!1),e.components.selection.forEach((e=>this._withBCFComponent(t,e,(e=>e.selected=!0))))),e.components.translucency&&(s.setObjectsXRayed(s.xrayedObjectIds,!1),e.components.translucency.forEach((e=>this._withBCFComponent(t,e,(e=>e.xrayed=!0))))),e.components.coloring&&e.components.coloring.forEach((e=>{let i=e.color,s=0,r=!1;8===i.length&&(s=parseInt(i.substring(0,2),16)/256,s<=1&&s>=.95&&(s=1),i=i.substring(2),r=!0);const o=[parseInt(i.substring(0,2),16)/256,parseInt(i.substring(2,4),16)/256,parseInt(i.substring(4,6),16)/256];e.components.map((e=>this._withBCFComponent(t,e,(e=>{e.colorize=o,r&&(e.opacity=s)}))))}))}if(e.perspective_camera||e.orthogonal_camera){let a,A,h,u;if(e.perspective_camera?(a=nh(e.perspective_camera.camera_view_point,th),A=nh(e.perspective_camera.camera_direction,th),h=nh(e.perspective_camera.camera_up_vector,th),r.perspective.fov=e.perspective_camera.field_of_view,u="perspective"):(a=nh(e.orthogonal_camera.camera_view_point,th),A=nh(e.orthogonal_camera.camera_direction,th),h=nh(e.orthogonal_camera.camera_up_vector,th),r.ortho.scale=e.orthogonal_camera.view_to_world_scale,u="ortho"),c.subVec3(a,l),r.yUp&&(a=lh(a),A=lh(A),h=lh(h)),o){const e=s.pick({pickSurface:!0,origin:a,direction:A});A=e?e.worldPos:c.addVec3(a,A,th)}else A=c.addVec3(a,A,th);n?(r.eye=a,r.look=A,r.up=h,r.projection=u):i.cameraFlight.flyTo({eye:a,look:A,up:h,duration:t.duration,projection:u})}}_withBCFComponent(e,t,i){const s=this.viewer,r=s.scene;if(t.authoring_tool_id&&t.originating_system===this.originatingSystem){const o=t.authoring_tool_id,n=r.objects[o];if(n)return void i(n);if(e.updateCompositeObjects){if(s.metaScene.metaObjects[o])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(o),i)}}if(t.ifc_guid){const o=t.ifc_guid,n=r.objects[o];if(n)return void i(n);if(e.updateCompositeObjects){if(s.metaScene.metaObjects[o])return void r.withObjects(s.metaScene.getObjectIDsInSubtree(o),i)}Object.keys(r.models).forEach((t=>{const n=c.globalizeObjectId(t,o),a=r.objects[n];if(a)i(a);else if(e.updateCompositeObjects){s.metaScene.metaObjects[n]&&r.withObjects(s.metaScene.getObjectIDsInSubtree(n),i)}}))}}destroy(){super.destroy()}},exports.Bitmap=Vs,exports.ByteType=1010,exports.CameraMemento=kh,exports.CameraPath=class extends D{get type(){return"CameraPath"}constructor(e,t={}){super(e,t),this._frames=[],this._eyeCurve=new bh(this),this._lookCurve=new bh(this),this._upCurve=new bh(this),t.frames&&(this.addFrames(t.frames),this.smoothFrameTimes(1))}get frames(){return this._frames}get eyeCurve(){return this._eyeCurve}get lookCurve(){return this._lookCurve}get upCurve(){return this._upCurve}saveFrame(e){const t=this.scene.camera;this.addFrame(e,t.eye,t.look,t.up)}addFrame(e,t,i,s){const r={t:e,eye:t.slice(0),look:i.slice(0),up:s.slice(0)};this._frames.push(r),this._eyeCurve.points.push(r.eye),this._lookCurve.points.push(r.look),this._upCurve.points.push(r.up)}addFrames(e){let t;for(let i=0,s=e.length;i1?1:e,t.eye=this._eyeCurve.getPoint(e,yh),t.look=this._lookCurve.getPoint(e,yh),t.up=this._upCurve.getPoint(e,yh)}sampleFrame(e,t,i,s){e=e<0?0:e>1?1:e,this._eyeCurve.getPoint(e,t),this._lookCurve.getPoint(e,i),this._upCurve.getPoint(e,s)}smoothFrameTimes(e){if(0===this._frames.length)return;const t=c.vec3();var i=0;this._frames[0].t=0;const s=[];for(let e=1,o=this._frames.length;e{this._parseModel(e,t,i,s),r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){if(s.destroyed)return;const r=e.transform?this._transformVertices(e.vertices,e.transform,i.rotateX):e.vertices,o=t.stats||{};o.sourceFormat=e.type||"CityJSON",o.schemaVersion=e.version||"",o.title="",o.author="",o.created="",o.numMetaObjects=0,o.numPropertySets=0,o.numObjects=0,o.numGeometries=0,o.numTriangles=0,o.numVertices=0;const n=!1!==t.loadMetadata,a=n?{id:c.createUUID(),name:"Model",type:"Model"}:null,l=n?{id:"",projectId:"",author:"",createdAt:"",schema:e.version||"",creatingApplication:"",metaObjects:[a],propertySets:[]}:null,A={data:e,vertices:r,sceneModel:s,loadMetadata:n,metadata:l,rootMetaObject:a,nextId:0,stats:o};if(this._parseCityJSON(A),s.finalize(),n){const e=s.id;this.viewer.metaScene.createMetaModel(e,A.metadata,i)}s.scene.once("tick",(()=>{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))}))}_transformVertices(e,t,i){const s=[],r=t.scale||c.vec3([1,1,1]),o=t.translate||c.vec3([0,0,0]);for(let t=0,n=0;t0))return;const o=[];for(let i=0,s=t.geometry.length;i0){const r=t[s[0]];if(void 0!==r.value)n=e[r.value];else{const t=r.values;if(t){a=[];for(let s=0,r=t.length;s0&&(s.createEntity({id:i,meshIds:o,isObject:!0}),e.stats.numObjects++)}_parseGeometrySurfacesWithOwnMaterials(e,t,i,s){switch(t.type){case"MultiPoint":case"MultiLineString":break;case"MultiSurface":case"CompositeSurface":const r=t.boundaries;this._parseSurfacesWithOwnMaterials(e,i,r,s);break;case"Solid":const o=t.boundaries;for(let t=0;t0&&h.push(A.length);const i=this._extractLocalIndices(e,a[t],u,d);A.push(...i)}if(3===A.length)d.indices.push(A[0]),d.indices.push(A[1]),d.indices.push(A[2]);else if(A.length>3){const e=[];for(let t=0;t0&&n.indices.length>0){const t=""+e.nextId++;r.createMesh({id:t,primitive:"triangles",positions:n.positions,indices:n.indices,color:i&&i.diffuseColor?i.diffuseColor:[.8,.8,.8],opacity:1}),s.push(t),e.stats.numGeometries++,e.stats.numVertices+=n.positions.length/3,e.stats.numTriangles+=n.indices.length/3}}_parseSurfacesWithSharedMaterial(e,t,i,s){const r=e.vertices;for(let o=0;o0&&a.push(n.length);const l=this._extractLocalIndices(e,t[o][r],i,s);n.push(...l)}if(3===n.length)s.indices.push(n[0]),s.indices.push(n[1]),s.indices.push(n[2]);else if(n.length>3){let e=[];for(let t=0;t{e.target.classList.contains("xeokit-context-menu-item")||this.hide()})),document.addEventListener("touchstart",this._canvasTouchStartHandler=e=>{e.target.classList.contains("xeokit-context-menu-item")||this.hide()})),e.items&&(this.items=e.items),this._hideOnAction=!1!==e.hideOnAction,this.context=e.context,this.enabled=!1!==e.enabled,this.hide()}on(e,t){let i=this._eventSubs[e];i||(i=[],this._eventSubs[e]=i),i.push(t)}fire(e,t){const i=this._eventSubs[e];if(i)for(let e=0,s=i.length;e{const o=this._getNextId(),n=new i(o);for(let i=0,o=e.length;i0,A=this._getNextId(),h=i.getTitle||(()=>i.title||""),c=i.doAction||i.callback||(()=>{}),u=i.getEnabled||(()=>!0),d=i.getShown||(()=>!0),p=new r(A,h,c,u,d);if(p.parentMenu=n,a.items.push(p),l){const e=t(s);p.subMenu=e,e.parentItem=p}this._itemList.push(p),this._itemMap[p.id]=p}}return this._menuList.push(n),this._menuMap[n.id]=n,n};this._rootMenu=t(e)}_getNextId(){return"ContextMenu_"+this._id+"_"+this._nextId++}_createUI(){const e=t=>{this._createMenuUI(t);const i=t.groups;for(let t=0,s=i.length;t'),i.push("
    "),t)for(let e=0,s=t.length;e'+l+" [MORE]"):i.push('
  • '+l+"
  • ")}}i.push("
"),i.push("");const s=i.join("");document.body.insertAdjacentHTML("beforeend",s);const r=document.querySelector("."+e.id);e.menuElement=r,r.style["border-radius"]="4px",r.style.display="none",r.style["z-index"]=3e5,r.style.background="white",r.style.border="1px solid black",r.style["box-shadow"]="0 4px 5px 0 gray",r.oncontextmenu=e=>{e.preventDefault()};const o=this;let n=null;if(t)for(let e=0,i=t.length;e{e.preventDefault();const i=t.subMenu;if(!i)return void(n&&(o._hideMenu(n.id),n=null));if(n&&n.id!==i.id&&(o._hideMenu(n.id),n=null),!1===t.enabled)return;const s=t.itemElement,r=i.menuElement,a=s.getBoundingClientRect();r.getBoundingClientRect();a.right+200>window.innerWidth?o._showMenu(i.id,a.left-200,a.top-1):o._showMenu(i.id,a.right-5,a.top-1),n=i})),s||(t.itemElement.addEventListener("click",(e=>{e.preventDefault(),o._context&&!1!==t.enabled&&(t.doAction&&t.doAction(o._context),this._hideOnAction?o.hide():(o._updateItemsTitles(),o._updateItemsEnabledStatus()))})),t.itemElement.addEventListener("mouseup",(e=>{3===e.which&&(e.preventDefault(),o._context&&!1!==t.enabled&&(t.doAction&&t.doAction(o._context),this._hideOnAction?o.hide():(o._updateItemsTitles(),o._updateItemsEnabledStatus())))})),t.itemElement.addEventListener("mouseenter",(e=>{e.preventDefault(),!1!==t.enabled&&t.doHover&&t.doHover(o._context)})))):console.error("ContextMenu item element not found: "+t.id)}}}_updateItemsTitles(){if(this._context)for(let e=0,t=this._itemList.length;ewindow.innerHeight&&(i=window.innerHeight-s),t+r>window.innerWidth&&(t=window.innerWidth-r),e.style.left=t+"px",e.style.top=i+"px"}_hideMenuElement(e){e.style.display="none"}},exports.CubicBezierCurve=class extends vh{constructor(e,t={}){super(e,t),this.v0=t.v0,this.v1=t.v1,this.v2=t.v2,this.v3=t.v3,this.t=t.t}set v0(e){this._v0=e||c.vec3([0,0,0])}get v0(){return this._v0}set v1(e){this._v1=e||c.vec3([0,0,0])}get v1(){return this._v1}set v2(e){this._v2=e||c.vec3([0,0,0])}get v2(){return this._v2}set v3(e){this.fire("v3",this._v3=e||c.vec3([0,0,0]))}get v3(){return this._v3}set t(e){e=e||0,this._t=e<0?0:e>1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=c.vec3();return t[0]=c.b3(e,this._v0[0],this._v1[0],this._v2[0],this._v3[0]),t[1]=c.b3(e,this._v0[1],this._v1[1],this._v2[1],this._v3[1]),t[2]=c.b3(e,this._v0[2],this._v1[2],this._v2[2],this._v3[2]),t}getJSON(){return{v0:this._v0,v1:this._v1,v2:this._v2,v3:this._v3,t:this._t}}},exports.Curve=vh,exports.DefaultLoadingManager=_A,exports.DepthFormat=1026,exports.DepthStencilFormat=1027,exports.DirLight=It,exports.DistanceMeasurementEditControl=ph,exports.DistanceMeasurementEditMouseControl=class extends ph{constructor(e,t){super(e,t,!0,!1)}},exports.DistanceMeasurementEditTouchControl=class extends ph{constructor(e,t){super(e,t,!1,!0)}},exports.DistanceMeasurementsControl=uh,exports.DistanceMeasurementsMouseControl=dh,exports.DistanceMeasurementsPlugin=class extends V{constructor(e,t={}){super("DistanceMeasurements",e),this._pointerLens=t.pointerLens,this._container=t.container||document.body,this._defaultControl=null,this._measurements={},this.labelMinAxisLength=t.labelMinAxisLength,this.defaultVisible=!1!==t.defaultVisible,this.defaultOriginVisible=!1!==t.defaultOriginVisible,this.defaultTargetVisible=!1!==t.defaultTargetVisible,this.defaultWireVisible=!1!==t.defaultWireVisible,this.defaultXLabelEnabled=!1!==t.defaultXLabelEnabled,this.defaultYLabelEnabled=!1!==t.defaultYLabelEnabled,this.defaultZLabelEnabled=!1!==t.defaultZLabelEnabled,this.defaultLengthLabelEnabled=!1!==t.defaultLengthLabelEnabled,this.defaultLabelsVisible=!1!==t.defaultLabelsVisible,this.defaultAxisVisible=!1!==t.defaultAxisVisible,this.defaultXAxisVisible=!1!==t.defaultXAxisVisible,this.defaultYAxisVisible=!1!==t.defaultYAxisVisible,this.defaultZAxisVisible=!1!==t.defaultZAxisVisible,this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.zIndex=t.zIndex||1e4,this.defaultLabelsOnWires=!1!==t.defaultLabelsOnWires,this.useRotationAdjustment=void 0!==t.useRotationAdjustment&&!1!==t.useRotationAdjustment,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,distanceMeasurement:t,measurement:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,distanceMeasurement:t,measurement:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,distanceMeasurement:t,measurement:t,event:e})}}getContainerElement(){return this._container}send(e,t){}get pointerLens(){return this._pointerLens}get control(){return this._defaultControl||(this._defaultControl=new dh(this,{})),this._defaultControl}get measurements(){return this._measurements}set labelMinAxisLength(e){e<1&&(this.error("labelMinAxisLength must be >= 1; defaulting to 25"),e=25),this._labelMinAxisLength=e||25}get labelMinAxisLength(){return this._labelMinAxisLength}set useRotationAdjustment(e){e=void 0!==e&&Boolean(e),this._useRotationAdjustment=e}get useRotationAdjustment(){return this._useRotationAdjustment}createMeasurement(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=e.origin,i=e.target,s=new ch(this,{id:e.id,plugin:this,container:this._container,origin:{entity:t.entity,worldPos:t.worldPos},target:{entity:i.entity,worldPos:i.worldPos},visible:e.visible,wireVisible:e.wireVisible,axisVisible:!1!==e.axisVisible&&!1!==this.defaultAxisVisible,xAxisVisible:!1!==e.xAxisVisible&&!1!==this.defaultXAxisVisible,yAxisVisible:!1!==e.yAxisVisible&&!1!==this.defaultYAxisVisible,zAxisVisible:!1!==e.zAxisVisible&&!1!==this.defaultZAxisVisible,xLabelEnabled:!1!==e.xLabelEnabled&&!1!==this.defaultXLabelEnabled,yLabelEnabled:!1!==e.yLabelEnabled&&!1!==this.defaultYLabelEnabled,zLabelEnabled:!1!==e.zLabelEnabled&&!1!==this.defaultZLabelEnabled,lengthLabelEnabled:!1!==e.lengthLabelEnabled&&!1!==this.defaultLengthLabelEnabled,labelsVisible:!1!==e.labelsVisible&&!1!==this.defaultLabelsVisible,useRotationAdjustment:this.useRotationAdjustment,originVisible:e.originVisible,targetVisible:e.targetVisible,color:e.color,labelsOnWires:!1!==e.labelsOnWires&&!1!==this.defaultLabelsOnWires,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._measurements[s.id]=s,s.clickable=!0,s.on("destroyed",(()=>{delete this._measurements[s.id]})),this.fire("measurementCreated",s),s}destroyMeasurement(e){const t=this._measurements[e];t?(t.destroy(),this.fire("measurementDestroyed",t)):this.log("DistanceMeasurement not found: "+e)}setLabelsShown(e){for(const[t,i]of Object.entries(this.measurements))i.labelShown=e}setAxisVisible(e){for(const[t,i]of Object.entries(this.measurements))i.axisVisible=e;this.defaultAxisVisible=e}getAxisVisible(){return this.defaultAxisVisible}clear(){const e=Object.keys(this._measurements);for(var t=0,i=e.length;t{this.plugin.viewer.cameraControl.active=!1},u=()=>{this.plugin.viewer.cameraControl.active=!0},d=()=>{o&&(clearTimeout(o),o=null),this._currentDistanceMeasurement&&(this._currentDistanceMeasurement.destroy(),this._currentDistanceMeasurement=null),u(),this._touchState=0};i.addEventListener("touchstart",this._onCanvasTouchStart=i=>{const l=i.touches.length;if(1!==l)return void(o&&(clearTimeout(o),o=null));const u=i.touches[0],p=u.clientX,f=u.clientY;switch(n.set([p,f]),a.set([p,f]),this._touchState){case 0:if(1!==l&&null!==o)return void d();const i=t.pick({canvasPos:a,snapping:this._snapping,snapToEdge:this._snapping});if(i&&i.snapped)s.set(i.worldPos),this.pointerCircle.start(i.snappedCanvasPos);else{const e=t.pick({canvasPos:a,pickSurface:!0});if(!e||!e.worldPos)return;s.set(e.worldPos),this.pointerCircle.start(e.canvasPos)}o=setTimeout((()=>{1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{if(o=null,1!==l||a[0]>n[0]+r||a[0]n[1]+r||a[1]{this.pointerCircle.stop();const r=i.touches.length;if(1!==r||1!==i.changedTouches.length)return void(o&&(clearTimeout(o),o=null));const n=i.touches[0],l=n.clientX,h=n.clientY;if(n.identifier!==A)return;let u,d;switch(a.set([l,h]),this._touchState){case 2:this.pointerLens&&(this.pointerLens.canvasPos=a),u=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),u&&u.snapped?(this.pointerLens&&(this.pointerLens.snappedCanvasPos=u.snappedCanvasPos,this.pointerLens.snapped=!0),s.set(u.worldPos),this._currentDistanceMeasurement?this._currentDistanceMeasurement.origin.worldPos=u.worldPos:(this._currentDistanceMeasurement=e.createMeasurement({id:c.createUUID(),origin:{worldPos:u.worldPos,entity:u.entity},target:{worldPos:u.worldPos,entity:u.entity}}),this._currentDistanceMeasurement.labelsVisible=!1,this._currentDistanceMeasurement.xAxisVisible=!1,this._currentDistanceMeasurement.yAxisVisible=!1,this._currentDistanceMeasurement.zAxisVisible=!1,this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.originVisible=!0,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.clickable=!1),this.distanceMeasurementsPlugin.fire("measurementStart",this._currentDistanceMeasurement)):(d=t.pick({canvasPos:a,pickSurface:!0}),d&&d.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=d.canvasPos,this.pointerLens.snapped=!1),s.set(d.worldPos),this._currentDistanceMeasurement?this._currentDistanceMeasurement.origin.worldPos=d.worldPos:(this._currentDistanceMeasurement=e.createMeasurement({id:c.createUUID(),origin:{worldPos:d.worldPos,entity:d.entity},target:{worldPos:d.worldPos,entity:d.entity}}),this._currentDistanceMeasurement.labelsVisible=!1,this._currentDistanceMeasurement.xAxisVisible=!1,this._currentDistanceMeasurement.yAxisVisible=!1,this._currentDistanceMeasurement.zAxisVisible=!1,this._currentDistanceMeasurement.wireVisible=!1,this._currentDistanceMeasurement.originVisible=!0,this._currentDistanceMeasurement.targetVisible=!1,this._currentDistanceMeasurement.clickable=!1),this.distanceMeasurementsPlugin.fire("measurementStart",this._currentDistanceMeasurement)):this.pointerLens&&(this.pointerLens.cursorPos=null,this.pointerLens.snapped=!1)),this._touchState=2;break;case 5:if(1!==r&&null!==o)return clearTimeout(o),o=null,this.pointerLens&&(this.pointerLens.visible=!1),void(this._touchState=7);this.pointerLens&&(this.pointerLens.canvasPos=a),u=t.pick({canvasPos:a,snapToVertex:this._snapping,snapToEdge:this._snapping}),u&&u.worldPos?(this.pointerLens&&(this.pointerLens.cursorPos=u.snappedCanvasPos,this.pointerLens.snapped=!0),this._currentDistanceMeasurement.target.worldPos=u.worldPos,this._currentDistanceMeasurement.target.entity=u.entity,this._currentDistanceMeasurement.targetVisible=!0,this._currentDistanceMeasurement.wireVisible=!0,this._currentDistanceMeasurement.labelsVisible=!0):(d=t.pick({canvasPos:a,pickSurface:!0}),d&&d.worldPos&&(this.pointerLens&&(this.pointerLens.cursorPos=d.canvasPos,this.pointerLens.snapped=!1),this._currentDistanceMeasurement.target.worldPos=d.worldPos,this._currentDistanceMeasurement.target.entity=d.entity,this._currentDistanceMeasurement.targetVisible=!0,this._currentDistanceMeasurement.wireVisible=!0,this._currentDistanceMeasurement.labelsVisible=!0)),this._touchState=5}}),{passive:!0}),i.addEventListener("touchend",this._onCanvasTouchEnd=i=>{this.pointerCircle.stop();const s=i.changedTouches.length;if(1!==s)return;const h=i.changedTouches[0],d=h.clientX,p=h.clientY;if(h.identifier===A)switch(o&&(clearTimeout(o),o=null),l.set([d,p]),this._touchState){case 1:{if(1!==s||d>n[0]+r||dn[1]+r||pn[0]+r||dn[1]+r||p{const t=e.fileData,n=e.sceneModel,a={},l={},A=c.createUUID(),h=c.createUUID(),u=c.createUUID(),d=c.createUUID(),p={metaObjects:[{id:A,name:"IfcProject",type:"IfcProject",parent:null},{id:h,name:"IfcSite",type:"IfcSite",parent:A},{id:u,name:"IfcBuilding",type:"IfcBuilding",parent:h},{id:d,name:"IfcBuildingStorey",type:"IfcBuildingStorey",parent:u}],propertySets:[]};for(let e=0,i=t.meshes.length;e{if(l[e])return;const i=a[e],s=t.meshes[i];n.createGeometry({id:e,primitive:"triangles",positions:s.coordinates,indices:s.indices}),l[e]=!0},g=t.elements;for(let e=0,t=g.length;e{n.destroyed||(n.scene.fire("modelLoaded",n.id),n.fire("loaded",!0,!1))}))};if(e.src){const i=e.src;this.viewer.scene.canvas.spinner.processes++,this._dataSource.getDotBIM(i,(e=>{n({fileData:e,sceneModel:t,nextId:0,error:function(e){}}),this.viewer.scene.canvas.spinner.processes--}),(e=>{this.viewer.scene.canvas.spinner.processes--,this.error(e)}))}else if(e.dotBIM){const i={fileData:e.dotBIM,sceneModel:t,nextId:0,error:function(e){}};n(i)}return t.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(i)})),t}destroy(){super.destroy()}},exports.EdgeMaterial=qt,exports.EmphasisMaterial=Yt,exports.FaceAlignedSectionPlanesPlugin=class extends V{constructor(e,t={}){if(super("FaceAlignedSectionPlanesPlugin",e),this._freeControls=[],this._sectionPlanes=e.scene.sectionPlanes,this._controls={},this._shownControlId=null,this._dragSensitivity=t.dragSensitivity||1,null!==t.overviewCanvasId&&void 0!==t.overviewCanvasId){const e=document.getElementById(t.overviewCanvasId);e?this._overview=new lw(this,{overviewCanvas:e,visible:t.overviewVisible,onHoverEnterPlane:e=>{this._overview.setPlaneHighlighted(e,!0)},onHoverLeavePlane:e=>{this._overview.setPlaneHighlighted(e,!1)},onClickedPlane:e=>{if(this.getShownControl()===e)return void this.hideControl();this.showControl(e);const t=this.sectionPlanes[e].pos;Aw.set(this.viewer.scene.aabb),c.getAABB3Center(Aw,hw),Aw[0]+=t[0]-hw[0],Aw[1]+=t[1]-hw[1],Aw[2]+=t[2]-hw[2],Aw[3]+=t[0]-hw[0],Aw[4]+=t[1]-hw[1],Aw[5]+=t[2]-hw[2],this.viewer.cameraFlight.flyTo({aabb:Aw,fitFOV:65})},onClickedNothing:()=>{this.hideControl()}}):this.warn("Can't find overview canvas: '"+t.overviewCanvasId+"' - will create plugin without overview")}null===t.controlElementId||void 0===t.controlElementId?this.error("Parameter expected: controlElementId"):(this._controlElement=document.getElementById(t.controlElementId),this._controlElement||this.warn("Can't find control element: '"+t.controlElementId+"' - will create plugin without control element")),this._onSceneSectionPlaneCreated=e.scene.on("sectionPlaneCreated",(e=>{this._sectionPlaneCreated(e)}))}setDragSensitivity(e){this._dragSensitivity=e||1}getDragSensitivity(){return this._dragSensitivity}setOverviewVisible(e){this._overview&&this._overview.setVisible(e)}getOverviewVisible(){if(this._overview)return this._overview.getVisible()}get sectionPlanes(){return this._sectionPlanes}createSectionPlane(e={}){void 0!==e.id&&null!==e.id&&this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);return new os(this.viewer.scene,{id:e.id,pos:e.pos,dir:e.dir,active:!0})}_sectionPlaneCreated(e){const t=this._freeControls.length>0?this._freeControls.pop():new nw(this);t._setSectionPlane(e),t.setVisible(!1),this._controls[e.id]=t,this._overview&&this._overview.addSectionPlane(e),e.once("destroyed",(()=>{this._sectionPlaneDestroyed(e)}))}flipSectionPlanes(){const e=this.viewer.scene.sectionPlanes;for(let t in e){e[t].flipDir()}}showControl(e){const t=this._controls[e];t?(this.hideControl(),t.setVisible(!0),this._overview&&this._overview.setPlaneSelected(e,!0),this._shownControlId=e):this.error("Control not found: "+e)}getShownControl(){return this._shownControlId}hideControl(){for(let e in this._controls)this._controls.hasOwnProperty(e)&&(this._controls[e].setVisible(!1),this._overview&&this._overview.setPlaneSelected(e,!1));this._shownControlId=null}destroySectionPlane(e){let t=this.viewer.scene.sectionPlanes[e];t?(this._sectionPlaneDestroyed(t),t.destroy(),e===this._shownControlId&&(this._shownControlId=null)):this.error("SectionPlane not found: "+e)}_sectionPlaneDestroyed(e){this._overview&&this._overview.removeSectionPlane(e);const t=this._controls[e.id];t&&(t.setVisible(!1),t._setSectionPlane(null),delete this._controls[e.id],this._freeControls.push(t))}clear(){const e=Object.keys(this._sectionPlanes);for(let t=0,i=e.length;t{i=1e3*this._delayBeforeRestoreSeconds,s||(e.scene._renderer.setColorTextureEnabled(!this._hideColorTexture),e.scene._renderer.setPBREnabled(!this._hidePBR),e.scene._renderer.setSAOEnabled(!this._hideSAO),e.scene._renderer.setTransparentEnabled(!this._hideTransparentObjects),e.scene._renderer.setEdgesEnabled(!this._hideEdges),this._scaleCanvasResolution?e.scene.canvas.resolutionScale=this._scaleCanvasResolutionFactor:e.scene.canvas.resolutionScale=this._defaultScaleCanvasResolutionFactor,s=!0)},o=()=>{e.scene.canvas.resolutionScale=this._defaultScaleCanvasResolutionFactor,e.scene._renderer.setEdgesEnabled(!0),e.scene._renderer.setColorTextureEnabled(!0),e.scene._renderer.setPBREnabled(!0),e.scene._renderer.setSAOEnabled(!0),e.scene._renderer.setTransparentEnabled(!0),s=!1};this._onCanvasBoundary=e.scene.canvas.on("boundary",r),this._onCameraMatrix=e.scene.camera.on("matrix",r),this._onSceneTick=e.scene.on("tick",(e=>{s&&(i-=e.deltaTime,(!this._delayBeforeRestore||i<=0)&&o())}));let n=!1;this._onSceneMouseDown=e.scene.input.on("mousedown",(()=>{n=!0})),this._onSceneMouseUp=e.scene.input.on("mouseup",(()=>{n=!1})),this._onSceneMouseMove=e.scene.input.on("mousemove",(()=>{n&&r()}))}get hideColorTexture(){return this._hideColorTexture}set hideColorTexture(e){this._hideColorTexture=e}get hidePBR(){return this._hidePBR}set hidePBR(e){this._hidePBR=e}get hideSAO(){return this._hideSAO}set hideSAO(e){this._hideSAO=e}get hideEdges(){return this._hideEdges}set hideEdges(e){this._hideEdges=e}get hideTransparentObjects(){return this._hideTransparentObjects}set hideTransparentObjects(e){this._hideTransparentObjects=!1!==e}get scaleCanvasResolution(){return this._scaleCanvasResolution}set scaleCanvasResolution(e){this._scaleCanvasResolution=e}get defaultScaleCanvasResolutionFactor(){return this._defaultScaleCanvasResolutionFactor}set defaultScaleCanvasResolutionFactor(e){this._defaultScaleCanvasResolutionFactor=e||1}get scaleCanvasResolutionFactor(){return this._scaleCanvasResolutionFactor}set scaleCanvasResolutionFactor(e){this._scaleCanvasResolutionFactor=e||.6}get delayBeforeRestore(){return this._delayBeforeRestore}set delayBeforeRestore(e){this._delayBeforeRestore=e}get delayBeforeRestoreSeconds(){return this._delayBeforeRestoreSeconds}set delayBeforeRestoreSeconds(e){this._delayBeforeRestoreSeconds=null!=e?e:.5}send(e,t){}destroy(){this.viewer.scene.camera.off(this._onCameraMatrix),this.viewer.scene.canvas.off(this._onCanvasBoundary),this.viewer.scene.input.off(this._onSceneMouseDown),this.viewer.scene.input.off(this._onSceneMouseUp),this.viewer.scene.input.off(this._onSceneMouseMove),this.viewer.scene.off(this._onSceneTick),super.destroy()}},exports.FloatType=1015,exports.Fresnel=class extends D{get type(){return"Fresnel"}constructor(e,t={}){super(e,t),this._state=new at({edgeColor:c.vec3([0,0,0]),centerColor:c.vec3([1,1,1]),edgeBias:0,centerBias:1,power:1}),this.edgeColor=t.edgeColor,this.centerColor=t.centerColor,this.edgeBias=t.edgeBias,this.centerBias=t.centerBias,this.power=t.power}set edgeColor(e){this._state.edgeColor.set(e||[0,0,0]),this.glRedraw()}get edgeColor(){return this._state.edgeColor}set centerColor(e){this._state.centerColor.set(e||[1,1,1]),this.glRedraw()}get centerColor(){return this._state.centerColor}set edgeBias(e){this._state.edgeBias=e||0,this.glRedraw()}get edgeBias(){return this._state.edgeBias}set centerBias(e){this._state.centerBias=null!=e?e:1,this.glRedraw()}get centerBias(){return this._state.centerBias}set power(e){this._state.power=null!=e?e:1,this.glRedraw()}get power(){return this._state.power}destroy(){super.destroy(),this._state.destroy()}},exports.Frustum=U,exports.FrustumPlane=R,exports.GIFMediaType=1e4,exports.GLTFDefaultDataSource=fh,exports.GLTFLoaderPlugin=class extends V{constructor(e,t={}){super("GLTFLoader",e,t),this._sceneModelLoader=new wB(this,t),this.dataSource=t.dataSource,this.objectDefaults=t.objectDefaults}set dataSource(e){this._dataSource=e||new fh}get dataSource(){return this._dataSource}set objectDefaults(e){this._objectDefaults=e||RB}get objectDefaults(){return this._objectDefaults}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new qA(this.viewer.scene,_.apply(e,{isModel:!0,dtxEnabled:e.dtxEnabled})),i=t.id;if(!e.src&&!e.gltf)return this.error("load() param expected: src or gltf"),t;if(e.metaModelSrc||e.metaModelJSON){const s=e.objectDefaults||this._objectDefaults||RB,r=r=>{let o;if(this.viewer.metaScene.createMetaModel(i,r,{includeTypes:e.includeTypes,excludeTypes:e.excludeTypes}),this.viewer.scene.canvas.spinner.processes--,e.includeTypes){o={};for(let t=0,i=e.includeTypes.length;t{const r=t.name;if(!r)return!0;const o=r,n=this.viewer.metaScene.metaObjects[o],a=(n?n.type:"DEFAULT")||"DEFAULT";i.createEntity={id:o,isObject:!0};const l=s[a];return l&&(!1===l.visible&&(i.createEntity.visible=!1),l.colorize&&(i.createEntity.colorize=l.colorize),!1===l.pickable&&(i.createEntity.pickable=!1),void 0!==l.opacity&&null!==l.opacity&&(i.createEntity.opacity=l.opacity)),!0},e.src?this._sceneModelLoader.load(this,e.src,r,e,t):this._sceneModelLoader.parse(this,e.gltf,r,e,t)};if(e.metaModelSrc){const t=e.metaModelSrc;this.viewer.scene.canvas.spinner.processes++,this._dataSource.getMetaModel(t,(e=>{this.viewer.scene.canvas.spinner.processes--,r(e)}),(e=>{this.error(`load(): Failed to load model metadata for model '${i} from '${t}' - ${e}`),this.viewer.scene.canvas.spinner.processes--}))}else e.metaModelJSON&&r(e.metaModelJSON)}else e.handleGLTFNode=(e,t,i)=>{const s=t.name;if(!s)return!0;const r=s;return i.createEntity={id:r,isObject:!0},!0},e.src?this._sceneModelLoader.load(this,e.src,null,e,t):this._sceneModelLoader.parse(this,e.gltf,null,e,t);return t.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(i)})),t}destroy(){super.destroy()}},exports.HalfFloatType=1016,exports.ImagePlane=class extends D{constructor(e,t={}){super(e,t),this._src=null,this._image=null,this._pos=c.vec3(),this._origin=c.vec3(),this._rtcPos=c.vec3(),this._dir=c.vec3(),this._size=1,this._imageSize=c.vec2(),this._texture=new Ds(this),this._plane=new $i(this,{geometry:new jt(this,Os({center:[0,0,0],xSize:1,zSize:1,xSegments:10,zSegments:10})),material:new Xt(this,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:this._texture,emissiveMap:this._texture,backfaces:!0}),clippable:t.clippable}),this._grid=new $i(this,{geometry:new jt(this,ks({size:1,divisions:10})),material:new Xt(this,{diffuse:[0,0,0],ambient:[0,0,0],emissive:[.2,.8,.2]}),position:[0,.001,0],clippable:t.clippable}),this._node=new fs(this,{rotation:[0,0,0],position:[0,0,0],scale:[1,1,1],clippable:!1,children:[this._plane,this._grid]}),this._gridVisible=!1,this.visible=!0,this.gridVisible=t.gridVisible,this.position=t.position,this.rotation=t.rotation,this.dir=t.dir,this.size=t.size,this.collidable=t.collidable,this.clippable=t.clippable,this.pickable=t.pickable,this.opacity=t.opacity,t.image?this.image=t.image:this.src=t.src}set visible(e){this._plane.visible=e,this._grid.visible=this._gridVisible&&e}get visible(){return this._plane.visible}set gridVisible(e){e=!1!==e,this._gridVisible=e,this._grid.visible=this._gridVisible&&this.visible}get gridVisible(){return this._gridVisible}set image(e){this._image=e,this._image&&(this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage(),this._src=null,this._texture.image=this._image)}get image(){return this._image}set src(e){if(this._src=e,this._src){this._image=null;const e=new Image;e.onload=()=>{this._texture.image=e,this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage()},e.src=this._src}}get src(){return this._src}set position(e){this._pos.set(e||[0,0,0]),W(this._pos,this._origin,this._rtcPos),this._node.origin=this._origin,this._node.position=this._rtcPos}get position(){return this._pos}set rotation(e){this._node.rotation=e}get rotation(){return this._node.rotation}set size(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}get size(){return this._size}set dir(e){if(this._dir.set(e||[0,0,-1]),e){const t=this.scene.center,i=[-this._dir[0],-this._dir[1],-this._dir[2]];c.subVec3(t,this.position,Fh);const s=-c.dotVec3(i,Fh);c.normalizeVec3(i),c.mulVec3Scalar(i,s,Ih),c.vec3PairToQuaternion(Dh,e,Sh),this._node.quaternion=Sh}}get dir(){return this._dir}set collidable(e){this._node.collidable=!1!==e}get collidable(){return this._node.collidable}set clippable(e){this._node.clippable=!1!==e}get clippable(){return this._node.clippable}set pickable(e){this._node.pickable=!1!==e}get pickable(){return this._node.pickable}set opacity(e){this._node.opacity=e}get opacity(){return this._node.opacity}destroy(){super.destroy()}_updatePlaneSizeFromImage(){const e=this._size,t=this._imageSize[0],i=this._imageSize[1];if(t>i){const s=i/t;this._node.scale=[e,1,e*s]}else{const s=t/i;this._node.scale=[e*s,1,e]}}},exports.IntType=1013,exports.JPEGMediaType=10001,exports.KTX2TextureTranscoder=wA,exports.LASLoaderPlugin=class extends V{constructor(e,t={}){super("lasLoader",e,t),this.dataSource=t.dataSource,this.skip=t.skip,this.fp64=t.fp64,this.colorDepth=t.colorDepth}get dataSource(){return this._dataSource}set dataSource(e){this._dataSource=e||new EP}get skip(){return this._skip}set skip(e){this._skip=e||1}get fp64(){return this._fp64}set fp64(e){this._fp64=!!e}get colorDepth(){return this._colorDepth}set colorDepth(e){this._colorDepth=e||"auto"}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new qA(this.viewer.scene,_.apply(e,{isModel:!0}));if(!e.src&&!e.las)return this.error("load() param expected: src or las"),t;const i={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(e.src)this._loadModel(e.src,e,i,t);else{const s=this.viewer.scene.canvas.spinner;s.processes++,this._parseModel(e.las,e,i,t).then((()=>{s.processes--}),(e=>{s.processes--,this.error(e),t.fire("error",e)}))}return t}_loadModel(e,t,i,s){const r=this.viewer.scene.canvas.spinner;r.processes++,this._dataSource.getLAS(t.src,(e=>{this._parseModel(e,t,i,s).then((()=>{r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){function r(e){const i=e.value;if(t.rotateX&&i)for(let e=0,t=i.length;e{if(s.destroyed)return void l();const A=t.stats||{};A.sourceFormat="LAS",A.schemaVersion="",A.title="",A.author="",A.created="",A.numMetaObjects=0,A.numPropertySets=0,A.numObjects=0,A.numGeometries=0,A.numTriangles=0,A.numVertices=0;try{const A=SP(e);Hb(e,FP,i).then((e=>{const h=e.attributes,u=e.loaderData,d=void 0!==u.pointsFormatId?u.pointsFormatId:-1;if(!h.POSITION)return s.finalize(),void l("No positions found in file");let p,f;switch(d){case 0:p=r(h.POSITION),f=n(h.intensity);break;case 1:if(!h.intensity)return s.finalize(),void l("No positions found in file");p=r(h.POSITION),f=n(h.intensity);break;case 2:case 3:if(!h.intensity)return s.finalize(),void l("No positions found in file");p=r(h.POSITION),f=o(h.COLOR_0,h.intensity)}const g=RP(p,15e5),m=RP(f,2e6),_=[];for(let e=0,t=g.length;e{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))})),a()}))}catch(e){s.finalize(),l(e)}}))}},exports.LambertMaterial=gs,exports.LightMap=class extends Uh{get type(){return"LightMap"}constructor(e,t={}){super(e,t),this.scene._lightMapCreated(this)}destroy(){super.destroy(),this.scene._lightMapDestroyed(this)}},exports.LineSet=eh,exports.LinearEncoding=3e3,exports.LinearFilter=1006,exports.LinearMipMapLinearFilter=1008,exports.LinearMipMapNearestFilter=1007,exports.LinearMipmapLinearFilter=1008,exports.LinearMipmapNearestFilter=1007,exports.Loader=vA,exports.LoadingManager=mA,exports.LocaleService=gh,exports.LuminanceAlphaFormat=1025,exports.LuminanceFormat=1024,exports.Map=e,exports.Marker=Ae,exports.MarqueePicker=N,exports.MarqueePickerMouseControl=class extends D{constructor(e){super(e.marqueePicker,e);const t=e.marqueePicker,i=t.viewer.scene.canvas.canvas;let s,r,o,n,a,l,A,h=!1,c=!1,u=!1;i.addEventListener("mousedown",(e=>{this.getActive()&&0===e.button&&(A=setTimeout((function(){const o=t.viewer.scene.input;o.keyDown[o.KEY_CTRL]||t.clear(),s=e.pageX,r=e.pageY,a=e.offsetX,t.setMarqueeCorner1([s,r]),h=!0,t.viewer.cameraControl.pointerEnabled=!1,t.setMarqueeVisible(!0),i.style.cursor="crosshair"}),400),c=!0)})),i.addEventListener("mouseup",(e=>{if(!this.getActive())return;if(!h&&!u)return;if(0!==e.button)return;clearTimeout(A),o=e.pageX,n=e.pageY;const i=Math.abs(o-s),a=Math.abs(n-r);h=!1,t.viewer.cameraControl.pointerEnabled=!0,u&&(u=!1),(i>3||a>3)&&t.pick()})),document.addEventListener("mouseup",(e=>{this.getActive()&&0===e.button&&(clearTimeout(A),h&&(t.setMarqueeVisible(!1),h=!1,c=!1,u=!0,t.viewer.cameraControl.pointerEnabled=!0))}),!0),i.addEventListener("mousemove",(e=>{this.getActive()&&0===e.button&&c&&(clearTimeout(A),h&&(o=e.pageX,n=e.pageY,l=e.offsetX,t.setMarqueeVisible(!0),t.setMarqueeCorner2([o,n]),t.setPickMode(a{e.camera.zUp?(this._zUp=!0,this._cubeTextureCanvas.setZUp(),this._repaint(),this._synchCamera()):e.camera.yUp&&(this._zUp=!1,this._cubeTextureCanvas.setYUp(),this._repaint(),this._synchCamera())})),this._onCameraFOV=e.camera.perspective.on("fov",(e=>{this._synchProjection&&(this._navCubeCamera.perspective.fov=e)})),this._onCameraProjection=e.camera.on("projection",(e=>{this._synchProjection&&(this._navCubeCamera.projection="ortho"===e||"perspective"===e?e:"perspective")}));var o=-1;function n(e){var t=[0,0];if(e){for(var i=e.target,s=0,r=0;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;t[0]=e.pageX-s,t[1]=e.pageY-r}else e=window.event,t[0]=e.x,t[1]=e.y;return t}var a,l,A=null,h=null,u=!1,d=!1,p=.5;s._navCubeCanvas.addEventListener("mouseenter",s._onMouseEnter=function(e){d=!0}),s._navCubeCanvas.addEventListener("mouseleave",s._onMouseLeave=function(e){d=!1}),s._navCubeCanvas.addEventListener("mousedown",s._onMouseDown=function(e){if(1===e.which){A=e.x,h=e.y,a=e.clientX,l=e.clientY;var t=n(e),s=i.pick({canvasPos:t});u=!!s}}),document.addEventListener("mouseup",s._onMouseUp=function(e){if(1===e.which&&(u=!1,null!==A)){var t=n(e),a=i.pick({canvasPos:t,pickSurface:!0});if(a&&a.uv){var l=s._cubeTextureCanvas.getArea(a.uv);if(l>=0&&(document.body.style.cursor="pointer",o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),l>=0)){if(s._cubeTextureCanvas.setAreaHighlighted(l,!0),o=l,s._repaint(),e.xA+3||e.yh+3)return;var c=s._cubeTextureCanvas.getAreaDir(l);if(c){var d=s._cubeTextureCanvas.getAreaUp(l);s._isProjectNorth&&s._projectNorthOffsetAngle&&(c=r(1,c,kB),d=r(1,d,OB)),f(c,d,(function(){o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),document.body.style.cursor="pointer",o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),l>=0&&(s._cubeTextureCanvas.setAreaHighlighted(l,!1),o=-1,s._repaint())}))}}}}}),document.addEventListener("mousemove",s._onMouseMove=function(t){if(o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),1!==t.buttons||u){if(u){var r=t.clientX,A=t.clientY;return document.body.style.cursor="move",void function(t,i){var s=(t-a)*-p,r=(i-l)*-p;e.camera.orbitYaw(s),e.camera.orbitPitch(-r),a=t,l=i}(r,A)}if(d){var h=n(t),c=i.pick({canvasPos:h,pickSurface:!0});if(c){if(c.uv){document.body.style.cursor="pointer";var f=s._cubeTextureCanvas.getArea(c.uv);if(f===o)return;o>=0&&s._cubeTextureCanvas.setAreaHighlighted(o,!1),f>=0&&(s._cubeTextureCanvas.setAreaHighlighted(f,!0),s._repaint(),o=f)}}else document.body.style.cursor="default",o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1)}}});var f=function(){var t=c.vec3();return function(i,r,o){var n=s._fitVisible?e.scene.getAABB(e.scene.visibleObjectIds):e.scene.aabb,a=c.getAABB3Diag(n);c.getAABB3Center(n,t);var l=Math.abs(a/Math.tan(s._cameraFitFOV*c.DEGTORAD));e.cameraControl.pivotPos=t,s._cameraFly?e.cameraFlight.flyTo({look:t,eye:[t[0]-l*i[0],t[1]-l*i[1],t[2]-l*i[2]],up:r||[0,1,0],orthoScale:1.1*a,fitFOV:s._cameraFitFOV,duration:s._cameraFlyDuration},o):e.cameraFlight.jumpTo({look:t,eye:[t[0]-l*i[0],t[1]-l*i[1],t[2]-l*i[2]],up:r||[0,1,0],orthoScale:1.1*a,fitFOV:s._cameraFitFOV},o)}}();this._onUpdated=e.localeService.on("updated",(()=>{this._cubeTextureCanvas.clear(),this._repaint()})),this.setVisible(t.visible),this.setCameraFitFOV(t.cameraFitFOV),this.setCameraFly(t.cameraFly),this.setCameraFlyDuration(t.cameraFlyDuration),this.setFitVisible(t.fitVisible),this.setSynchProjection(t.synchProjection)}send(e,t){if("language"===e)this._cubeTextureCanvas.clear(),this._repaint()}_repaint(){const e=this._cubeTextureCanvas.getImage();this._cubeMesh.material.diffuseMap.image=e,this._cubeMesh.material.emissiveMap.image=e}setVisible(e=!0){this._navCubeCanvas&&(this._cubeMesh.visible=e,this._shadow&&(this._shadow.visible=e),this._navCubeCanvas.style.visibility=e?"visible":"hidden")}getVisible(){return!!this._navCubeCanvas&&this._cubeMesh.visible}setFitVisible(e=!1){this._fitVisible=e}getFitVisible(){return this._fitVisible}setCameraFly(e=!0){this._cameraFly=e}getCameraFly(){return this._cameraFly}setCameraFitFOV(e=45){this._cameraFitFOV=e}getCameraFitFOV(){return this._cameraFitFOV}setCameraFlyDuration(e=.5){this._cameraFlyDuration=e}getCameraFlyDuration(){return this._cameraFlyDuration}setSynchProjection(e=!1){this._synchProjection=e}getSynchProjection(){return this._synchProjection}setIsProjectNorth(e=!1){this._isProjectNorth=e}getIsProjectNorth(){return this._isProjectNorth}setProjectNorthOffsetAngle(e){this._projectNorthOffsetAngle=e}getProjectNorthOffsetAngle(){return this._projectNorthOffsetAngle}destroy(){this._navCubeCanvas&&(this.viewer.localeService.off(this._onUpdated),this.viewer.camera.off(this._onCameraMatrix),this.viewer.camera.off(this._onCameraWorldAxis),this.viewer.camera.perspective.off(this._onCameraFOV),this.viewer.camera.off(this._onCameraProjection),this._navCubeCanvas.removeEventListener("mouseenter",this._onMouseEnter),this._navCubeCanvas.removeEventListener("mouseleave",this._onMouseLeave),this._navCubeCanvas.removeEventListener("mousedown",this._onMouseDown),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._navCubeCanvas=null,this._cubeTextureCanvas.destroy(),this._cubeTextureCanvas=null,this._onMouseEnter=null,this._onMouseLeave=null,this._onMouseDown=null,this._onMouseMove=null,this._onMouseUp=null),this._navCubeScene.destroy(),this._navCubeScene=null,this._cubeMesh=null,this._shadow=null,super.destroy()}},exports.NearestFilter=1003,exports.NearestMipMapLinearFilter=1005,exports.NearestMipMapNearestFilter=1004,exports.NearestMipmapLinearFilter=1005,exports.NearestMipmapNearestFilter=1004,exports.Node=fs,exports.OBJLoaderPlugin=class extends V{constructor(e,t){super("OBJLoader",e,t),this._sceneGraphLoader=new QB}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);var t=new fs(this.viewer.scene,_.apply(e,{isModel:!0}));const i=t.id,s=e.src;if(!s)return this.error("load() param expected: src"),t;if(e.metaModelSrc){const r=e.metaModelSrc;_.loadJSON(r,(r=>{this.viewer.metaScene.createMetaModel(i,r),this._sceneGraphLoader.load(t,s,e)}),(e=>{this.error(`load(): Failed to load model modelMetadata for model '${i} from '${r}' - ${e}`)}))}else this._sceneGraphLoader.load(t,s,e);return t.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(i)})),t}destroy(){super.destroy()}},exports.ObjectsKdTree3=class{constructor(e){if(!e)throw"Parameter expected: cfg";if(!e.viewer)throw"Parameter expected: cfg.viewer";this.viewer=e.viewer,this._maxTreeDepth=e.maxTreeDepth||15,this._root=null,this._needsRebuild=!0,this._onModelLoaded=this.viewer.scene.on("modelLoaded",(e=>{this._needsRebuild=!0})),this._onModelUnloaded=this.viewer.scene.on("modelUnloaded",(e=>{this._needsRebuild=!0}))}get root(){return this._needsRebuild&&this._rebuild(),this._root}_rebuild(){const e=this.viewer.scene;this._root={aabb:e.getAABB()};for(let t in e.objects){const i=e.objects[t];this._insertEntity(this._root,i,1)}this._needsRebuild=!1}_insertEntity(e,t,i){const s=t.aabb;if(i>=this._maxTreeDepth)return e.entities=e.entities||[],void e.entities.push(t);if(e.left&&c.containsAABB3(e.left.aabb,s))return void this._insertEntity(e.left,t,i+1);if(e.right&&c.containsAABB3(e.right.aabb,s))return void this._insertEntity(e.right,t,i+1);const r=e.aabb;u[0]=r[3]-r[0],u[1]=r[4]-r[1],u[2]=r[5]-r[2];let o=0;if(u[1]>u[o]&&(o=1),u[2]>u[o]&&(o=2),!e.left){const n=r.slice();if(n[o+3]=(r[o]+r[o+3])/2,e.left={aabb:n},c.containsAABB3(n,s))return void this._insertEntity(e.left,t,i+1)}if(!e.right){const n=r.slice();if(n[o]=(r[o]+r[o+3])/2,e.right={aabb:n},c.containsAABB3(n,s))return void this._insertEntity(e.right,t,i+1)}e.entities=e.entities||[],e.entities.push(t)}destroy(){const e=this.viewer.scene;e.off(this._onModelLoaded),e.off(this._onModelUnloaded),this._root=null,this._needsRebuild=!0}},exports.ObjectsMemento=Qh,exports.PNGMediaType=10002,exports.Path=class extends vh{constructor(e,t={}){super(e,t),this._cachedLengths=[],this._dirty=!0,this._curves=[],this._t=0,this._dirtySubs=[],this._destroyedSubs=[],this.curves=t.curves||[],this.t=t.t}addCurve(e){this._curves.push(e),this._dirty=!0}set curves(e){var t,i,s;for(e=e||[],i=0,s=this._curves.length;i1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}get length(){var e=this._getCurveLengths();return e[e.length-1]}getPoint(e){for(var t,i=e*this.length,s=this._getCurveLengths(),r=0;r=i){var o=1-(s[r]-i)/(t=this._curves[r]).length;return t.getPointAt(o)}r++}return null}_getCurveLengths(){if(!this._dirty)return this._cachedLengths;var e,t=[],i=0,s=this._curves.length;for(e=0;e{this._shadowViewMatrixDirty=!0})),this._onCameraProjMatrix=s.on("projMatrix",(()=>{this._shadowProjMatrixDirty=!0})),this._onCanvasBoundary=r.on("boundary",(()=>{this._shadowProjMatrixDirty=!0})),this._state=new at({type:"point",pos:c.vec3([1,1,1]),color:c.vec3([.7,.7,.8]),intensity:1,attenuation:[0,0,0],space:t.space||"view",castsShadow:!1,getShadowViewMatrix:()=>{if(i._shadowViewMatrixDirty){i._shadowViewMatrix||(i._shadowViewMatrix=c.identityMat4());const e=i._state.pos,t=s.look,r=s.up;c.lookAtMat4v(e,t,r,i._shadowViewMatrix),i._shadowViewMatrixDirty=!1}return i._shadowViewMatrix},getShadowProjMatrix:()=>{if(i._shadowProjMatrixDirty){i._shadowProjMatrix||(i._shadowProjMatrix=c.identityMat4());const e=i.scene.canvas.canvas;c.perspectiveMat4(Math.PI/180*70,e.clientWidth/e.clientHeight,.1,500,i._shadowProjMatrix),i._shadowProjMatrixDirty=!1}return i._shadowProjMatrix},getShadowRenderBuf:()=>(i._shadowRenderBuf||(i._shadowRenderBuf=new tt(i.scene.canvas.canvas,i.scene.canvas.gl,{size:[1024,1024]})),i._shadowRenderBuf)}),this.pos=t.pos,this.color=t.color,this.intensity=t.intensity,this.constantAttenuation=t.constantAttenuation,this.linearAttenuation=t.linearAttenuation,this.quadraticAttenuation=t.quadraticAttenuation,this.castsShadow=t.castsShadow,this.scene._lightCreated(this)}set pos(e){this._state.pos.set(e||[1,1,1]),this._shadowViewMatrixDirty=!0,this.glRedraw()}get pos(){return this._state.pos}set color(e){this._state.color.set(e||[.7,.7,.8]),this.glRedraw()}get color(){return this._state.color}set intensity(e){e=void 0!==e?e:1,this._state.intensity=e,this.glRedraw()}get intensity(){return this._state.intensity}set constantAttenuation(e){this._state.attenuation[0]=e||0,this.glRedraw()}get constantAttenuation(){return this._state.attenuation[0]}set linearAttenuation(e){this._state.attenuation[1]=e||0,this.glRedraw()}get linearAttenuation(){return this._state.attenuation[1]}set quadraticAttenuation(e){this._state.attenuation[2]=e||0,this.glRedraw()}get quadraticAttenuation(){return this._state.attenuation[2]}set castsShadow(e){e=!!e,this._state.castsShadow!==e&&(this._state.castsShadow=e,this._shadowViewMatrixDirty=!0,this.glRedraw())}get castsShadow(){return this._state.castsShadow}destroy(){const e=this.scene.camera,t=this.scene.canvas;e.off(this._onCameraViewMatrix),e.off(this._onCameraProjMatrix),t.off(this._onCanvasBoundary),super.destroy(),this._state.destroy(),this._shadowRenderBuf&&this._shadowRenderBuf.destroy(),this.scene._lightDestroyed(this),this.glRedraw()}},exports.PointerCircle=Q,exports.PointerLens=class{constructor(e,t={}){this.viewer=e,this.scene=this.viewer.scene,this._lensCursorDiv=document.createElement("div"),this.viewer.scene.canvas.canvas.parentNode.insertBefore(this._lensCursorDiv,this.viewer.scene.canvas.canvas),this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red",this._lensCursorDiv.style.borderRadius="20px",this._lensCursorDiv.style.width="10px",this._lensCursorDiv.style.height="10px",this._lensCursorDiv.style.margin="-200px -200px",this._lensCursorDiv.style.zIndex="100000",this._lensCursorDiv.style.position="absolute",this._lensCursorDiv.style.pointerEvents="none",this._lensContainer=document.createElement("div"),this._lensContainer.style.border="1px solid black",this._lensContainer.style.background="white",this._lensContainer.style.borderRadius="50%",this._lensContainer.style.width="300px",this._lensContainer.style.height="300px",this._lensContainer.style.marginTop="85px",this._lensContainer.style.marginLeft="25px",this._lensContainer.style.zIndex="15000",this._lensContainer.style.position="absolute",this._lensContainer.style.pointerEvents="none",this._lensContainer.style.visibility="hidden",this._lensCanvas=document.createElement("canvas"),this._lensCanvas.style.borderRadius="50%",this._lensCanvas.style.width="300px",this._lensCanvas.style.height="300px",this._lensCanvas.style.zIndex="15000",this._lensCanvas.style.pointerEvents="none",document.body.appendChild(this._lensContainer),this._lensContainer.appendChild(this._lensCanvas),this._lensCanvasContext=this._lensCanvas.getContext("2d"),this._canvasElement=this.viewer.scene.canvas.canvas,this._canvasPos=null,this._snappedCanvasPos=null,this._lensPosToggle=!0,this._zoomLevel=t.zoomLevel||2,this._active=!1!==t.active,this._visible=!1,this._snapped=!1,this._onViewerRendering=this.viewer.scene.on("rendering",(()=>{this._active&&this._visible&&this.update()}))}update(){if(!this._active||!this._visible)return;if(!this._canvasPos)return;const e=this._lensContainer.getBoundingClientRect(),t=this._canvasElement.getBoundingClientRect(),i=this._canvasPos[0]e.left&&this._canvasPos[1]e.top;this._lensContainer.style.marginLeft="25px",i&&(this._lensPosToggle?this._lensContainer.style.marginTop=t.bottom-t.top-this._lensCanvas.height-85+"px":this._lensContainer.style.marginTop="85px",this._lensPosToggle=!this._lensPosToggle),this._lensCanvasContext.clearRect(0,0,this._lensCanvas.width,this._lensCanvas.height);const s=Math.max(this._lensCanvas.width,this._lensCanvas.height)/this._zoomLevel;this._lensCanvasContext.drawImage(this._canvasElement,this._canvasPos[0]-s/2,this._canvasPos[1]-s/2,s,s,0,0,this._lensCanvas.width,this._lensCanvas.height);const r=[(e.left+e.right)/2-t.left,(e.top+e.bottom)/2-t.top];if(this._snappedCanvasPos){const e=this._snappedCanvasPos[0]-this._canvasPos[0],t=this._snappedCanvasPos[1]-this._canvasPos[1];this._lensCursorDiv.style.marginLeft=r[0]+e*this._zoomLevel-10+"px",this._lensCursorDiv.style.marginTop=r[1]+t*this._zoomLevel-10+"px"}else this._lensCursorDiv.style.marginLeft=r[0]-10+"px",this._lensCursorDiv.style.marginTop=r[1]-10+"px"}set zoomFactor(e){this._zoomFactor=e,this.update()}get zoomFactor(){return this._zoomFactor}set canvasPos(e){this._canvasPos=e,this.update()}get canvasPos(){return this._canvasPos}set snappedCanvasPos(e){this._snappedCanvasPos=e,this.update()}get snappedCanvasPos(){return this._snappedCanvasPos}set snapped(e){this._snapped=e,e?(this._lensCursorDiv.style.background="greenyellow",this._lensCursorDiv.style.border="2px solid green"):(this._lensCursorDiv.style.background="pink",this._lensCursorDiv.style.border="2px solid red")}get snapped(){return this._snapped}set active(e){this._active=e,this._lensContainer.style.visibility=e&&this._visible?"visible":"hidden",e&&this._visible||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}get active(){return this._active}set visible(e){this._visible=e,this._lensContainer.style.visibility=e&&this._active?"visible":"hidden",e&&this._active||(this._lensCursorDiv.style.marginLeft="-100px",this._lensCursorDiv.style.marginTop="-100px"),this.update()}get visible(){return this._visible}destroy(){this._destroyed||(this.viewer.scene.off(this._onViewerRendering),this._lensContainer.removeChild(this._lensCanvas),document.body.removeChild(this._lensContainer),this._destroyed=!0)}},exports.QuadraticBezierCurve=class extends vh{constructor(e,t={}){super(e,t),this.v0=t.v0,this.v1=t.v1,this.v2=t.v2,this.t=t.t}set v0(e){this._v0=e||c.vec3([0,0,0])}get v0(){return this._v0}set v1(e){this._v1=e||c.vec3([0,0,0])}get v1(){return this._v1}set v2(e){this._v2=e||c.vec3([0,0,0])}get v2(){return this._v2}set t(e){e=e||0,this._t=e<0?0:e>1?1:e}get t(){return this._t}get point(){return this.getPoint(this._t)}getPoint(e){var t=c.vec3();return t[0]=c.b2(e,this._v0[0],this._v1[0],this._v2[0]),t[1]=c.b2(e,this._v0[1],this._v1[1],this._v2[1]),t[2]=c.b2(e,this._v0[2],this._v1[2],this._v2[2]),t}getJSON(){return{v0:this._v0,v1:this._v1,v2:this._v2,t:this._t}}},exports.Queue=d,exports.RGBAFormat=1023,exports.RGBAIntegerFormat=1033,exports.RGBA_ASTC_10x10_Format=37819,exports.RGBA_ASTC_10x5_Format=37816,exports.RGBA_ASTC_10x6_Format=37817,exports.RGBA_ASTC_10x8_Format=37818,exports.RGBA_ASTC_12x10_Format=37820,exports.RGBA_ASTC_12x12_Format=37821,exports.RGBA_ASTC_4x4_Format=37808,exports.RGBA_ASTC_5x4_Format=37809,exports.RGBA_ASTC_5x5_Format=37810,exports.RGBA_ASTC_6x5_Format=37811,exports.RGBA_ASTC_6x6_Format=37812,exports.RGBA_ASTC_8x5_Format=37813,exports.RGBA_ASTC_8x6_Format=37814,exports.RGBA_ASTC_8x8_Format=37815,exports.RGBA_BPTC_Format=36492,exports.RGBA_ETC2_EAC_Format=37496,exports.RGBA_PVRTC_2BPPV1_Format=35843,exports.RGBA_PVRTC_4BPPV1_Format=35842,exports.RGBA_S3TC_DXT1_Format=33777,exports.RGBA_S3TC_DXT3_Format=33778,exports.RGBA_S3TC_DXT5_Format=33779,exports.RGBFormat=1022,exports.RGB_ETC1_Format=36196,exports.RGB_ETC2_Format=37492,exports.RGB_PVRTC_2BPPV1_Format=35841,exports.RGB_PVRTC_4BPPV1_Format=35840,exports.RGB_S3TC_DXT1_Format=33776,exports.RGFormat=1030,exports.RGIntegerFormat=1031,exports.ReadableGeometry=jt,exports.RedFormat=1028,exports.RedIntegerFormat=1029,exports.ReflectionMap=class extends Uh{get type(){return"ReflectionMap"}constructor(e,t={}){super(e,t),this.scene._lightsState.addReflectionMap(this._state),this.scene._reflectionMapCreated(this)}destroy(){super.destroy(),this.scene._reflectionMapDestroyed(this)}},exports.RepeatWrapping=1e3,exports.STLDefaultDataSource=cw,exports.STLLoaderPlugin=class extends V{constructor(e,t={}){super("STLLoader",e,t),this._sceneGraphLoader=new dw,this.dataSource=t.dataSource}set dataSource(e){this._dataSource=e||new cw}get dataSource(){return this._dataSource}load(e){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new fs(this.viewer.scene,_.apply(e,{isModel:!0})),i=e.src,s=e.stl;return i||s?(i?this._sceneGraphLoader.load(this,t,i,e):this._sceneGraphLoader.parse(this,t,s,e),t):(this.error("load() param expected: either 'src' or 'stl'"),t)}},exports.SceneModel=qA,exports.SceneModelMesh=zs,exports.SceneModelTransform=jA,exports.SectionPlane=os,exports.SectionPlanesPlugin=class extends V{constructor(e,t={}){if(super("SectionPlanes",e),this._freeControls=[],this._sectionPlanes=e.scene.sectionPlanes,this._controls={},this._shownControlId=null,null!==t.overviewCanvasId&&void 0!==t.overviewCanvasId){const e=document.getElementById(t.overviewCanvasId);e?this._overview=new ZB(this,{overviewCanvas:e,visible:t.overviewVisible,onHoverEnterPlane:e=>{this._overview.setPlaneHighlighted(e,!0)},onHoverLeavePlane:e=>{this._overview.setPlaneHighlighted(e,!1)},onClickedPlane:e=>{if(this.getShownControl()===e)return void this.hideControl();this.showControl(e);const t=this.sectionPlanes[e].pos;qB.set(this.viewer.scene.aabb),c.getAABB3Center(qB,$B),qB[0]+=t[0]-$B[0],qB[1]+=t[1]-$B[1],qB[2]+=t[2]-$B[2],qB[3]+=t[0]-$B[0],qB[4]+=t[1]-$B[1],qB[5]+=t[2]-$B[2],this.viewer.cameraFlight.flyTo({aabb:qB,fitFOV:65})},onClickedNothing:()=>{this.hideControl()}}):this.warn("Can't find overview canvas: '"+t.overviewCanvasId+"' - will create plugin without overview")}this._onSceneSectionPlaneCreated=e.scene.on("sectionPlaneCreated",(e=>{this._sectionPlaneCreated(e)}))}setOverviewVisible(e){this._overview&&this._overview.setVisible(e)}getOverviewVisible(){if(this._overview)return this._overview.getVisible()}get sectionPlanes(){return this._sectionPlanes}createSectionPlane(e={}){void 0!==e.id&&null!==e.id&&this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);return new os(this.viewer.scene,{id:e.id,pos:e.pos,dir:e.dir,active:!0})}_sectionPlaneCreated(e){const t=this._freeControls.length>0?this._freeControls.pop():new JB(this);t._setSectionPlane(e),t.setVisible(!1),this._controls[e.id]=t,this._overview&&this._overview.addSectionPlane(e),e.once("destroyed",(()=>{this._sectionPlaneDestroyed(e)}))}flipSectionPlanes(){const e=this.viewer.scene.sectionPlanes;for(let t in e){e[t].flipDir()}}showControl(e){const t=this._controls[e];t?(this.hideControl(),t.setVisible(!0),this._overview&&this._overview.setPlaneSelected(e,!0),this._shownControlId=e):this.error("Control not found: "+e)}getShownControl(){return this._shownControlId}hideControl(){for(var e in this._controls)this._controls.hasOwnProperty(e)&&(this._controls[e].setVisible(!1),this._overview&&this._overview.setPlaneSelected(e,!1));this._shownControlId=null}destroySectionPlane(e){var t=this.viewer.scene.sectionPlanes[e];t?(this._sectionPlaneDestroyed(t),t.destroy(),e===this._shownControlId&&(this._shownControlId=null)):this.error("SectionPlane not found: "+e)}_sectionPlaneDestroyed(e){this._overview&&this._overview.removeSectionPlane(e);const t=this._controls[e.id];t&&(t.setVisible(!1),t._setSectionPlane(null),delete this._controls[e.id],this._freeControls.push(t))}clear(){const e=Object.keys(this._sectionPlanes);for(var t=0,i=e.length;t{this._texture.image=e,this._imageSize[0]=e.width,this._imageSize[1]=e.height,this._updatePlaneSizeFromImage()},e.src=this._src}}get src(){return this._src}set size(e){this._size=null==e?1:e,this._image&&this._updatePlaneSizeFromImage()}get size(){return this._size}set collidable(e){this._mesh.collidable=!1!==e}get collidable(){return this._mesh.collidable}set clippable(e){this._mesh.clippable=!1!==e}get clippable(){return this._mesh.clippable}set pickable(e){this._mesh.pickable=!1!==e}get pickable(){return this._mesh.pickable}set opacity(e){this._mesh.opacity=e}get opacity(){return this._mesh.opacity}_updatePlaneSizeFromImage(){const e=.5*this._size,t=this._imageSize[0],i=this._imageSize[1],s=i/t;this._geometry.positions=t>i?[e,e*s,0,-e,e*s,0,-e,-e*s,0,e,-e*s,0]:[e/s,e,0,-e/s,e,0,-e/s,-e,0,e/s,-e,0]}},exports.StoreyViewsPlugin=class extends V{constructor(e,t={}){super("StoreyViews",e),this._objectsMemento=new Qh,this._cameraMemento=new kh,this.storeys={},this.modelStoreys={},this._fitStoreyMaps=!!t.fitStoreyMaps,this._onModelLoaded=this.viewer.scene.on("modelLoaded",(e=>{this._registerModelStoreys(e),this.fire("storeys",this.storeys)}))}_registerModelStoreys(e){const t=this.viewer,i=t.scene,s=t.metaScene,r=s.metaModels[e],o=i.models[e];if(!r||!r.rootMetaObjects)return;const n=r.rootMetaObjects;for(let t=0,r=n.length;t.5?a.length:0,h=new ew(this,o.aabb,l,e,n,A);h._onModelDestroyed=o.once("destroyed",(()=>{this._deregisterModelStoreys(e),this.fire("storeys",this.storeys)})),this.storeys[n]=h,this.modelStoreys[e]||(this.modelStoreys[e]={}),this.modelStoreys[e][n]=h}}}_deregisterModelStoreys(e){const t=this.modelStoreys[e];if(t){const i=this.viewer.scene;for(let e in t)if(t.hasOwnProperty(e)){const s=t[e],r=i.models[s.modelId];r&&r.off(s._onModelDestroyed),delete this.storeys[e]}delete this.modelStoreys[e]}}get fitStoreyMaps(){return this._fitStoreyMaps}gotoStoreyCamera(e,t={}){const i=this.storeys[e];if(!i)return this.error("IfcBuildingStorey not found with this ID: "+e),void(t.done&&t.done());const s=this.viewer,r=s.scene.camera,o=i.storeyAABB;if(o[3]{t.done()})):(s.cameraFlight.jumpTo(_.apply(t,{eye:h,look:n,up:u,orthoScale:A})),s.camera.ortho.scale=A)}showStoreyObjects(e,t={}){if(!this.storeys[e])return void this.error("IfcBuildingStorey not found with this ID: "+e);const i=this.viewer,s=i.scene;i.metaScene.metaObjects[e]&&(t.hideOthers&&s.setObjectsVisible(i.scene.visibleObjectIds,!1),this.withStoreyObjects(e,((e,t)=>{e&&(e.visible=!0)})))}withStoreyObjects(e,t){const i=this.viewer,s=i.scene,r=i.metaScene,o=r.metaObjects[e];if(!o)return;const n=o.getObjectIDsInSubtree();for(var a=0,l=n.length;au[1]&&u[0]>u[2],p=!d&&u[1]>u[0]&&u[1]>u[2];!d&&!p&&u[2]>u[0]&&(u[2],u[1]);const f=e.width/A,g=p?e.height/c:e.height/h;return i[0]=Math.floor(e.width-(t[0]-n)*f),i[1]=Math.floor(e.height-(t[2]-l)*g),i[0]>=0&&i[0]=0&&i[1]<=e.height}worldDirToStoreyMap(e,t,i){const s=this.viewer.camera,r=s.eye,o=s.look,n=c.subVec3(o,r,iw),a=s.worldUp,l=a[0]>a[1]&&a[0]>a[2],A=!l&&a[1]>a[0]&&a[1]>a[2];!l&&!A&&a[2]>a[0]&&(a[2],a[1]),l?(i[0]=n[1],i[1]=n[2]):A?(i[0]=n[0],i[1]=n[2]):(i[0]=n[0],i[1]=n[1]),c.normalizeVec2(i)}destroy(){this.viewer.scene.off(this._onModelLoaded),super.destroy()}},exports.Texture=Ds,exports.TextureTranscoder=class{transcode(e,t,i={}){}destroy(){}},exports.TreeViewPlugin=class extends V{constructor(e,t={}){super("TreeViewPlugin",e),this.errors=[],this.valid=!0;const i=t.containerElement||document.getElementById(t.containerElementId);if(i instanceof HTMLElement){for(let e=0;;e++)if(!yw[e]){yw[e]=this,this._index=e,this._id=`tree-${e}`;break}if(this._containerElement=i,this._metaModels={},this._autoAddModels=!1!==t.autoAddModels,this._autoExpandDepth=t.autoExpandDepth||0,this._sortNodes=!1!==t.sortNodes,this._viewer=e,this._rootElement=null,this._muteSceneEvents=!1,this._muteTreeEvents=!1,this._rootNodes=[],this._objectNodes={},this._nodeNodes={},this._rootNames={},this._sortNodes=t.sortNodes,this._pruneEmptyNodes=t.pruneEmptyNodes,this._showListItemElementId=null,this._renderService=t.renderService||new bw,!this._renderService)throw new Error("TreeViewPlugin: no render service set");if(this._containerElement.oncontextmenu=e=>{e.preventDefault()},this._onObjectVisibility=this._viewer.scene.on("objectVisibility",(e=>{if(this._muteSceneEvents)return;const t=e.id,i=this._objectNodes[t];if(!i)return;const s=e.visible;if(!(s!==i.checked))return;this._muteTreeEvents=!0,i.checked=s,s?i.numVisibleEntities++:i.numVisibleEntities--,this._renderService.setCheckbox(i.nodeId,s);let r=i.parent;for(;r;)r.checked=s,s?r.numVisibleEntities++:r.numVisibleEntities--,this._renderService.setCheckbox(r.nodeId,r.numVisibleEntities>0),r=r.parent;this._muteTreeEvents=!1})),this._onObjectXrayed=this._viewer.scene.on("objectXRayed",(e=>{if(this._muteSceneEvents)return;const t=e.id,i=this._objectNodes[t];if(!i)return;this._muteTreeEvents=!0;const s=e.xrayed;s!==i.xrayed&&(i.xrayed=s,this._renderService.setXRayed(i.nodeId,s),this._muteTreeEvents=!1)})),this._switchExpandHandler=e=>{e.preventDefault(),e.stopPropagation();const t=e.target;this._expandSwitchElement(t)},this._switchCollapseHandler=e=>{e.preventDefault(),e.stopPropagation();const t=e.target;this._collapseSwitchElement(t)},this._checkboxChangeHandler=e=>{if(this._muteTreeEvents)return;this._muteSceneEvents=!0;const t=e.target,i=this._renderService.isChecked(t),s=this._renderService.getIdFromCheckbox(t),r=this._nodeNodes[s],o=this._viewer.scene.objects;let n=0;this._withNodeTree(r,(e=>{const t=e.objectId,s=o[t],r=0===e.children.length;e.numVisibleEntities=i?e.numEntities:0,r&&i!==e.checked&&n++,e.checked=i,this._renderService.setCheckbox(e.nodeId,i),s&&(s.visible=i)}));let a=r.parent;for(;a;)a.checked=i,i?a.numVisibleEntities+=n:a.numVisibleEntities-=n,this._renderService.setCheckbox(a.nodeId,a.numVisibleEntities>0),a=a.parent;this._muteSceneEvents=!1},this._hierarchy=t.hierarchy||"containment",this._autoExpandDepth=t.autoExpandDepth||0,this._autoAddModels){const e=Object.keys(this.viewer.metaScene.metaModels);for(let t=0,i=e.length;t{this.viewer.metaScene.metaModels[e]&&this.addModel(e)}))}this.hierarchy=t.hierarchy}else this.error("Mandatory config expected: valid containerElementId or containerElement")}set hierarchy(e){"containment"!==(e=e||"containment")&&"storeys"!==e&&"types"!==e&&(this.error("Unsupported value for `hierarchy' - defaulting to 'containment'"),e="containment"),this._hierarchy!==e&&(this._hierarchy=e,this._createNodes())}get hierarchy(){return this._hierarchy}addModel(e,t={}){if(!this._containerElement)return;const i=this.viewer.scene.models[e];if(!i)throw"Model not found: "+e;const s=this.viewer.metaScene.metaModels[e];s?this._metaModels[e]?this.warn("Model already added: "+e):(this._metaModels[e]=s,t&&t.rootName&&(this._rootNames[e]=t.rootName),i.on("destroyed",(()=>{this.removeModel(i.id)})),this._createNodes()):this.error("MetaModel not found: "+e)}removeModel(e){if(!this._containerElement)return;this._metaModels[e]&&(this._rootNames[e]&&delete this._rootNames[e],delete this._metaModels[e],this._createNodes())}showNode(e){this.unShowNode();const t=this._objectNodes[e];if(!t)return;const i=t.nodeId,s=this._renderService.getSwitchElement(i);if(s)return this._expandSwitchElement(s),s.scrollIntoView(),!0;const r=[];r.unshift(t);let o=t.parent;for(;o;)r.unshift(o),o=o.parent;for(let e=0,t=r.length;e{if(s===e)return;const r=this._renderService.getSwitchElement(i.nodeId);if(r){this._expandSwitchElement(r);const e=i.children;for(var o=0,n=e.length;o0;return this.valid}_validateMetaModelForStoreysHierarchy(e=0,t,i){return!0}_createEnabledNodes(){switch(this._pruneEmptyNodes&&this._findEmptyNodes(),this._hierarchy){case"storeys":this._createStoreysNodes(),0===this._rootNodes.length&&this.error("Failed to build storeys hierarchy");break;case"types":this._createTypesNodes();break;default:this._createContainmentNodes()}this._sortNodes&&this._doSortNodes(),this._synchNodesToEntities(),this._createTrees(),this.expandToDepth(this._autoExpandDepth)}_createDisabledNodes(){const e=this._renderService.createRootNode();this._rootElement=e,this._containerElement.appendChild(e);const t=this._viewer.metaScene.rootMetaObjects;for(let i in t){const s=t[i],r=s.type,o=s.name,n=o&&""!==o&&"Undefined"!==o&&"Default"!==o?o:r,a=this._renderService.createDisabledNodeElement(n);e.appendChild(a)}}_findEmptyNodes(){const e=this._viewer.metaScene.rootMetaObjects;for(let t in e)this._findEmptyNodes2(e[t])}_findEmptyNodes2(e,t=0){const i=this.viewer.scene,s=e.children,r=e.id,o=i.objects[r];if(e._countEntities=0,o&&e._countEntities++,s)for(let t=0,i=s.length;t{e.aabb&&r.aabb||(e.aabb||(e.aabb=t.getAABB(s.getObjectIDsInSubtree(e.objectId))),r.aabb||(r.aabb=t.getAABB(s.getObjectIDsInSubtree(r.objectId))));let o=0;return o=i.xUp?0:i.yUp?1:2,e.aabb[o]>r.aabb[o]?-1:e.aabb[o]s?1:0}_synchNodesToEntities(){const e=Object.keys(this.viewer.metaScene.metaObjects),t=this._viewer.metaScene.metaObjects,i=this._viewer.scene.objects;for(let s=0,r=e.length;sthis._createNodeElement(e))),t=this._renderService.createRootNode();e.forEach((e=>{t.appendChild(e)})),this._containerElement.appendChild(t),this._rootElement=t}_createNodeElement(e){return this._renderService.createNodeElement(e,this._switchExpandHandler,this._checkboxChangeHandler,(t=>{this.fire("contextmenu",{event:t,viewer:this._viewer,treeViewPlugin:this,treeViewNode:e}),t.preventDefault()}),(t=>{this.fire("nodeTitleClicked",{event:t,viewer:this._viewer,treeViewPlugin:this,treeViewNode:e}),t.preventDefault()}))}_expandSwitchElement(e){if(this._renderService.isExpanded(e))return;const t=this._renderService.getId(e),i=this._nodeNodes[t].children.map((e=>this._createNodeElement(e)));this._renderService.addChildren(e,i),this._renderService.expand(e,this._switchExpandHandler,this._switchCollapseHandler)}_collapseNode(e){const t=this._renderService.getSwitchElement(e);this._collapseSwitchElement(t)}_collapseSwitchElement(e){this._renderService.collapse(e,this._switchExpandHandler,this._switchCollapseHandler)}},exports.UnsignedByteType=1009,exports.UnsignedInt248Type=1020,exports.UnsignedIntType=1014,exports.UnsignedShort4444Type=1017,exports.UnsignedShort5551Type=1018,exports.UnsignedShortType=1012,exports.VBOGeometry=Ls,exports.ViewCullPlugin=class extends V{constructor(e,t={}){super("ViewCull",e),this._objectCullStates=function(e){const t=e.id;let i=Bw[t];return i||(i=new xw(e),Bw[t]=i,e.on("destroyed",(()=>{delete Bw[t],i._destroy()}))),i}(e.scene),this._maxTreeDepth=t.maxTreeDepth||8,this._modelInfos={},this._frustum=new U,this._kdRoot=null,this._frustumDirty=!1,this._kdTreeDirty=!1,this._onViewMatrix=e.scene.camera.on("viewMatrix",(()=>{this._frustumDirty=!0})),this._onProjMatrix=e.scene.camera.on("projMatMatrix",(()=>{this._frustumDirty=!0})),this._onModelLoaded=e.scene.on("modelLoaded",(e=>{const t=this.viewer.scene.models[e];t&&this._addModel(t)})),this._onSceneTick=e.scene.on("tick",(()=>{this._doCull()}))}set enabled(e){this._enabled=e}get enabled(){return this._enabled}_addModel(e){const t={model:e,onDestroyed:e.on("destroyed",(()=>{this._removeModel(e)}))};this._modelInfos[e.id]=t,this._kdTreeDirty=!0}_removeModel(e){const t=this._modelInfos[e.id];t&&(t.model.off(t.onDestroyed),delete this._modelInfos[e.id],this._kdTreeDirty=!0)}_doCull(){const e=this._frustumDirty||this._kdTreeDirty;if(this._frustumDirty&&this._buildFrustum(),this._kdTreeDirty&&this._buildKDTree(),e){const e=this._kdRoot;e&&this._visitKDNode(e)}}_buildFrustum(){const e=this.viewer.scene.camera;k(this._frustum,e.viewMatrix,e.projMatrix),this._frustumDirty=!1}_buildKDTree(){const e=this.viewer.scene;this._kdRoot,this._kdRoot={aabb:e.getAABB(),intersection:U.INTERSECT};for(let e=0,t=this._objectCullStates.numObjects;e=this._maxTreeDepth)return e.objects=e.objects||[],e.objects.push(i),void c.expandAABB3(e.aabb,r);if(e.left&&c.containsAABB3(e.left.aabb,r))return void this._insertEntityIntoKDTree(e.left,t,i,s+1);if(e.right&&c.containsAABB3(e.right.aabb,r))return void this._insertEntityIntoKDTree(e.right,t,i,s+1);const o=e.aabb;ww[0]=o[3]-o[0],ww[1]=o[4]-o[1],ww[2]=o[5]-o[2];let n=0;if(ww[1]>ww[n]&&(n=1),ww[2]>ww[n]&&(n=2),!e.left){const a=o.slice();if(a[n+3]=(o[n]+o[n+3])/2,e.left={aabb:a,intersection:U.INTERSECT},c.containsAABB3(a,r))return void this._insertEntityIntoKDTree(e.left,t,i,s+1)}if(!e.right){const a=o.slice();if(a[n]=(o[n]+o[n+3])/2,e.right={aabb:a,intersection:U.INTERSECT},c.containsAABB3(a,r))return void this._insertEntityIntoKDTree(e.right,t,i,s+1)}e.objects=e.objects||[],e.objects.push(i),c.expandAABB3(e.aabb,r)}_visitKDNode(e,t=U.INTERSECT){if(t!==U.INTERSECT&&e.intersects===t)return;t===U.INTERSECT&&(t=O(this._frustum,e.aabb),e.intersects=t);const i=t===U.OUTSIDE,s=e.objects;if(s&&s.length>0)for(let e=0,t=s.length;e{this._parseModel(e,t,i,s),r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){if(s.destroyed)return;const r=t.stats||{};if(r.sourceFormat="IFC",r.schemaVersion="",r.title="",r.author="",r.created="",r.numMetaObjects=0,r.numPropertySets=0,r.numObjects=0,r.numGeometries=0,r.numTriangles=0,r.numVertices=0,!this._ifcAPI)throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";const o=new Uint8Array(e),n=this._ifcAPI.OpenModel(o),a=this._ifcAPI.GetModelSchema(n),l=this._ifcAPI.GetLineIDsWithType(n,this._webIFC.IFCPROJECT).get(0),A=!1!==t.loadMetadata,h={modelID:n,modelSchema:a,sceneModel:s,loadMetadata:A,metadata:A?{id:"",projectId:""+l,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:null,metaObjects:{},options:i,log:function(e){},nextId:0,stats:r};if(A){if(i.includeTypes){h.includeTypes={};for(let e=0,t=i.includeTypes.length;e{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))}))}_parseMetaObjects(e){const t=this._ifcAPI.GetLineIDsWithType(e.modelID,this._webIFC.IFCPROJECT).get(0),i=this._ifcAPI.GetLine(e.modelID,t);this._parseSpatialChildren(e,i)}_parseSpatialChildren(e,t,i){const s=this._ifcAPI.GetNameFromTypeCode(t.type);if(e.includeTypes&&!e.includeTypes[s])return;if(e.excludeTypes&&e.excludeTypes[s])return;this._createMetaObject(e,t,i);const r=t.GlobalId.value;this._parseRelatedItemsOfType(e,t.expressID,"RelatingObject","RelatedObjects",this._webIFC.IFCRELAGGREGATES,r),this._parseRelatedItemsOfType(e,t.expressID,"RelatingStructure","RelatedElements",this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,r)}_createMetaObject(e,t,i){const s=t.GlobalId.value,r=this._ifcAPI.GetNameFromTypeCode(t.type),o={id:s,name:t.Name&&""!==t.Name.value?t.Name.value:r,type:r,parent:i};e.metadata.metaObjects.push(o),e.metaObjects[s]=o,e.stats.numMetaObjects++}_parseRelatedItemsOfType(e,t,i,s,r,o){const n=this._ifcAPI.GetLineIDsWithType(e.modelID,r);for(let r=0;re.value)).includes(t)}else h=A.value===t;if(h){const t=l[s];if(Array.isArray(t))t.forEach((t=>{const i=this._ifcAPI.GetLine(e.modelID,t.value);this._parseSpatialChildren(e,i,o)}));else{const i=this._ifcAPI.GetLine(e.modelID,t.value);this._parseSpatialChildren(e,i,o)}}}}_parsePropertySets(e){const t=this._ifcAPI.GetLineIDsWithType(e.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(let i=0;i0){const o="Default",n=t.Name.value,a=[];for(let e=0,t=s.length;e{const i=t.expressID,s=t.geometries,r=[],o=this._ifcAPI.GetLine(e.modelID,i).GlobalId.value;if(e.loadMetadata){const t=o,i=e.metaObjects[t];if(e.includeTypes&&(!i||!e.includeTypes[i.type]))return;if(e.excludeTypes&&(!i||e.excludeTypes[i.type]))return}const n=c.mat4(),a=c.vec3();for(let t=0,i=s.size();t{o.finalize(),a.finalize(),this.viewer.scene.canvas.spinner.processes--,o.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(a.id)})),this.scheduleTask((()=>{o.destroyed||(o.scene.fire("modelLoaded",o.id),o.fire("loaded",!0,!1))}))},A=e=>{this.viewer.scene.canvas.spinner.processes--,this.error(e),o.fire("error",e)};let h=0;const c={getNextId:()=>`${n}.${h++}`};if(e.metaModelSrc||e.metaModelData)if(e.metaModelSrc){const r=e.metaModelSrc;this._dataSource.getMetaModel(r,(r=>{o.destroyed||(a.loadData(r,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),e.src?this._loadModel(e.src,e,t,o,null,c,l,A):(this._parseModel(e.xkt,e,t,o,null,c),l()))}),(e=>{A(`load(): Failed to load model metadata for model '${n} from '${r}' - ${e}`)}))}else e.metaModelData&&(a.loadData(e.metaModelData,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),e.src?this._loadModel(e.src,e,t,o,null,c,l,A):(this._parseModel(e.xkt,e,t,o,null,c),l()));else if(e.src)this._loadModel(e.src,e,t,o,a,c,l,A);else if(e.xkt)this._parseModel(e.xkt,e,t,o,a,c),l();else if(e.manifestSrc||e.manifest){const r=e.manifestSrc?function(e){const t=e.split("/");return t.pop(),t.join("/")+"/"}(e.manifestSrc):"",n=(e,o,n)=>{let l=0;const A=()=>{l>=e.length?o():this._dataSource.getMetaModel(`${r}${e[l]}`,(e=>{a.loadData(e,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),l++,this.scheduleTask(A,100)}),n)};A()},h=(i,s,n)=>{let a=0;const l=()=>{a>=i.length?s():this._dataSource.getXKT(`${r}${i[a]}`,(i=>{this._parseModel(i,e,t,o,null,c),a++,this.scheduleTask(l,100)}),n)};l()},u=(i,s,n)=>{let l=0;const A=()=>{l>=i.length?s():this._dataSource.getXKT(`${r}${i[l]}`,(i=>{this._parseModel(i,e,t,o,a,c),l++,this.scheduleTask(A,100)}),n)};A()};if(e.manifest){const t=e.manifest,i=t.xktFiles;if(!i||0===i.length)return void A("load(): Failed to load model manifest - manifest not valid");const s=t.metaModelFiles;s?n(s,(()=>{h(i,l,A)}),A):u(i,l,A)}else this._dataSource.getManifest(e.manifestSrc,(e=>{if(o.destroyed)return;const t=e.xktFiles;if(!t||0===t.length)return void A("load(): Failed to load model manifest - manifest not valid");const i=e.metaModelFiles;i?n(i,(()=>{h(t,l,A)}),A):u(t,l,A)}),A)}return o}_loadModel(e,t,i,s,r,o,n,a){this._dataSource.getXKT(t.src,(e=>{this._parseModel(e,t,i,s,r,o),n()}),a)}_parseModel(e,t,i,s,r,o){if(s.destroyed)return;const n=new DataView(e),a=new Uint8Array(e),l=n.getUint32(0,!0),A=uP[l];if(!A)return void this.error("Unsupported .XKT file version: "+l+" - this XKTLoaderPlugin supports versions "+Object.keys(uP));this.log("Loading .xkt V"+l);const h=n.getUint32(4,!0),c=[];let u=4*(h+2);for(let e=0;e{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=vC(o,(function(t,i){return yC(e,c.vec3([0,1,0]),t,i)}));!function o(){a._deactivate=_C(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._deactivate=()=>{t=!1},a.fire("zoneEnd",e),t&&o()})).deactivate}()}deactivate(){this._deactivate&&(this._deactivate(),this._deactivate=null)}destroy(){this.deactivate(),super.destroy()}},exports.ZonesPlugin=class extends V{constructor(e,t={}){super("Zones",e),this._pointerLens=t.pointerLens,this._container=t.container||document.body,this._zones=[],this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.zIndex=t.zIndex||1e4,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,zone:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,zone:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,zone:t,event:e})}}createZone(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=new xC(this,{id:e.id,plugin:this,container:this._container,geometry:e.geometry,alpha:e.alpha,color:e.color,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._zones.push(t),t.on("destroyed",(()=>{const e=this._zones.indexOf(t);e>=0&&this._zones.splice(e,1)})),this.fire("zoneCreated",t),t}get zones(){return this._zones}destroy(){super.destroy()}},exports.ZonesPolysurfaceMouseControl=class extends D{constructor(e,t={}){super(e.viewer.scene),this.zonesPlugin=e,this.pointerLens=t.pointerLens,this._action=null}get active(){return!!this._action}activate(e,t,i,s){if("object"==typeof e&&null!==e){const r=e,o=(e,t)=>{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}if(this._action)return;const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=vC(o,(function(t,i){return yC(e,c.vec3([0,1,0]),t,i)}));!function o(){a._action=BC(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._action={deactivate:()=>{t=!1}},a.fire("zoneEnd",e),t&&o()}))}()}deactivate(){this._action&&(this._action.deactivate(),this._action=null)}destroy(){this.deactivate(),super.destroy()}},exports.ZonesPolysurfaceTouchControl=class extends D{constructor(e,t={}){super(e.viewer.scene),this.zonesPlugin=e,this.pointerLens=t.pointerLens,this.pointerCircle=new Q(e.viewer),this._action=null}get active(){return!!this._action}activate(e,t,i,s){if("object"==typeof e&&null!==e){const r=e,o=(e,t)=>{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}if(this._action)return;const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=bC(o,this.pointerCircle,(function(t,i){return yC(e,c.vec3([0,1,0]),t,i)}));!function o(){a._action=BC(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._action={deactivate:()=>{t=!1}},a.fire("zoneEnd",e),t&&o()}))}()}deactivate(){this._action&&(this._action.deactivate(),this._action=null)}destroy(){this.deactivate(),super.destroy()}},exports.ZonesTouchControl=class extends D{constructor(e,t={}){super(e.viewer.scene),this.zonesPlugin=e,this.pointerLens=t.pointerLens,this.pointerCircle=new Q(e.viewer),this._deactivate=null}get active(){return!!this._deactivate}activate(e,t,i,s){if("object"==typeof e&&null!==e){const r=e,o=(e,t)=>{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}if(this._deactivate)return;const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=bC(o,this.pointerCircle,(function(t,i){return yC(e,c.vec3([0,1,0]),t,i)}));!function o(){a._deactivate=_C(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._deactivate=()=>{t=!1},a.fire("zoneEnd",e),t&&o()})).deactivate}()}deactivate(){this._deactivate&&(this._deactivate(),this._deactivate=null)}destroy(){this.deactivate(),super.destroy()}},exports.buildBoxGeometry=Gt,exports.buildBoxLinesGeometry=Us,exports.buildBoxLinesGeometryFromAABB=function(e={}){return Us({id:e.id,center:[(e.aabb[0]+e.aabb[3])/2,(e.aabb[1]+e.aabb[4])/2,(e.aabb[2]+e.aabb[5])/2],xSize:Math.abs(e.aabb[3]-e.aabb[0])/2,ySize:Math.abs(e.aabb[4]-e.aabb[1])/2,zSize:Math.abs(e.aabb[5]-e.aabb[2])/2})},exports.buildCylinderGeometry=ts,exports.buildGridGeometry=ks,exports.buildLineGeometry=function(e={}){if(3!==e.startPoint.length)throw"Start point should contain 3 elements in array: x, y and z";if(3!==e.endPoint.length)throw"End point should contain 3 elements in array: x, y and z";let t=[],i=[],s=e.startPoint[0],r=e.startPoint[1],o=e.startPoint[2],n=e.endPoint[0],a=e.endPoint[1],l=e.endPoint[2],A=Math.sqrt((n-s)**2+(a-r)**2+(l-o)**2),h=[(n-s)/A,(a-r)/A,(l-o)/A];if(e.pattern){let c=e.pattern.length,u=!1,d=0,p=0,f=0,g=[s,r,o],m=e.pattern[p];for(i.push(g[0],g[1],g[2]);m<=A-d;){let s=[h[0]*m,h[1]*m,h[2]*m],r=[g[0]+s[0],g[1]+s[1],g[2]+s[2]];i.push(r[0],r[1],r[2]),u||(t.push(f),t.push(f+1)),u=!u,f+=1,g=r,p+=1,p>=c&&(p=0),d+=m,m=e.pattern[p]}e.extendToEnd&&(i.push(n,a,l),t.push(t.length-2),t.push(t.length-1))}else t.push(0),t.push(1),i.push(s,r,o,n,a,l);return _.apply(e,{primitive:"lines",positions:i,indices:t})},exports.buildPlaneGeometry=Os,exports.buildPolylineGeometry=Qs,exports.buildPolylineGeometryFromCurve=function(e={}){let t=e.curve.getPoints(e.divisions).map((e=>[...e])).flat();return Qs({id:e.id,points:t})},exports.buildSphereGeometry=is,exports.buildTorusGeometry=Ns,exports.buildVectorTextGeometry=rs,exports.createRTCViewMat=z,exports.frustumIntersectsAABB3=O,exports.getKTX2TextureTranscoder=CA,exports.getPlaneRTCPos=X,exports.load3DSGeometry=function(e,t={}){return new Promise((function(i,s){t.src||(console.error("load3DSGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,_.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("load3DSGeometry: no data loaded"),r.processes--,s());var o=Rs.parse.from3DS(e).edit.objects[0].mesh,n=o.vertices,a=o.uvt,l=o.indices;r.processes--,i(_.apply(t,{primitive:"triangles",positions:n,normals:null,uv:a,indices:l}))}),(function(e){console.error("load3DSGeometry: "+e),r.processes--,s()}))}))},exports.loadOBJGeometry=function(e,t={}){return new Promise((function(i,s){t.src||(console.error("loadOBJGeometry: Parameter expected: src"),s());var r=e.canvas.spinner;r.processes++,_.loadArraybuffer(t.src,(function(e){e.byteLength||(console.error("loadOBJGeometry: no data loaded"),r.processes--,s());for(var o=Rs.parse.fromOBJ(e),n=Rs.edit.unwrap(o.i_verts,o.c_verts,3),a=Rs.edit.unwrap(o.i_norms,o.c_norms,3),l=Rs.edit.unwrap(o.i_uvt,o.c_uvt,2),A=new Int32Array(o.i_verts.length),h=0;h0?a:null,autoNormals:0===a.length,uv:l,indices:A}))}),(function(e){console.error("loadOBJGeometry: "+e),r.processes--,s()}))}))},exports.math=c,exports.rtcToWorldPos=function(e,t,i){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i},exports.sRGBEncoding=3001,exports.setFrustum=k,exports.stats=p,exports.utils=_,exports.worldToRTCPos=W,exports.worldToRTCPositions=K; diff --git a/dist/xeokit-sdk.min.es.js b/dist/xeokit-sdk.min.es.js index e2c84e6a0..0e7b8b749 100644 --- a/dist/xeokit-sdk.min.es.js +++ b/dist/xeokit-sdk.min.es.js @@ -34,4 +34,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var Cd=function(e,t){return Cd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},Cd(e,t)};function Md(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}Cd(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var Ed=function(){return Ed=Object.assign||function(e){for(var t,i=1,s=arguments.length;i0&&r[r.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]=55296&&r<=56319&&i>10),n%1024+56320)),(r+1===i||s.length>16384)&&(o+=String.fromCharCode.apply(String,s),s.length=0)}return o},Ud="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",kd="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Od=0;Od=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>5])<<2)+(31&e),this.data[t];if(e<=65535)return t=((t=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[t];if(e>11),t=this.index[t],t+=e>>5&63,t=((t=this.index[t])<<2)+(31&e),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Gd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zd="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Wd=0;Wd>4,h[l++]=(15&s)<<4|r>>2,h[l++]=(3&r)<<6|63&o;return A}(e),n=Array.isArray(o)?function(e){for(var t=e.length,i=[],s=0;s0;){var n=s[--o];if(Array.isArray(e)?-1!==e.indexOf(n):e===n)for(var a=i;a<=s.length;){var l;if((l=s[++a])===t)return!0;if(l!==Kd)break}if(n!==Kd)break}return!1},Mp=function(e,t){for(var i=e;i>=0;){var s=t[i];if(s!==Kd)return s;i--}return 0},Ep=function(e,t,i,s,r){if(0===i[s])return"×";var o=s-1;if(Array.isArray(r)&&!0===r[o])return"×";var n=o-1,a=o+1,l=t[o],A=n>=0?t[n]:0,h=t[a];if(2===l&&3===h)return"×";if(-1!==bp.indexOf(l))return"!";if(-1!==bp.indexOf(h))return"×";if(-1!==yp.indexOf(h))return"×";if(8===Mp(o,t))return"÷";if(11===_p.get(e[o]))return"×";if((l===lp||l===Ap)&&11===_p.get(e[a]))return"×";if(7===l||7===h)return"×";if(9===l)return"×";if(-1===[Kd,Xd,Jd].indexOf(l)&&9===h)return"×";if(-1!==[Yd,Zd,qd,ip,np].indexOf(h))return"×";if(Mp(o,t)===tp)return"×";if(Cp(23,tp,o,t))return"×";if(Cp([Yd,Zd],ep,o,t))return"×";if(Cp(12,12,o,t))return"×";if(l===Kd)return"÷";if(23===l||23===h)return"×";if(16===h||16===l)return"÷";if(-1!==[Xd,Jd,ep].indexOf(h)||14===l)return"×";if(36===A&&-1!==Pp.indexOf(l))return"×";if(l===np&&36===h)return"×";if(h===$d)return"×";if(-1!==vp.indexOf(h)&&l===sp||-1!==vp.indexOf(l)&&h===sp)return"×";if(l===op&&-1!==[up,lp,Ap].indexOf(h)||-1!==[up,lp,Ap].indexOf(l)&&h===rp)return"×";if(-1!==vp.indexOf(l)&&-1!==Bp.indexOf(h)||-1!==Bp.indexOf(l)&&-1!==vp.indexOf(h))return"×";if(-1!==[op,rp].indexOf(l)&&(h===sp||-1!==[tp,Jd].indexOf(h)&&t[a+1]===sp)||-1!==[tp,Jd].indexOf(l)&&h===sp||l===sp&&-1!==[sp,np,ip].indexOf(h))return"×";if(-1!==[sp,np,ip,Yd,Zd].indexOf(h))for(var c=o;c>=0;){if((u=t[c])===sp)return"×";if(-1===[np,ip].indexOf(u))break;c--}if(-1!==[op,rp].indexOf(h))for(c=-1!==[Yd,Zd].indexOf(l)?n:o;c>=0;){var u;if((u=t[c])===sp)return"×";if(-1===[np,ip].indexOf(u))break;c--}if(dp===l&&-1!==[dp,pp,hp,cp].indexOf(h)||-1!==[pp,hp].indexOf(l)&&-1!==[pp,fp].indexOf(h)||-1!==[fp,cp].indexOf(l)&&h===fp)return"×";if(-1!==xp.indexOf(l)&&-1!==[$d,rp].indexOf(h)||-1!==xp.indexOf(h)&&l===op)return"×";if(-1!==vp.indexOf(l)&&-1!==vp.indexOf(h))return"×";if(l===ip&&-1!==vp.indexOf(h))return"×";if(-1!==vp.concat(sp).indexOf(l)&&h===tp&&-1===mp.indexOf(e[a])||-1!==vp.concat(sp).indexOf(h)&&l===Zd)return"×";if(41===l&&41===h){for(var d=i[o],p=1;d>0&&41===t[--d];)p++;if(p%2!=0)return"×"}return l===lp&&h===Ap?"×":"÷"},Fp=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var i=function(e,t){void 0===t&&(t="strict");var i=[],s=[],r=[];return e.forEach((function(e,o){var n=_p.get(e);if(n>50?(r.push(!0),n-=50):r.push(!1),-1!==["normal","auto","loose"].indexOf(t)&&-1!==[8208,8211,12316,12448].indexOf(e))return s.push(o),i.push(16);if(4===n||11===n){if(0===o)return s.push(o),i.push(ap);var a=i[o-1];return-1===wp.indexOf(a)?(s.push(s[o-1]),i.push(a)):(s.push(o),i.push(ap))}return s.push(o),31===n?i.push("strict"===t?ep:up):n===gp||29===n?i.push(ap):43===n?e>=131072&&e<=196605||e>=196608&&e<=262141?i.push(up):i.push(ap):void i.push(n)})),[s,i,r]}(e,t.lineBreak),s=i[0],r=i[1],o=i[2];"break-all"!==t.wordBreak&&"break-word"!==t.wordBreak||(r=r.map((function(e){return-1!==[sp,ap,gp].indexOf(e)?up:e})));var n="keep-all"===t.wordBreak?o.map((function(t,i){return t&&e[i]>=19968&&e[i]<=40959})):void 0;return[s,r,n]},Ip=function(){function e(e,t,i,s){this.codePoints=e,this.required="!"===t,this.start=i,this.end=s}return e.prototype.slice=function(){return Rd.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),Dp=function(e){return e>=48&&e<=57},Sp=function(e){return Dp(e)||e>=65&&e<=70||e>=97&&e<=102},Tp=function(e){return 10===e||9===e||32===e},Lp=function(e){return function(e){return function(e){return e>=97&&e<=122}(e)||function(e){return e>=65&&e<=90}(e)}(e)||function(e){return e>=128}(e)||95===e},Rp=function(e){return Lp(e)||Dp(e)||45===e},Up=function(e){return e>=0&&e<=8||11===e||e>=14&&e<=31||127===e},kp=function(e,t){return 92===e&&10!==t},Op=function(e,t,i){return 45===e?Lp(t)||kp(t,i):!!Lp(e)||!(92!==e||!kp(e,t))},Np=function(e,t,i){return 43===e||45===e?!!Dp(t)||46===t&&Dp(i):Dp(46===e?t:e)},Qp=function(e){var t=0,i=1;43!==e[t]&&45!==e[t]||(45===e[t]&&(i=-1),t++);for(var s=[];Dp(e[t]);)s.push(e[t++]);var r=s.length?parseInt(Rd.apply(void 0,s),10):0;46===e[t]&&t++;for(var o=[];Dp(e[t]);)o.push(e[t++]);var n=o.length,a=n?parseInt(Rd.apply(void 0,o),10):0;69!==e[t]&&101!==e[t]||t++;var l=1;43!==e[t]&&45!==e[t]||(45===e[t]&&(l=-1),t++);for(var A=[];Dp(e[t]);)A.push(e[t++]);var h=A.length?parseInt(Rd.apply(void 0,A),10):0;return i*(r+a*Math.pow(10,-n))*Math.pow(10,l*h)},Vp={type:2},Hp={type:3},jp={type:4},Gp={type:13},zp={type:8},Wp={type:21},Kp={type:9},Xp={type:10},Jp={type:11},Yp={type:12},Zp={type:14},qp={type:23},$p={type:1},ef={type:25},tf={type:24},sf={type:26},rf={type:27},of={type:28},nf={type:29},af={type:31},lf={type:32},Af=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(Ld(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==lf;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case 34:return this.consumeStringToken(34);case 35:var t=this.peekCodePoint(0),i=this.peekCodePoint(1),s=this.peekCodePoint(2);if(Rp(t)||kp(i,s)){var r=Op(t,i,s)?2:1;return{type:5,value:this.consumeName(),flags:r}}break;case 36:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Gp;break;case 39:return this.consumeStringToken(39);case 40:return Vp;case 41:return Hp;case 42:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Zp;break;case 43:if(Np(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case 44:return jp;case 45:var o=e,n=this.peekCodePoint(0),a=this.peekCodePoint(1);if(Np(o,n,a))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(Op(o,n,a))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(45===n&&62===a)return this.consumeCodePoint(),this.consumeCodePoint(),tf;break;case 46:if(Np(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case 47:if(42===this.peekCodePoint(0))for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(42===l&&47===(l=this.consumeCodePoint()))return this.consumeToken();if(-1===l)return this.consumeToken()}break;case 58:return sf;case 59:return rf;case 60:if(33===this.peekCodePoint(0)&&45===this.peekCodePoint(1)&&45===this.peekCodePoint(2))return this.consumeCodePoint(),this.consumeCodePoint(),ef;break;case 64:var A=this.peekCodePoint(0),h=this.peekCodePoint(1),c=this.peekCodePoint(2);if(Op(A,h,c))return{type:7,value:this.consumeName()};break;case 91:return of;case 92:if(kp(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case 93:return nf;case 61:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),zp;break;case 123:return Jp;case 125:return Yp;case 117:case 85:var u=this.peekCodePoint(0),d=this.peekCodePoint(1);return 43!==u||!Sp(d)&&63!==d||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case 124:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Kp;if(124===this.peekCodePoint(0))return this.consumeCodePoint(),Wp;break;case 126:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Xp;break;case-1:return lf}return Tp(e)?(this.consumeWhiteSpace(),af):Dp(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Lp(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Rd(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return void 0===e?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();Sp(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var i=!1;63===t&&e.length<6;)e.push(t),t=this.consumeCodePoint(),i=!0;if(i)return{type:30,start:parseInt(Rd.apply(void 0,e.map((function(e){return 63===e?48:e}))),16),end:parseInt(Rd.apply(void 0,e.map((function(e){return 63===e?70:e}))),16)};var s=parseInt(Rd.apply(void 0,e),16);if(45===this.peekCodePoint(0)&&Sp(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var r=[];Sp(t)&&r.length<6;)r.push(t),t=this.consumeCodePoint();return{type:30,start:s,end:parseInt(Rd.apply(void 0,r),16)}}return{type:30,start:s,end:s}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return"url"===e.toLowerCase()&&40===this.peekCodePoint(0)?(this.consumeCodePoint(),this.consumeUrlToken()):40===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),-1===this.peekCodePoint(0))return{type:22,value:""};var t=this.peekCodePoint(0);if(39===t||34===t){var i=this.consumeStringToken(this.consumeCodePoint());return 0===i.type&&(this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0))?(this.consumeCodePoint(),{type:22,value:i.value}):(this.consumeBadUrlRemnants(),qp)}for(;;){var s=this.consumeCodePoint();if(-1===s||41===s)return{type:22,value:Rd.apply(void 0,e)};if(Tp(s))return this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:22,value:Rd.apply(void 0,e)}):(this.consumeBadUrlRemnants(),qp);if(34===s||39===s||40===s||Up(s))return this.consumeBadUrlRemnants(),qp;if(92===s){if(!kp(s,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),qp;e.push(this.consumeEscapedCodePoint())}else e.push(s)}},e.prototype.consumeWhiteSpace=function(){for(;Tp(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(41===e||-1===e)return;kp(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t="";e>0;){var i=Math.min(5e4,e);t+=Rd.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),t},e.prototype.consumeStringToken=function(e){for(var t="",i=0;;){var s=this._value[i];if(-1===s||void 0===s||s===e)return{type:0,value:t+=this.consumeStringSlice(i)};if(10===s)return this._value.splice(0,i),$p;if(92===s){var r=this._value[i+1];-1!==r&&void 0!==r&&(10===r?(t+=this.consumeStringSlice(i),i=-1,this._value.shift()):kp(s,r)&&(t+=this.consumeStringSlice(i),t+=Rd(this.consumeEscapedCodePoint()),i=-1))}i++}},e.prototype.consumeNumber=function(){var e=[],t=4,i=this.peekCodePoint(0);for(43!==i&&45!==i||e.push(this.consumeCodePoint());Dp(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0);var s=this.peekCodePoint(1);if(46===i&&Dp(s))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;Dp(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0),s=this.peekCodePoint(1);var r=this.peekCodePoint(2);if((69===i||101===i)&&((43===s||45===s)&&Dp(r)||Dp(s)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;Dp(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[Qp(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],i=e[1],s=this.peekCodePoint(0),r=this.peekCodePoint(1),o=this.peekCodePoint(2);return Op(s,r,o)?{type:15,number:t,flags:i,unit:this.consumeName()}:37===s?(this.consumeCodePoint(),{type:16,number:t,flags:i}):{type:17,number:t,flags:i}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Sp(e)){for(var t=Rd(e);Sp(this.peekCodePoint(0))&&t.length<6;)t+=Rd(this.consumeCodePoint());Tp(this.peekCodePoint(0))&&this.consumeCodePoint();var i=parseInt(t,16);return 0===i||function(e){return e>=55296&&e<=57343}(i)||i>1114111?65533:i}return-1===e?65533:e},e.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Rp(t))e+=Rd(t);else{if(!kp(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),e;e+=Rd(this.consumeEscapedCodePoint())}}},e}(),hf=function(){function e(e){this._tokens=e}return e.create=function(t){var i=new Af;return i.write(t),new e(i.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();31===e.type;)e=this.consumeToken();if(32===e.type)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do{e=this.consumeToken()}while(31===e.type);if(32===e.type)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(32===t.type)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},i=this.consumeToken();;){if(32===i.type||vf(i,e))return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue()),i=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var i=this.consumeToken();if(32===i.type||3===i.type)return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return void 0===e?lf:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),cf=function(e){return 15===e.type},uf=function(e){return 17===e.type},df=function(e){return 20===e.type},pf=function(e){return 0===e.type},ff=function(e,t){return df(e)&&e.value===t},gf=function(e){return 31!==e.type},mf=function(e){return 31!==e.type&&4!==e.type},_f=function(e){var t=[],i=[];return e.forEach((function(e){if(4===e.type){if(0===i.length)throw new Error("Error parsing function args, zero tokens for arg");return t.push(i),void(i=[])}31!==e.type&&i.push(e)})),i.length&&t.push(i),t},vf=function(e,t){return 11===t&&12===e.type||(28===t&&29===e.type||2===t&&3===e.type)},bf=function(e){return 17===e.type||15===e.type},yf=function(e){return 16===e.type||bf(e)},Bf=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},wf={type:17,number:0,flags:4},xf={type:16,number:50,flags:4},Pf={type:16,number:100,flags:4},Cf=function(e,t,i){var s=e[0],r=e[1];return[Mf(s,t),Mf(void 0!==r?r:s,i)]},Mf=function(e,t){if(16===e.type)return e.number/100*t;if(cf(e))switch(e.unit){case"rem":case"em":return 16*e.number;default:return e.number}return e.number},Ef=function(e,t){if(15===t.type)switch(t.unit){case"deg":return Math.PI*t.number/180;case"grad":return Math.PI/200*t.number;case"rad":return t.number;case"turn":return 2*Math.PI*t.number}throw new Error("Unsupported angle type")},Ff=function(e){return 15===e.type&&("deg"===e.unit||"grad"===e.unit||"rad"===e.unit||"turn"===e.unit)},If=function(e){switch(e.filter(df).map((function(e){return e.value})).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[wf,wf];case"to top":case"bottom":return Df(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[wf,Pf];case"to right":case"left":return Df(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Pf,Pf];case"to bottom":case"top":return Df(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Pf,wf];case"to left":case"right":return Df(270)}return 0},Df=function(e){return Math.PI*e/180},Sf=function(e,t){if(18===t.type){var i=Qf[t.name];if(void 0===i)throw new Error('Attempting to parse an unsupported color function "'+t.name+'"');return i(e,t.values)}if(5===t.type){if(3===t.value.length){var s=t.value.substring(0,1),r=t.value.substring(1,2),o=t.value.substring(2,3);return Rf(parseInt(s+s,16),parseInt(r+r,16),parseInt(o+o,16),1)}if(4===t.value.length){s=t.value.substring(0,1),r=t.value.substring(1,2),o=t.value.substring(2,3);var n=t.value.substring(3,4);return Rf(parseInt(s+s,16),parseInt(r+r,16),parseInt(o+o,16),parseInt(n+n,16)/255)}if(6===t.value.length){s=t.value.substring(0,2),r=t.value.substring(2,4),o=t.value.substring(4,6);return Rf(parseInt(s,16),parseInt(r,16),parseInt(o,16),1)}if(8===t.value.length){s=t.value.substring(0,2),r=t.value.substring(2,4),o=t.value.substring(4,6),n=t.value.substring(6,8);return Rf(parseInt(s,16),parseInt(r,16),parseInt(o,16),parseInt(n,16)/255)}}if(20===t.type){var a=Hf[t.value.toUpperCase()];if(void 0!==a)return a}return Hf.TRANSPARENT},Tf=function(e){return 0==(255&e)},Lf=function(e){var t=255&e,i=255&e>>8,s=255&e>>16,r=255&e>>24;return t<255?"rgba("+r+","+s+","+i+","+t/255+")":"rgb("+r+","+s+","+i+")"},Rf=function(e,t,i,s){return(e<<24|t<<16|i<<8|Math.round(255*s)<<0)>>>0},Uf=function(e,t){if(17===e.type)return e.number;if(16===e.type){var i=3===t?1:255;return 3===t?e.number/100*i:Math.round(e.number/100*i)}return 0},kf=function(e,t){var i=t.filter(mf);if(3===i.length){var s=i.map(Uf),r=s[0],o=s[1],n=s[2];return Rf(r,o,n,1)}if(4===i.length){var a=i.map(Uf),l=(r=a[0],o=a[1],n=a[2],a[3]);return Rf(r,o,n,l)}return 0};function Of(e,t,i){return i<0&&(i+=1),i>=1&&(i-=1),i<1/6?(t-e)*i*6+e:i<.5?t:i<2/3?6*(t-e)*(2/3-i)+e:e}var Nf=function(e,t){var i=t.filter(mf),s=i[0],r=i[1],o=i[2],n=i[3],a=(17===s.type?Df(s.number):Ef(e,s))/(2*Math.PI),l=yf(r)?r.number/100:0,A=yf(o)?o.number/100:0,h=void 0!==n&&yf(n)?Mf(n,1):1;if(0===l)return Rf(255*A,255*A,255*A,1);var c=A<=.5?A*(l+1):A+l-A*l,u=2*A-c,d=Of(u,c,a+1/3),p=Of(u,c,a),f=Of(u,c,a-1/3);return Rf(255*d,255*p,255*f,h)},Qf={hsl:Nf,hsla:Nf,rgb:kf,rgba:kf},Vf=function(e,t){return Sf(e,hf.create(t).parseComponentValue())},Hf={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},jf={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(df(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},Gf={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},zf=function(e,t){var i=Sf(e,t[0]),s=t[1];return s&&yf(s)?{color:i,stop:s}:{color:i,stop:null}},Wf=function(e,t){var i=e[0],s=e[e.length-1];null===i.stop&&(i.stop=wf),null===s.stop&&(s.stop=Pf);for(var r=[],o=0,n=0;no?r.push(l):r.push(o),o=l}else r.push(null)}var A=null;for(n=0;ne.optimumDistance)?{optimumCorner:t,optimumDistance:a}:e}),{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},Yf=function(e,t){var i=Df(180),s=[];return _f(t).forEach((function(t,r){if(0===r){var o=t[0];if(20===o.type&&-1!==["top","left","right","bottom"].indexOf(o.value))return void(i=If(t));if(Ff(o))return void(i=(Ef(e,o)+Df(270))%Df(360))}var n=zf(e,t);s.push(n)})),{angle:i,stops:s,type:1}},Zf=function(e,t){var i=0,s=3,r=[],o=[];return _f(t).forEach((function(t,n){var a=!0;if(0===n?a=t.reduce((function(e,t){if(df(t))switch(t.value){case"center":return o.push(xf),!1;case"top":case"left":return o.push(wf),!1;case"right":case"bottom":return o.push(Pf),!1}else if(yf(t)||bf(t))return o.push(t),!1;return e}),a):1===n&&(a=t.reduce((function(e,t){if(df(t))switch(t.value){case"circle":return i=0,!1;case"ellipse":return i=1,!1;case"contain":case"closest-side":return s=0,!1;case"farthest-side":return s=1,!1;case"closest-corner":return s=2,!1;case"cover":case"farthest-corner":return s=3,!1}else if(bf(t)||yf(t))return Array.isArray(s)||(s=[]),s.push(t),!1;return e}),a)),a){var l=zf(e,t);r.push(l)}})),{size:s,shape:i,stops:r,position:o,type:2}},qf=function(e,t){if(22===t.type){var i={url:t.value,type:0};return e.cache.addImage(t.value),i}if(18===t.type){var s=eg[t.name];if(void 0===s)throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return s(e,t.values)}throw new Error("Unsupported image type "+t.type)};var $f,eg={"linear-gradient":function(e,t){var i=Df(180),s=[];return _f(t).forEach((function(t,r){if(0===r){var o=t[0];if(20===o.type&&"to"===o.value)return void(i=If(t));if(Ff(o))return void(i=Ef(e,o))}var n=zf(e,t);s.push(n)})),{angle:i,stops:s,type:1}},"-moz-linear-gradient":Yf,"-ms-linear-gradient":Yf,"-o-linear-gradient":Yf,"-webkit-linear-gradient":Yf,"radial-gradient":function(e,t){var i=0,s=3,r=[],o=[];return _f(t).forEach((function(t,n){var a=!0;if(0===n){var l=!1;a=t.reduce((function(e,t){if(l)if(df(t))switch(t.value){case"center":return o.push(xf),e;case"top":case"left":return o.push(wf),e;case"right":case"bottom":return o.push(Pf),e}else(yf(t)||bf(t))&&o.push(t);else if(df(t))switch(t.value){case"circle":return i=0,!1;case"ellipse":return i=1,!1;case"at":return l=!0,!1;case"closest-side":return s=0,!1;case"cover":case"farthest-side":return s=1,!1;case"contain":case"closest-corner":return s=2,!1;case"farthest-corner":return s=3,!1}else if(bf(t)||yf(t))return Array.isArray(s)||(s=[]),s.push(t),!1;return e}),a)}if(a){var A=zf(e,t);r.push(A)}})),{size:s,shape:i,stops:r,position:o,type:2}},"-moz-radial-gradient":Zf,"-ms-radial-gradient":Zf,"-o-radial-gradient":Zf,"-webkit-radial-gradient":Zf,"-webkit-gradient":function(e,t){var i=Df(180),s=[],r=1;return _f(t).forEach((function(t,i){var o=t[0];if(0===i){if(df(o)&&"linear"===o.value)return void(r=1);if(df(o)&&"radial"===o.value)return void(r=2)}if(18===o.type)if("from"===o.name){var n=Sf(e,o.values[0]);s.push({stop:wf,color:n})}else if("to"===o.name){n=Sf(e,o.values[0]);s.push({stop:Pf,color:n})}else if("color-stop"===o.name){var a=o.values.filter(mf);if(2===a.length){n=Sf(e,a[1]);var l=a[0];uf(l)&&s.push({stop:{type:16,number:100*l.number,flags:l.flags},color:n})}}})),1===r?{angle:(i+Df(180))%Df(360),stops:s,type:r}:{size:3,shape:0,stops:s,position:[],type:r}}},tg={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(0===t.length)return[];var i=t[0];return 20===i.type&&"none"===i.value?[]:t.filter((function(e){return mf(e)&&function(e){return!(20===e.type&&"none"===e.value||18===e.type&&!eg[e.name])}(e)})).map((function(t){return qf(e,t)}))}},ig={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(df(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},sg={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return _f(t).map((function(e){return e.filter(yf)})).map(Bf)}},rg={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return _f(t).map((function(e){return e.filter(df).map((function(e){return e.value})).join(" ")})).map(og)}},og=function(e){switch(e){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}};!function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"}($f||($f={}));var ng,ag={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return _f(t).map((function(e){return e.filter(lg)}))}},lg=function(e){return df(e)||yf(e)},Ag=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},hg=Ag("top"),cg=Ag("right"),ug=Ag("bottom"),dg=Ag("left"),pg=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return Bf(t.filter(yf))}}},fg=pg("top-left"),gg=pg("top-right"),mg=pg("bottom-right"),_g=pg("bottom-left"),vg=function(e){return{name:"border-"+e+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},bg=vg("top"),yg=vg("right"),Bg=vg("bottom"),wg=vg("left"),xg=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return cf(t)?t.number:0}}},Pg=xg("top"),Cg=xg("right"),Mg=xg("bottom"),Eg=xg("left"),Fg={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Ig={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){return"rtl"===t?1:0}},Dg={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(df).reduce((function(e,t){return e|Sg(t.value)}),0)}},Sg=function(e){switch(e){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},Tg={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},Lg={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(e,t){return 20===t.type&&"normal"===t.value?0:17===t.type||15===t.type?t.number:0}};!function(e){e.NORMAL="normal",e.STRICT="strict"}(ng||(ng={}));var Rg,Ug={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"strict"===t?ng.STRICT:ng.NORMAL}},kg={name:"line-height",initialValue:"normal",prefix:!1,type:4},Og=function(e,t){return df(e)&&"normal"===e.value?1.2*t:17===e.type?t*e.number:yf(e)?Mf(e,t):t},Ng={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return 20===t.type&&"none"===t.value?null:qf(e,t)}},Qg={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(e,t){return"inside"===t?0:1}},Vg={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Hg=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},jg=Hg("top"),Gg=Hg("right"),zg=Hg("bottom"),Wg=Hg("left"),Kg={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(df).map((function(e){switch(e.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}}))}},Xg={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"break-word"===t?"break-word":"normal"}},Jg=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Yg=Jg("top"),Zg=Jg("right"),qg=Jg("bottom"),$g=Jg("left"),em={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(e,t){switch(t){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},tm={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(e,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},im={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return 1===t.length&&ff(t[0],"none")?[]:_f(t).map((function(t){for(var i={color:Hf.TRANSPARENT,offsetX:wf,offsetY:wf,blur:wf},s=0,r=0;r1?1:0],this.overflowWrap=Rm(e,Xg,t.overflowWrap),this.paddingTop=Rm(e,Yg,t.paddingTop),this.paddingRight=Rm(e,Zg,t.paddingRight),this.paddingBottom=Rm(e,qg,t.paddingBottom),this.paddingLeft=Rm(e,$g,t.paddingLeft),this.paintOrder=Rm(e,Fm,t.paintOrder),this.position=Rm(e,tm,t.position),this.textAlign=Rm(e,em,t.textAlign),this.textDecorationColor=Rm(e,pm,null!==(i=t.textDecorationColor)&&void 0!==i?i:t.color),this.textDecorationLine=Rm(e,fm,null!==(s=t.textDecorationLine)&&void 0!==s?s:t.textDecoration),this.textShadow=Rm(e,im,t.textShadow),this.textTransform=Rm(e,sm,t.textTransform),this.transform=Rm(e,rm,t.transform),this.transformOrigin=Rm(e,lm,t.transformOrigin),this.visibility=Rm(e,Am,t.visibility),this.webkitTextStrokeColor=Rm(e,Im,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Rm(e,Dm,t.webkitTextStrokeWidth),this.wordBreak=Rm(e,hm,t.wordBreak),this.zIndex=Rm(e,cm,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&0===this.visibility},e.prototype.isTransparent=function(){return Tf(this.backgroundColor)},e.prototype.isTransformed=function(){return null!==this.transform},e.prototype.isPositioned=function(){return 0!==this.position},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return 0!==this.float},e.prototype.isInlineLevel=function(){return ym(this.display,4)||ym(this.display,33554432)||ym(this.display,268435456)||ym(this.display,536870912)||ym(this.display,67108864)||ym(this.display,134217728)},e}(),Tm=function(e,t){this.content=Rm(e,Bm,t.content),this.quotes=Rm(e,Cm,t.quotes)},Lm=function(e,t){this.counterIncrement=Rm(e,wm,t.counterIncrement),this.counterReset=Rm(e,xm,t.counterReset)},Rm=function(e,t,i){var s=new Af,r=null!=i?i.toString():t.initialValue;s.write(r);var o=new hf(s.read());switch(t.type){case 2:var n=o.parseComponentValue();return t.parse(e,df(n)?n.value:t.initialValue);case 0:return t.parse(e,o.parseComponentValue());case 1:return t.parse(e,o.parseComponentValues());case 4:return o.parseComponentValue();case 3:switch(t.format){case"angle":return Ef(e,o.parseComponentValue());case"color":return Sf(e,o.parseComponentValue());case"image":return qf(e,o.parseComponentValue());case"length":var a=o.parseComponentValue();return bf(a)?a:wf;case"length-percentage":var l=o.parseComponentValue();return yf(l)?l:wf;case"time":return um(e,o.parseComponentValue())}}},Um=function(e,t){var i=function(e){switch(e.getAttribute("data-html2canvas-debug")){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}}(e);return 1===i||t===i},km=function(e,t){this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Um(t,3),this.styles=new Sm(e,window.getComputedStyle(t,null)),k_(t)&&(this.styles.animationDuration.some((function(e){return e>0}))&&(t.style.animationDuration="0s"),null!==this.styles.transform&&(t.style.transform="none")),this.bounds=Td(this.context,t),Um(t,4)&&(this.flags|=16)},Om="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Nm="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Qm=0;Qm=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>5])<<2)+(31&e),this.data[t];if(e<=65535)return t=((t=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[t];if(e>11),t=this.index[t],t+=e>>5&63,t=((t=this.index[t])<<2)+(31&e),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),jm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Gm="undefined"==typeof Uint8Array?[]:new Uint8Array(256),zm=0;zm>10),n%1024+56320)),(r+1===i||s.length>16384)&&(o+=String.fromCharCode.apply(String,s),s.length=0)}return o},qm=function(e,t){var i,s,r,o=function(e){var t,i,s,r,o,n=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(n--,"="===e[e.length-2]&&n--);var A="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(n):new Array(n),h=Array.isArray(A)?A:new Uint8Array(A);for(t=0;t>4,h[l++]=(15&s)<<4|r>>2,h[l++]=(3&r)<<6|63&o;return A}(e),n=Array.isArray(o)?function(e){for(var t=e.length,i=[],s=0;s=55296&&r<=56319&&i=i)return{done:!0,value:null};for(var e="×";sn.x||r.y>n.y;return n=r,0===t||a}));return e.body.removeChild(t),a}(document);return Object.defineProperty(o_,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=function(e){var t=new Image,i=e.createElement("canvas"),s=i.getContext("2d");if(!s)return!1;t.src="data:image/svg+xml,";try{s.drawImage(t,0,0),i.toDataURL()}catch(e){return!1}return!0}(document);return Object.defineProperty(o_,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e="function"==typeof Array.from&&"function"==typeof window.fetch?function(e){var t=e.createElement("canvas"),i=100;t.width=i,t.height=i;var s=t.getContext("2d");if(!s)return Promise.reject(!1);s.fillStyle="rgb(0, 255, 0)",s.fillRect(0,0,i,i);var r=new Image,o=t.toDataURL();r.src=o;var n=s_(i,i,0,0,r);return s.fillStyle="red",s.fillRect(0,0,i,i),r_(n).then((function(t){s.drawImage(t,0,0);var r=s.getImageData(0,0,i,i).data;s.fillStyle="red",s.fillRect(0,0,i,i);var n=e.createElement("div");return n.style.backgroundImage="url("+o+")",n.style.height="100px",i_(r)?r_(s_(i,i,0,0,n)):Promise.reject(!1)})).then((function(e){return s.drawImage(e,0,0),i_(s.getImageData(0,0,i,i).data)})).catch((function(){return!1}))}(document):Promise.resolve(!1);return Object.defineProperty(o_,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=void 0!==(new Image).crossOrigin;return Object.defineProperty(o_,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e="string"==typeof(new XMLHttpRequest).responseType;return Object.defineProperty(o_,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(o_,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!("undefined"==typeof Intl||!Intl.Segmenter);return Object.defineProperty(o_,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},n_=function(e,t){this.text=e,this.bounds=t},a_=function(e,t){var i=t.ownerDocument;if(i){var s=i.createElement("html2canvaswrapper");s.appendChild(t.cloneNode(!0));var r=t.parentNode;if(r){r.replaceChild(s,t);var o=Td(e,s);return s.firstChild&&r.replaceChild(s.firstChild,s),o}}return Sd.EMPTY},l_=function(e,t,i){var s=e.ownerDocument;if(!s)throw new Error("Node has no owner document");var r=s.createRange();return r.setStart(e,t),r.setEnd(e,t+i),r},A_=function(e){if(o_.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(e)).map((function(e){return e.segment}))}return function(e){for(var t,i=t_(e),s=[];!(t=i.next()).done;)t.value&&s.push(t.value.slice());return s}(e)},h_=function(e,t){return 0!==t.letterSpacing?A_(e):function(e,t){if(o_.SUPPORT_NATIVE_TEXT_SEGMENTATION){var i=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(i.segment(e)).map((function(e){return e.segment}))}return u_(e,t)}(e,t)},c_=[32,160,4961,65792,65793,4153,4241],u_=function(e,t){for(var i,s=function(e,t){var i=Ld(e),s=Fp(i,t),r=s[0],o=s[1],n=s[2],a=i.length,l=0,A=0;return{next:function(){if(A>=a)return{done:!0,value:null};for(var e="×";A0)if(o_.SUPPORT_RANGE_BOUNDS){var r=l_(s,n,t.length).getClientRects();if(r.length>1){var a=A_(t),l=0;a.forEach((function(t){o.push(new n_(t,Sd.fromDOMRectList(e,l_(s,l+n,t.length).getClientRects()))),l+=t.length}))}else o.push(new n_(t,Sd.fromDOMRectList(e,r)))}else{var A=s.splitText(t.length);o.push(new n_(t,a_(e,s))),s=A}else o_.SUPPORT_RANGE_BOUNDS||(s=s.splitText(t.length));n+=t.length})),o}(e,this.text,i,t)},p_=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(f_,g_);case 2:return e.toUpperCase();default:return e}},f_=/(^|\s|:|-|\(|\))([a-z])/g,g_=function(e,t,i){return e.length>0?t+i.toUpperCase():e},m_=function(e){function t(t,i){var s=e.call(this,t,i)||this;return s.src=i.currentSrc||i.src,s.intrinsicWidth=i.naturalWidth,s.intrinsicHeight=i.naturalHeight,s.context.cache.addImage(s.src),s}return Md(t,e),t}(km),__=function(e){function t(t,i){var s=e.call(this,t,i)||this;return s.canvas=i,s.intrinsicWidth=i.width,s.intrinsicHeight=i.height,s}return Md(t,e),t}(km),v_=function(e){function t(t,i){var s=e.call(this,t,i)||this,r=new XMLSerializer,o=Td(t,i);return i.setAttribute("width",o.width+"px"),i.setAttribute("height",o.height+"px"),s.svg="data:image/svg+xml,"+encodeURIComponent(r.serializeToString(i)),s.intrinsicWidth=i.width.baseVal.value,s.intrinsicHeight=i.height.baseVal.value,s.context.cache.addImage(s.svg),s}return Md(t,e),t}(km),b_=function(e){function t(t,i){var s=e.call(this,t,i)||this;return s.value=i.value,s}return Md(t,e),t}(km),y_=function(e){function t(t,i){var s=e.call(this,t,i)||this;return s.start=i.start,s.reversed="boolean"==typeof i.reversed&&!0===i.reversed,s}return Md(t,e),t}(km),B_=[{type:15,flags:0,unit:"px",number:3}],w_=[{type:16,flags:0,number:50}],x_="password",P_=function(e){function t(t,i){var s,r=e.call(this,t,i)||this;switch(r.type=i.type.toLowerCase(),r.checked=i.checked,r.value=function(e){var t=e.type===x_?new Array(e.value.length+1).join("•"):e.value;return 0===t.length?e.placeholder||"":t}(i),"checkbox"!==r.type&&"radio"!==r.type||(r.styles.backgroundColor=3739148031,r.styles.borderTopColor=r.styles.borderRightColor=r.styles.borderBottomColor=r.styles.borderLeftColor=2779096575,r.styles.borderTopWidth=r.styles.borderRightWidth=r.styles.borderBottomWidth=r.styles.borderLeftWidth=1,r.styles.borderTopStyle=r.styles.borderRightStyle=r.styles.borderBottomStyle=r.styles.borderLeftStyle=1,r.styles.backgroundClip=[0],r.styles.backgroundOrigin=[0],r.bounds=(s=r.bounds).width>s.height?new Sd(s.left+(s.width-s.height)/2,s.top,s.height,s.height):s.width0)i.textNodes.push(new d_(e,r,i.styles));else if(U_(r))if(Z_(r)&&r.assignedNodes)r.assignedNodes().forEach((function(t){return I_(e,t,i,s)}));else{var n=D_(e,r);n.styles.isVisible()&&(T_(r,n,s)?n.flags|=4:L_(n.styles)&&(n.flags|=2),-1!==F_.indexOf(r.tagName)&&(n.flags|=8),i.elements.push(n),r.slot,r.shadowRoot?I_(e,r.shadowRoot,n,s):J_(r)||H_(r)||Y_(r)||I_(e,r,n,s))}},D_=function(e,t){return W_(t)?new m_(e,t):G_(t)?new __(e,t):H_(t)?new v_(e,t):N_(t)?new b_(e,t):Q_(t)?new y_(e,t):V_(t)?new P_(e,t):Y_(t)?new C_(e,t):J_(t)?new M_(e,t):K_(t)?new E_(e,t):new km(e,t)},S_=function(e,t){var i=D_(e,t);return i.flags|=4,I_(e,t,i,i),i},T_=function(e,t,i){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||j_(e)&&i.styles.isTransparent()},L_=function(e){return e.isPositioned()||e.isFloating()},R_=function(e){return e.nodeType===Node.TEXT_NODE},U_=function(e){return e.nodeType===Node.ELEMENT_NODE},k_=function(e){return U_(e)&&void 0!==e.style&&!O_(e)},O_=function(e){return"object"==typeof e.className},N_=function(e){return"LI"===e.tagName},Q_=function(e){return"OL"===e.tagName},V_=function(e){return"INPUT"===e.tagName},H_=function(e){return"svg"===e.tagName},j_=function(e){return"BODY"===e.tagName},G_=function(e){return"CANVAS"===e.tagName},z_=function(e){return"VIDEO"===e.tagName},W_=function(e){return"IMG"===e.tagName},K_=function(e){return"IFRAME"===e.tagName},X_=function(e){return"STYLE"===e.tagName},J_=function(e){return"TEXTAREA"===e.tagName},Y_=function(e){return"SELECT"===e.tagName},Z_=function(e){return"SLOT"===e.tagName},q_=function(e){return e.tagName.indexOf("-")>0},$_=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},e.prototype.pop=function(e){var t=this;e.forEach((function(e){return t.counters[e].pop()}))},e.prototype.parse=function(e){var t=this,i=e.counterIncrement,s=e.counterReset,r=!0;null!==i&&i.forEach((function(e){var i=t.counters[e.counter];i&&0!==e.increment&&(r=!1,i.length||i.push(1),i[Math.max(0,i.length-1)]+=e.increment)}));var o=[];return r&&s.forEach((function(e){var i=t.counters[e.counter];o.push(e.counter),i||(i=t.counters[e.counter]=[]),i.push(e.reset)})),o},e}(),ev={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},tv={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},iv={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},sv={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},rv=function(e,t,i,s,r,o){return ei?Av(e,r,o.length>0):s.integers.reduce((function(t,i,r){for(;e>=i;)e-=i,t+=s.values[r];return t}),"")+o},ov=function(e,t,i,s){var r="";do{i||e--,r=s(e)+r,e/=t}while(e*t>=t);return r},nv=function(e,t,i,s,r){var o=i-t+1;return(e<0?"-":"")+(ov(Math.abs(e),o,s,(function(e){return Rd(Math.floor(e%o)+t)}))+r)},av=function(e,t,i){void 0===i&&(i=". ");var s=t.length;return ov(Math.abs(e),s,!1,(function(e){return t[Math.floor(e%s)]}))+i},lv=function(e,t,i,s,r,o){if(e<-9999||e>9999)return Av(e,4,r.length>0);var n=Math.abs(e),a=r;if(0===n)return t[0]+a;for(var l=0;n>0&&l<=4;l++){var A=n%10;0===A&&ym(o,1)&&""!==a?a=t[A]+a:A>1||1===A&&0===l||1===A&&1===l&&ym(o,2)||1===A&&1===l&&ym(o,4)&&e>100||1===A&&l>1&&ym(o,8)?a=t[A]+(l>0?i[l-1]:"")+a:1===A&&l>0&&(a=i[l-1]+a),n=Math.floor(n/10)}return(e<0?s:"")+a},Av=function(e,t,i){var s=i?". ":"",r=i?"、":"",o=i?", ":"",n=i?" ":"";switch(t){case 0:return"•"+n;case 1:return"◦"+n;case 2:return"◾"+n;case 5:var a=nv(e,48,57,!0,s);return a.length<4?"0"+a:a;case 4:return av(e,"〇一二三四五六七八九",r);case 6:return rv(e,1,3999,ev,3,s).toLowerCase();case 7:return rv(e,1,3999,ev,3,s);case 8:return nv(e,945,969,!1,s);case 9:return nv(e,97,122,!1,s);case 10:return nv(e,65,90,!1,s);case 11:return nv(e,1632,1641,!0,s);case 12:case 49:return rv(e,1,9999,tv,3,s);case 35:return rv(e,1,9999,tv,3,s).toLowerCase();case 13:return nv(e,2534,2543,!0,s);case 14:case 30:return nv(e,6112,6121,!0,s);case 15:return av(e,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return av(e,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return lv(e,"零一二三四五六七八九","十百千萬","負",r,14);case 47:return lv(e,"零壹貳參肆伍陸柒捌玖","拾佰仟萬","負",r,15);case 42:return lv(e,"零一二三四五六七八九","十百千萬","负",r,14);case 41:return lv(e,"零壹贰叁肆伍陆柒捌玖","拾佰仟萬","负",r,15);case 26:return lv(e,"〇一二三四五六七八九","十百千万","マイナス",r,0);case 25:return lv(e,"零壱弐参四伍六七八九","拾百千万","マイナス",r,7);case 31:return lv(e,"영일이삼사오육칠팔구","십백천만","마이너스",o,7);case 33:return lv(e,"零一二三四五六七八九","十百千萬","마이너스",o,0);case 32:return lv(e,"零壹貳參四五六七八九","拾百千","마이너스",o,7);case 18:return nv(e,2406,2415,!0,s);case 20:return rv(e,1,19999,sv,3,s);case 21:return nv(e,2790,2799,!0,s);case 22:return nv(e,2662,2671,!0,s);case 22:return rv(e,1,10999,iv,3,s);case 23:return av(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return av(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return nv(e,3302,3311,!0,s);case 28:return av(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return av(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return nv(e,3792,3801,!0,s);case 37:return nv(e,6160,6169,!0,s);case 38:return nv(e,4160,4169,!0,s);case 39:return nv(e,2918,2927,!0,s);case 40:return nv(e,1776,1785,!0,s);case 43:return nv(e,3046,3055,!0,s);case 44:return nv(e,3174,3183,!0,s);case 45:return nv(e,3664,3673,!0,s);case 46:return nv(e,3872,3881,!0,s);default:return nv(e,48,57,!0,s)}},hv=function(){function e(e,t,i){if(this.context=e,this.options=i,this.scrolledElements=[],this.referenceElement=t,this.counters=new $_,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var i=this,s=uv(e,t);if(!s.contentWindow)return Promise.reject("Unable to find iframe window");var r=e.defaultView.pageXOffset,o=e.defaultView.pageYOffset,n=s.contentWindow,a=n.document,l=fv(s).then((function(){return Fd(i,void 0,void 0,(function(){var e,i;return Id(this,(function(r){switch(r.label){case 0:return this.scrolledElements.forEach(bv),n&&(n.scrollTo(t.left,t.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||n.scrollY===t.top&&n.scrollX===t.left||(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(n.scrollX-t.left,n.scrollY-t.top,0,0))),e=this.options.onclone,void 0===(i=this.clonedReferenceElement)?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:a.fonts&&a.fonts.ready?[4,a.fonts.ready]:[3,2];case 1:r.sent(),r.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,pv(a)]:[3,4];case 3:r.sent(),r.label=4;case 4:return"function"==typeof e?[2,Promise.resolve().then((function(){return e(a,i)})).then((function(){return s}))]:[2,s]}}))}))}));return a.open(),a.write(_v(document.doctype)+""),vv(this.referenceElement.ownerDocument,r,o),a.replaceChild(a.adoptNode(this.documentElement),a.documentElement),a.close(),l},e.prototype.createElementClone=function(e){if(Um(e,2),G_(e))return this.createCanvasClone(e);if(z_(e))return this.createVideoClone(e);if(X_(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return W_(t)&&(W_(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),"lazy"===t.loading&&(t.loading="eager")),q_(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return mv(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var i=[].slice.call(t.cssRules,0).reduce((function(e,t){return t&&"string"==typeof t.cssText?e+t.cssText:e}),""),s=e.cloneNode(!1);return s.textContent=i,s}}catch(e){if(this.context.logger.error("Unable to access cssRules property",e),"SecurityError"!==e.name)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var i=e.ownerDocument.createElement("img");try{return i.src=e.toDataURL(),i}catch(t){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var s=e.cloneNode(!1);try{s.width=e.width,s.height=e.height;var r=e.getContext("2d"),o=s.getContext("2d");if(o)if(!this.options.allowTaint&&r)o.putImageData(r.getImageData(0,0,e.width,e.height),0,0);else{var n=null!==(t=e.getContext("webgl2"))&&void 0!==t?t:e.getContext("webgl");if(n){var a=n.getContextAttributes();!1===(null==a?void 0:a.preserveDrawingBuffer)&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}o.drawImage(e,0,0)}return s}catch(t){this.context.logger.info("Unable to clone canvas as it is tainted",e)}return s},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var i=t.getContext("2d");try{return i&&(i.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||i.getImageData(0,0,t.width,t.height)),t}catch(t){this.context.logger.info("Unable to clone video as it is tainted",e)}var s=e.ownerDocument.createElement("canvas");return s.width=e.offsetWidth,s.height=e.offsetHeight,s},e.prototype.appendChildNode=function(e,t,i){U_(t)&&(function(e){return"SCRIPT"===e.tagName}(t)||t.hasAttribute("data-html2canvas-ignore")||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(t))||this.options.copyStyles&&U_(t)&&X_(t)||e.appendChild(this.cloneNode(t,i))},e.prototype.cloneChildNodes=function(e,t,i){for(var s=this,r=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;r;r=r.nextSibling)if(U_(r)&&Z_(r)&&"function"==typeof r.assignedNodes){var o=r.assignedNodes();o.length&&o.forEach((function(e){return s.appendChildNode(t,e,i)}))}else this.appendChildNode(t,r,i)},e.prototype.cloneNode=function(e,t){if(R_(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var i=e.ownerDocument.defaultView;if(i&&U_(e)&&(k_(e)||O_(e))){var s=this.createElementClone(e);s.style.transitionProperty="none";var r=i.getComputedStyle(e),o=i.getComputedStyle(e,":before"),n=i.getComputedStyle(e,":after");this.referenceElement===e&&k_(s)&&(this.clonedReferenceElement=s),j_(s)&&wv(s);var a=this.counters.parse(new Lm(this.context,r)),l=this.resolvePseudoContent(e,s,o,Wm.BEFORE);q_(e)&&(t=!0),z_(e)||this.cloneChildNodes(e,s,t),l&&s.insertBefore(l,s.firstChild);var A=this.resolvePseudoContent(e,s,n,Wm.AFTER);return A&&s.appendChild(A),this.counters.pop(a),(r&&(this.options.copyStyles||O_(e))&&!K_(e)||t)&&mv(r,s),0===e.scrollTop&&0===e.scrollLeft||this.scrolledElements.push([s,e.scrollLeft,e.scrollTop]),(J_(e)||Y_(e))&&(J_(s)||Y_(s))&&(s.value=e.value),s}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,i,s){var r=this;if(i){var o=i.content,n=t.ownerDocument;if(n&&o&&"none"!==o&&"-moz-alt-content"!==o&&"none"!==i.display){this.counters.parse(new Lm(this.context,i));var a=new Tm(this.context,i),l=n.createElement("html2canvaspseudoelement");mv(i,l),a.content.forEach((function(t){if(0===t.type)l.appendChild(n.createTextNode(t.value));else if(22===t.type){var i=n.createElement("img");i.src=t.value,i.style.opacity="1",l.appendChild(i)}else if(18===t.type){if("attr"===t.name){var s=t.values.filter(df);s.length&&l.appendChild(n.createTextNode(e.getAttribute(s[0].value)||""))}else if("counter"===t.name){var o=t.values.filter(mf),A=o[0],h=o[1];if(A&&df(A)){var c=r.counters.getCounterValue(A.value),u=h&&df(h)?Vg.parse(r.context,h.value):3;l.appendChild(n.createTextNode(Av(c,u,!1)))}}else if("counters"===t.name){var d=t.values.filter(mf),p=(A=d[0],d[1]);h=d[2];if(A&&df(A)){var f=r.counters.getCounterValues(A.value),g=h&&df(h)?Vg.parse(r.context,h.value):3,m=p&&0===p.type?p.value:"",_=f.map((function(e){return Av(e,g,!1)})).join(m);l.appendChild(n.createTextNode(_))}}}else if(20===t.type)switch(t.value){case"open-quote":l.appendChild(n.createTextNode(Mm(a.quotes,r.quoteDepth++,!0)));break;case"close-quote":l.appendChild(n.createTextNode(Mm(a.quotes,--r.quoteDepth,!1)));break;default:l.appendChild(n.createTextNode(t.value))}})),l.className=yv+" "+Bv;var A=s===Wm.BEFORE?" "+yv:" "+Bv;return O_(t)?t.className.baseValue+=A:t.className+=A,l}}},e.destroy=function(e){return!!e.parentNode&&(e.parentNode.removeChild(e),!0)},e}();!function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"}(Wm||(Wm={}));var cv,uv=function(e,t){var i=e.createElement("iframe");return i.className="html2canvas-container",i.style.visibility="hidden",i.style.position="fixed",i.style.left="-10000px",i.style.top="0px",i.style.border="0",i.width=t.width.toString(),i.height=t.height.toString(),i.scrolling="no",i.setAttribute("data-html2canvas-ignore","true"),e.body.appendChild(i),i},dv=function(e){return new Promise((function(t){e.complete?t():e.src?(e.onload=t,e.onerror=t):t()}))},pv=function(e){return Promise.all([].slice.call(e.images,0).map(dv))},fv=function(e){return new Promise((function(t,i){var s=e.contentWindow;if(!s)return i("No window assigned for iframe");var r=s.document;s.onload=e.onload=function(){s.onload=e.onload=null;var i=setInterval((function(){r.body.childNodes.length>0&&"complete"===r.readyState&&(clearInterval(i),t(e))}),50)}}))},gv=["all","d","content"],mv=function(e,t){for(var i=e.length-1;i>=0;i--){var s=e.item(i);-1===gv.indexOf(s)&&t.style.setProperty(s,e.getPropertyValue(s))}return t},_v=function(e){var t="";return e&&(t+=""),t},vv=function(e,t,i){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||i!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,i)},bv=function(e){var t=e[0],i=e[1],s=e[2];t.scrollLeft=i,t.scrollTop=s},yv="___html2canvas___pseudoelement_before",Bv="___html2canvas___pseudoelement_after",wv=function(e){xv(e,"."+yv+':before{\n content: "" !important;\n display: none !important;\n}\n .'+Bv+':after{\n content: "" !important;\n display: none !important;\n}')},xv=function(e,t){var i=e.ownerDocument;if(i){var s=i.createElement("style");s.textContent=t,e.appendChild(s)}},Pv=function(){function e(){}return e.getOrigin=function(t){var i=e._link;return i?(i.href=t,i.href=i.href,i.protocol+i.hostname+i.port):"about:blank"},e.isSameOrigin=function(t){return e.getOrigin(t)===e._origin},e.setContext=function(t){e._link=t.document.createElement("a"),e._origin=e.getOrigin(t.location.href)},e._origin="about:blank",e}(),Cv=function(){function e(e,t){this.context=e,this._options=t,this._cache={}}return e.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)?t:Tv(e)||Iv(e)?((this._cache[e]=this.loadImage(e)).catch((function(){})),t):t},e.prototype.match=function(e){return this._cache[e]},e.prototype.loadImage=function(e){return Fd(this,void 0,void 0,(function(){var t,i,s,r,o=this;return Id(this,(function(n){switch(n.label){case 0:return t=Pv.isSameOrigin(e),i=!Dv(e)&&!0===this._options.useCORS&&o_.SUPPORT_CORS_IMAGES&&!t,s=!Dv(e)&&!t&&!Tv(e)&&"string"==typeof this._options.proxy&&o_.SUPPORT_CORS_XHR&&!i,t||!1!==this._options.allowTaint||Dv(e)||Tv(e)||s||i?(r=e,s?[4,this.proxy(r)]:[3,2]):[2];case 1:r=n.sent(),n.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise((function(e,t){var s=new Image;s.onload=function(){return e(s)},s.onerror=t,(Sv(r)||i)&&(s.crossOrigin="anonymous"),s.src=r,!0===s.complete&&setTimeout((function(){return e(s)}),500),o._options.imageTimeout>0&&setTimeout((function(){return t("Timed out ("+o._options.imageTimeout+"ms) loading image")}),o._options.imageTimeout)}))];case 3:return[2,n.sent()]}}))}))},e.prototype.has=function(e){return void 0!==this._cache[e]},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(e){var t=this,i=this._options.proxy;if(!i)throw new Error("No proxy defined");var s=e.substring(0,256);return new Promise((function(r,o){var n=o_.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(200===a.status)if("text"===n)r(a.response);else{var e=new FileReader;e.addEventListener("load",(function(){return r(e.result)}),!1),e.addEventListener("error",(function(e){return o(e)}),!1),e.readAsDataURL(a.response)}else o("Failed to proxy resource "+s+" with status code "+a.status)},a.onerror=o;var l=i.indexOf("?")>-1?"&":"?";if(a.open("GET",""+i+l+"url="+encodeURIComponent(e)+"&responseType="+n),"text"!==n&&a instanceof XMLHttpRequest&&(a.responseType=n),t._options.imageTimeout){var A=t._options.imageTimeout;a.timeout=A,a.ontimeout=function(){return o("Timed out ("+A+"ms) proxying "+s)}}a.send()}))},e}(),Mv=/^data:image\/svg\+xml/i,Ev=/^data:image\/.*;base64,/i,Fv=/^data:image\/.*/i,Iv=function(e){return o_.SUPPORT_SVG_DRAWING||!Lv(e)},Dv=function(e){return Fv.test(e)},Sv=function(e){return Ev.test(e)},Tv=function(e){return"blob"===e.substr(0,4)},Lv=function(e){return"svg"===e.substr(-3).toLowerCase()||Mv.test(e)},Rv=function(){function e(e,t){this.type=0,this.x=e,this.y=t}return e.prototype.add=function(t,i){return new e(this.x+t,this.y+i)},e}(),Uv=function(e,t,i){return new Rv(e.x+(t.x-e.x)*i,e.y+(t.y-e.y)*i)},kv=function(){function e(e,t,i,s){this.type=1,this.start=e,this.startControl=t,this.endControl=i,this.end=s}return e.prototype.subdivide=function(t,i){var s=Uv(this.start,this.startControl,t),r=Uv(this.startControl,this.endControl,t),o=Uv(this.endControl,this.end,t),n=Uv(s,r,t),a=Uv(r,o,t),l=Uv(n,a,t);return i?new e(this.start,s,n,l):new e(l,a,o,this.end)},e.prototype.add=function(t,i){return new e(this.start.add(t,i),this.startControl.add(t,i),this.endControl.add(t,i),this.end.add(t,i))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),Ov=function(e){return 1===e.type},Nv=function(e){var t=e.styles,i=e.bounds,s=Cf(t.borderTopLeftRadius,i.width,i.height),r=s[0],o=s[1],n=Cf(t.borderTopRightRadius,i.width,i.height),a=n[0],l=n[1],A=Cf(t.borderBottomRightRadius,i.width,i.height),h=A[0],c=A[1],u=Cf(t.borderBottomLeftRadius,i.width,i.height),d=u[0],p=u[1],f=[];f.push((r+a)/i.width),f.push((d+h)/i.width),f.push((o+p)/i.height),f.push((l+c)/i.height);var g=Math.max.apply(Math,f);g>1&&(r/=g,o/=g,a/=g,l/=g,h/=g,c/=g,d/=g,p/=g);var m=i.width-a,_=i.height-c,v=i.width-h,b=i.height-p,y=t.borderTopWidth,B=t.borderRightWidth,w=t.borderBottomWidth,x=t.borderLeftWidth,P=Mf(t.paddingTop,e.bounds.width),C=Mf(t.paddingRight,e.bounds.width),M=Mf(t.paddingBottom,e.bounds.width),E=Mf(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=r>0||o>0?Qv(i.left+x/3,i.top+y/3,r-x/3,o-y/3,cv.TOP_LEFT):new Rv(i.left+x/3,i.top+y/3),this.topRightBorderDoubleOuterBox=r>0||o>0?Qv(i.left+m,i.top+y/3,a-B/3,l-y/3,cv.TOP_RIGHT):new Rv(i.left+i.width-B/3,i.top+y/3),this.bottomRightBorderDoubleOuterBox=h>0||c>0?Qv(i.left+v,i.top+_,h-B/3,c-w/3,cv.BOTTOM_RIGHT):new Rv(i.left+i.width-B/3,i.top+i.height-w/3),this.bottomLeftBorderDoubleOuterBox=d>0||p>0?Qv(i.left+x/3,i.top+b,d-x/3,p-w/3,cv.BOTTOM_LEFT):new Rv(i.left+x/3,i.top+i.height-w/3),this.topLeftBorderDoubleInnerBox=r>0||o>0?Qv(i.left+2*x/3,i.top+2*y/3,r-2*x/3,o-2*y/3,cv.TOP_LEFT):new Rv(i.left+2*x/3,i.top+2*y/3),this.topRightBorderDoubleInnerBox=r>0||o>0?Qv(i.left+m,i.top+2*y/3,a-2*B/3,l-2*y/3,cv.TOP_RIGHT):new Rv(i.left+i.width-2*B/3,i.top+2*y/3),this.bottomRightBorderDoubleInnerBox=h>0||c>0?Qv(i.left+v,i.top+_,h-2*B/3,c-2*w/3,cv.BOTTOM_RIGHT):new Rv(i.left+i.width-2*B/3,i.top+i.height-2*w/3),this.bottomLeftBorderDoubleInnerBox=d>0||p>0?Qv(i.left+2*x/3,i.top+b,d-2*x/3,p-2*w/3,cv.BOTTOM_LEFT):new Rv(i.left+2*x/3,i.top+i.height-2*w/3),this.topLeftBorderStroke=r>0||o>0?Qv(i.left+x/2,i.top+y/2,r-x/2,o-y/2,cv.TOP_LEFT):new Rv(i.left+x/2,i.top+y/2),this.topRightBorderStroke=r>0||o>0?Qv(i.left+m,i.top+y/2,a-B/2,l-y/2,cv.TOP_RIGHT):new Rv(i.left+i.width-B/2,i.top+y/2),this.bottomRightBorderStroke=h>0||c>0?Qv(i.left+v,i.top+_,h-B/2,c-w/2,cv.BOTTOM_RIGHT):new Rv(i.left+i.width-B/2,i.top+i.height-w/2),this.bottomLeftBorderStroke=d>0||p>0?Qv(i.left+x/2,i.top+b,d-x/2,p-w/2,cv.BOTTOM_LEFT):new Rv(i.left+x/2,i.top+i.height-w/2),this.topLeftBorderBox=r>0||o>0?Qv(i.left,i.top,r,o,cv.TOP_LEFT):new Rv(i.left,i.top),this.topRightBorderBox=a>0||l>0?Qv(i.left+m,i.top,a,l,cv.TOP_RIGHT):new Rv(i.left+i.width,i.top),this.bottomRightBorderBox=h>0||c>0?Qv(i.left+v,i.top+_,h,c,cv.BOTTOM_RIGHT):new Rv(i.left+i.width,i.top+i.height),this.bottomLeftBorderBox=d>0||p>0?Qv(i.left,i.top+b,d,p,cv.BOTTOM_LEFT):new Rv(i.left,i.top+i.height),this.topLeftPaddingBox=r>0||o>0?Qv(i.left+x,i.top+y,Math.max(0,r-x),Math.max(0,o-y),cv.TOP_LEFT):new Rv(i.left+x,i.top+y),this.topRightPaddingBox=a>0||l>0?Qv(i.left+Math.min(m,i.width-B),i.top+y,m>i.width+B?0:Math.max(0,a-B),Math.max(0,l-y),cv.TOP_RIGHT):new Rv(i.left+i.width-B,i.top+y),this.bottomRightPaddingBox=h>0||c>0?Qv(i.left+Math.min(v,i.width-x),i.top+Math.min(_,i.height-w),Math.max(0,h-B),Math.max(0,c-w),cv.BOTTOM_RIGHT):new Rv(i.left+i.width-B,i.top+i.height-w),this.bottomLeftPaddingBox=d>0||p>0?Qv(i.left+x,i.top+Math.min(b,i.height-w),Math.max(0,d-x),Math.max(0,p-w),cv.BOTTOM_LEFT):new Rv(i.left+x,i.top+i.height-w),this.topLeftContentBox=r>0||o>0?Qv(i.left+x+E,i.top+y+P,Math.max(0,r-(x+E)),Math.max(0,o-(y+P)),cv.TOP_LEFT):new Rv(i.left+x+E,i.top+y+P),this.topRightContentBox=a>0||l>0?Qv(i.left+Math.min(m,i.width+x+E),i.top+y+P,m>i.width+x+E?0:a-x+E,l-(y+P),cv.TOP_RIGHT):new Rv(i.left+i.width-(B+C),i.top+y+P),this.bottomRightContentBox=h>0||c>0?Qv(i.left+Math.min(v,i.width-(x+E)),i.top+Math.min(_,i.height+y+P),Math.max(0,h-(B+C)),c-(w+M),cv.BOTTOM_RIGHT):new Rv(i.left+i.width-(B+C),i.top+i.height-(w+M)),this.bottomLeftContentBox=d>0||p>0?Qv(i.left+x+E,i.top+b,Math.max(0,d-(x+E)),p-(w+M),cv.BOTTOM_LEFT):new Rv(i.left+x+E,i.top+i.height-(w+M))};!function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"}(cv||(cv={}));var Qv=function(e,t,i,s,r){var o=(Math.sqrt(2)-1)/3*4,n=i*o,a=s*o,l=e+i,A=t+s;switch(r){case cv.TOP_LEFT:return new kv(new Rv(e,A),new Rv(e,A-a),new Rv(l-n,t),new Rv(l,t));case cv.TOP_RIGHT:return new kv(new Rv(e,t),new Rv(e+n,t),new Rv(l,A-a),new Rv(l,A));case cv.BOTTOM_RIGHT:return new kv(new Rv(l,t),new Rv(l,t+a),new Rv(e+n,A),new Rv(e,A));case cv.BOTTOM_LEFT:default:return new kv(new Rv(l,A),new Rv(l-n,A),new Rv(e,t+a),new Rv(e,t))}},Vv=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Hv=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},jv=function(e,t,i){this.offsetX=e,this.offsetY=t,this.matrix=i,this.type=0,this.target=6},Gv=function(e,t){this.path=e,this.target=t,this.type=1},zv=function(e){this.opacity=e,this.type=2,this.target=6},Wv=function(e){return 1===e.type},Kv=function(e,t){return e.length===t.length&&e.some((function(e,i){return e===t[i]}))},Xv=function(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]},Jv=function(){function e(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new Nv(this.container),this.container.styles.opacity<1&&this.effects.push(new zv(this.container.styles.opacity)),null!==this.container.styles.transform){var i=this.container.bounds.left+this.container.styles.transformOrigin[0].number,s=this.container.bounds.top+this.container.styles.transformOrigin[1].number,r=this.container.styles.transform;this.effects.push(new jv(i,s,r))}if(0!==this.container.styles.overflowX){var o=Vv(this.curves),n=Hv(this.curves);Kv(o,n)?this.effects.push(new Gv(o,6)):(this.effects.push(new Gv(o,2)),this.effects.push(new Gv(n,4)))}}return e.prototype.getEffects=function(e){for(var t=-1===[2,3].indexOf(this.container.styles.position),i=this.parent,s=this.effects.slice(0);i;){var r=i.effects.filter((function(e){return!Wv(e)}));if(t||0!==i.container.styles.position||!i.parent){if(s.unshift.apply(s,r),t=-1===[2,3].indexOf(i.container.styles.position),0!==i.container.styles.overflowX){var o=Vv(i.curves),n=Hv(i.curves);Kv(o,n)||s.unshift(new Gv(n,6))}}else s.unshift.apply(s,r);i=i.parent}return s.filter((function(t){return ym(t.target,e)}))},e}(),Yv=function(e,t,i,s){e.container.elements.forEach((function(r){var o=ym(r.flags,4),n=ym(r.flags,2),a=new Jv(r,e);ym(r.styles.display,2048)&&s.push(a);var l=ym(r.flags,8)?[]:s;if(o||n){var A=o||r.styles.isPositioned()?i:t,h=new Xv(a);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var c=r.styles.zIndex.order;if(c<0){var u=0;A.negativeZIndex.some((function(e,t){return c>e.element.container.styles.zIndex.order?(u=t,!1):u>0})),A.negativeZIndex.splice(u,0,h)}else if(c>0){var d=0;A.positiveZIndex.some((function(e,t){return c>=e.element.container.styles.zIndex.order?(d=t+1,!1):d>0})),A.positiveZIndex.splice(d,0,h)}else A.zeroOrAutoZIndexOrTransformedOrOpacity.push(h)}else r.styles.isFloating()?A.nonPositionedFloats.push(h):A.nonPositionedInlineLevel.push(h);Yv(a,h,o?h:i,l)}else r.styles.isInlineLevel()?t.inlineLevel.push(a):t.nonInlineLevel.push(a),Yv(a,t,i,l);ym(r.flags,8)&&Zv(r,l)}))},Zv=function(e,t){for(var i=e instanceof y_?e.start:1,s=e instanceof y_&&e.reversed,r=0;r0&&e.intrinsicHeight>0){var s=ib(e),r=Hv(t);this.path(r),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,e.intrinsicWidth,e.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},t.prototype.renderNodeContent=function(e){return Fd(this,void 0,void 0,(function(){var i,s,r,o,n,a,l,A,h,c,u,d,p,f,g,m,_,v;return Id(this,(function(b){switch(b.label){case 0:this.applyEffects(e.getEffects(4)),i=e.container,s=e.curves,r=i.styles,o=0,n=i.textNodes,b.label=1;case 1:return o0&&w>0&&(m=s.ctx.createPattern(p,"repeat"),s.renderRepeat(v,m,P,C))):function(e){return 2===e.type}(i)&&(_=sb(e,t,[null,null,null]),v=_[0],b=_[1],y=_[2],B=_[3],w=_[4],x=0===i.position.length?[xf]:i.position,P=Mf(x[0],B),C=Mf(x[x.length-1],w),M=function(e,t,i,s,r){var o=0,n=0;switch(e.size){case 0:0===e.shape?o=n=Math.min(Math.abs(t),Math.abs(t-s),Math.abs(i),Math.abs(i-r)):1===e.shape&&(o=Math.min(Math.abs(t),Math.abs(t-s)),n=Math.min(Math.abs(i),Math.abs(i-r)));break;case 2:if(0===e.shape)o=n=Math.min(Xf(t,i),Xf(t,i-r),Xf(t-s,i),Xf(t-s,i-r));else if(1===e.shape){var a=Math.min(Math.abs(i),Math.abs(i-r))/Math.min(Math.abs(t),Math.abs(t-s)),l=Jf(s,r,t,i,!0),A=l[0],h=l[1];n=a*(o=Xf(A-t,(h-i)/a))}break;case 1:0===e.shape?o=n=Math.max(Math.abs(t),Math.abs(t-s),Math.abs(i),Math.abs(i-r)):1===e.shape&&(o=Math.max(Math.abs(t),Math.abs(t-s)),n=Math.max(Math.abs(i),Math.abs(i-r)));break;case 3:if(0===e.shape)o=n=Math.max(Xf(t,i),Xf(t,i-r),Xf(t-s,i),Xf(t-s,i-r));else if(1===e.shape){a=Math.max(Math.abs(i),Math.abs(i-r))/Math.max(Math.abs(t),Math.abs(t-s));var c=Jf(s,r,t,i,!1);A=c[0],h=c[1],n=a*(o=Xf(A-t,(h-i)/a))}}return Array.isArray(e.size)&&(o=Mf(e.size[0],s),n=2===e.size.length?Mf(e.size[1],r):o),[o,n]}(i,P,C,B,w),E=M[0],F=M[1],E>0&&F>0&&(I=s.ctx.createRadialGradient(b+P,y+C,0,b+P,y+C,E),Wf(i.stops,2*E).forEach((function(e){return I.addColorStop(e.stop,Lf(e.color))})),s.path(v),s.ctx.fillStyle=I,E!==F?(D=e.bounds.left+.5*e.bounds.width,S=e.bounds.top+.5*e.bounds.height,L=1/(T=F/E),s.ctx.save(),s.ctx.translate(D,S),s.ctx.transform(1,0,0,T,0,0),s.ctx.translate(-D,-S),s.ctx.fillRect(b,L*(y-S)+S,B,w*L),s.ctx.restore()):s.ctx.fill())),R.label=6;case 6:return t--,[2]}}))},s=this,r=0,o=e.styles.backgroundImage.slice(0).reverse(),a.label=1;case 1:return r0?2!==l.style?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,o,e.curves,2)]:[3,11]:[3,13];case 4:return h.sent(),[3,11];case 5:return 3!==l.style?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,o,e.curves,3)];case 6:return h.sent(),[3,11];case 7:return 4!==l.style?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,o,e.curves)];case 8:return h.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,o,e.curves)];case 10:h.sent(),h.label=11;case 11:o++,h.label=12;case 12:return n++,[3,3];case 13:return[2]}}))}))},t.prototype.renderDashedDottedBorder=function(e,t,i,s,r){return Fd(this,void 0,void 0,(function(){var o,n,a,l,A,h,c,u,d,p,f,g,m,_,v,b;return Id(this,(function(y){return this.ctx.save(),o=function(e,t){switch(t){case 0:return $v(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return $v(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return $v(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);default:return $v(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}}(s,i),n=qv(s,i),2===r&&(this.path(n),this.ctx.clip()),Ov(n[0])?(a=n[0].start.x,l=n[0].start.y):(a=n[0].x,l=n[0].y),Ov(n[1])?(A=n[1].end.x,h=n[1].end.y):(A=n[1].x,h=n[1].y),c=0===i||2===i?Math.abs(a-A):Math.abs(l-h),this.ctx.beginPath(),3===r?this.formatPath(o):this.formatPath(n.slice(0,2)),u=t<3?3*t:2*t,d=t<3?2*t:t,3===r&&(u=t,d=t),p=!0,c<=2*u?p=!1:c<=2*u+d?(u*=f=c/(2*u+d),d*=f):(g=Math.floor((c+d)/(u+d)),m=(c-g*u)/(g-1),d=(_=(c-(g+1)*u)/g)<=0||Math.abs(d-m){})),Rb(this,"_reject",(()=>{})),this.name=e,this.workerThread=t,this.result=new Promise(((e,t)=>{this._resolve=e,this._reject=t}))}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){Eb(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){Eb(this.isRunning),this.isRunning=!1,this._reject(e)}}class kb{}const Ob=new Map;function Nb(e){Eb(e.source&&!e.url||!e.source&&e.url);let t=Ob.get(e.source||e.url);return t||(e.url&&(t=function(e){if(!e.startsWith("http"))return e;return Qb((t=e,"try {\n importScripts('".concat(t,"');\n} catch (error) {\n console.error(error);\n throw error;\n}")));var t}(e.url),Ob.set(e.url,t)),e.source&&(t=Qb(e.source),Ob.set(e.source,t))),Eb(t),t}function Qb(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function Vb(e,t=!0,i){const s=i||new Set;if(e){if(Hb(e))s.add(e);else if(Hb(e.buffer))s.add(e.buffer);else if(ArrayBuffer.isView(e));else if(t&&"object"==typeof e)for(const i in e)Vb(e[i],t,s)}else;return void 0===i?Array.from(s):[]}function Hb(e){return!!e&&(e instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&e instanceof MessagePort||("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)))}const jb=()=>{};class Gb{static isSupported(){return"undefined"!=typeof Worker&&Db||void 0!==typeof kb}constructor(e){Rb(this,"name",void 0),Rb(this,"source",void 0),Rb(this,"url",void 0),Rb(this,"terminated",!1),Rb(this,"worker",void 0),Rb(this,"onMessage",void 0),Rb(this,"onError",void 0),Rb(this,"_loadableURL","");const{name:t,source:i,url:s}=e;Eb(i||s),this.name=t,this.source=i,this.url=s,this.onMessage=jb,this.onError=e=>console.log(e),this.worker=Db?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=jb,this.onError=jb,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,t){t=t||Vb(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+="worker ".concat(this.name," from ").concat(this.url,". "),e.message&&(t+="".concat(e.message," in ")),e.lineno&&(t+=":".concat(e.lineno,":").concat(e.colno)),new Error(t)}_createBrowserWorker(){this._loadableURL=Nb({source:this.source,url:this.url});const e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=e=>{e.data?this.onMessage(e.data):this.onError(new Error("No data received"))},e.onerror=e=>{this.onError(this._getErrorFromErrorEvent(e)),this.terminated=!0},e.onmessageerror=e=>console.error(e),e}_createNodeWorker(){let e;if(this.url){const t=this.url.includes(":/")||this.url.startsWith("/")?this.url:"./".concat(this.url);e=new kb(t,{eval:!1})}else{if(!this.source)throw new Error("no worker");e=new kb(this.source,{eval:!0})}return e.on("message",(e=>{this.onMessage(e)})),e.on("error",(e=>{this.onError(e)})),e.on("exit",(e=>{})),e}}class zb{static isSupported(){return Gb.isSupported()}constructor(e){Rb(this,"name","unnamed"),Rb(this,"source",void 0),Rb(this,"url",void 0),Rb(this,"maxConcurrency",1),Rb(this,"maxMobileConcurrency",1),Rb(this,"onDebug",(()=>{})),Rb(this,"reuseWorkers",!0),Rb(this,"props",{}),Rb(this,"jobQueue",[]),Rb(this,"idleQueue",[]),Rb(this,"count",0),Rb(this,"isDestroyed",!1),this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach((e=>e.destroy())),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},void 0!==e.name&&(this.name=e.name),void 0!==e.maxConcurrency&&(this.maxConcurrency=e.maxConcurrency),void 0!==e.maxMobileConcurrency&&(this.maxMobileConcurrency=e.maxMobileConcurrency),void 0!==e.reuseWorkers&&(this.reuseWorkers=e.reuseWorkers),void 0!==e.onDebug&&(this.onDebug=e.onDebug)}async startJob(e,t=((e,t,i)=>e.done(i)),i=((e,t)=>e.error(t))){const s=new Promise((s=>(this.jobQueue.push({name:e,onMessage:t,onError:i,onStart:s}),this)));return this._startQueuedJob(),await s}async _startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:e,backlog:this.jobQueue.length});const i=new Ub(t.name,e);e.onMessage=e=>t.onMessage(i,e.type,e.payload),e.onError=e=>t.onError(i,e),t.onStart(i);try{await i.result}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count{}};class Kb{static isSupported(){return Gb.isSupported()}static getWorkerFarm(e={}){return Kb._workerFarm=Kb._workerFarm||new Kb({}),Kb._workerFarm.setProps(e),Kb._workerFarm}constructor(e){Rb(this,"props",void 0),Rb(this,"workerPools",new Map),this.props={...Wb},this.setProps(e),this.workerPools=new Map}destroy(){for(const e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(const e of this.workerPools.values())e.setProps(this._getWorkerPoolProps())}getWorkerPool(e){const{name:t,source:i,url:s}=e;let r=this.workerPools.get(t);return r||(r=new zb({name:t,source:i,url:s}),r.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,r)),r}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}Rb(Kb,"_workerFarm",void 0);var Xb=Object.freeze({__proto__:null,default:{}});const Jb={};async function Yb(e,t=null,i={}){return t&&(e=function(e,t,i){if(e.startsWith("http"))return e;const s=i.modules||{};if(s[e])return s[e];if(!Db)return"modules/".concat(t,"/dist/libs/").concat(e);if(i.CDN)return Eb(i.CDN.startsWith("http")),"".concat(i.CDN,"/").concat(t,"@").concat("3.2.6","/dist/libs/").concat(e);if(Sb)return"../src/libs/".concat(e);return"modules/".concat(t,"/src/libs/").concat(e)}(e,t,i)),Jb[e]=Jb[e]||async function(e){if(e.endsWith("wasm")){const t=await fetch(e);return await t.arrayBuffer()}if(!Db)try{return Xb&&void 0}catch{return null}if(Sb)return importScripts(e);const t=await fetch(e);return function(e,t){if(!Db)return;if(Sb)return eval.call(Ib,e),null;const i=document.createElement("script");i.id=t;try{i.appendChild(document.createTextNode(e))}catch(t){i.text=e}return document.body.appendChild(i),null}(await t.text(),e)}(e),await Jb[e]}async function Zb(e,t,i,s,r){const o=e.id,n=function(e,t={}){const i=t[e.id]||{},s="".concat(e.id,"-worker.js");let r=i.workerUrl;if(r||"compression"!==e.id||(r=t.workerUrl),"test"===t._workerType&&(r="modules/".concat(e.module,"/dist/").concat(s)),!r){let t=e.version;"latest"===t&&(t="latest");const i=t?"@".concat(t):"";r="https://unpkg.com/@loaders.gl/".concat(e.module).concat(i,"/dist/").concat(s)}return Eb(r),r}(e,i),a=Kb.getWorkerFarm(i).getWorkerPool({name:o,url:n});i=JSON.parse(JSON.stringify(i)),s=JSON.parse(JSON.stringify(s||{}));const l=await a.startJob("process-on-worker",qb.bind(null,r));l.postMessage("process",{input:t,options:i,context:s});const A=await l.result;return await A.result}async function qb(e,t,i,s){switch(i){case"done":t.done(s);break;case"error":t.error(new Error(s.error));break;case"process":const{id:r,input:o,options:n}=s;try{const i=await e(o,n);t.postMessage("done",{id:r,result:i})}catch(e){const i=e instanceof Error?e.message:"unknown error";t.postMessage("error",{id:r,error:i})}break;default:console.warn("parse-with-worker unknown message ".concat(i))}}function $b(e,t,i){if(e.byteLength<=t+i)return"";const s=new DataView(e);let r="";for(let e=0;e=0),Pb(t>0),e+(t-1)&~(t-1)}function oy(e,t,i){let s;if(e instanceof ArrayBuffer)s=new Uint8Array(e);else{const t=e.byteOffset,i=e.byteLength;s=new Uint8Array(e.buffer||e.arrayBuffer,t,i)}return t.set(s,i),i+ry(s.byteLength,4)}async function ny(e){const t=[];for await(const i of e)t.push(i);return function(...e){const t=e.map((e=>e instanceof ArrayBuffer?new Uint8Array(e):e)),i=t.reduce(((e,t)=>e+t.byteLength),0),s=new Uint8Array(i);let r=0;for(const e of t)s.set(e,r),r+=e.byteLength;return s.buffer}(...t)}const ay={};const ly=e=>"function"==typeof e,Ay=e=>null!==e&&"object"==typeof e,hy=e=>Ay(e)&&e.constructor==={}.constructor,cy=e=>"undefined"!=typeof Response&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json,uy=e=>"undefined"!=typeof Blob&&e instanceof Blob,dy=e=>(e=>"undefined"!=typeof ReadableStream&&e instanceof ReadableStream||Ay(e)&&ly(e.tee)&&ly(e.cancel)&&ly(e.getReader))(e)||(e=>Ay(e)&&ly(e.read)&&ly(e.pipe)&&(e=>"boolean"==typeof e)(e.readable))(e),py=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,fy=/^([-\w.]+\/[-\w.+]+)/;function gy(e){const t=fy.exec(e);return t?t[1]:e}function my(e){const t=py.exec(e);return t?t[1]:""}const _y=/\?.*/;function vy(e){if(cy(e)){const t=by(e.url||"");return{url:t,type:gy(e.headers.get("content-type")||"")||my(t)}}return uy(e)?{url:by(e.name||""),type:e.type||""}:"string"==typeof e?{url:by(e),type:my(e)}:{url:"",type:""}}function by(e){return e.replace(_y,"")}async function yy(e){if(cy(e))return e;const t={},i=function(e){return cy(e)?e.headers["content-length"]||-1:uy(e)?e.size:"string"==typeof e?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}(e);i>=0&&(t["content-length"]=String(i));const{url:s,type:r}=vy(e);r&&(t["content-type"]=r);const o=await async function(e){const t=5;if("string"==typeof e)return"data:,".concat(e.slice(0,t));if(e instanceof Blob){const t=e.slice(0,5);return await new Promise((e=>{const i=new FileReader;i.onload=t=>{var i;return e(null==t||null===(i=t.target)||void 0===i?void 0:i.result)},i.readAsDataURL(t)}))}if(e instanceof ArrayBuffer){const i=function(e){let t="";const i=new Uint8Array(e);for(let e=0;e=0)}();class Ey{constructor(e,t,i="sessionStorage"){this.storage=function(e){try{const t=window[e],i="__storage_test__";return t.setItem(i,i),t.removeItem(i),t}catch(e){return null}}(i),this.id=e,this.config={},Object.assign(this.config,t),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){return this.config={},this.updateConfiguration(e)}updateConfiguration(e){if(Object.assign(this.config,e),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}return this}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function Fy(e,t,i,s=600){const r=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>s&&(i=Math.min(i,s/e.width));const o=e.width*i,n=e.height*i,a=["font-size:1px;","padding:".concat(Math.floor(n/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(n,"px;"),"background:url(".concat(r,");"),"background-size:".concat(o,"px ").concat(n,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}const Iy={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function Dy(e){return"string"==typeof e?Iy[e.toUpperCase()]||Iy.WHITE:e}function Sy(e,t){if(!e)throw new Error(t||"Assertion failed")}function Ty(){let e;if(My&&xy.performance)e=xy.performance.now();else if(Py.hrtime){const t=Py.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}const Ly={debug:My&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Ry={enabled:!0,level:0};function Uy(){}const ky={},Oy={once:!0};function Ny(e){for(const t in e)for(const i in e[t])return i||"untitled";return"empty"}class Qy{constructor({id:e}={id:""}){this.id=e,this.VERSION=Cy,this._startTs=Ty(),this._deltaTs=Ty(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new Ey("__probe-".concat(this.id,"__"),Ry),this.userData={},this.timeStamp("".concat(this.id," started")),function(e,t=["constructor"]){const i=Object.getPrototypeOf(e),s=Object.getOwnPropertyNames(i);for(const i of s)"function"==typeof e[i]&&(t.find((e=>i===e))||(e[i]=e[i].bind(e)))}(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Ty()-this._startTs).toPrecision(10))}getDelta(){return Number((Ty()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.updateConfiguration({enabled:e}),this}setLevel(e){return this._storage.updateConfiguration({level:e}),this}assert(e,t){Sy(e,t)}warn(e){return this._getLogFunction(0,e,Ly.warn,arguments,Oy)}error(e){return this._getLogFunction(0,e,Ly.error,arguments)}deprecated(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}probe(e,t){return this._getLogFunction(e,t,Ly.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,Ly.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,Ly.debug||Ly.info,arguments,Oy)}table(e,t,i){return t?this._getLogFunction(e,t,console.table||Uy,i&&[i],{tag:Ny(t)}):Uy}image({logLevel:e,priority:t,image:i,message:s="",scale:r=1}){return this._shouldLog(e||t)?My?function({image:e,message:t="",scale:i=1}){if("string"==typeof e){const s=new Image;return s.onload=()=>{const e=Fy(s,t,i);console.log(...e)},s.src=e,Uy}const s=e.nodeName||"";if("img"===s.toLowerCase())return console.log(...Fy(e,t,i)),Uy;if("canvas"===s.toLowerCase()){const s=new Image;return s.onload=()=>console.log(...Fy(s,t,i)),s.src=e.toDataURL(),Uy}return Uy}({image:i,message:s,scale:r}):function({image:e,message:t="",scale:i=1}){let s=null;try{s=module.require("asciify-image")}catch(e){}if(s)return()=>s(e,{fit:"box",width:"".concat(Math.round(80*i),"%")}).then((e=>console.log(e)));return Uy}({image:i,message:s,scale:r}):Uy}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}get(e){return this._storage.config[e]}set(e,t){this._storage.updateConfiguration({[e]:t})}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||Uy)}group(e,t,i={collapsed:!1}){i=Hy({logLevel:e,message:t,opts:i});const{collapsed:s}=i;return i.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,t,i={}){return this.group(e,t,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Uy)}withGroup(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=Vy(e)}_getLogFunction(e,t,i,s=[],r){if(this._shouldLog(e)){r=Hy({logLevel:e,message:t,args:s,opts:r}),Sy(i=i||r.method),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=Ty();const o=r.tag||r.message;if(r.once){if(ky[o])return Uy;ky[o]=Ty()}return t=function(e,t,i){if("string"==typeof t){const s=i.time?function(e,t=8){const i=Math.max(t-e.length,0);return"".concat(" ".repeat(i)).concat(e)}(function(e){let t;return t=e<10?"".concat(e.toFixed(2),"ms"):e<100?"".concat(e.toFixed(1),"ms"):e<1e3?"".concat(e.toFixed(0),"ms"):"".concat((e/1e3).toFixed(2),"s"),t}(i.total)):"";t=i.time?"".concat(e,": ").concat(s," ").concat(t):"".concat(e,": ").concat(t),t=function(e,t,i){return My||"string"!=typeof e||(t&&(t=Dy(t),e="[".concat(t,"m").concat(e,"")),i&&(t=Dy(i),e="[".concat(i+10,"m").concat(e,""))),e}(t,i.color,i.background)}return t}(this.id,r.message,r),i.bind(console,t,...r.args)}return Uy}}function Vy(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Sy(Number.isFinite(t)&&t>=0),t}function Hy(e){const{logLevel:t,message:i}=e;e.logLevel=Vy(t);const s=e.args?Array.from(e.args):[];for(;s.length&&s.shift()!==i;);switch(e.args=s,typeof t){case"string":case"function":void 0!==i&&s.unshift(i),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());const r=typeof e.message;return Sy("string"===r||"object"===r),Object.assign(e,e.opts)}Qy.VERSION=Cy;const jy=new Qy({id:"loaders.gl"});class Gy{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const zy={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){Rb(this,"console",void 0),this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}},CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Cb,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},Wy={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 Ky(){globalThis.loaders=globalThis.loaders||{};const{loaders:e}=globalThis;return e._state=e._state||{},e._state}const Xy=()=>{const e=Ky();return e.globalOptions=e.globalOptions||{...zy},e.globalOptions};function Jy(e,t,i,s){return i=i||[],function(e,t){Zy(e,null,zy,Wy,t);for(const i of t){const s=e&&e[i.id]||{},r=i.options&&i.options[i.id]||{},o=i.deprecatedOptions&&i.deprecatedOptions[i.id]||{};Zy(s,i.id,r,o,t)}}(e,i=Array.isArray(i)?i:[i]),function(e,t,i){const s={...e.options||{}};(function(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)})(s,i),null===s.log&&(s.log=new Gy);return $y(s,Xy()),$y(s,t),s}(t,e,s)}function Yy(e,t){const i=Xy(),s=e||i;return"function"==typeof s.fetch?s.fetch:Ay(s.fetch)?e=>By(e,s):null!=t&&t.fetch?null==t?void 0:t.fetch:By}function Zy(e,t,i,s,r){const o=t||"Top level",n=t?"".concat(t,"."):"";for(const a in e){const l=!t&&Ay(e[a]),A="baseUri"===a&&!t,h="workerUrl"===a&&t;if(!(a in i)&&!A&&!h)if(a in s)jy.warn("".concat(o," loader option '").concat(n).concat(a,"' no longer supported, use '").concat(s[a],"'"))();else if(!l){const e=qy(a,r);jy.warn("".concat(o," loader option '").concat(n).concat(a,"' not recognized. ").concat(e))()}}}function qy(e,t){const i=e.toLowerCase();let s="";for(const r of t)for(const t in r.options){if(e===t)return"Did you mean '".concat(r.id,".").concat(t,"'?");const o=t.toLowerCase();(i.startsWith(o)||o.startsWith(i))&&(s=s||"Did you mean '".concat(r.id,".").concat(t,"'?"))}return s}function $y(e,t){for(const i in t)if(i in t){const s=t[i];hy(s)&&hy(e[i])?e[i]={...e[i],...t[i]}:e[i]=t[i]}}function eB(e){var t;if(!e)return!1;Array.isArray(e)&&(e=e[0]);return Array.isArray(null===(t=e)||void 0===t?void 0:t.extensions)}function tB(e){var t,i;let s;return Pb(e,"null loader"),Pb(eB(e),"invalid loader"),Array.isArray(e)&&(s=e[1],e=e[0],e={...e,options:{...e.options,...s}}),(null!==(t=e)&&void 0!==t&&t.parseTextSync||null!==(i=e)&&void 0!==i&&i.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}function iB(){return(()=>{const e=Ky();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry})()}function sB(){return!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)||function(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof process&&"object"==typeof process.versions&&Boolean(process.versions.electron))return!0;const t="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,i=e||t;return!!(i&&i.indexOf("Electron")>=0)}()}const rB={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"==typeof process&&process},oB=rB.window||rB.self||rB.global,nB=rB.process||{},aB="undefined"!=typeof __VERSION__?__VERSION__:"untranspiled source";sB();class lB{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";Rb(this,"storage",void 0),Rb(this,"id",void 0),Rb(this,"config",{}),this.storage=function(e){try{const t=window[e],i="__storage_test__";return t.setItem(i,i),t.removeItem(i),t}catch(e){return null}}(i),this.id=e,this.config={},Object.assign(this.config,t),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){return this.config={},this.updateConfiguration(e)}updateConfiguration(e){if(Object.assign(this.config,e),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}return this}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function AB(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600;const r=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>s&&(i=Math.min(i,s/e.width));const o=e.width*i,n=e.height*i,a=["font-size:1px;","padding:".concat(Math.floor(n/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(n,"px;"),"background:url(".concat(r,");"),"background-size:".concat(o,"px ").concat(n,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}let hB;function cB(e){return"string"==typeof e?hB[e.toUpperCase()]||hB.WHITE:e}function uB(e,t){if(!e)throw new Error(t||"Assertion failed")}function dB(){let e;var t,i;if(sB&&"performance"in oB)e=null==oB||null===(t=oB.performance)||void 0===t||null===(i=t.now)||void 0===i?void 0:i.call(t);else if("hrtime"in nB){var s;const t=null==nB||null===(s=nB.hrtime)||void 0===s?void 0:s.call(nB);e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}!function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(hB||(hB={}));const pB={debug:sB&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},fB={enabled:!0,level:0};function gB(){}const mB={},_B={once:!0};class vB{constructor(){let{id:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""};Rb(this,"id",void 0),Rb(this,"VERSION",aB),Rb(this,"_startTs",dB()),Rb(this,"_deltaTs",dB()),Rb(this,"_storage",void 0),Rb(this,"userData",{}),Rb(this,"LOG_THROTTLE_TIMEOUT",0),this.id=e,this._storage=new lB("__probe-".concat(this.id,"__"),fB),this.userData={},this.timeStamp("".concat(this.id," started")),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"];const i=Object.getPrototypeOf(e),s=Object.getOwnPropertyNames(i);for(const i of s)"function"==typeof e[i]&&(t.find((e=>i===e))||(e[i]=e[i].bind(e)))}(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((dB()-this._startTs).toPrecision(10))}getDelta(){return Number((dB()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:e}),this}setLevel(e){return this._storage.updateConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.updateConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){uB(e,t)}warn(e){return this._getLogFunction(0,e,pB.warn,arguments,_B)}error(e){return this._getLogFunction(0,e,pB.error,arguments)}deprecated(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}probe(e,t){return this._getLogFunction(e,t,pB.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,pB.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){for(var i=arguments.length,s=new Array(i>2?i-2:0),r=2;r{const t=AB(e,i,s);console.log(...t)},e.src=t,gB}const r=t.nodeName||"";if("img"===r.toLowerCase())return console.log(...AB(t,i,s)),gB;if("canvas"===r.toLowerCase()){const e=new Image;return e.onload=()=>console.log(...AB(e,i,s)),e.src=t.toDataURL(),gB}return gB}({image:s,message:r,scale:o}):function(e){let{image:t,message:i="",scale:s=1}=e,r=null;try{r=module.require("asciify-image")}catch(e){}if(r)return()=>r(t,{fit:"box",width:"".concat(Math.round(80*s),"%")}).then((e=>console.log(e)));return gB}({image:s,message:r,scale:o}):gB}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||gB)}group(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};const s=yB({logLevel:e,message:t,opts:i}),{collapsed:r}=i;return s.method=(r?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(e,t,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||gB)}withGroup(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=bB(e)}_getLogFunction(e,t,i,s,r){if(this._shouldLog(e)){r=yB({logLevel:e,message:t,args:s,opts:r}),uB(i=i||r.method),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=dB();const o=r.tag||r.message;if(r.once){if(mB[o])return gB;mB[o]=dB()}return t=function(e,t,i){if("string"==typeof t){const s=i.time?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const i=Math.max(t-e.length,0);return"".concat(" ".repeat(i)).concat(e)}(function(e){let t;return t=e<10?"".concat(e.toFixed(2),"ms"):e<100?"".concat(e.toFixed(1),"ms"):e<1e3?"".concat(e.toFixed(0),"ms"):"".concat((e/1e3).toFixed(2),"s"),t}(i.total)):"";t=i.time?"".concat(e,": ").concat(s," ").concat(t):"".concat(e,": ").concat(t),t=function(e,t,i){return sB||"string"!=typeof e||(t&&(t=cB(t),e="[".concat(t,"m").concat(e,"")),i&&(t=cB(i),e="[".concat(i+10,"m").concat(e,""))),e}(t,i.color,i.background)}return t}(this.id,r.message,r),i.bind(console,t,...r.args)}return gB}}function bB(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return uB(Number.isFinite(t)&&t>=0),t}function yB(e){const{logLevel:t,message:i}=e;e.logLevel=bB(t);const s=e.args?Array.from(e.args):[];for(;s.length&&s.shift()!==i;);switch(typeof t){case"string":case"function":void 0!==i&&s.unshift(i),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());const r=typeof e.message;return uB("string"===r||"object"===r),Object.assign(e,{args:s},e.opts)}function BB(e){for(const t in e)for(const i in e[t])return i||"untitled";return"empty"}Rb(vB,"VERSION",aB);const wB=new vB({id:"loaders.gl"}),xB=/\.([^.]+)$/;function PB(e,t=[],i,s){if(!CB(e))return null;if(t&&!Array.isArray(t))return tB(t);let r=[];t&&(r=r.concat(t)),null!=i&&i.ignoreRegisteredLoaders||r.push(...iB()),function(e){for(const t of e)tB(t)}(r);const o=function(e,t,i,s){const{url:r,type:o}=vy(e),n=r||(null==s?void 0:s.url);let a=null,l="";null!=i&&i.mimeType&&(a=EB(t,null==i?void 0:i.mimeType),l="match forced by supplied MIME type ".concat(null==i?void 0:i.mimeType));var A;a=a||function(e,t){const i=t&&xB.exec(t),s=i&&i[1];return s?function(e,t){t=t.toLowerCase();for(const i of e)for(const e of i.extensions)if(e.toLowerCase()===t)return i;return null}(e,s):null}(t,n),l=l||(a?"matched url ".concat(n):""),a=a||EB(t,o),l=l||(a?"matched MIME type ".concat(o):""),a=a||function(e,t){if(!t)return null;for(const i of e)if("string"==typeof t){if(FB(t,i))return i}else if(ArrayBuffer.isView(t)){if(IB(t.buffer,t.byteOffset,i))return i}else if(t instanceof ArrayBuffer){if(IB(t,0,i))return i}return null}(t,e),l=l||(a?"matched initial data ".concat(DB(e)):""),a=a||EB(t,null==i?void 0:i.fallbackMimeType),l=l||(a?"matched fallback MIME type ".concat(o):""),l&&wB.log(1,"selectLoader selected ".concat(null===(A=a)||void 0===A?void 0:A.name,": ").concat(l,"."));return a}(e,r,i,s);if(!(o||null!=i&&i.nothrow))throw new Error(MB(e));return o}function CB(e){return!(e instanceof Response&&204===e.status)}function MB(e){const{url:t,type:i}=vy(e);let s="No valid loader found (";s+=t?"".concat(function(e){const t=e&&e.lastIndexOf("/");return t>=0?e.substr(t+1):""}(t),", "):"no url provided, ",s+="MIME type: ".concat(i?'"'.concat(i,'"'):"not provided",", ");const r=e?DB(e):"";return s+=r?' first bytes: "'.concat(r,'"'):"first bytes: not available",s+=")",s}function EB(e,t){for(const i of e){if(i.mimeTypes&&i.mimeTypes.includes(t))return i;if(t==="application/x.".concat(i.id))return i}return null}function FB(e,t){if(t.testText)return t.testText(e);return(Array.isArray(t.tests)?t.tests:[t.tests]).some((t=>e.startsWith(t)))}function IB(e,t,i){return(Array.isArray(i.tests)?i.tests:[i.tests]).some((s=>function(e,t,i,s){if(s instanceof ArrayBuffer)return function(e,t,i){if(i=i||e.byteLength,e.byteLength60?"".concat(t.slice(0,60),"..."):t}catch(e){}return t}(e);throw new Error(t)}}(i),t.binary?await i.arrayBuffer():await i.text()}if(dy(e)&&(e=RB(e,i)),(r=e)&&"function"==typeof r[Symbol.iterator]||(e=>e&&"function"==typeof e[Symbol.asyncIterator])(e))return ny(e);var r;throw new Error(UB)}async function OB(e,t,i,s){Eb(!s||"object"==typeof s),!t||Array.isArray(t)||eB(t)||(s=void 0,i=t,t=void 0),e=await e,i=i||{};const{url:r}=vy(e),o=function(e,t){if(!t&&e&&!Array.isArray(e))return e;let i;if(e&&(i=Array.isArray(e)?e:[e]),t&&t.loaders){const e=Array.isArray(t.loaders)?t.loaders:[t.loaders];i=i?[...i,...e]:e}return i&&i.length?i:null}(t,s),n=await async function(e,t=[],i,s){if(!CB(e))return null;let r=PB(e,t,{...i,nothrow:!0},s);if(r)return r;if(uy(e)&&(r=PB(e=await e.slice(0,10).arrayBuffer(),t,i,s)),!(r||null!=i&&i.nothrow))throw new Error(MB(e));return r}(e,o,i);return n?(s=function(e,t,i=null){if(i)return i;const s={fetch:Yy(t,e),...e};return Array.isArray(s.loaders)||(s.loaders=null),s}({url:r,parse:OB,loaders:o},i=Jy(i,n,o,r),s),await async function(e,t,i,s){if(function(e,t="3.2.6"){Eb(e,"no worker provided");const i=e.version}(e),cy(t)){const e=t,{ok:i,redirected:r,status:o,statusText:n,type:a,url:l}=e,A=Object.fromEntries(e.headers.entries());s.response={headers:A,ok:i,redirected:r,status:o,statusText:n,type:a,url:l}}if(t=await kB(t,e,i),e.parseTextSync&&"string"==typeof t)return i.dataType="text",e.parseTextSync(t,i,s,e);if(function(e,t){return!!Kb.isSupported()&&!!(Db||null!=t&&t._nodeWorkers)&&e.worker&&(null==t?void 0:t.worker)}(e,i))return await Zb(e,t,i,s,OB);if(e.parseText&&"string"==typeof t)return await e.parseText(t,i,s,e);if(e.parse)return await e.parse(t,i,s,e);throw Eb(!e.parseSync),new Error("".concat(e.id," loader - no parser found and worker is disabled"))}(n,e,i,s)):null}const NB="https://unpkg.com/@loaders.gl/textures@".concat("3.2.6","/dist/libs/basis_encoder.wasm"),QB="https://unpkg.com/@loaders.gl/textures@".concat("3.2.6","/dist/libs/basis_encoder.js");let VB,HB;async function jB(e){const t=e.modules||{};return t.basis?t.basis:(VB=VB||async function(e){let t=null,i=null;return[t,i]=await Promise.all([await Yb("basis_transcoder.js","textures",e),await Yb("basis_transcoder.wasm","textures",e)]),t=t||globalThis.BASIS,await function(e,t){const i={};t&&(i.wasmBinary=t);return new Promise((t=>{e(i).then((e=>{const{BasisFile:i,initializeBasis:s}=e;s(),t({BasisFile:i})}))}))}(t,i)}(e),await VB)}async function GB(e){const t=e.modules||{};return t.basisEncoder?t.basisEncoder:(HB=HB||async function(e){let t=null,i=null;return[t,i]=await Promise.all([await Yb(QB,"textures",e),await Yb(NB,"textures",e)]),t=t||globalThis.BASIS,await function(e,t){const i={};t&&(i.wasmBinary=t);return new Promise((t=>{e(i).then((e=>{const{BasisFile:i,KTX2File:s,initializeBasis:r,BasisEncoder:o}=e;r(),t({BasisFile:i,KTX2File:s,BasisEncoder:o})}))}))}(t,i)}(e),await HB)}const zB=33776,WB=33779,KB=35840,XB=35842,JB=36196,YB=37808,ZB=["","WEBKIT_","MOZ_"],qB={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"};let $B=null;function ew(e){if(!$B){e=e||function(){try{return document.createElement("canvas").getContext("webgl")}catch(e){return null}}()||void 0,$B=new Set;for(const t of ZB)for(const i in qB)if(e&&e.getExtension("".concat(t).concat(i))){const e=qB[i];$B.add(e)}}return $B}var tw,iw,sw,rw,ow,nw,aw,lw,Aw;(Aw=tw||(tw={}))[Aw.NONE=0]="NONE",Aw[Aw.BASISLZ=1]="BASISLZ",Aw[Aw.ZSTD=2]="ZSTD",Aw[Aw.ZLIB=3]="ZLIB",function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(iw||(iw={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(sw||(sw={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(rw||(rw={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(ow||(ow={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(nw||(nw={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(aw||(aw={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(lw||(lw={}));const hw=[171,75,84,88,32,50,48,187,13,10,26,10];const cw={etc1:{basisFormat:0,compressed:!0,format:JB},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:zB},bc3:{basisFormat:3,compressed:!0,format:WB},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:KB},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:XB},"astc-4x4":{basisFormat:10,compressed:!0,format:YB},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};function uw(e,t,i){const s=new e(new Uint8Array(t));try{if(!s.startTranscoding())throw new Error("Failed to start basis transcoding");const e=s.getNumImages(),t=[];for(let r=0;r{try{i.onload=()=>t(i),i.onerror=t=>s(new Error("Could not load image ".concat(e,": ").concat(t)))}catch(e){s(e)}}))}(o||s,t)}finally{o&&r.revokeObjectURL(o)}}const Iw={};let Dw=!0;async function Sw(e,t,i){let s;if(Mw(i)){s=await Fw(e,t,i)}else s=Ew(e,i);const r=t&&t.imagebitmap;return await async function(e,t=null){!function(e){for(const t in e||Iw)return!1;return!0}(t)&&Dw||(t=null);if(t)try{return await createImageBitmap(e,t)}catch(e){console.warn(e),Dw=!1}return await createImageBitmap(e)}(s,r)}function Tw(e){const t=Lw(e);return function(e){const t=Lw(e);if(!(t.byteLength>=24&&2303741511===t.getUint32(0,false)))return null;return{mimeType:"image/png",width:t.getUint32(16,false),height:t.getUint32(20,false)}}(t)||function(e){const t=Lw(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,false)&&255===t.getUint8(2)))return null;const{tableMarkers:i,sofMarkers:s}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let r=2;for(;r+9=10&&1195984440===t.getUint32(0,false)))return null;return{mimeType:"image/gif",width:t.getUint16(6,true),height:t.getUint16(8,true)}}(t)||function(e){const t=Lw(e);if(!(t.byteLength>=14&&16973===t.getUint16(0,false)&&t.getUint32(2,true)===t.byteLength))return null;return{mimeType:"image/bmp",width:t.getUint32(18,true),height:t.getUint32(22,true)}}(t)}function Lw(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}const Rw={id:"image",module:"images",name:"Images",version:"3.2.6",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:async function(e,t,i){const s=((t=t||{}).image||{}).type||"auto",{url:r}=i||{};let o;switch(function(e){switch(e){case"auto":case"data":return function(){if(yw)return"imagebitmap";if(bw)return"image";if(ww)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(e){switch(e){case"auto":return yw||bw||ww;case"imagebitmap":return yw;case"image":return bw;case"data":return ww;default:throw new Error("@loaders.gl/images: image ".concat(e," not supported in this environment"))}}(e),e}}(s)){case"imagebitmap":o=await Sw(e,t,r);break;case"image":o=await Fw(e,t,r);break;case"data":o=await async function(e,t){const{mimeType:i}=Tw(e)||{},s=globalThis._parseImageNode;return Pb(s),await s(e,i)}(e);break;default:Pb(!1)}return"data"===s&&(o=function(e){switch(xw(e)){case"data":return e;case"image":case"imagebitmap":const t=document.createElement("canvas"),i=t.getContext("2d");if(!i)throw new Error("getImageData");return t.width=e.width,t.height=e.height,i.drawImage(e,0,0),i.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}(o)),o},tests:[e=>Boolean(Tw(new DataView(e)))],options:{image:{type:"auto",decode:!0}}},Uw=["image/png","image/jpeg","image/gif"],kw={};function Ow(e){return void 0===kw[e]&&(kw[e]=function(e){switch(e){case"image/webp":return function(){if(!Cb)return!1;try{return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}catch{return!1}}();case"image/svg":return Cb;default:if(!Cb){const{_parseImageNode:t}=globalThis;return Boolean(t)&&Uw.includes(e)}return!0}}(e)),kw[e]}function Nw(e,t){if(!e)throw new Error(t||"assert failed: gltf")}function Qw(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;const i=t.baseUri||t.uri;if(!i)throw new Error("'baseUri' must be provided to resolve relative url ".concat(e));return i.substr(0,i.lastIndexOf("/")+1)+e}const Vw=["SCALAR","VEC2","VEC3","VEC4"],Hw=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],jw=new Map(Hw),Gw={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},zw={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Ww={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function Kw(e){return Vw[e-1]||Vw[0]}function Xw(e){const t=jw.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function Jw(e,t){const i=Ww[e.componentType],s=Gw[e.type],r=zw[e.componentType],o=e.count*s,n=e.count*s*r;return Nw(n>=0&&n<=t.byteLength),{ArrayType:i,length:o,byteLength:n}}const Yw={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]};class Zw{constructor(e){Rb(this,"gltf",void 0),Rb(this,"sourceBuffers",void 0),Rb(this,"byteLength",void 0),this.gltf=e||{json:{...Yw},buffers:[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}getExtension(e){const t=this.getUsedExtensions().find((t=>t===e)),i=this.json.extensions||{};return t?i[e]||!0:null}getRequiredExtension(e){const t=this.getRequiredExtensions().find((t=>t===e));return t?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,t){if("object"==typeof t)return t;const i=this.json[e]&&this.json[e][t];if(!i)throw new Error("glTF file error: Could not find ".concat(e,"[").concat(t,"]"));return i}getTypedArrayForBufferView(e){const t=(e=this.getBufferView(e)).buffer,i=this.gltf.buffers[t];Nw(i);const s=(e.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,s,e.byteLength)}getTypedArrayForAccessor(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),i=this.getBuffer(t.buffer).data,{ArrayType:s,length:r}=Jw(e,t);return new s(i,t.byteOffset+e.byteOffset,r)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),i=this.getBuffer(t.buffer).data,s=t.byteOffset||0;return new Uint8Array(i,s,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,i){return e.extensions=e.extensions||{},e.extensions[t]=i,this.registerUsedExtension(t),this}setObjectExtension(e,t,i){(e.extensions||{})[t]=i}removeObjectExtension(e,t){const i=e.extensions||{},s=i[t];return delete i[t],s}addExtension(e,t={}){return Nw(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return Nw(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find((t=>t===e))||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find((t=>t===e))||this.json.extensionsRequired.push(e)}removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}setDefaultScene(e){this.json.scene=e}addScene(e){const{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){const{meshIndex:t,matrix:i}=e;this.json.nodes=this.json.nodes||[];const s={mesh:t};return i&&(s.matrix=i),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(e){const{attributes:t,indices:i,material:s,mode:r=4}=e,o={primitives:[{attributes:this._addAttributes(t),mode:r}]};if(i){const e=this._addIndices(i);o.primitives[0].indices=e}return Number.isFinite(s)&&(o.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(o),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addImage(e,t){const i=Tw(e),s=t||(null==i?void 0:i.mimeType),r={bufferView:this.addBufferView(e),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(r),this.json.images.length-1}addBufferView(e){const t=e.byteLength;Nw(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const i={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=ry(t,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(e,t){const i={bufferView:e,type:Kw(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(i),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const i=this.addBufferView(e);let s={min:t.min,max:t.max};s.min&&s.max||(s=this._getAccessorMinMax(e,t.size));const r={size:t.size,componentType:Xw(e),count:Math.round(e.length/t.size),min:s.min,max:s.max};return this.addAccessor(i,Object.assign(r,t))}addTexture(e){const{imageIndex:t}=e,i={source:t};return this.json.textures=this.json.textures||[],this.json.textures.push(i),this.json.textures.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){var e,t;this.gltf.buffers=[];const i=this.byteLength,s=new ArrayBuffer(i),r=new Uint8Array(s);let o=0;for(const e of this.sourceBuffers||[])o=oy(e,r,o);null!==(e=this.json)&&void 0!==e&&null!==(t=e.buffers)&&void 0!==t&&t[0]?this.json.buffers[0].byteLength=i:this.json.buffers=[{byteLength:i}],this.gltf.binary=s,this.sourceBuffers=[s]}_removeStringFromArray(e,t){let i=!0;for(;i;){const s=e.indexOf(t);s>-1?e.splice(s,1):i=!1}}_addAttributes(e={}){const t={};for(const i in e){const s=e[i],r=this._getGltfAttributeName(i),o=this.addBinaryBuffer(s.value,s);t[r]=o}return t}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.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 e}}_getAccessorMinMax(e,t){const i={min:null,max:null};if(e.length96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let i=0;for(let s=0;st[e.name]));return new cx(i,this.metadata)}selectAt(...e){const t=e.map((e=>this.fields[e])).filter(Boolean);return new cx(t,this.metadata)}assign(e){let t,i=this.metadata;if(e instanceof cx){const s=e;t=s.fields,i=ux(ux(new Map,this.metadata),s.metadata)}else t=e;const s=Object.create(null);for(const e of this.fields)s[e.name]=e;for(const e of t)s[e.name]=e;const r=Object.values(s);return new cx(r,i)}}function ux(e,t){return new Map([...e||new Map,...t||new Map])}class dx{constructor(e,t,i=!1,s=new Map){Rb(this,"name",void 0),Rb(this,"type",void 0),Rb(this,"nullable",void 0),Rb(this,"metadata",void 0),this.name=e,this.type=t,this.nullable=i,this.metadata=s}get typeId(){return this.type&&this.type.typeId}clone(){return new dx(this.name,this.type,this.nullable,this.metadata)}compareTo(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}toString(){return"".concat(this.type).concat(this.nullable?", nullable":"").concat(this.metadata?", metadata: ".concat(this.metadata):"")}}let px,fx,gx,mx;!function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(px||(px={}));class _x{static isNull(e){return e&&e.typeId===px.Null}static isInt(e){return e&&e.typeId===px.Int}static isFloat(e){return e&&e.typeId===px.Float}static isBinary(e){return e&&e.typeId===px.Binary}static isUtf8(e){return e&&e.typeId===px.Utf8}static isBool(e){return e&&e.typeId===px.Bool}static isDecimal(e){return e&&e.typeId===px.Decimal}static isDate(e){return e&&e.typeId===px.Date}static isTime(e){return e&&e.typeId===px.Time}static isTimestamp(e){return e&&e.typeId===px.Timestamp}static isInterval(e){return e&&e.typeId===px.Interval}static isList(e){return e&&e.typeId===px.List}static isStruct(e){return e&&e.typeId===px.Struct}static isUnion(e){return e&&e.typeId===px.Union}static isFixedSizeBinary(e){return e&&e.typeId===px.FixedSizeBinary}static isFixedSizeList(e){return e&&e.typeId===px.FixedSizeList}static isMap(e){return e&&e.typeId===px.Map}static isDictionary(e){return e&&e.typeId===px.Dictionary}get typeId(){return px.NONE}compareTo(e){return this===e}}fx=Symbol.toStringTag;class vx extends _x{constructor(e,t){super(),Rb(this,"isSigned",void 0),Rb(this,"bitWidth",void 0),this.isSigned=e,this.bitWidth=t}get typeId(){return px.Int}get[fx](){return"Int"}toString(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}}class bx extends vx{constructor(){super(!0,8)}}class yx extends vx{constructor(){super(!0,16)}}class Bx extends vx{constructor(){super(!0,32)}}class wx extends vx{constructor(){super(!1,8)}}class xx extends vx{constructor(){super(!1,16)}}class Px extends vx{constructor(){super(!1,32)}}const Cx=32,Mx=64;gx=Symbol.toStringTag;class Ex extends _x{constructor(e){super(),Rb(this,"precision",void 0),this.precision=e}get typeId(){return px.Float}get[gx](){return"Float"}toString(){return"Float".concat(this.precision)}}class Fx extends Ex{constructor(){super(Cx)}}class Ix extends Ex{constructor(){super(Mx)}}mx=Symbol.toStringTag;class Dx extends _x{constructor(e,t){super(),Rb(this,"listSize",void 0),Rb(this,"children",void 0),this.listSize=e,this.children=[t]}get typeId(){return px.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[mx](){return"FixedSizeList"}toString(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}}function Sx(e,t,i){const s=function(e){switch(e.constructor){case Int8Array:return new bx;case Uint8Array:return new wx;case Int16Array:return new yx;case Uint16Array:return new xx;case Int32Array:return new Bx;case Uint32Array:return new Px;case Float32Array:return new Fx;case Float64Array:return new Ix;default:throw new Error("array type not supported")}}(t.value),r=i||function(e){const t=new Map;"byteOffset"in e&&t.set("byteOffset",e.byteOffset.toString(10));"byteStride"in e&&t.set("byteStride",e.byteStride.toString(10));"normalized"in e&&t.set("normalized",e.normalized.toString());return t}(t);return new dx(e,new Dx(t.size,new dx("value",s)),!1,r)}function Tx(e,t,i){return Sx(e,t,i?Lx(i.metadata):void 0)}function Lx(e){const t=new Map;for(const i in e)t.set("".concat(i,".string"),JSON.stringify(e[i]));return t}const Rx={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},Ux={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class kx{constructor(e){Rb(this,"draco",void 0),Rb(this,"decoder",void 0),Rb(this,"metadataQuerier",void 0),this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,t={}){const i=new this.draco.DecoderBuffer;i.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(t);const s=this.decoder.GetEncodedGeometryType(i),r=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let e;switch(s){case this.draco.TRIANGULAR_MESH:e=this.decoder.DecodeBufferToMesh(i,r);break;case this.draco.POINT_CLOUD:e=this.decoder.DecodeBufferToPointCloud(i,r);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!e.ok()||!r.ptr){const t="DRACO decompression failed: ".concat(e.error_msg());throw new Error(t)}const o=this._getDracoLoaderData(r,s,t),n=this._getMeshData(r,o,t),a=function(e){let t=1/0,i=1/0,s=1/0,r=-1/0,o=-1/0,n=-1/0;const a=e.POSITION?e.POSITION.value:[],l=a&&a.length;for(let e=0;er?l:r,o=A>o?A:o,n=h>n?h:n}return[[t,i,s],[r,o,n]]}(n.attributes),l=function(e,t,i){const s=Lx(t.metadata),r=[],o=function(e){const t={};for(const i in e){const s=e[i];t[s.name||"undefined"]=s}return t}(t.attributes);for(const t in e){const i=Tx(t,e[t],o[t]);r.push(i)}if(i){const e=Tx("indices",i);r.push(e)}return new cx(r,s)}(n.attributes,o,n.indices);return{loader:"draco",loaderData:o,header:{vertexCount:r.num_points(),boundingBox:a},...n,schema:l}}finally{this.draco.destroy(i),r&&this.draco.destroy(r)}}_getDracoLoaderData(e,t,i){const s=this._getTopLevelMetadata(e),r=this._getDracoAttributes(e,i);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:s,attributes:r}}_getDracoAttributes(e,t){const i={};for(let s=0;sthis.decoder[e])).includes(s)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits(),range:t.range(),min_values:new Float32Array([1,2,3]).map((e=>t.min_value(e)))}}finally{this.draco.destroy(t)}}return null}_getOctahedronTransform(e,t){const{octahedronAttributes:i=[]}=t,s=e.attribute_type();if(i.map((e=>this.decoder[e])).includes(s)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits()}}finally{this.draco.destroy(t)}}return null}}const Ox="https://www.gstatic.com/draco/versioned/decoders/".concat("1.4.1","/draco_decoder.js"),Nx="https://www.gstatic.com/draco/versioned/decoders/".concat("1.4.1","/draco_wasm_wrapper.js"),Qx="https://www.gstatic.com/draco/versioned/decoders/".concat("1.4.1","/draco_decoder.wasm");let Vx;async function Hx(e){const t=e.modules||{};return Vx=t.draco3d?Vx||t.draco3d.createDecoderModule({}).then((e=>({draco:e}))):Vx||async function(e){let t,i;if("js"===(e.draco&&e.draco.decoderType))t=await Yb(Ox,"draco",e);else[t,i]=await Promise.all([await Yb(Nx,"draco",e),await Yb(Qx,"draco",e)]);return t=t||globalThis.DracoDecoderModule,await function(e,t){const i={};t&&(i.wasmBinary=t);return new Promise((t=>{e({...i,onModuleLoaded:e=>t({draco:e})})}))}(t,i)}(e),await Vx}const jx={...hx,parse:async function(e,t){const{draco:i}=await Hx(t),s=new kx(i);try{return s.parseSync(e,null==t?void 0:t.draco)}finally{s.destroy()}}};function Gx(e){const{buffer:t,size:i,count:s}=function(e){let t=e,i=1,s=0;e&&e.value&&(t=e.value,i=e.size||1);t&&(ArrayBuffer.isView(t)||(t=function(e,t,i=!1){if(!e)return null;if(Array.isArray(e))return new t(e);if(i&&!(e instanceof t))return new t(e);return e}(t,Float32Array)),s=t.length/i);return{buffer:t,size:i,count:s}}(e);return{value:t,size:i,byteOffset:0,count:s,type:Kw(i),componentType:Xw(t)}}async function zx(e,t,i,s){const r=e.getObjectExtension(t,"KHR_draco_mesh_compression");if(!r)return;const o=e.getTypedArrayForBufferView(r.bufferView),n=sy(o.buffer,o.byteOffset),{parse:a}=s,l={...i};delete l["3d-tiles"];const A=await a(n,jx,l,s),h=function(e){const t={};for(const i in e){const s=e[i];if("indices"!==i){const e=Gx(s);t[i]=e}}return t}(A.attributes);for(const[i,s]of Object.entries(h))if(i in t.attributes){const r=t.attributes[i],o=e.getAccessor(r);null!=o&&o.min&&null!=o&&o.max&&(s.min=o.min,s.max=o.max)}t.attributes=h,A.indices&&(t.indices=Gx(A.indices)),function(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(t)}function Wx(e,t,i=4,s,r){var o;if(!s.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const n=s.DracoWriter.encodeSync({attributes:e}),a=null==r||null===(o=r.parseSync)||void 0===o?void 0:o.call(r,{attributes:e}),l=s._addFauxAttributes(a.attributes);return{primitives:[{attributes:l,mode:i,extensions:{KHR_draco_mesh_compression:{bufferView:s.addBufferView(n),attributes:l}}}]}}function*Kx(e){for(const t of e.json.meshes||[])for(const e of t.primitives)yield e}var Xx=Object.freeze({__proto__:null,name:"KHR_draco_mesh_compression",preprocess:function(e,t,i){const s=new Zw(e);for(const e of Kx(s))s.getObjectExtension(e,"KHR_draco_mesh_compression")},decode:async function(e,t,i){var s;if(null==t||null===(s=t.gltf)||void 0===s||!s.decompressMeshes)return;const r=new Zw(e),o=[];for(const e of Kx(r))r.getObjectExtension(e,"KHR_draco_mesh_compression")&&o.push(zx(r,e,t,i));await Promise.all(o),r.removeExtension("KHR_draco_mesh_compression")},encode:function(e,t={}){const i=new Zw(e);for(const e of i.json.meshes||[])Wx(e),i.addRequiredExtension("KHR_draco_mesh_compression")}});var Jx=Object.freeze({__proto__:null,name:"KHR_lights_punctual",decode:async function(e){const t=new Zw(e),{json:i}=t,s=t.getExtension("KHR_lights_punctual");s&&(t.json.lights=s.lights,t.removeExtension("KHR_lights_punctual"));for(const e of i.nodes||[]){const i=t.getObjectExtension(e,"KHR_lights_punctual");i&&(e.light=i.light),t.removeObjectExtension(e,"KHR_lights_punctual")}},encode:async function(e){const t=new Zw(e),{json:i}=t;if(i.lights){const e=t.addExtension("KHR_lights_punctual");Nw(!e.lights),e.lights=i.lights,delete i.lights}if(t.json.lights){for(const e of t.json.lights){const i=e.node;t.addObjectExtension(i,"KHR_lights_punctual",e)}delete t.json.lights}}});function Yx(e,t){const i=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach((t=>{e.uniforms[t].value&&!(t in i)&&(i[t]=e.uniforms[t].value)})),Object.keys(i).forEach((e=>{"object"==typeof i[e]&&void 0!==i[e].index&&(i[e].texture=t.getTexture(i[e].index))})),i}const Zx=[ax,lx,Ax,Xx,Jx,Object.freeze({__proto__:null,name:"KHR_materials_unlit",decode:async function(e){const t=new Zw(e),{json:i}=t;t.removeExtension("KHR_materials_unlit");for(const e of i.materials||[]){e.extensions&&e.extensions.KHR_materials_unlit&&(e.unlit=!0),t.removeObjectExtension(e,"KHR_materials_unlit")}},encode:function(e){const t=new Zw(e),{json:i}=t;if(t.materials)for(const e of i.materials||[])e.unlit&&(delete e.unlit,t.addObjectExtension(e,"KHR_materials_unlit",{}),t.addExtension("KHR_materials_unlit"))}}),Object.freeze({__proto__:null,name:"KHR_techniques_webgl",decode:async function(e){const t=new Zw(e),{json:i}=t,s=t.getExtension("KHR_techniques_webgl");if(s){const e=function(e,t){const{programs:i=[],shaders:s=[],techniques:r=[]}=e,o=new TextDecoder;return s.forEach((e=>{if(!Number.isFinite(e.bufferView))throw new Error("KHR_techniques_webgl: no shader code");e.code=o.decode(t.getTypedArrayForBufferView(e.bufferView))})),i.forEach((e=>{e.fragmentShader=s[e.fragmentShader],e.vertexShader=s[e.vertexShader]})),r.forEach((e=>{e.program=i[e.program]})),r}(s,t);for(const s of i.materials||[]){const i=t.getObjectExtension(s,"KHR_techniques_webgl");i&&(s.technique=Object.assign({},i,e[i.technique]),s.technique.values=Yx(s.technique,t)),t.removeObjectExtension(s,"KHR_techniques_webgl")}t.removeExtension("KHR_techniques_webgl")}},encode:async function(e,t){}})];function qx(e,t){var i;const s=(null==t||null===(i=t.gltf)||void 0===i?void 0:i.excludeExtensions)||{};return!(e in s&&!s[e])}const $x={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},eP={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class tP{constructor(){Rb(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),Rb(this,"json",void 0)}normalize(e,t){this.json=e.json;const i=e.json;switch(i.asset&&i.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version ".concat(i.asset.version))}if(!t.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(i),this._convertTopLevelObjectsToArrays(i),function(e){const t=new Zw(e),{json:i}=t;for(const e of i.images||[]){const i=t.getObjectExtension(e,"KHR_binary_glTF");i&&Object.assign(e,i),t.removeObjectExtension(e,"KHR_binary_glTF")}i.buffers&&i.buffers[0]&&delete i.buffers[0].uri,t.removeExtension("KHR_binary_glTF")}(e),this._convertObjectIdsToArrayIndices(i),this._updateObjects(i),this._updateMaterial(i)}_addAsset(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(e){for(const t in $x)this._convertTopLevelObjectToArray(e,t)}_convertTopLevelObjectToArray(e,t){const i=e[t];if(i&&!Array.isArray(i)){e[t]=[];for(const s in i){const r=i[s];r.id=r.id||s;const o=e[t].length;e[t].push(r),this.idToIndexMap[t][s]=o}}}_convertObjectIdsToArrayIndices(e){for(const t in $x)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(const t of e.textures)this._convertTextureIds(t);for(const t of e.meshes)this._convertMeshIds(t);for(const t of e.nodes)this._convertNodeIds(t);for(const t of e.scenes)this._convertSceneIds(t)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(const t of e.primitives){const{attributes:e,indices:i,material:s}=t;for(const t in e)e[t]=this._convertIdToIndex(e[t],"accessor");i&&(t.indices=this._convertIdToIndex(i,"accessor")),s&&(t.material=this._convertIdToIndex(s,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map((e=>this._convertIdToIndex(e,"node")))),e.meshes&&(e.meshes=e.meshes.map((e=>this._convertIdToIndex(e,"mesh"))))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map((e=>this._convertIdToIndex(e,"node"))))}_convertIdsToIndices(e,t){e[t]||(console.warn("gltf v1: json doesn't contain attribute ".concat(t)),e[t]=[]);for(const i of e[t])for(const e in i){const t=i[e],s=this._convertIdToIndex(t,e);i[e]=s}}_convertIdToIndex(e,t){const i=eP[t];if(i in this.idToIndexMap){const s=this.idToIndexMap[i][e];if(!Number.isFinite(s))throw new Error("gltf v1: failed to resolve ".concat(t," with id ").concat(e));return s}return e}_updateObjects(e){for(const e of this.json.buffers)delete e.type}_updateMaterial(e){for(const s of e.materials){var t,i;s.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const r=(null===(t=s.values)||void 0===t?void 0:t.tex)||(null===(i=s.values)||void 0===i?void 0:i.texture2d_0),o=e.textures.findIndex((e=>e.id===r));-1!==o&&(s.pbrMetallicRoughness.baseColorTexture={index:o})}}}const iP={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},sP={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},rP=10240,oP=10241,nP=10242,aP=10243,lP=10497,AP={magFilter:rP,minFilter:oP,wrapS:nP,wrapT:aP},hP={[rP]:9729,[oP]:9986,[nP]:lP,[aP]:lP};class cP{constructor(){Rb(this,"baseUri",""),Rb(this,"json",{}),Rb(this,"buffers",[]),Rb(this,"images",[])}postProcess(e,t={}){const{json:i,buffers:s=[],images:r=[],baseUri:o=""}=e;return Nw(i),this.baseUri=o,this.json=i,this.buffers=s,this.images=r,this._resolveTree(this.json,t),this.json}_resolveTree(e,t={}){e.bufferViews&&(e.bufferViews=e.bufferViews.map(((e,t)=>this._resolveBufferView(e,t)))),e.images&&(e.images=e.images.map(((e,t)=>this._resolveImage(e,t)))),e.samplers&&(e.samplers=e.samplers.map(((e,t)=>this._resolveSampler(e,t)))),e.textures&&(e.textures=e.textures.map(((e,t)=>this._resolveTexture(e,t)))),e.accessors&&(e.accessors=e.accessors.map(((e,t)=>this._resolveAccessor(e,t)))),e.materials&&(e.materials=e.materials.map(((e,t)=>this._resolveMaterial(e,t)))),e.meshes&&(e.meshes=e.meshes.map(((e,t)=>this._resolveMesh(e,t)))),e.nodes&&(e.nodes=e.nodes.map(((e,t)=>this._resolveNode(e,t)))),e.skins&&(e.skins=e.skins.map(((e,t)=>this._resolveSkin(e,t)))),e.scenes&&(e.scenes=e.scenes.map(((e,t)=>this._resolveScene(e,t)))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene])}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const i=this.json[e]&&this.json[e][t];return i||console.warn("glTF file error: Could not find ".concat(e,"[").concat(t,"]")),i}_resolveScene(e,t){return e.id=e.id||"scene-".concat(t),e.nodes=(e.nodes||[]).map((e=>this.getNode(e))),e}_resolveNode(e,t){return e.id=e.id||"node-".concat(t),e.children&&(e.children=e.children.map((e=>this.getNode(e)))),void 0!==e.mesh?e.mesh=this.getMesh(e.mesh):void 0!==e.meshes&&e.meshes.length&&(e.mesh=e.meshes.reduce(((e,t)=>{const i=this.getMesh(t);return e.id=i.id,e.primitives=e.primitives.concat(i.primitives),e}),{primitives:[]})),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}_resolveSkin(e,t){return e.id=e.id||"skin-".concat(t),e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}_resolveMesh(e,t){return e.id=e.id||"mesh-".concat(t),e.primitives&&(e.primitives=e.primitives.map((e=>{const t=(e={...e}).attributes;e.attributes={};for(const i in t)e.attributes[i]=this.getAccessor(t[i]);return void 0!==e.indices&&(e.indices=this.getAccessor(e.indices)),void 0!==e.material&&(e.material=this.getMaterial(e.material)),e}))),e}_resolveMaterial(e,t){if(e.id=e.id||"material-".concat(t),e.normalTexture&&(e.normalTexture={...e.normalTexture},e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture={...e.occlustionTexture},e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture={...e.emmisiveTexture},e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.emissiveFactor||(e.emissiveFactor=e.emmisiveTexture?[1,1,1]:[0,0,0]),e.pbrMetallicRoughness){e.pbrMetallicRoughness={...e.pbrMetallicRoughness};const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return e}_resolveAccessor(e,t){var i,s;if(e.id=e.id||"accessor-".concat(t),void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(i=e.componentType,sP[i]),e.components=(s=e.type,iP[s]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){const t=e.bufferView.buffer,{ArrayType:i,byteLength:s}=Jw(e,e.bufferView),r=(e.bufferView.byteOffset||0)+(e.byteOffset||0)+t.byteOffset;let o=t.arrayBuffer.slice(r,r+s);e.bufferView.byteStride&&(o=this._getValueFromInterleavedBuffer(t,r,e.bufferView.byteStride,e.bytesPerElement,e.count)),e.value=new i(o)}return e}_getValueFromInterleavedBuffer(e,t,i,s,r){const o=new Uint8Array(r*s);for(let n=0;n20);const s=t.getUint32(i+0,dP),r=t.getUint32(i+4,dP);return i+=8,Pb(0===r),fP(e,t,i,s),i+=s,i+=gP(e,t,i,e.header.byteLength)}(e,r,i);case 2:return function(e,t,i,s){return Pb(e.header.byteLength>20),function(e,t,i,s){for(;i+8<=e.header.byteLength;){const r=t.getUint32(i+0,dP),o=t.getUint32(i+4,dP);switch(i+=8,o){case 1313821514:fP(e,t,i,r);break;case 5130562:gP(e,t,i,r);break;case 0:s.strict||fP(e,t,i,r);break;case 1:s.strict||gP(e,t,i,r)}i+=ry(r,4)}}(e,t,i,s),i+e.header.byteLength}(e,r,i,{});default:throw new Error("Invalid GLB version ".concat(e.version,". Only supports v1 and v2."))}}function fP(e,t,i,s){const r=new Uint8Array(t.buffer,i,s),o=new TextDecoder("utf8").decode(r);return e.json=JSON.parse(o),ry(s,4)}function gP(e,t,i,s){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:i,byteLength:s,arrayBuffer:t.buffer}),ry(s,4)}async function mP(e,t,i=0,s,r){var o,n,a,l;!function(e,t,i,s){s.uri&&(e.baseUri=s.uri);if(t instanceof ArrayBuffer&&!function(e,t=0,i={}){const s=new DataView(e),{magic:r=uP}=i,o=s.getUint32(t,!1);return o===r||o===uP}(t,i,s)){t=(new TextDecoder).decode(t)}if("string"==typeof t)e.json=ey(t);else if(t instanceof ArrayBuffer){const r={};i=pP(r,t,i,s.glb),Nw("glTF"===r.type,"Invalid GLB magic string ".concat(r.type)),e._glb=r,e.json=r.json}else Nw(!1,"GLTF: must be ArrayBuffer or string");const r=e.json.buffers||[];if(e.buffers=new Array(r.length).fill(null),e._glb&&e._glb.header.hasBinChunk){const{binChunks:t}=e._glb;e.buffers[0]={arrayBuffer:t[0].arrayBuffer,byteOffset:t[0].byteOffset,byteLength:t[0].byteLength}}const o=e.json.images||[];e.images=new Array(o.length).fill({})}(e,t,i,s),function(e,t={}){(new tP).normalize(e,t)}(e,{normalize:null==s||null===(o=s.gltf)||void 0===o?void 0:o.normalize}),function(e,t={},i){const s=Zx.filter((e=>qx(e.name,t)));for(const o of s){var r;null===(r=o.preprocess)||void 0===r||r.call(o,e,t,i)}}(e,s,r);const A=[];if(null!=s&&null!==(n=s.gltf)&&void 0!==n&&n.loadBuffers&&e.json.buffers&&await async function(e,t,i){const s=e.json.buffers||[];for(let n=0;nqx(e.name,t)));for(const o of s){var r;await(null===(r=o.decode)||void 0===r?void 0:r.call(o,e,t,i))}}(e,s,r);return A.push(h),await Promise.all(A),null!=s&&null!==(l=s.gltf)&&void 0!==l&&l.postProcess?function(e,t){return(new cP).postProcess(e,t)}(e,s):e}async function _P(e,t,i,s,r){const{fetch:o,parse:n}=r;let a;if(t.uri){const e=Qw(t.uri,s),i=await o(e);a=await i.arrayBuffer()}if(Number.isFinite(t.bufferView)){const i=function(e,t,i){const s=e.bufferViews[i];Nw(s);const r=t[s.buffer];Nw(r);const o=(s.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,o,s.byteLength)}(e.json,e.buffers,t.bufferView);a=sy(i.buffer,i.byteOffset,i.byteLength)}Nw(a,"glTF image has no data");let l=await n(a,[Rw,_w],{mimeType:t.mimeType,basis:s.basis||{format:mw()}},r);l&&l[0]&&(l={compressed:!0,mipmaps:!1,width:l[0].width,height:l[0].height,data:l[0]}),e.images=e.images||[],e.images[i]=l}const vP={name:"glTF",id:"gltf",module:"gltf",version:"3.2.6",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:async function(e,t={},i){(t={...vP.options,...t}).gltf={...vP.options.gltf,...t.gltf};const{byteOffset:s=0}=t;return await mP({},e,s,t,i)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0,postProcess:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes"}}};class bP{constructor(e){}load(e,t,i,s,r,o,n){!function(e,t,i,s,r,o,n){const a=e.viewer.scene.canvas.spinner;a.processes++;"glb"===t.split(".").pop()?e.dataSource.getGLB(t,(n=>{s.basePath=BP(t),wP(e,t,n,i,s,r,o),a.processes--}),(e=>{a.processes--,n(e)})):e.dataSource.getGLTF(t,(n=>{s.basePath=BP(t),wP(e,t,n,i,s,r,o),a.processes--}),(e=>{a.processes--,n(e)}))}(e,t,i,s=s||{},r,(function(){I.scheduleTask((function(){r.scene.fire("modelLoaded",r.id),r.fire("loaded",!0,!1)})),o&&o()}),(function(t){e.error(t),n&&n(t),r.fire("error",t)}))}parse(e,t,i,s,r,o,n){wP(e,"",t,i,s=s||{},r,(function(){r.scene.fire("modelLoaded",r.id),r.fire("loaded",!0,!1),o&&o()}))}}function yP(e){const t={},i={},s=e.metaObjects||[],r={};for(let e=0,t=s.length;e{const l={src:t,entityId:r.entityId,metaModelCorrections:s?yP(s):null,loadBuffer:r.loadBuffer,basePath:r.basePath,handlenode:r.handlenode,backfaces:!!r.backfaces,gltfData:i,scene:o.scene,plugin:e,sceneModel:o,numObjects:0,nodes:[],nextId:0,log:t=>{e.log(t)}};!function(e){const t=e.gltfData.textures;if(t)for(let i=0,s=t.length;i0)for(let t=0;t0){null==s&&e.log("Warning: 'name' properties not found on glTF scene nodes - will randomly-generate object IDs in XKT");let t=s;if(e.metaModelCorrections){const i=e.metaModelCorrections.eachChildRoot[t];if(i){const t=e.metaModelCorrections.eachRootStats[i.id];t.countChildren++,t.countChildren>=t.numChildren&&(o.createEntity({id:i.id,meshIds:EP,isObject:!0}),EP.length=0)}else{e.metaModelCorrections.metaObjectsMap[t]&&(o.createEntity({id:t,meshIds:EP,isObject:!0}),EP.length=0)}}else o.createEntity({id:t,meshIds:EP,isObject:!0}),EP.length=0}}}function IP(e,t){e.plugin.error(t)}const DP={DEFAULT:{}};class SP extends z{constructor(e,t={}){super("GLTFLoader",e,t),this._sceneModelLoader=new bP(this,t),this.dataSource=t.dataSource,this.objectDefaults=t.objectDefaults}set dataSource(e){this._dataSource=e||new qc}get dataSource(){return this._dataSource}set objectDefaults(e){this._objectDefaults=e||DP}get objectDefaults(){return this._objectDefaults}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new Fc(this.viewer.scene,y.apply(e,{isModel:!0,dtxEnabled:e.dtxEnabled})),i=t.id;if(!e.src&&!e.gltf)return this.error("load() param expected: src or gltf"),t;if(e.metaModelSrc||e.metaModelJSON){const s=e.objectDefaults||this._objectDefaults||DP,r=r=>{let o;if(this.viewer.metaScene.createMetaModel(i,r,{includeTypes:e.includeTypes,excludeTypes:e.excludeTypes}),this.viewer.scene.canvas.spinner.processes--,e.includeTypes){o={};for(let t=0,i=e.includeTypes.length;t{const r=t.name;if(!r)return!0;const o=r,n=this.viewer.metaScene.metaObjects[o],a=(n?n.type:"DEFAULT")||"DEFAULT";i.createEntity={id:o,isObject:!0};const l=s[a];return l&&(!1===l.visible&&(i.createEntity.visible=!1),l.colorize&&(i.createEntity.colorize=l.colorize),!1===l.pickable&&(i.createEntity.pickable=!1),void 0!==l.opacity&&null!==l.opacity&&(i.createEntity.opacity=l.opacity)),!0},e.src?this._sceneModelLoader.load(this,e.src,r,e,t):this._sceneModelLoader.parse(this,e.gltf,r,e,t)};if(e.metaModelSrc){const t=e.metaModelSrc;this.viewer.scene.canvas.spinner.processes++,this._dataSource.getMetaModel(t,(e=>{this.viewer.scene.canvas.spinner.processes--,r(e)}),(e=>{this.error(`load(): Failed to load model metadata for model '${i} from '${t}' - ${e}`),this.viewer.scene.canvas.spinner.processes--}))}else e.metaModelJSON&&r(e.metaModelJSON)}else e.handleGLTFNode=(e,t,i)=>{const s=t.name;if(!s)return!0;const r=s;return i.createEntity={id:r,isObject:!0},!0},e.src?this._sceneModelLoader.load(this,e.src,null,e,t):this._sceneModelLoader.parse(this,e.gltf,null,e,t);return t.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(i)})),t}destroy(){super.destroy()}}function TP(e,t,i={}){const s="lightgrey",r=i.hoverColor||"rgba(0,0,0,0.4)",o=i.textColor||"black",n=500,a=n+n/3,l=a/24,A=[{boundary:[6,6,6,6],color:i.frontColor||i.color||"#55FF55"},{boundary:[18,6,6,6],color:i.backColor||i.color||"#55FF55"},{boundary:[12,6,6,6],color:i.rightColor||i.color||"#FF5555"},{boundary:[0,6,6,6],color:i.leftColor||i.color||"#FF5555"},{boundary:[6,0,6,6],color:i.topColor||i.color||"#7777FF"},{boundary:[6,12,6,6],color:i.bottomColor||i.color||"#7777FF"}],h=[{label:"NavCube.front",boundaries:[[7,7,4,4]],dir:[0,1,0],up:[0,0,1]},{label:"NavCube.back",boundaries:[[19,7,4,4]],dir:[0,-1,0],up:[0,0,1]},{label:"NavCube.right",boundaries:[[13,7,4,4]],dir:[-1,0,0],up:[0,0,1]},{label:"NavCube.left",boundaries:[[1,7,4,4]],dir:[1,0,0],up:[0,0,1]},{label:"NavCube.top",boundaries:[[7,1,4,4]],dir:[0,0,-1],up:[0,1,0]},{label:"NavCube.bottom",boundaries:[[7,13,4,4]],dir:[0,0,1],up:[0,-1,0]},{boundaries:[[7,5,4,2]],dir:[0,1,-1],up:[0,1,1]},{boundaries:[[1,6,4,1],[6,1,1,4]],dir:[1,0,-1],up:[1,0,1]},{boundaries:[[7,0,4,1],[19,6,4,1]],dir:[0,-1,-1],up:[0,-1,1]},{boundaries:[[13,6,4,1],[11,1,1,4]],dir:[-1,0,-1],up:[-1,0,1]},{boundaries:[[7,11,4,2]],dir:[0,1,1],up:[0,-1,1]},{boundaries:[[1,11,4,1],[6,13,1,4]],dir:[1,0,1],up:[-1,0,1]},{boundaries:[[7,17,4,1],[19,11,4,1]],dir:[0,-1,1],up:[0,1,1]},{boundaries:[[13,11,4,1],[11,13,1,4]],dir:[-1,0,1],up:[1,0,1]},{boundaries:[[5,7,2,4]],dir:[1,1,0],up:[0,0,1]},{boundaries:[[11,7,2,4]],dir:[-1,1,0],up:[0,0,1]},{boundaries:[[17,7,2,4]],dir:[-1,-1,0],up:[0,0,1]},{boundaries:[[0,7,1,4],[23,7,1,4]],dir:[1,-1,0],up:[0,0,1]},{boundaries:[[5,11,2,2]],dir:[1,1,1],up:[-1,-1,1]},{boundaries:[[23,11,1,1],[6,17,1,1],[0,11,1,1]],dir:[1,-1,1],up:[-1,1,1]},{boundaries:[[5,5,2,2]],dir:[1,1,-1],up:[1,1,1]},{boundaries:[[11,17,1,1],[17,11,2,1]],dir:[-1,-1,1],up:[1,1,1]},{boundaries:[[17,6,2,1],[11,0,1,1]],dir:[-1,-1,-1],up:[-1,-1,1]},{boundaries:[[11,11,2,2]],dir:[-1,1,1],up:[1,-1,1]},{boundaries:[[0,6,1,1],[6,0,1,1],[23,6,1,1]],dir:[1,-1,-1],up:[1,-1,1]},{boundaries:[[11,5,2,2]],dir:[-1,1,-1],up:[-1,1,1]}];i.frontColor||i.color,i.backColor||i.color,i.rightColor||i.color,i.leftColor||i.color,i.topColor||i.color,i.bottomColor||i.color;const c=[{yUp:"",label:"NavCube.front",boundaries:[[7,7,4,4]],dir:[0,0,-1],up:[0,1,0]},{label:"NavCube.back",boundaries:[[19,7,4,4]],dir:[0,0,1],up:[0,1,0]},{label:"NavCube.right",boundaries:[[13,7,4,4]],dir:[-1,0,0],up:[0,1,0]},{label:"NavCube.left",boundaries:[[1,7,4,4]],dir:[1,0,0],up:[0,1,0]},{label:"NavCube.top",boundaries:[[7,1,4,4]],dir:[0,-1,0],up:[0,0,-1]},{label:"NavCube.bottom",boundaries:[[7,13,4,4]],dir:[0,1,0],up:[0,0,1]},{boundaries:[[7,5,4,2]],dir:[0,-.7071,-.7071],up:[0,.7071,-.7071]},{boundaries:[[1,6,4,1],[6,1,1,4]],dir:[1,-1,0],up:[1,1,0]},{boundaries:[[7,0,4,1],[19,6,4,1]],dir:[0,-.7071,.7071],up:[0,.7071,.7071]},{boundaries:[[13,6,4,1],[11,1,1,4]],dir:[-1,-1,0],up:[-1,1,0]},{boundaries:[[7,11,4,2]],dir:[0,1,-1],up:[0,1,1]},{boundaries:[[1,11,4,1],[6,13,1,4]],dir:[1,1,0],up:[-1,1,0]},{boundaries:[[7,17,4,1],[19,11,4,1]],dir:[0,1,1],up:[0,1,-1]},{boundaries:[[13,11,4,1],[11,13,1,4]],dir:[-1,1,0],up:[1,1,0]},{boundaries:[[5,7,2,4]],dir:[1,0,-1],up:[0,1,0]},{boundaries:[[11,7,2,4]],dir:[-1,0,-1],up:[0,1,0]},{boundaries:[[17,7,2,4]],dir:[-1,0,1],up:[0,1,0]},{boundaries:[[0,7,1,4],[23,7,1,4]],dir:[1,0,1],up:[0,1,0]},{boundaries:[[5,11,2,2]],dir:[.5,.7071,-.5],up:[-.5,.7071,.5]},{boundaries:[[23,11,1,1],[6,17,1,1],[0,11,1,1]],dir:[.5,.7071,.5],up:[-.5,.7071,-.5]},{boundaries:[[5,5,2,2]],dir:[.5,-.7071,-.5],up:[.5,.7071,-.5]},{boundaries:[[11,17,1,1],[17,11,2,1]],dir:[-.5,.7071,.5],up:[.5,.7071,-.5]},{boundaries:[[17,6,2,1],[11,0,1,1]],dir:[-.5,-.7071,.5],up:[-.5,.7071,.5]},{boundaries:[[11,11,2,2]],dir:[-.5,.7071,-.5],up:[.5,.7071,.5]},{boundaries:[[0,6,1,1],[6,0,1,1],[23,6,1,1]],dir:[.5,-.7071,.5],up:[.5,.7071,.5]},{boundaries:[[11,5,2,2]],dir:[-.5,-.7071,-.5],up:[-.5,.7071,-.5]}];for(let e=0,t=h.length;e=r[0]*l&&t<=(r[0]+r[2])*l&&i>=r[1]*l&&i<=(r[1]+r[3])*l)return s}}return-1},this.setAreaHighlighted=function(e,t){var i=u[e];if(!i)throw"Area not found: "+e;i.highlighted=!!t,g()},this.getAreaDir=function(e){var t=u[e];if(!t)throw"Unknown area: "+e;return t.dir},this.getAreaUp=function(e){var t=u[e];if(!t)throw"Unknown area: "+e;return t.up},this.getImage=function(){return this._textureCanvas},this.destroy=function(){this._textureCanvas&&(this._textureCanvas.parentNode.removeChild(this._textureCanvas),this._textureCanvas=null)}}const LP=d.vec3(),RP=d.vec3();d.mat4();class UP extends z{constructor(e,t={}){super("NavCube",e,t),e.navCube=this;try{this._navCubeScene=new _i(e,{canvasId:t.canvasId,canvasElement:t.canvasElement,transparent:!0}),this._navCubeCanvas=this._navCubeScene.canvas.canvas,this._navCubeScene.input.keyboardEnabled=!1}catch(e){return void this.error(e)}const i=this._navCubeScene;i.clearLights(),new Qt(i,{dir:[.4,-.4,.8],color:[.8,1,1],intensity:1,space:"view"}),new Qt(i,{dir:[-.8,-.3,-.4],color:[.8,.8,.8],intensity:1,space:"view"}),new Qt(i,{dir:[.8,-.6,-.8],color:[1,1,1],intensity:1,space:"view"}),this._navCubeCamera=i.camera,this._navCubeCamera.ortho.scale=7,this._navCubeCamera.ortho.near=.1,this._navCubeCamera.ortho.far=2e3,i.edgeMaterial.edgeColor=[.2,.2,.2],i.edgeMaterial.edgeAlpha=.6,this._zUp=Boolean(e.camera.zUp);var s=this;this.setIsProjectNorth(t.isProjectNorth),this.setProjectNorthOffsetAngle(t.projectNorthOffsetAngle);const r=function(){const e=d.mat4();return function(t,i,r){return d.identityMat4(e),d.rotationMat4v(t*s._projectNorthOffsetAngle*d.DEGTORAD,[0,1,0],e),d.transformVec3(e,i,r)}}();this._synchCamera=function(){var t=d.rotationMat4c(-90*d.DEGTORAD,1,0,0),i=d.vec3(),o=d.vec3(),n=d.vec3();return function(){var a=e.camera.eye,l=e.camera.look,A=e.camera.up;i=d.mulVec3Scalar(d.normalizeVec3(d.subVec3(a,l,i)),5),s._isProjectNorth&&s._projectNorthOffsetAngle&&(i=r(-1,i,LP),A=r(-1,A,RP)),s._zUp?(d.transformVec3(t,i,o),d.transformVec3(t,A,n),s._navCubeCamera.look=[0,0,0],s._navCubeCamera.eye=d.transformVec3(t,i,o),s._navCubeCamera.up=d.transformPoint3(t,A,n)):(s._navCubeCamera.look=[0,0,0],s._navCubeCamera.eye=i,s._navCubeCamera.up=A)}}(),this._cubeTextureCanvas=new TP(e,i,t),this._cubeSampler=new io(i,{image:this._cubeTextureCanvas.getImage(),flipY:!0,wrapS:1001,wrapT:1001}),this._cubeMesh=new wr(i,{geometry:new $t(i,{primitive:"triangles",normals:[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1],uv:[.5,.6666,.25,.6666,.25,.3333,.5,.3333,.5,.6666,.5,.3333,.75,.3333,.75,.6666,.5,.6666,.5,1,.25,1,.25,.6666,.25,.6666,0,.6666,0,.3333,.25,.3333,.25,0,.5,0,.5,.3333,.25,.3333,.75,.3333,1,.3333,1,.6666,.75,.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),material:new ri(i,{diffuse:[.4,.4,.4],specular:[.4,.4,.4],emissive:[.6,.6,.6],diffuseMap:this._cubeSampler,emissiveMap:this._cubeSampler}),visible:!0,edges:!0}),this._shadow=!1===t.shadowVisible?null:new wr(i,{geometry:new $t(i,Pr({center:[0,0,0],radiusTop:.001,radiusBottom:1.4,height:.01,radialSegments:20,heightSegments:1,openEnded:!0})),material:new ri(i,{diffuse:[0,0,0],specular:[0,0,0],emissive:[0,0,0],alpha:.5}),position:[0,-1.5,0],visible:!0,pickable:!1,backfaces:!1}),this._onCameraMatrix=e.camera.on("matrix",this._synchCamera),this._onCameraWorldAxis=e.camera.on("worldAxis",(()=>{e.camera.zUp?(this._zUp=!0,this._cubeTextureCanvas.setZUp(),this._repaint(),this._synchCamera()):e.camera.yUp&&(this._zUp=!1,this._cubeTextureCanvas.setYUp(),this._repaint(),this._synchCamera())})),this._onCameraFOV=e.camera.perspective.on("fov",(e=>{this._synchProjection&&(this._navCubeCamera.perspective.fov=e)})),this._onCameraProjection=e.camera.on("projection",(e=>{this._synchProjection&&(this._navCubeCamera.projection="ortho"===e||"perspective"===e?e:"perspective")}));var o=-1;function n(e){var t=[0,0];if(e){for(var i=e.target,s=0,r=0;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;t[0]=e.pageX-s,t[1]=e.pageY-r}else e=window.event,t[0]=e.x,t[1]=e.y;return t}var a,l,A=null,h=null,c=!1,u=!1,p=.5;s._navCubeCanvas.addEventListener("mouseenter",s._onMouseEnter=function(e){u=!0}),s._navCubeCanvas.addEventListener("mouseleave",s._onMouseLeave=function(e){u=!1}),s._navCubeCanvas.addEventListener("mousedown",s._onMouseDown=function(e){if(1===e.which){A=e.x,h=e.y,a=e.clientX,l=e.clientY;var t=n(e),s=i.pick({canvasPos:t});c=!!s}}),document.addEventListener("mouseup",s._onMouseUp=function(e){if(1===e.which&&(c=!1,null!==A)){var t=n(e),a=i.pick({canvasPos:t,pickSurface:!0});if(a&&a.uv){var l=s._cubeTextureCanvas.getArea(a.uv);if(l>=0&&(document.body.style.cursor="pointer",o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),l>=0)){if(s._cubeTextureCanvas.setAreaHighlighted(l,!0),o=l,s._repaint(),e.xA+3||e.yh+3)return;var u=s._cubeTextureCanvas.getAreaDir(l);if(u){var d=s._cubeTextureCanvas.getAreaUp(l);s._isProjectNorth&&s._projectNorthOffsetAngle&&(u=r(1,u,LP),d=r(1,d,RP)),f(u,d,(function(){o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),document.body.style.cursor="pointer",o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),l>=0&&(s._cubeTextureCanvas.setAreaHighlighted(l,!1),o=-1,s._repaint())}))}}}}}),document.addEventListener("mousemove",s._onMouseMove=function(t){if(o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1),1!==t.buttons||c){if(c){var r=t.clientX,A=t.clientY;return document.body.style.cursor="move",void function(t,i){var s=(t-a)*-p,r=(i-l)*-p;e.camera.orbitYaw(s),e.camera.orbitPitch(-r),a=t,l=i}(r,A)}if(u){var h=n(t),d=i.pick({canvasPos:h,pickSurface:!0});if(d){if(d.uv){document.body.style.cursor="pointer";var f=s._cubeTextureCanvas.getArea(d.uv);if(f===o)return;o>=0&&s._cubeTextureCanvas.setAreaHighlighted(o,!1),f>=0&&(s._cubeTextureCanvas.setAreaHighlighted(f,!0),s._repaint(),o=f)}}else document.body.style.cursor="default",o>=0&&(s._cubeTextureCanvas.setAreaHighlighted(o,!1),s._repaint(),o=-1)}}});var f=function(){var t=d.vec3();return function(i,r,o){var n=s._fitVisible?e.scene.getAABB(e.scene.visibleObjectIds):e.scene.aabb,a=d.getAABB3Diag(n);d.getAABB3Center(n,t);var l=Math.abs(a/Math.tan(s._cameraFitFOV*d.DEGTORAD));e.cameraControl.pivotPos=t,s._cameraFly?e.cameraFlight.flyTo({look:t,eye:[t[0]-l*i[0],t[1]-l*i[1],t[2]-l*i[2]],up:r||[0,1,0],orthoScale:1.1*a,fitFOV:s._cameraFitFOV,duration:s._cameraFlyDuration},o):e.cameraFlight.jumpTo({look:t,eye:[t[0]-l*i[0],t[1]-l*i[1],t[2]-l*i[2]],up:r||[0,1,0],orthoScale:1.1*a,fitFOV:s._cameraFitFOV},o)}}();this._onUpdated=e.localeService.on("updated",(()=>{this._cubeTextureCanvas.clear(),this._repaint()})),this.setVisible(t.visible),this.setCameraFitFOV(t.cameraFitFOV),this.setCameraFly(t.cameraFly),this.setCameraFlyDuration(t.cameraFlyDuration),this.setFitVisible(t.fitVisible),this.setSynchProjection(t.synchProjection)}send(e,t){if("language"===e)this._cubeTextureCanvas.clear(),this._repaint()}_repaint(){const e=this._cubeTextureCanvas.getImage();this._cubeMesh.material.diffuseMap.image=e,this._cubeMesh.material.emissiveMap.image=e}setVisible(e=!0){this._navCubeCanvas&&(this._cubeMesh.visible=e,this._shadow&&(this._shadow.visible=e),this._navCubeCanvas.style.visibility=e?"visible":"hidden")}getVisible(){return!!this._navCubeCanvas&&this._cubeMesh.visible}setFitVisible(e=!1){this._fitVisible=e}getFitVisible(){return this._fitVisible}setCameraFly(e=!0){this._cameraFly=e}getCameraFly(){return this._cameraFly}setCameraFitFOV(e=45){this._cameraFitFOV=e}getCameraFitFOV(){return this._cameraFitFOV}setCameraFlyDuration(e=.5){this._cameraFlyDuration=e}getCameraFlyDuration(){return this._cameraFlyDuration}setSynchProjection(e=!1){this._synchProjection=e}getSynchProjection(){return this._synchProjection}setIsProjectNorth(e=!1){this._isProjectNorth=e}getIsProjectNorth(){return this._isProjectNorth}setProjectNorthOffsetAngle(e){this._projectNorthOffsetAngle=e}getProjectNorthOffsetAngle(){return this._projectNorthOffsetAngle}destroy(){this._navCubeCanvas&&(this.viewer.localeService.off(this._onUpdated),this.viewer.camera.off(this._onCameraMatrix),this.viewer.camera.off(this._onCameraWorldAxis),this.viewer.camera.perspective.off(this._onCameraFOV),this.viewer.camera.off(this._onCameraProjection),this._navCubeCanvas.removeEventListener("mouseenter",this._onMouseEnter),this._navCubeCanvas.removeEventListener("mouseleave",this._onMouseLeave),this._navCubeCanvas.removeEventListener("mousedown",this._onMouseDown),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._navCubeCanvas=null,this._cubeTextureCanvas.destroy(),this._cubeTextureCanvas=null,this._onMouseEnter=null,this._onMouseLeave=null,this._onMouseDown=null,this._onMouseMove=null,this._onMouseUp=null),this._navCubeScene.destroy(),this._navCubeScene=null,this._cubeMesh=null,this._shadow=null,super.destroy()}}const kP=d.vec3();class OP{load(e,t,i={}){var s=e.scene.canvas.spinner;s.processes++,NP(e,t,(function(t){!function(e,t,i){for(var s=t.basePath,r=Object.keys(t.materialLibraries),o=r.length,n=0,a=o;n=0?i-1:i+t/3)}function r(e,t){var i=parseInt(e,10);return 3*(i>=0?i-1:i+t/3)}function o(e,t){var i=parseInt(e,10);return 2*(i>=0?i-1:i+t/2)}function n(e,t,i,s){var r=e.positions,o=e.object.geometry.positions;o.push(r[t+0]),o.push(r[t+1]),o.push(r[t+2]),o.push(r[i+0]),o.push(r[i+1]),o.push(r[i+2]),o.push(r[s+0]),o.push(r[s+1]),o.push(r[s+2])}function a(e,t){var i=e.positions,s=e.object.geometry.positions;s.push(i[t+0]),s.push(i[t+1]),s.push(i[t+2])}function l(e,t,i,s){var r=e.normals,o=e.object.geometry.normals;o.push(r[t+0]),o.push(r[t+1]),o.push(r[t+2]),o.push(r[i+0]),o.push(r[i+1]),o.push(r[i+2]),o.push(r[s+0]),o.push(r[s+1]),o.push(r[s+2])}function A(e,t,i,s){var r=e.uv,o=e.object.geometry.uv;o.push(r[t+0]),o.push(r[t+1]),o.push(r[i+0]),o.push(r[i+1]),o.push(r[s+0]),o.push(r[s+1])}function h(e,t){var i=e.uv,s=e.object.geometry.uv;s.push(i[t+0]),s.push(i[t+1])}function c(e,t,i,a,h,c,u,d,p,f,g,m,_){var v,b=e.positions.length,y=s(t,b),B=s(i,b),w=s(a,b);if(void 0===h?n(e,y,B,w):(n(e,y,B,v=s(h,b)),n(e,B,w,v)),void 0!==c){var x=e.uv.length;y=o(c,x),B=o(u,x),w=o(d,x),void 0===h?A(e,y,B,w):(A(e,y,B,v=o(p,x)),A(e,B,w,v))}if(void 0!==f){var P=e.normals.length;y=r(f,P),B=f===g?y:r(g,P),w=f===m?y:r(m,P),void 0===h?l(e,y,B,w):(l(e,y,B,v=r(_,P)),l(e,B,w,v))}}function u(e,t,i){e.object.geometry.type="Line";for(var r=e.positions.length,n=e.uv.length,l=0,A=t.length;l=0?n.substring(0,a):n).toLowerCase(),A=(A=a>=0?n.substring(a+1):"").trim(),l.toLowerCase()){case"newmtl":i(e,u),u={id:A},d=!0;break;case"ka":u.ambient=s(A);break;case"kd":u.diffuse=s(A);break;case"ks":u.specular=s(A);break;case"map_kd":u.diffuseMap||(u.diffuseMap=t(e,o,A,"sRGB"));break;case"map_ks":u.specularMap||(u.specularMap=t(e,o,A,"linear"));break;case"map_bump":case"bump":u.normalMap||(u.normalMap=t(e,o,A));break;case"ns":u.shininess=parseFloat(A);break;case"d":(h=parseFloat(A))<1&&(u.alpha=h,u.alphaMode="blend");break;case"tr":(h=parseFloat(A))>0&&(u.alpha=1-h,u.alphaMode="blend")}d&&i(e,u)};function t(e,t,i,s){var r={},o=i.split(/\s+/),n=o.indexOf("-bm");return n>=0&&o.splice(n,2),(n=o.indexOf("-s"))>=0&&(r.scale=[parseFloat(o[n+1]),parseFloat(o[n+2])],o.splice(n,4)),(n=o.indexOf("-o"))>=0&&(r.translate=[parseFloat(o[n+1]),parseFloat(o[n+2])],o.splice(n,4)),r.src=t+o.join(" ").trim(),r.flipY=!0,r.encoding=s||"linear",new io(e,r).id}function i(e,t){new ri(e,t)}function s(t){var i=t.split(e,3);return[parseFloat(i[0]),parseFloat(i[1]),parseFloat(i[2])]}}();function jP(e,t){for(var i=0,s=t.objects.length;i0&&(n.normals=o.normals),o.uv.length>0&&(n.uv=o.uv);for(var a=new Array(n.positions.length/3),l=0;l{this.viewer.metaScene.createMetaModel(i,r),this._sceneGraphLoader.load(t,s,e)}),(e=>{this.error(`load(): Failed to load model modelMetadata for model '${i} from '${r}' - ${e}`)}))}else this._sceneGraphLoader.load(t,s,e);return t.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(i)})),t}destroy(){super.destroy()}}const WP=new Float64Array([0,0,1]),KP=new Float64Array(4);class XP{constructor(e){this.id=null,this._viewer=e.viewer,this._visible=!1,this._pos=d.vec3(),this._origin=d.vec3(),this._rtcPos=d.vec3(),this._baseDir=d.vec3(),this._rootNode=null,this._displayMeshes=null,this._affordanceMeshes=null,this._ignoreNextSectionPlaneDirUpdate=!1,this._createNodes(),this._bindEvents()}_setSectionPlane(e){this._sectionPlane&&(this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._onSectionPlanePos=null,this._onSectionPlaneDir=null,this._sectionPlane=null),e&&(this.id=e.id,this._setPos(e.pos),this._setDir(e.dir),this._sectionPlane=e,this._onSectionPlanePos=e.on("pos",(()=>{this._setPos(this._sectionPlane.pos)})),this._onSectionPlaneDir=e.on("dir",(()=>{this._ignoreNextSectionPlaneDirUpdate?this._ignoreNextSectionPlaneDirUpdate=!1:this._setDir(this._sectionPlane.dir)})))}get sectionPlane(){return this._sectionPlane}_setPos(e){this._pos.set(e),Y(this._pos,this._origin,this._rtcPos),this._rootNode.origin=this._origin,this._rootNode.position=this._rtcPos}_setDir(e){this._baseDir.set(e),this._rootNode.quaternion=d.vec3PairToQuaternion(WP,e,KP)}_setSectionPlaneDir(e){this._sectionPlane&&(this._ignoreNextSectionPlaneDirUpdate=!0,this._sectionPlane.dir=e)}setVisible(e=!0){if(this._visible!==e){var t;for(t in this._visible=e,this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].visible=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].visible=e)}}getVisible(){return this._visible}setCulled(e){var t;for(t in this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].culled=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].culled=e)}_createNodes(){const e=!1,t=this._viewer.scene,i=.01;this._rootNode=new Qr(t,{position:[0,0,0],scale:[5,5,5],isObject:!1});const s=this._rootNode,r={arrowHead:new $t(s,Pr({radiusTop:.001,radiusBottom:.07,radialSegments:32,heightSegments:1,height:.2,openEnded:!1})),arrowHeadBig:new $t(s,Pr({radiusTop:.001,radiusBottom:.09,radialSegments:32,heightSegments:1,height:.25,openEnded:!1})),arrowHeadHandle:new $t(s,Pr({radiusTop:.09,radiusBottom:.09,radialSegments:8,heightSegments:1,height:.37,openEnded:!1})),curve:new $t(s,fo({radius:.8,tube:i,radialSegments:64,tubeSegments:14,arc:2*Math.PI/4})),curveHandle:new $t(s,fo({radius:.8,tube:.06,radialSegments:64,tubeSegments:14,arc:2*Math.PI/4})),hoop:new $t(s,fo({radius:.8,tube:i,radialSegments:64,tubeSegments:8,arc:2*Math.PI})),axis:new $t(s,Pr({radiusTop:i,radiusBottom:i,radialSegments:20,heightSegments:1,height:1,openEnded:!1})),axisHandle:new $t(s,Pr({radiusTop:.08,radiusBottom:.08,radialSegments:20,heightSegments:1,height:1,openEnded:!1}))},o={pickable:new ri(s,{diffuse:[1,1,0],alpha:0,alphaMode:"blend"}),red:new ri(s,{diffuse:[1,0,0],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightRed:new ni(s,{edges:!1,fill:!0,fillColor:[1,0,0],fillAlpha:.6}),green:new ri(s,{diffuse:[0,1,0],emissive:[0,1,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightGreen:new ni(s,{edges:!1,fill:!0,fillColor:[0,1,0],fillAlpha:.6}),blue:new ri(s,{diffuse:[0,0,1],emissive:[0,0,1],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightBlue:new ni(s,{edges:!1,fill:!0,fillColor:[0,0,1],fillAlpha:.2}),center:new ri(s,{diffuse:[0,0,0],emissive:[0,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80}),highlightBall:new ni(s,{edges:!1,fill:!0,fillColor:[.5,.5,.5],fillAlpha:.5,vertices:!1}),highlightPlane:new ni(s,{edges:!0,edgeWidth:3,fill:!1,fillColor:[.5,.5,.5],fillAlpha:.5,vertices:!1})};this._displayMeshes={plane:s.addChild(new wr(s,{geometry:new $t(s,{primitive:"triangles",positions:[.5,.5,0,.5,-.5,0,-.5,-.5,0,-.5,.5,0,.5,.5,-0,.5,-.5,-0,-.5,-.5,-0,-.5,.5,-0],indices:[0,1,2,2,3,0]}),material:new ri(s,{emissive:[0,0,0],diffuse:[0,0,0],backfaces:!0}),opacity:.6,ghosted:!0,ghostMaterial:new ni(s,{edges:!1,filled:!0,fillColor:[1,1,0],edgeColor:[0,0,0],fillAlpha:.1,backfaces:!0}),pickable:!1,collidable:!0,clippable:!1,visible:!1,scale:[2.4,2.4,1],isObject:!1}),e),planeFrame:s.addChild(new wr(s,{geometry:new $t(s,fo({center:[0,0,0],radius:1.7,tube:.02,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new ri(s,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),highlightMaterial:new ni(s,{edges:!1,edgeColor:[0,0,0],filled:!0,fillColor:[.8,.8,.8],fillAlpha:1}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,.1],rotation:[0,0,45],isObject:!1}),e),xCurve:s.addChild(new wr(s,{geometry:r.curve,material:o.red,matrix:function(){const e=d.rotationMat4v(90*d.DEGTORAD,[0,1,0],d.identityMat4()),t=d.rotationMat4v(270*d.DEGTORAD,[1,0,0],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),xCurveHandle:s.addChild(new wr(s,{geometry:r.curveHandle,material:o.pickable,matrix:function(){const e=d.rotationMat4v(90*d.DEGTORAD,[0,1,0],d.identityMat4()),t=d.rotationMat4v(270*d.DEGTORAD,[1,0,0],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),xCurveArrow1:s.addChild(new wr(s,{geometry:r.arrowHead,material:o.red,matrix:function(){const e=d.translateMat4c(0,-.07,-.8,d.identityMat4()),t=d.scaleMat4v([.6,.6,.6],d.identityMat4()),i=d.rotationMat4v(0*d.DEGTORAD,[0,0,1],d.identityMat4());return d.mulMat4(d.mulMat4(e,t,d.identityMat4()),i,d.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xCurveArrow2:s.addChild(new wr(s,{geometry:r.arrowHead,material:o.red,matrix:function(){const e=d.translateMat4c(0,-.8,-.07,d.identityMat4()),t=d.scaleMat4v([.6,.6,.6],d.identityMat4()),i=d.rotationMat4v(90*d.DEGTORAD,[1,0,0],d.identityMat4());return d.mulMat4(d.mulMat4(e,t,d.identityMat4()),i,d.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yCurve:s.addChild(new wr(s,{geometry:r.curve,material:o.green,rotation:[-90,0,0],pickable:!1,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),yCurveHandle:s.addChild(new wr(s,{geometry:r.curveHandle,material:o.pickable,rotation:[-90,0,0],pickable:!0,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),yCurveArrow1:s.addChild(new wr(s,{geometry:r.arrowHead,material:o.green,matrix:function(){const e=d.translateMat4c(.07,0,-.8,d.identityMat4()),t=d.scaleMat4v([.6,.6,.6],d.identityMat4()),i=d.rotationMat4v(90*d.DEGTORAD,[0,0,1],d.identityMat4());return d.mulMat4(d.mulMat4(e,t,d.identityMat4()),i,d.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yCurveArrow2:s.addChild(new wr(s,{geometry:r.arrowHead,material:o.green,matrix:function(){const e=d.translateMat4c(.8,0,-.07,d.identityMat4()),t=d.scaleMat4v([.6,.6,.6],d.identityMat4()),i=d.rotationMat4v(90*d.DEGTORAD,[1,0,0],d.identityMat4());return d.mulMat4(d.mulMat4(e,t,d.identityMat4()),i,d.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurve:s.addChild(new wr(s,{geometry:r.curve,material:o.blue,matrix:d.rotationMat4v(180*d.DEGTORAD,[1,0,0],d.identityMat4()),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurveHandle:s.addChild(new wr(s,{geometry:r.curveHandle,material:o.pickable,matrix:d.rotationMat4v(180*d.DEGTORAD,[1,0,0],d.identityMat4()),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurveCurveArrow1:s.addChild(new wr(s,{geometry:r.arrowHead,material:o.blue,matrix:function(){const e=d.translateMat4c(.8,-.07,0,d.identityMat4()),t=d.scaleMat4v([.6,.6,.6],d.identityMat4());return d.mulMat4(e,t,d.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurveArrow2:s.addChild(new wr(s,{geometry:r.arrowHead,material:o.blue,matrix:function(){const e=d.translateMat4c(.05,-.8,0,d.identityMat4()),t=d.scaleMat4v([.6,.6,.6],d.identityMat4()),i=d.rotationMat4v(90*d.DEGTORAD,[0,0,1],d.identityMat4());return d.mulMat4(d.mulMat4(e,t,d.identityMat4()),i,d.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),center:s.addChild(new wr(s,{geometry:new $t(s,Cr({radius:.05})),material:o.center,pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxisArrow:s.addChild(new wr(s,{geometry:r.arrowHead,material:o.red,matrix:function(){const e=d.translateMat4c(0,1.1,0,d.identityMat4()),t=d.rotationMat4v(-90*d.DEGTORAD,[0,0,1],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxisArrowHandle:s.addChild(new wr(s,{geometry:r.arrowHeadHandle,material:o.pickable,matrix:function(){const e=d.translateMat4c(0,1.1,0,d.identityMat4()),t=d.rotationMat4v(-90*d.DEGTORAD,[0,0,1],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxis:s.addChild(new wr(s,{geometry:r.axis,material:o.red,matrix:function(){const e=d.translateMat4c(0,.5,0,d.identityMat4()),t=d.rotationMat4v(-90*d.DEGTORAD,[0,0,1],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxisHandle:s.addChild(new wr(s,{geometry:r.axisHandle,material:o.pickable,matrix:function(){const e=d.translateMat4c(0,.5,0,d.identityMat4()),t=d.rotationMat4v(-90*d.DEGTORAD,[0,0,1],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yAxisArrow:s.addChild(new wr(s,{geometry:r.arrowHead,material:o.green,matrix:function(){const e=d.translateMat4c(0,1.1,0,d.identityMat4()),t=d.rotationMat4v(180*d.DEGTORAD,[1,0,0],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yAxisArrowHandle:s.addChild(new wr(s,{geometry:r.arrowHeadHandle,material:o.pickable,matrix:function(){const e=d.translateMat4c(0,1.1,0,d.identityMat4()),t=d.rotationMat4v(180*d.DEGTORAD,[1,0,0],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,opacity:.2,isObject:!1}),e),yShaft:s.addChild(new wr(s,{geometry:r.axis,material:o.green,position:[0,-.5,0],pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yShaftHandle:s.addChild(new wr(s,{geometry:r.axisHandle,material:o.pickable,position:[0,-.5,0],pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zAxisArrow:s.addChild(new wr(s,{geometry:r.arrowHead,material:o.blue,matrix:function(){const e=d.translateMat4c(0,1.1,0,d.identityMat4()),t=d.rotationMat4v(-90*d.DEGTORAD,[.8,0,0],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zAxisArrowHandle:s.addChild(new wr(s,{geometry:r.arrowHeadHandle,material:o.pickable,matrix:function(){const e=d.translateMat4c(0,1.1,0,d.identityMat4()),t=d.rotationMat4v(-90*d.DEGTORAD,[.8,0,0],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zShaft:s.addChild(new wr(s,{geometry:r.axis,material:o.blue,matrix:function(){const e=d.translateMat4c(0,.5,0,d.identityMat4()),t=d.rotationMat4v(-90*d.DEGTORAD,[1,0,0],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),clippable:!1,pickable:!1,collidable:!0,visible:!1,isObject:!1}),e),zAxisHandle:s.addChild(new wr(s,{geometry:r.axisHandle,material:o.pickable,matrix:function(){const e=d.translateMat4c(0,.5,0,d.identityMat4()),t=d.rotationMat4v(-90*d.DEGTORAD,[1,0,0],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),clippable:!1,pickable:!0,collidable:!0,visible:!1,isObject:!1}),e)},this._affordanceMeshes={planeFrame:s.addChild(new wr(s,{geometry:new $t(s,fo({center:[0,0,0],radius:2,tube:i,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new ri(s,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:!0,highlightMaterial:new ni(s,{edges:!1,filled:!0,fillColor:[1,1,0],fillAlpha:1}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,1],rotation:[0,0,45],isObject:!1}),e),xHoop:s.addChild(new wr(s,{geometry:r.hoop,material:o.red,highlighted:!0,highlightMaterial:o.highlightRed,matrix:function(){const e=d.rotationMat4v(90*d.DEGTORAD,[0,1,0],d.identityMat4()),t=d.rotationMat4v(270*d.DEGTORAD,[1,0,0],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yHoop:s.addChild(new wr(s,{geometry:r.hoop,material:o.green,highlighted:!0,highlightMaterial:o.highlightGreen,rotation:[-90,0,0],pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zHoop:s.addChild(new wr(s,{geometry:r.hoop,material:o.blue,highlighted:!0,highlightMaterial:o.highlightBlue,matrix:d.rotationMat4v(180*d.DEGTORAD,[1,0,0],d.identityMat4()),pickable:!1,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),xAxisArrow:s.addChild(new wr(s,{geometry:r.arrowHeadBig,material:o.red,matrix:function(){const e=d.translateMat4c(0,1.1,0,d.identityMat4()),t=d.rotationMat4v(-90*d.DEGTORAD,[0,0,1],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yAxisArrow:s.addChild(new wr(s,{geometry:r.arrowHeadBig,material:o.green,matrix:function(){const e=d.translateMat4c(0,1.1,0,d.identityMat4()),t=d.rotationMat4v(180*d.DEGTORAD,[1,0,0],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zAxisArrow:s.addChild(new wr(s,{geometry:r.arrowHeadBig,material:o.blue,matrix:function(){const e=d.translateMat4c(0,1.1,0,d.identityMat4()),t=d.rotationMat4v(-90*d.DEGTORAD,[.8,0,0],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e)}}_bindEvents(){const e=this;var t=!1;const i=-1,s=0,r=1,o=2,n=3,a=4,l=5,A=this._rootNode;var h=null,c=null;const u=d.vec2(),p=d.vec3([1,0,0]),f=d.vec3([0,1,0]),g=d.vec3([0,0,1]),m=this._viewer.scene.canvas.canvas,_=this._viewer.camera,v=this._viewer.scene;{const e=d.vec3([0,0,0]);let t=-1;this._onCameraViewMatrix=v.camera.on("viewMatrix",(()=>{})),this._onCameraProjMatrix=v.camera.on("projMatrix",(()=>{})),this._onSceneTick=v.on("tick",(()=>{const i=Math.abs(d.lenVec3(d.subVec3(v.camera.eye,this._pos,e)));if(i!==t&&"perspective"===_.projection){const e=.07*(Math.tan(_.perspective.fov*d.DEGTORAD)*i);A.scale=[e,e,e],t=i}if("ortho"===_.projection){const e=_.ortho.scale/10;A.scale=[e,e,e],t=i}}))}const b=function(){const e=new Float64Array(2);return function(t){if(t){for(var i=t.target,s=0,r=0;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;e[0]=t.pageX-s,e[1]=t.pageY-r}else t=window.event,e[0]=t.x,e[1]=t.y;return e}}(),y=function(){const t=d.mat4();return function(i,s){return d.quaternionToMat4(e._rootNode.quaternion,t),d.transformVec3(t,i,s),d.normalizeVec3(s),s}}();var B=function(){const e=d.vec3();return function(t){const i=Math.abs(t[0]);return i>Math.abs(t[1])&&i>Math.abs(t[2])?d.cross3Vec3(t,[0,1,0],e):d.cross3Vec3(t,[1,0,0],e),d.cross3Vec3(e,t,e),d.normalizeVec3(e),e}}();const w=function(){const t=d.vec3(),i=d.vec3(),s=d.vec4();return function(r,o,n){y(r,s);const a=B(s,o,n);P(o,a,t),P(n,a,i),d.subVec3(i,t);const l=d.dotVec3(i,s);e._pos[0]+=s[0]*l,e._pos[1]+=s[1]*l,e._pos[2]+=s[2]*l,e._rootNode.position=e._pos,e._sectionPlane&&(e._sectionPlane.pos=e._pos)}}();var x=function(){const t=d.vec4(),i=d.vec4(),s=d.vec4(),r=d.vec4();return function(o,n,a){y(o,r);if(!(P(n,r,t)&&P(a,r,i))){const e=B(r,n,a);P(n,e,t,1),P(a,e,i,1);var l=d.dotVec3(t,r);t[0]-=l*r[0],t[1]-=l*r[1],t[2]-=l*r[2],l=d.dotVec3(i,r),i[0]-=l*r[0],i[1]-=l*r[1],i[2]-=l*r[2]}d.normalizeVec3(t),d.normalizeVec3(i),l=d.dotVec3(t,i),l=d.clamp(l,-1,1);var A=Math.acos(l)*d.RADTODEG;d.cross3Vec3(t,i,s),d.dotVec3(s,r)<0&&(A=-A),e._rootNode.rotate(o,A),C()}}(),P=function(){const t=d.vec4([0,0,0,1]),i=d.mat4();return function(s,r,o,n){n=n||0,t[0]=s[0]/m.width*2-1,t[1]=-(s[1]/m.height*2-1),t[2]=0,t[3]=1,d.mulMat4(_.projMatrix,_.viewMatrix,i),d.inverseMat4(i),d.transformVec4(i,t,t),d.mulVec4Scalar(t,1/t[3]);var a=_.eye;d.subVec4(t,a,t);const l=e._sectionPlane.pos;var A=-d.dotVec3(l,r)-n,h=d.dotVec3(r,t);if(Math.abs(h)>.005){var c=-(d.dotVec3(r,a)+A)/h;return d.mulVec3Scalar(t,c,o),d.addVec3(o,a),d.subVec3(o,l,o),!0}return!1}}();const C=function(){const t=d.vec3(),i=d.mat4();return function(){e.sectionPlane&&(d.quaternionToMat4(A.quaternion,i),d.transformVec3(i,[0,0,1],t),e._setSectionPlaneDir(t))}}();var M,E=!1;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",(e=>{if(!this._visible)return;if(E)return;var A;t=!1,M&&(M.visible=!1);switch(e.entity.id){case this._displayMeshes.xAxisArrowHandle.id:case this._displayMeshes.xAxisHandle.id:A=this._affordanceMeshes.xAxisArrow,h=s;break;case this._displayMeshes.yAxisArrowHandle.id:case this._displayMeshes.yShaftHandle.id:A=this._affordanceMeshes.yAxisArrow,h=r;break;case this._displayMeshes.zAxisArrowHandle.id:case this._displayMeshes.zAxisHandle.id:A=this._affordanceMeshes.zAxisArrow,h=o;break;case this._displayMeshes.xCurveHandle.id:A=this._affordanceMeshes.xHoop,h=n;break;case this._displayMeshes.yCurveHandle.id:A=this._affordanceMeshes.yHoop,h=a;break;case this._displayMeshes.zCurveHandle.id:A=this._affordanceMeshes.zHoop,h=l;break;default:return void(h=i)}A&&(A.visible=!0),M=A,t=!0})),this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOutEntity",(e=>{this._visible&&(M&&(M.visible=!1),M=null,h=i)})),m.addEventListener("mousedown",this._canvasMouseDownListener=e=>{if(e.preventDefault(),this._visible&&t&&(this._viewer.cameraControl.pointerEnabled=!1,1===e.which)){E=!0;var i=b(e);c=h,u[0]=i[0],u[1]=i[1]}}),m.addEventListener("mousemove",this._canvasMouseMoveListener=e=>{if(!this._visible)return;if(!E)return;var t=b(e);const i=t[0],A=t[1];switch(c){case s:w(p,u,t);break;case r:w(f,u,t);break;case o:w(g,u,t);break;case n:x(p,u,t);break;case a:x(f,u,t);break;case l:x(g,u,t)}u[0]=i,u[1]=A}),m.addEventListener("mouseup",this._canvasMouseUpListener=e=>{this._visible&&(this._viewer.cameraControl.pointerEnabled=!0,E&&(e.which,E=!1,t=!1))}),m.addEventListener("wheel",this._canvasWheelListener=e=>{if(this._visible)Math.max(-1,Math.min(1,40*-e.deltaY))})}_destroy(){this._unbindEvents(),this._destroyNodes()}_unbindEvents(){const e=this._viewer,t=e.scene,i=t.canvas.canvas,s=e.camera,r=e.cameraControl;t.off(this._onSceneTick),i.removeEventListener("mousedown",this._canvasMouseDownListener),i.removeEventListener("mousemove",this._canvasMouseMoveListener),i.removeEventListener("mouseup",this._canvasMouseUpListener),i.removeEventListener("wheel",this._canvasWheelListener),s.off(this._onCameraViewMatrix),s.off(this._onCameraProjMatrix),r.off(this._onCameraControlHover),r.off(this._onCameraControlHoverLeave)}_destroyNodes(){this._setSectionPlane(null),this._rootNode.destroy(),this._displayMeshes={},this._affordanceMeshes={}}}class JP{constructor(e,t,i){this.id=i.id,this._sectionPlane=i,this._mesh=new wr(t,{id:i.id,geometry:new $t(t,ei({xSize:.5,ySize:.5,zSize:.001})),material:new ri(t,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:!1}),edgeMaterial:new li(t,{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),highlightMaterial:new ni(t,{fill:!0,fillColor:[.5,1,.5],fillAlpha:.7,edges:!0,edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),selectedMaterial:new ni(t,{fill:!0,fillColor:[0,0,1],fillAlpha:.7,edges:!0,edgeColor:[1,0,0],edgeAlpha:1,edgeWidth:1}),highlighted:!0,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:.3,edges:!0});{const e=d.vec3([0,0,0]),t=d.vec3(),i=d.vec3([0,0,1]),s=d.vec4(4),r=d.vec3(),o=()=>{const o=this._sectionPlane.scene.center,n=[-this._sectionPlane.dir[0],-this._sectionPlane.dir[1],-this._sectionPlane.dir[2]];d.subVec3(o,this._sectionPlane.pos,e);const a=-d.dotVec3(n,e);d.normalizeVec3(n),d.mulVec3Scalar(n,a,t);const l=d.vec3PairToQuaternion(i,this._sectionPlane.dir,s);r[0]=.1*t[0],r[1]=.1*t[1],r[2]=.1*t[2],this._mesh.quaternion=l,this._mesh.position=r};this._onSectionPlanePos=this._sectionPlane.on("pos",o),this._onSectionPlaneDir=this._sectionPlane.on("dir",o)}this._highlighted=!1,this._selected=!1}setHighlighted(e){this._highlighted=!!e,this._mesh.highlighted=this._highlighted,this._mesh.highlightMaterial.fillColor=e?[0,.7,0]:[0,0,0]}getHighlighted(){return this._highlighted}setSelected(e){this._selected=!!e,this._mesh.edgeMaterial.edgeWidth=e?3:1,this._mesh.highlightMaterial.edgeWidth=e?3:1}getSelected(){return this._selected}destroy(){this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._mesh.destroy()}}class YP{constructor(e,t){if(!(t.onHoverEnterPlane&&t.onHoverLeavePlane&&t.onClickedNothing&&t.onClickedPlane))throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";this.plugin=e,this._viewer=e.viewer,this._onHoverEnterPlane=t.onHoverEnterPlane,this._onHoverLeavePlane=t.onHoverLeavePlane,this._onClickedNothing=t.onClickedNothing,this._onClickedPlane=t.onClickedPlane,this._visible=!0,this._planes={},this._canvas=t.overviewCanvas,this._scene=new _i(this._viewer,{canvasId:this._canvas.id,transparent:!0}),this._scene.clearLights(),new Qt(this._scene,{dir:[.4,-.4,.8],color:[.8,1,1],intensity:1,space:"view"}),new Qt(this._scene,{dir:[-.8,-.3,-.4],color:[.8,.8,.8],intensity:1,space:"view"}),new Qt(this._scene,{dir:[.8,-.6,-.8],color:[1,1,1],intensity:1,space:"view"}),this._scene.camera,this._scene.camera.perspective.fov=70,this._zUp=!1;{const e=this._scene.camera,t=d.rotationMat4c(-90*d.DEGTORAD,1,0,0),i=d.vec3(),s=d.vec3(),r=d.vec3();this._synchCamera=()=>{const o=this._viewer.camera.eye,n=this._viewer.camera.look,a=this._viewer.camera.up;d.mulVec3Scalar(d.normalizeVec3(d.subVec3(o,n,i)),7),this._zUp?(d.transformVec3(t,i,s),d.transformVec3(t,a,r),e.look=[0,0,0],e.eye=d.transformVec3(t,i,s),e.up=d.transformPoint3(t,a,r)):(e.look=[0,0,0],e.eye=i,e.up=a)}}this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera),this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera),this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",(e=>{this._scene.camera.perspective.fov=e}));var i=null;this._onInputMouseMove=this._scene.input.on("mousemove",(e=>{const t=this._scene.pick({canvasPos:e});if(t){if(!i||t.entity.id!==i.id){if(i){this._planes[i.id]&&this._onHoverLeavePlane(i.id)}i=t.entity;this._planes[i.id]&&this._onHoverEnterPlane(i.id)}}else i&&(this._onHoverLeavePlane(i.id),i=null)})),this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=()=>{if(i){this._planes[i.id]&&this._onClickedPlane(i.id)}else this._onClickedNothing()}),this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=()=>{i&&(this._onHoverLeavePlane(i.id),i=null)}),this.setVisible(t.overviewVisible)}addSectionPlane(e){this._planes[e.id]=new JP(this,this._scene,e)}setPlaneHighlighted(e,t){const i=this._planes[e];i&&i.setHighlighted(t)}setPlaneSelected(e,t){const i=this._planes[e];i&&i.setSelected(t)}removeSectionPlane(e){const t=this._planes[e.id];t&&(t.destroy(),delete this._planes[e.id])}setVisible(e=!0){this._visible=e,this._canvas.style.visibility=e?"visible":"hidden"}getVisible(){return this._visible}destroy(){this._viewer.camera.off(this._onViewerCameraMatrix),this._viewer.camera.off(this._onViewerCameraWorldAxis),this._viewer.camera.perspective.off(this._onViewerCameraFOV),this._scene.input.off(this._onInputMouseMove),this._scene.canvas.canvas.removeEventListener("mouseup",this._onCanvasMouseUp),this._scene.canvas.canvas.removeEventListener("mouseout",this._onCanvasMouseOut),this._scene.destroy()}}const ZP=d.AABB3(),qP=d.vec3();class $P extends z{constructor(e,t={}){if(super("SectionPlanes",e),this._freeControls=[],this._sectionPlanes=e.scene.sectionPlanes,this._controls={},this._shownControlId=null,null!==t.overviewCanvasId&&void 0!==t.overviewCanvasId){const e=document.getElementById(t.overviewCanvasId);e?this._overview=new YP(this,{overviewCanvas:e,visible:t.overviewVisible,onHoverEnterPlane:e=>{this._overview.setPlaneHighlighted(e,!0)},onHoverLeavePlane:e=>{this._overview.setPlaneHighlighted(e,!1)},onClickedPlane:e=>{if(this.getShownControl()===e)return void this.hideControl();this.showControl(e);const t=this.sectionPlanes[e].pos;ZP.set(this.viewer.scene.aabb),d.getAABB3Center(ZP,qP),ZP[0]+=t[0]-qP[0],ZP[1]+=t[1]-qP[1],ZP[2]+=t[2]-qP[2],ZP[3]+=t[0]-qP[0],ZP[4]+=t[1]-qP[1],ZP[5]+=t[2]-qP[2],this.viewer.cameraFlight.flyTo({aabb:ZP,fitFOV:65})},onClickedNothing:()=>{this.hideControl()}}):this.warn("Can't find overview canvas: '"+t.overviewCanvasId+"' - will create plugin without overview")}this._onSceneSectionPlaneCreated=e.scene.on("sectionPlaneCreated",(e=>{this._sectionPlaneCreated(e)}))}setOverviewVisible(e){this._overview&&this._overview.setVisible(e)}getOverviewVisible(){if(this._overview)return this._overview.getVisible()}get sectionPlanes(){return this._sectionPlanes}createSectionPlane(e={}){void 0!==e.id&&null!==e.id&&this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);return new Ir(this.viewer.scene,{id:e.id,pos:e.pos,dir:e.dir,active:!0})}_sectionPlaneCreated(e){const t=this._freeControls.length>0?this._freeControls.pop():new XP(this);t._setSectionPlane(e),t.setVisible(!1),this._controls[e.id]=t,this._overview&&this._overview.addSectionPlane(e),e.once("destroyed",(()=>{this._sectionPlaneDestroyed(e)}))}flipSectionPlanes(){const e=this.viewer.scene.sectionPlanes;for(let t in e){e[t].flipDir()}}showControl(e){const t=this._controls[e];t?(this.hideControl(),t.setVisible(!0),this._overview&&this._overview.setPlaneSelected(e,!0),this._shownControlId=e):this.error("Control not found: "+e)}getShownControl(){return this._shownControlId}hideControl(){for(var e in this._controls)this._controls.hasOwnProperty(e)&&(this._controls[e].setVisible(!1),this._overview&&this._overview.setPlaneSelected(e,!1));this._shownControlId=null}destroySectionPlane(e){var t=this.viewer.scene.sectionPlanes[e];t?(this._sectionPlaneDestroyed(t),t.destroy(),e===this._shownControlId&&(this._shownControlId=null)):this.error("SectionPlane not found: "+e)}_sectionPlaneDestroyed(e){this._overview&&this._overview.removeSectionPlane(e);const t=this._controls[e.id];t&&(t.setVisible(!1),t._setSectionPlane(null),delete this._controls[e.id],this._freeControls.push(t))}clear(){const e=Object.keys(this._sectionPlanes);for(var t=0,i=e.length;t{this._registerModelStoreys(e),this.fire("storeys",this.storeys)}))}_registerModelStoreys(e){const t=this.viewer,i=t.scene,s=t.metaScene,r=s.metaModels[e],o=i.models[e];if(!r||!r.rootMetaObjects)return;const n=r.rootMetaObjects;for(let t=0,r=n.length;t.5?a.length:0,h=new eC(this,o.aabb,l,e,n,A);h._onModelDestroyed=o.once("destroyed",(()=>{this._deregisterModelStoreys(e),this.fire("storeys",this.storeys)})),this.storeys[n]=h,this.modelStoreys[e]||(this.modelStoreys[e]={}),this.modelStoreys[e][n]=h}}}_deregisterModelStoreys(e){const t=this.modelStoreys[e];if(t){const i=this.viewer.scene;for(let e in t)if(t.hasOwnProperty(e)){const s=t[e],r=i.models[s.modelId];r&&r.off(s._onModelDestroyed),delete this.storeys[e]}delete this.modelStoreys[e]}}get fitStoreyMaps(){return this._fitStoreyMaps}gotoStoreyCamera(e,t={}){const i=this.storeys[e];if(!i)return this.error("IfcBuildingStorey not found with this ID: "+e),void(t.done&&t.done());const s=this.viewer,r=s.scene.camera,o=i.storeyAABB;if(o[3]{t.done()})):(s.cameraFlight.jumpTo(y.apply(t,{eye:h,look:n,up:c,orthoScale:A})),s.camera.ortho.scale=A)}showStoreyObjects(e,t={}){if(!this.storeys[e])return void this.error("IfcBuildingStorey not found with this ID: "+e);const i=this.viewer,s=i.scene;i.metaScene.metaObjects[e]&&(t.hideOthers&&s.setObjectsVisible(i.scene.visibleObjectIds,!1),this.withStoreyObjects(e,((e,t)=>{e&&(e.visible=!0)})))}withStoreyObjects(e,t){const i=this.viewer,s=i.scene,r=i.metaScene,o=r.metaObjects[e];if(!o)return;const n=o.getObjectIDsInSubtree();for(var a=0,l=n.length;au[1]&&u[0]>u[2],p=!d&&u[1]>u[0]&&u[1]>u[2];!d&&!p&&u[2]>u[0]&&(u[2],u[1]);const f=e.width/A,g=p?e.height/c:e.height/h;return i[0]=Math.floor(e.width-(t[0]-n)*f),i[1]=Math.floor(e.height-(t[2]-l)*g),i[0]>=0&&i[0]=0&&i[1]<=e.height}worldDirToStoreyMap(e,t,i){const s=this.viewer.camera,r=s.eye,o=s.look,n=d.subVec3(o,r,iC),a=s.worldUp,l=a[0]>a[1]&&a[0]>a[2],A=!l&&a[1]>a[0]&&a[1]>a[2];!l&&!A&&a[2]>a[0]&&(a[2],a[1]),l?(i[0]=n[1],i[1]=n[2]):A?(i[0]=n[0],i[1]=n[2]):(i[0]=n[0],i[1]=n[1]),d.normalizeVec2(i)}destroy(){this.viewer.scene.off(this._onModelLoaded),super.destroy()}}const oC=new Float64Array([0,0,1]),nC=new Float64Array(4);class aC{constructor(e){this.id=null,this._viewer=e.viewer,this._plugin=e,this._visible=!1,this._pos=d.vec3(),this._origin=d.vec3(),this._rtcPos=d.vec3(),this._baseDir=d.vec3(),this._rootNode=null,this._displayMeshes=null,this._affordanceMeshes=null,this._ignoreNextSectionPlaneDirUpdate=!1,this._createNodes(),this._bindEvents()}_setSectionPlane(e){this._sectionPlane&&(this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._onSectionPlanePos=null,this._onSectionPlaneDir=null,this._sectionPlane=null),e&&(this.id=e.id,this._setPos(e.pos),this._setDir(e.dir),this._sectionPlane=e,this._onSectionPlanePos=e.on("pos",(()=>{this._setPos(this._sectionPlane.pos)})),this._onSectionPlaneDir=e.on("dir",(()=>{this._ignoreNextSectionPlaneDirUpdate?this._ignoreNextSectionPlaneDirUpdate=!1:this._setDir(this._sectionPlane.dir)})))}get sectionPlane(){return this._sectionPlane}_setPos(e){this._pos.set(e),Y(this._pos,this._origin,this._rtcPos),this._rootNode.origin=this._origin,this._rootNode.position=this._rtcPos}_setDir(e){this._baseDir.set(e),this._rootNode.quaternion=d.vec3PairToQuaternion(oC,e,nC)}_setSectionPlaneDir(e){this._sectionPlane&&(this._ignoreNextSectionPlaneDirUpdate=!0,this._sectionPlane.dir=e)}setVisible(e=!0){if(this._visible!==e){var t;for(t in this._visible=e,this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].visible=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].visible=e)}}getVisible(){return this._visible}setCulled(e){var t;for(t in this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].culled=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].culled=e)}_createNodes(){const e=!1,t=this._viewer.scene,i=.01;this._rootNode=new Qr(t,{position:[0,0,0],scale:[5,5,5]});const s=this._rootNode,r={arrowHead:new $t(s,Pr({radiusTop:.001,radiusBottom:.07,radialSegments:32,heightSegments:1,height:.2,openEnded:!1})),arrowHeadBig:new $t(s,Pr({radiusTop:.001,radiusBottom:.09,radialSegments:32,heightSegments:1,height:.25,openEnded:!1})),axis:new $t(s,Pr({radiusTop:i,radiusBottom:i,radialSegments:20,heightSegments:1,height:1,openEnded:!1}))},o={red:new ri(s,{diffuse:[1,0,0],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),green:new ri(s,{diffuse:[0,1,0],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),blue:new ri(s,{diffuse:[0,0,1],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightRed:new ni(s,{edges:!1,fill:!0,fillColor:[1,0,0],fillAlpha:.6})};this._displayMeshes={plane:s.addChild(new wr(s,{geometry:new $t(s,{primitive:"triangles",positions:[.5,.5,0,.5,-.5,0,-.5,-.5,0,-.5,.5,0,.5,.5,-0,.5,-.5,-0,-.5,-.5,-0,-.5,.5,-0],indices:[0,1,2,2,3,0]}),material:new ri(s,{emissive:[0,0,0],diffuse:[0,0,0],backfaces:!0}),opacity:.6,ghosted:!0,pickable:!1,collidable:!0,clippable:!1,visible:!1,scale:[2.4,2.4,1]}),e),planeFrame:s.addChild(new wr(s,{geometry:new $t(s,fo({center:[0,0,0],radius:1.7,tube:.02,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new ri(s,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,.1],rotation:[0,0,45]}),e),center:s.addChild(new wr(s,{geometry:new $t(s,Cr({radius:.05})),material:o.center,pickable:!1,collidable:!0,clippable:!1,visible:!1}),e),zAxisArrow:s.addChild(new wr(s,{geometry:r.arrowHead,material:o.blue,matrix:function(){const e=d.translateMat4c(0,1.1,0,d.identityMat4()),t=d.rotationMat4v(-90*d.DEGTORAD,[.8,0,0],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1}),e),zShaft:s.addChild(new wr(s,{geometry:r.axis,material:o.blue,matrix:function(){const e=d.translateMat4c(0,.5,0,d.identityMat4()),t=d.rotationMat4v(-90*d.DEGTORAD,[1,0,0],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),clippable:!1,pickable:!1,collidable:!0,visible:!1}),e)},this._affordanceMeshes={planeFrame:s.addChild(new wr(s,{geometry:new $t(s,fo({center:[0,0,0],radius:2,tube:i,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new ri(s,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:!0,highlightMaterial:new ni(s,{edges:!1,filled:!0,fillColor:[1,1,0],fillAlpha:1}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,1],rotation:[0,0,45]}),e),zAxisArrow:s.addChild(new wr(s,{geometry:r.arrowHeadBig,material:o.blue,matrix:function(){const e=d.translateMat4c(0,1.1,0,d.identityMat4()),t=d.rotationMat4v(-90*d.DEGTORAD,[.8,0,0],d.identityMat4());return d.mulMat4(t,e,d.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1}),e)}}_bindEvents(){const e=this._rootNode,t=d.vec2(),i=this._viewer.camera,s=this._viewer.scene;let r=0,o=!1;{const t=d.vec3([0,0,0]);let n=-1;this._onCameraViewMatrix=s.camera.on("viewMatrix",(()=>{})),this._onCameraProjMatrix=s.camera.on("projMatrix",(()=>{})),this._onSceneTick=s.on("tick",(()=>{o=!1;const l=Math.abs(d.lenVec3(d.subVec3(s.camera.eye,this._pos,t)));if(l!==n&&"perspective"===i.projection){const t=.07*(Math.tan(i.perspective.fov*d.DEGTORAD)*l);e.scale=[t,t,t],n=l}if("ortho"===i.projection){const t=i.ortho.scale/10;e.scale=[t,t,t],n=l}0!==r&&(a(r),r=0)}))}const n=function(){const e=new Float64Array(2);return function(t){if(t){for(var i=t.target,s=0,r=0;i.offsetParent;)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;e[0]=t.pageX-s,e[1]=t.pageY-r}else t=window.event,e[0]=t.x,e[1]=t.y;return e}}(),a=e=>{const t=this._sectionPlane.pos,i=this._sectionPlane.dir;d.addVec3(t,d.mulVec3Scalar(i,.1*e*this._plugin.getDragSensitivity(),d.vec3())),this._sectionPlane.pos=t};{let e=!1;this._plugin._controlElement.addEventListener("mousedown",this._canvasMouseDownListener=i=>{if(i.preventDefault(),this._visible&&(this._viewer.cameraControl.pointerEnabled=!1,1===i.which)){e=!0;var s=n(i);t[0]=s[0],t[1]=s[1]}}),this._plugin._controlElement.addEventListener("mousemove",this._canvasMouseMoveListener=i=>{if(!this._visible)return;if(!e)return;if(o)return;var s=n(i);const r=s[0],l=s[1];a(l-t[1]),t[0]=r,t[1]=l}),this._plugin._controlElement.addEventListener("mouseup",this._canvasMouseUpListener=t=>{this._visible&&(this._viewer.cameraControl.pointerEnabled=!0,e&&(t.which,e=!1))}),this._plugin._controlElement.addEventListener("wheel",this._canvasWheelListener=e=>{this._visible&&(r+=Math.max(-1,Math.min(1,40*-e.deltaY)))})}{let e,t,i=null;this._plugin._controlElement.addEventListener("touchstart",this._handleTouchStart=t=>{t.stopPropagation(),t.preventDefault(),this._visible&&(e=t.touches[0].clientY,i=e,r=0)}),this._plugin._controlElement.addEventListener("touchmove",this._handleTouchMove=e=>{e.stopPropagation(),e.preventDefault(),this._visible&&(o||(o=!0,t=e.touches[0].clientY,null!==i&&(r+=t-i),i=t))}),this._plugin._controlElement.addEventListener("touchend",this._handleTouchEnd=i=>{i.stopPropagation(),i.preventDefault(),this._visible&&(e=null,t=null,r=0)})}}_destroy(){this._unbindEvents(),this._destroyNodes()}_unbindEvents(){const e=this._viewer,t=e.scene,i=t.canvas.canvas,s=e.camera,r=this._plugin._controlElement;t.off(this._onSceneTick),i.removeEventListener("mousedown",this._canvasMouseDownListener),i.removeEventListener("mousemove",this._canvasMouseMoveListener),i.removeEventListener("mouseup",this._canvasMouseUpListener),i.removeEventListener("wheel",this._canvasWheelListener),r.removeEventListener("touchstart",this._handleTouchStart),r.removeEventListener("touchmove",this._handleTouchMove),r.removeEventListener("touchend",this._handleTouchEnd),s.off(this._onCameraViewMatrix),s.off(this._onCameraProjMatrix)}_destroyNodes(){this._setSectionPlane(null),this._rootNode.destroy(),this._displayMeshes={},this._affordanceMeshes={}}}class lC{constructor(e,t,i){this.id=i.id,this._sectionPlane=i,this._mesh=new wr(t,{id:i.id,geometry:new $t(t,ei({xSize:.5,ySize:.5,zSize:.001})),material:new ri(t,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:!1}),edgeMaterial:new li(t,{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),highlightMaterial:new ni(t,{fill:!0,fillColor:[.5,1,.5],fillAlpha:.7,edges:!0,edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),selectedMaterial:new ni(t,{fill:!0,fillColor:[0,0,1],fillAlpha:.7,edges:!0,edgeColor:[1,0,0],edgeAlpha:1,edgeWidth:1}),highlighted:!0,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:.3,edges:!0});{const e=d.vec3([0,0,0]),t=d.vec3(),i=d.vec3([0,0,1]),s=d.vec4(4),r=d.vec3(),o=()=>{const o=this._sectionPlane.scene.center,n=[-this._sectionPlane.dir[0],-this._sectionPlane.dir[1],-this._sectionPlane.dir[2]];d.subVec3(o,this._sectionPlane.pos,e);const a=-d.dotVec3(n,e);d.normalizeVec3(n),d.mulVec3Scalar(n,a,t);const l=d.vec3PairToQuaternion(i,this._sectionPlane.dir,s);r[0]=.1*t[0],r[1]=.1*t[1],r[2]=.1*t[2],this._mesh.quaternion=l,this._mesh.position=r};this._onSectionPlanePos=this._sectionPlane.on("pos",o),this._onSectionPlaneDir=this._sectionPlane.on("dir",o)}this._highlighted=!1,this._selected=!1}setHighlighted(e){this._highlighted=!!e,this._mesh.highlighted=this._highlighted,this._mesh.highlightMaterial.fillColor=e?[0,.7,0]:[0,0,0]}getHighlighted(){return this._highlighted}setSelected(e){this._selected=!!e,this._mesh.edgeMaterial.edgeWidth=e?3:1,this._mesh.highlightMaterial.edgeWidth=e?3:1}getSelected(){return this._selected}destroy(){this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._mesh.destroy()}}class AC{constructor(e,t){if(!(t.onHoverEnterPlane&&t.onHoverLeavePlane&&t.onClickedNothing&&t.onClickedPlane))throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";this.plugin=e,this._viewer=e.viewer,this._onHoverEnterPlane=t.onHoverEnterPlane,this._onHoverLeavePlane=t.onHoverLeavePlane,this._onClickedNothing=t.onClickedNothing,this._onClickedPlane=t.onClickedPlane,this._visible=!0,this._planes={},this._canvas=t.overviewCanvas,this._scene=new _i(this._viewer,{canvasId:this._canvas.id,transparent:!0}),this._scene.clearLights(),new Qt(this._scene,{dir:[.4,-.4,.8],color:[.8,1,1],intensity:1,space:"view"}),new Qt(this._scene,{dir:[-.8,-.3,-.4],color:[.8,.8,.8],intensity:1,space:"view"}),new Qt(this._scene,{dir:[.8,-.6,-.8],color:[1,1,1],intensity:1,space:"view"}),this._scene.camera,this._scene.camera.perspective.fov=70,this._zUp=!1;{const e=this._scene.camera,t=d.rotationMat4c(-90*d.DEGTORAD,1,0,0),i=d.vec3(),s=d.vec3(),r=d.vec3();this._synchCamera=()=>{const o=this._viewer.camera.eye,n=this._viewer.camera.look,a=this._viewer.camera.up;d.mulVec3Scalar(d.normalizeVec3(d.subVec3(o,n,i)),7),this._zUp?(d.transformVec3(t,i,s),d.transformVec3(t,a,r),e.look=[0,0,0],e.eye=d.transformVec3(t,i,s),e.up=d.transformPoint3(t,a,r)):(e.look=[0,0,0],e.eye=i,e.up=a)}}this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera),this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera),this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",(e=>{this._scene.camera.perspective.fov=e}));var i=null;this._onInputMouseMove=this._scene.input.on("mousemove",(e=>{const t=this._scene.pick({canvasPos:e});if(t){if(!i||t.entity.id!==i.id){if(i){this._planes[i.id]&&this._onHoverLeavePlane(i.id)}i=t.entity;this._planes[i.id]&&this._onHoverEnterPlane(i.id)}}else i&&(this._onHoverLeavePlane(i.id),i=null)})),this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=()=>{if(i){this._planes[i.id]&&this._onClickedPlane(i.id)}else this._onClickedNothing()}),this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=()=>{i&&(this._onHoverLeavePlane(i.id),i=null)}),this.setVisible(t.overviewVisible)}addSectionPlane(e){this._planes[e.id]=new lC(this,this._scene,e)}setPlaneHighlighted(e,t){const i=this._planes[e];i&&i.setHighlighted(t)}setPlaneSelected(e,t){const i=this._planes[e];i&&i.setSelected(t)}removeSectionPlane(e){const t=this._planes[e.id];t&&(t.destroy(),delete this._planes[e.id])}setVisible(e=!0){this._visible=e,this._canvas.style.visibility=e?"visible":"hidden"}getVisible(){return this._visible}destroy(){this._viewer.camera.off(this._onViewerCameraMatrix),this._viewer.camera.off(this._onViewerCameraWorldAxis),this._viewer.camera.perspective.off(this._onViewerCameraFOV),this._scene.input.off(this._onInputMouseMove),this._scene.canvas.canvas.removeEventListener("mouseup",this._onCanvasMouseUp),this._scene.canvas.canvas.removeEventListener("mouseout",this._onCanvasMouseOut),this._scene.destroy()}}const hC=d.AABB3(),cC=d.vec3();class uC extends z{constructor(e,t={}){if(super("FaceAlignedSectionPlanesPlugin",e),this._freeControls=[],this._sectionPlanes=e.scene.sectionPlanes,this._controls={},this._shownControlId=null,this._dragSensitivity=t.dragSensitivity||1,null!==t.overviewCanvasId&&void 0!==t.overviewCanvasId){const e=document.getElementById(t.overviewCanvasId);e?this._overview=new AC(this,{overviewCanvas:e,visible:t.overviewVisible,onHoverEnterPlane:e=>{this._overview.setPlaneHighlighted(e,!0)},onHoverLeavePlane:e=>{this._overview.setPlaneHighlighted(e,!1)},onClickedPlane:e=>{if(this.getShownControl()===e)return void this.hideControl();this.showControl(e);const t=this.sectionPlanes[e].pos;hC.set(this.viewer.scene.aabb),d.getAABB3Center(hC,cC),hC[0]+=t[0]-cC[0],hC[1]+=t[1]-cC[1],hC[2]+=t[2]-cC[2],hC[3]+=t[0]-cC[0],hC[4]+=t[1]-cC[1],hC[5]+=t[2]-cC[2],this.viewer.cameraFlight.flyTo({aabb:hC,fitFOV:65})},onClickedNothing:()=>{this.hideControl()}}):this.warn("Can't find overview canvas: '"+t.overviewCanvasId+"' - will create plugin without overview")}null===t.controlElementId||void 0===t.controlElementId?this.error("Parameter expected: controlElementId"):(this._controlElement=document.getElementById(t.controlElementId),this._controlElement||this.warn("Can't find control element: '"+t.controlElementId+"' - will create plugin without control element")),this._onSceneSectionPlaneCreated=e.scene.on("sectionPlaneCreated",(e=>{this._sectionPlaneCreated(e)}))}setDragSensitivity(e){this._dragSensitivity=e||1}getDragSensitivity(){return this._dragSensitivity}setOverviewVisible(e){this._overview&&this._overview.setVisible(e)}getOverviewVisible(){if(this._overview)return this._overview.getVisible()}get sectionPlanes(){return this._sectionPlanes}createSectionPlane(e={}){void 0!==e.id&&null!==e.id&&this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);return new Ir(this.viewer.scene,{id:e.id,pos:e.pos,dir:e.dir,active:!0})}_sectionPlaneCreated(e){const t=this._freeControls.length>0?this._freeControls.pop():new aC(this);t._setSectionPlane(e),t.setVisible(!1),this._controls[e.id]=t,this._overview&&this._overview.addSectionPlane(e),e.once("destroyed",(()=>{this._sectionPlaneDestroyed(e)}))}flipSectionPlanes(){const e=this.viewer.scene.sectionPlanes;for(let t in e){e[t].flipDir()}}showControl(e){const t=this._controls[e];t?(this.hideControl(),t.setVisible(!0),this._overview&&this._overview.setPlaneSelected(e,!0),this._shownControlId=e):this.error("Control not found: "+e)}getShownControl(){return this._shownControlId}hideControl(){for(let e in this._controls)this._controls.hasOwnProperty(e)&&(this._controls[e].setVisible(!1),this._overview&&this._overview.setPlaneSelected(e,!1));this._shownControlId=null}destroySectionPlane(e){let t=this.viewer.scene.sectionPlanes[e];t?(this._sectionPlaneDestroyed(t),t.destroy(),e===this._shownControlId&&(this._shownControlId=null)):this.error("SectionPlane not found: "+e)}_sectionPlaneDestroyed(e){this._overview&&this._overview.removeSectionPlane(e);const t=this._controls[e.id];t&&(t.setVisible(!1),t._setSectionPlane(null),delete this._controls[e.id],this._freeControls.push(t))}clear(){const e=Object.keys(this._sectionPlanes);for(let t=0,i=e.length;t-1?e+"&_="+t:e+"?_="+t}getSTL(e,t,i){e=this._cacheBusterURL(e);const s=new XMLHttpRequest;s.overrideMimeType("application/json"),s.open("GET",e,!0),s.responseType="arraybuffer",s.onreadystatechange=function(){4===s.readyState&&(200===s.status?t(s.response):i(s.statusText))},s.send(null)}}const fC=d.vec3();class gC{load(e,t,i,s,r,o){s=s||{};const n=e.viewer.scene.canvas.spinner;n.processes++,e.dataSource.getSTL(i,(function(i){!function(e,t,i,s){try{const r=BC(i);mC(r)?_C(e,r,t,s):vC(e,yC(i),t,s)}catch(e){t.fire("error",e)}}(e,t,i,s);try{const o=BC(i);mC(o)?_C(e,o,t,s):vC(e,yC(i),t,s),n.processes--,I.scheduleTask((function(){t.fire("loaded",!0,!1)})),r&&r()}catch(i){n.processes--,e.error(i),o&&o(i),t.fire("error",i)}}),(function(i){n.processes--,e.error(i),o&&o(i),t.fire("error",i)}))}parse(e,t,i,s){const r=e.viewer.scene.canvas.spinner;r.processes++;try{const o=BC(i);mC(o)?_C(e,o,t,s):vC(e,yC(i),t,s),r.processes--,I.scheduleTask((function(){t.fire("loaded",!0,!1)}))}catch(e){r.processes--,t.fire("error",e)}}}function mC(e){const t=new DataView(e);if(84+50*t.getUint32(80,!0)===t.byteLength)return!0;const i=[115,111,108,105,100];for(var s=0;s<5;s++)if(i[s]!==t.getUint8(s,!1))return!0;return!1}function _C(e,t,i,s){const r=new DataView(t),o=r.getUint32(80,!0);let n,a,l,A,h,c,u,d=!1,p=null,f=null,g=null,m=!1;for(let e=0;e<70;e++)1129270351===r.getUint32(e,!1)&&82===r.getUint8(e+4)&&61===r.getUint8(e+5)&&(d=!0,A=[],h=r.getUint8(e+6)/255,c=r.getUint8(e+7)/255,u=r.getUint8(e+8)/255,r.getUint8(e+9));const _=new Gr(i,{roughness:.5});let v=[],b=[],y=s.splitMeshes;for(let e=0;e>5&31)/31,l=(e>>10&31)/31):(n=h,a=c,l=u),(y&&n!==p||a!==f||l!==g)&&(null!==p&&(m=!0),p=n,f=a,g=l)}for(let e=1;e<=3;e++){let i=t+12*e;v.push(r.getFloat32(i,!0)),v.push(r.getFloat32(i+4,!0)),v.push(r.getFloat32(i+8,!0)),b.push(o,B,w),d&&A.push(n,a,l,1)}y&&m&&(bC(i,v,b,A,_,s),v=[],b=[],A=A?[]:null,m=!1)}v.length>0&&bC(i,v,b,A,_,s)}function vC(e,t,i,s){const r=/facet([\s\S]*?)endfacet/g;let o=0;const n=/[\s]+([+-]?(?:\d+.\d+|\d+.|\d+|.\d+)(?:[eE][+-]?\d+)?)/.source,a=new RegExp("vertex"+n+n+n,"g"),l=new RegExp("normal"+n+n+n,"g"),A=[],h=[];let c,u,d,p,f,g,m;for(;null!==(p=r.exec(t));){for(f=0,g=0,m=p[0];null!==(p=l.exec(m));)c=parseFloat(p[1]),u=parseFloat(p[2]),d=parseFloat(p[3]),g++;for(;null!==(p=a.exec(m));)A.push(parseFloat(p[1]),parseFloat(p[2]),parseFloat(p[3])),h.push(c,u,d),f++;1!==g&&e.error("Error in normal of face "+o),3!==f&&e.error("Error in positions of face "+o),o++}bC(i,A,h,null,new Gr(i,{roughness:.5}),s)}function bC(e,t,i,s,r,o){const n=new Int32Array(t.length/3);for(let e=0,t=n.length;e0?i:null,s=s&&s.length>0?s:null,o.smoothNormals&&d.faceToVertexNormals(t,i,o);const a=fC;Z(t,t,a);const l=new $t(e,{primitive:"triangles",positions:t,normals:i,colors:s,indices:n}),A=new wr(e,{origin:0!==a[0]||0!==a[1]||0!==a[2]?a:null,geometry:l,material:r,edges:o.edges});e.addChild(A)}function yC(e){return"string"!=typeof e?function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let i=0,s=e.length;i0){const i=document.createElement("a");i.href="#",i.id=`switch-${e.nodeId}`,i.textContent="+",i.classList.add("plus"),t&&i.addEventListener("click",t),o.appendChild(i)}const n=document.createElement("input");n.id=`checkbox-${e.nodeId}`,n.type="checkbox",n.checked=e.checked,n.style["pointer-events"]="all",i&&n.addEventListener("change",i),o.appendChild(n);const a=document.createElement("span");return a.textContent=e.title,o.appendChild(a),s&&(a.oncontextmenu=s),r&&(a.onclick=r),o}createDisabledNodeElement(e){const t=document.createElement("li"),i=document.createElement("a");i.href="#",i.textContent="!",i.classList.add("warn"),i.classList.add("warning"),t.appendChild(i);const s=document.createElement("span");return s.textContent=e,t.appendChild(s),t}addChildren(e,t){const i=document.createElement("ul");t.forEach((e=>{i.appendChild(e)})),e.parentElement.appendChild(i)}expand(e,t,i){e.classList.remove("plus"),e.classList.add("minus"),e.textContent="-",e.removeEventListener("click",t),e.addEventListener("click",i)}collapse(e,t,i){if(!e)return;const s=e.parentElement;if(!s)return;const r=s.querySelector("ul");r&&(s.removeChild(r),e.classList.remove("minus"),e.classList.add("plus"),e.textContent="+",e.removeEventListener("click",i),e.addEventListener("click",t))}isExpanded(e){return void 0!==e.parentElement.getElementsByTagName("li")[0]}getId(e){return e.parentElement.id}getIdFromCheckbox(e){return e.id.replace("checkbox-","")}getSwitchElement(e){return document.getElementById(`switch-${e}`)}isChecked(e){return e.checked}setCheckbox(e,t){const i=document.getElementById(`checkbox-${e}`);i&&t!==i.checked&&(i.checked=t)}setXRayed(e,t){const i=document.getElementById(e);i&&(t?i.classList.add("xrayed-node"):i.classList.remove("xrayed-node"))}setHighlighted(e,t){const i=document.getElementById(e);i&&(t?(i.scrollIntoView({block:"center"}),i.classList.add("highlighted-node")):i.classList.remove("highlighted-node"))}}const PC=[];class CC extends z{constructor(e,t={}){super("TreeViewPlugin",e),this.errors=[],this.valid=!0;const i=t.containerElement||document.getElementById(t.containerElementId);if(i instanceof HTMLElement){for(let e=0;;e++)if(!PC[e]){PC[e]=this,this._index=e,this._id=`tree-${e}`;break}if(this._containerElement=i,this._metaModels={},this._autoAddModels=!1!==t.autoAddModels,this._autoExpandDepth=t.autoExpandDepth||0,this._sortNodes=!1!==t.sortNodes,this._viewer=e,this._rootElement=null,this._muteSceneEvents=!1,this._muteTreeEvents=!1,this._rootNodes=[],this._objectNodes={},this._nodeNodes={},this._rootNames={},this._sortNodes=t.sortNodes,this._pruneEmptyNodes=t.pruneEmptyNodes,this._showListItemElementId=null,this._renderService=t.renderService||new xC,!this._renderService)throw new Error("TreeViewPlugin: no render service set");if(this._containerElement.oncontextmenu=e=>{e.preventDefault()},this._onObjectVisibility=this._viewer.scene.on("objectVisibility",(e=>{if(this._muteSceneEvents)return;const t=e.id,i=this._objectNodes[t];if(!i)return;const s=e.visible;if(!(s!==i.checked))return;this._muteTreeEvents=!0,i.checked=s,s?i.numVisibleEntities++:i.numVisibleEntities--,this._renderService.setCheckbox(i.nodeId,s);let r=i.parent;for(;r;)r.checked=s,s?r.numVisibleEntities++:r.numVisibleEntities--,this._renderService.setCheckbox(r.nodeId,r.numVisibleEntities>0),r=r.parent;this._muteTreeEvents=!1})),this._onObjectXrayed=this._viewer.scene.on("objectXRayed",(e=>{if(this._muteSceneEvents)return;const t=e.id,i=this._objectNodes[t];if(!i)return;this._muteTreeEvents=!0;const s=e.xrayed;s!==i.xrayed&&(i.xrayed=s,this._renderService.setXRayed(i.nodeId,s),this._muteTreeEvents=!1)})),this._switchExpandHandler=e=>{e.preventDefault(),e.stopPropagation();const t=e.target;this._expandSwitchElement(t)},this._switchCollapseHandler=e=>{e.preventDefault(),e.stopPropagation();const t=e.target;this._collapseSwitchElement(t)},this._checkboxChangeHandler=e=>{if(this._muteTreeEvents)return;this._muteSceneEvents=!0;const t=e.target,i=this._renderService.isChecked(t),s=this._renderService.getIdFromCheckbox(t),r=this._nodeNodes[s],o=this._viewer.scene.objects;let n=0;this._withNodeTree(r,(e=>{const t=e.objectId,s=o[t],r=0===e.children.length;e.numVisibleEntities=i?e.numEntities:0,r&&i!==e.checked&&n++,e.checked=i,this._renderService.setCheckbox(e.nodeId,i),s&&(s.visible=i)}));let a=r.parent;for(;a;)a.checked=i,i?a.numVisibleEntities+=n:a.numVisibleEntities-=n,this._renderService.setCheckbox(a.nodeId,a.numVisibleEntities>0),a=a.parent;this._muteSceneEvents=!1},this._hierarchy=t.hierarchy||"containment",this._autoExpandDepth=t.autoExpandDepth||0,this._autoAddModels){const e=Object.keys(this.viewer.metaScene.metaModels);for(let t=0,i=e.length;t{this.viewer.metaScene.metaModels[e]&&this.addModel(e)}))}this.hierarchy=t.hierarchy}else this.error("Mandatory config expected: valid containerElementId or containerElement")}set hierarchy(e){"containment"!==(e=e||"containment")&&"storeys"!==e&&"types"!==e&&(this.error("Unsupported value for `hierarchy' - defaulting to 'containment'"),e="containment"),this._hierarchy!==e&&(this._hierarchy=e,this._createNodes())}get hierarchy(){return this._hierarchy}addModel(e,t={}){if(!this._containerElement)return;const i=this.viewer.scene.models[e];if(!i)throw"Model not found: "+e;const s=this.viewer.metaScene.metaModels[e];s?this._metaModels[e]?this.warn("Model already added: "+e):(this._metaModels[e]=s,t&&t.rootName&&(this._rootNames[e]=t.rootName),i.on("destroyed",(()=>{this.removeModel(i.id)})),this._createNodes()):this.error("MetaModel not found: "+e)}removeModel(e){if(!this._containerElement)return;this._metaModels[e]&&(this._rootNames[e]&&delete this._rootNames[e],delete this._metaModels[e],this._createNodes())}showNode(e){this.unShowNode();const t=this._objectNodes[e];if(!t)return;const i=t.nodeId,s=this._renderService.getSwitchElement(i);if(s)return this._expandSwitchElement(s),s.scrollIntoView(),!0;const r=[];r.unshift(t);let o=t.parent;for(;o;)r.unshift(o),o=o.parent;for(let e=0,t=r.length;e{if(s===e)return;const r=this._renderService.getSwitchElement(i.nodeId);if(r){this._expandSwitchElement(r);const e=i.children;for(var o=0,n=e.length;o0;return this.valid}_validateMetaModelForStoreysHierarchy(e=0,t,i){return!0}_createEnabledNodes(){switch(this._pruneEmptyNodes&&this._findEmptyNodes(),this._hierarchy){case"storeys":this._createStoreysNodes(),0===this._rootNodes.length&&this.error("Failed to build storeys hierarchy");break;case"types":this._createTypesNodes();break;default:this._createContainmentNodes()}this._sortNodes&&this._doSortNodes(),this._synchNodesToEntities(),this._createTrees(),this.expandToDepth(this._autoExpandDepth)}_createDisabledNodes(){const e=this._renderService.createRootNode();this._rootElement=e,this._containerElement.appendChild(e);const t=this._viewer.metaScene.rootMetaObjects;for(let i in t){const s=t[i],r=s.type,o=s.name,n=o&&""!==o&&"Undefined"!==o&&"Default"!==o?o:r,a=this._renderService.createDisabledNodeElement(n);e.appendChild(a)}}_findEmptyNodes(){const e=this._viewer.metaScene.rootMetaObjects;for(let t in e)this._findEmptyNodes2(e[t])}_findEmptyNodes2(e,t=0){const i=this.viewer.scene,s=e.children,r=e.id,o=i.objects[r];if(e._countEntities=0,o&&e._countEntities++,s)for(let t=0,i=s.length;t{e.aabb&&r.aabb||(e.aabb||(e.aabb=t.getAABB(s.getObjectIDsInSubtree(e.objectId))),r.aabb||(r.aabb=t.getAABB(s.getObjectIDsInSubtree(r.objectId))));let o=0;return o=i.xUp?0:i.yUp?1:2,e.aabb[o]>r.aabb[o]?-1:e.aabb[o]s?1:0}_synchNodesToEntities(){const e=Object.keys(this.viewer.metaScene.metaObjects),t=this._viewer.metaScene.metaObjects,i=this._viewer.scene.objects;for(let s=0,r=e.length;sthis._createNodeElement(e))),t=this._renderService.createRootNode();e.forEach((e=>{t.appendChild(e)})),this._containerElement.appendChild(t),this._rootElement=t}_createNodeElement(e){return this._renderService.createNodeElement(e,this._switchExpandHandler,this._checkboxChangeHandler,(t=>{this.fire("contextmenu",{event:t,viewer:this._viewer,treeViewPlugin:this,treeViewNode:e}),t.preventDefault()}),(t=>{this.fire("nodeTitleClicked",{event:t,viewer:this._viewer,treeViewPlugin:this,treeViewNode:e}),t.preventDefault()}))}_expandSwitchElement(e){if(this._renderService.isExpanded(e))return;const t=this._renderService.getId(e),i=this._nodeNodes[t].children.map((e=>this._createNodeElement(e)));this._renderService.addChildren(e,i),this._renderService.expand(e,this._switchExpandHandler,this._switchCollapseHandler)}_collapseNode(e){const t=this._renderService.getSwitchElement(e);this._collapseSwitchElement(t)}_collapseSwitchElement(e){this._renderService.collapse(e,this._switchExpandHandler,this._switchCollapseHandler)}}class MC{constructor(e){this._scene=e,this._objects=[],this._objectsViewCulled=[],this._objectsDetailCulled=[],this._objectsChanged=[],this._objectsChangedList=[],this._modelInfos={},this._numObjects=0,this._lenObjectsChangedList=0,this._dirty=!0,this._onModelLoaded=e.on("modelLoaded",(t=>{const i=e.models[t];i&&this._addModel(i)})),this._onTick=e.on("tick",(()=>{this._dirty&&this._build(),this._applyChanges()}))}_addModel(e){const t={model:e,onDestroyed:e.on("destroyed",(()=>{this._removeModel(e)}))};this._modelInfos[e.id]=t,this._dirty=!0}_removeModel(e){const t=this._modelInfos[e.id];t&&(t.model.off(t.onDestroyed),delete this._modelInfos[e.id],this._dirty=!0)}_build(){if(!this._dirty)return;this._applyChanges();const e=this._scene.objects;for(let e=0;e0){for(let e=0;e{delete EC[t],i._destroy()}))),i}(e.scene),this._maxTreeDepth=t.maxTreeDepth||8,this._modelInfos={},this._frustum=new N,this._kdRoot=null,this._frustumDirty=!1,this._kdTreeDirty=!1,this._onViewMatrix=e.scene.camera.on("viewMatrix",(()=>{this._frustumDirty=!0})),this._onProjMatrix=e.scene.camera.on("projMatMatrix",(()=>{this._frustumDirty=!0})),this._onModelLoaded=e.scene.on("modelLoaded",(e=>{const t=this.viewer.scene.models[e];t&&this._addModel(t)})),this._onSceneTick=e.scene.on("tick",(()=>{this._doCull()}))}set enabled(e){this._enabled=e}get enabled(){return this._enabled}_addModel(e){const t={model:e,onDestroyed:e.on("destroyed",(()=>{this._removeModel(e)}))};this._modelInfos[e.id]=t,this._kdTreeDirty=!0}_removeModel(e){const t=this._modelInfos[e.id];t&&(t.model.off(t.onDestroyed),delete this._modelInfos[e.id],this._kdTreeDirty=!0)}_doCull(){const e=this._frustumDirty||this._kdTreeDirty;if(this._frustumDirty&&this._buildFrustum(),this._kdTreeDirty&&this._buildKDTree(),e){const e=this._kdRoot;e&&this._visitKDNode(e)}}_buildFrustum(){const e=this.viewer.scene.camera;Q(this._frustum,e.viewMatrix,e.projMatrix),this._frustumDirty=!1}_buildKDTree(){const e=this.viewer.scene;this._kdRoot,this._kdRoot={aabb:e.getAABB(),intersection:N.INTERSECT};for(let e=0,t=this._objectCullStates.numObjects;e=this._maxTreeDepth)return e.objects=e.objects||[],e.objects.push(i),void d.expandAABB3(e.aabb,r);if(e.left&&d.containsAABB3(e.left.aabb,r))return void this._insertEntityIntoKDTree(e.left,t,i,s+1);if(e.right&&d.containsAABB3(e.right.aabb,r))return void this._insertEntityIntoKDTree(e.right,t,i,s+1);const o=e.aabb;FC[0]=o[3]-o[0],FC[1]=o[4]-o[1],FC[2]=o[5]-o[2];let n=0;if(FC[1]>FC[n]&&(n=1),FC[2]>FC[n]&&(n=2),!e.left){const a=o.slice();if(a[n+3]=(o[n]+o[n+3])/2,e.left={aabb:a,intersection:N.INTERSECT},d.containsAABB3(a,r))return void this._insertEntityIntoKDTree(e.left,t,i,s+1)}if(!e.right){const a=o.slice();if(a[n]=(o[n]+o[n+3])/2,e.right={aabb:a,intersection:N.INTERSECT},d.containsAABB3(a,r))return void this._insertEntityIntoKDTree(e.right,t,i,s+1)}e.objects=e.objects||[],e.objects.push(i),d.expandAABB3(e.aabb,r)}_visitKDNode(e,t=N.INTERSECT){if(t!==N.INTERSECT&&e.intersects===t)return;t===N.INTERSECT&&(t=V(this._frustum,e.aabb),e.intersects=t);const i=t===N.OUTSIDE,s=e.objects;if(s&&s.length>0)for(let e=0,t=s.length;e-1?e+"&_="+t:e+"?_="+t}getManifest(e,t,i){y.loadJSON(this._cacheBusterURL(e),(e=>{t(e)}),(function(e){i(e)}))}getMetaModel(e,t,i){y.loadJSON(this._cacheBusterURL(e),(e=>{t(e)}),(function(e){i(e)}))}getXKT(e,t,i){var s=()=>{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n=0;)e[t]=0}const i=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]),s=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]),r=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),n=new Array(576);t(n);const a=new Array(60);t(a);const l=new Array(512);t(l);const A=new Array(256);t(A);const h=new Array(29);t(h);const c=new Array(30);function u(e,t,i,s,r){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=s,this.max_length=r,this.has_stree=e&&e.length}let d,p,f;function g(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}t(c);const m=e=>e<256?l[e]:l[256+(e>>>7)],_=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},v=(e,t,i)=>{e.bi_valid>16-i?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<{v(e,i[2*t],i[2*t+1])},y=(e,t)=>{let i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1},B=(e,t,i)=>{const s=new Array(16);let r,o,n=0;for(r=1;r<=15;r++)n=n+i[r-1]<<1,s[r]=n;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=y(s[t]++,t))}},w=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},x=e=>{e.bi_valid>8?_(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},P=(e,t,i,s)=>{const r=2*t,o=2*i;return e[r]{const s=e.heap[i];let r=i<<1;for(;r<=e.heap_len&&(r{let o,n,a,l,u=0;if(0!==e.sym_next)do{o=255&e.pending_buf[e.sym_buf+u++],o+=(255&e.pending_buf[e.sym_buf+u++])<<8,n=e.pending_buf[e.sym_buf+u++],0===o?b(e,n,t):(a=A[n],b(e,a+256+1,t),l=i[a],0!==l&&(n-=h[a],v(e,n,l)),o--,a=m(o),b(e,a,r),l=s[a],0!==l&&(o-=c[a],v(e,o,l)))}while(u{const i=t.dyn_tree,s=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.elems;let n,a,l,A=-1;for(e.heap_len=0,e.heap_max=573,n=0;n>1;n>=1;n--)C(e,i,n);l=o;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],C(e,i,1),a=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=a,i[2*l]=i[2*n]+i[2*a],e.depth[l]=(e.depth[n]>=e.depth[a]?e.depth[n]:e.depth[a])+1,i[2*n+1]=i[2*a+1]=l,e.heap[1]=l++,C(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const i=t.dyn_tree,s=t.max_code,r=t.stat_desc.static_tree,o=t.stat_desc.has_stree,n=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,l=t.stat_desc.max_length;let A,h,c,u,d,p,f=0;for(u=0;u<=15;u++)e.bl_count[u]=0;for(i[2*e.heap[e.heap_max]+1]=0,A=e.heap_max+1;A<573;A++)h=e.heap[A],u=i[2*i[2*h+1]+1]+1,u>l&&(u=l,f++),i[2*h+1]=u,h>s||(e.bl_count[u]++,d=0,h>=a&&(d=n[h-a]),p=i[2*h],e.opt_len+=p*(u+d),o&&(e.static_len+=p*(r[2*h+1]+d)));if(0!==f){do{for(u=l-1;0===e.bl_count[u];)u--;e.bl_count[u]--,e.bl_count[u+1]+=2,e.bl_count[l]--,f-=2}while(f>0);for(u=l;0!==u;u--)for(h=e.bl_count[u];0!==h;)c=e.heap[--A],c>s||(i[2*c+1]!==u&&(e.opt_len+=(u-i[2*c+1])*i[2*c],i[2*c+1]=u),h--)}})(e,t),B(i,A,e.bl_count)},F=(e,t,i)=>{let s,r,o=-1,n=t[1],a=0,l=7,A=4;for(0===n&&(l=138,A=3),t[2*(i+1)+1]=65535,s=0;s<=i;s++)r=n,n=t[2*(s+1)+1],++a{let s,r,o=-1,n=t[1],a=0,l=7,A=4;for(0===n&&(l=138,A=3),s=0;s<=i;s++)if(r=n,n=t[2*(s+1)+1],!(++a{v(e,0+(s?1:0),3),x(e),_(e,i),_(e,~i),i&&e.pending_buf.set(e.window.subarray(t,t+i),e.pending),e.pending+=i};var T={_tr_init:e=>{D||((()=>{let e,t,o,g,m;const _=new Array(16);for(o=0,g=0;g<28;g++)for(h[g]=o,e=0;e<1<>=7;g<30;g++)for(c[g]=m<<7,e=0;e<1<{let r,l,A=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),E(e,e.l_desc),E(e,e.d_desc),A=(e=>{let t;for(F(e,e.dyn_ltree,e.l_desc.max_code),F(e,e.dyn_dtree,e.d_desc.max_code),E(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*o[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,l=e.static_len+3+7>>>3,l<=r&&(r=l)):r=l=i+5,i+4<=r&&-1!==t?S(e,t,i,s):4===e.strategy||l===r?(v(e,2+(s?1:0),3),M(e,n,a)):(v(e,4+(s?1:0),3),((e,t,i,s)=>{let r;for(v(e,t-257,5),v(e,i-1,5),v(e,s-4,4),r=0;r(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=i,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(A[i]+256+1)]++,e.dyn_dtree[2*m(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{v(e,2,3),b(e,256,n),(e=>{16===e.bi_valid?(_(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}},L=(e,t,i,s)=>{let r=65535&e|0,o=e>>>16&65535|0,n=0;for(;0!==i;){n=i>2e3?2e3:i,i-=n;do{r=r+t[s++]|0,o=o+r|0}while(--n);r%=65521,o%=65521}return r|o<<16|0};const R=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var U=(e,t,i,s)=>{const r=R,o=s+i;e^=-1;for(let i=s;i>>8^r[255&(e^t[i])];return-1^e},k={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"},O={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};const{_tr_init:N,_tr_stored_block:Q,_tr_flush_block:V,_tr_tally:H,_tr_align:j}=T,{Z_NO_FLUSH:G,Z_PARTIAL_FLUSH:z,Z_FULL_FLUSH:W,Z_FINISH:K,Z_BLOCK:X,Z_OK:J,Z_STREAM_END:Y,Z_STREAM_ERROR:Z,Z_DATA_ERROR:q,Z_BUF_ERROR:$,Z_DEFAULT_COMPRESSION:ee,Z_FILTERED:te,Z_HUFFMAN_ONLY:ie,Z_RLE:se,Z_FIXED:re,Z_DEFAULT_STRATEGY:oe,Z_UNKNOWN:ne,Z_DEFLATED:ae}=O,le=258,Ae=262,he=42,ce=113,ue=666,de=(e,t)=>(e.msg=k[t],t),pe=e=>2*e-(e>4?9:0),fe=e=>{let t=e.length;for(;--t>=0;)e[t]=0},ge=e=>{let t,i,s,r=e.w_size;t=e.hash_size,s=t;do{i=e.head[--s],e.head[s]=i>=r?i-r:0}while(--t);t=r,s=t;do{i=e.prev[--s],e.prev[s]=i>=r?i-r:0}while(--t)};let me=(e,t,i)=>(t<{const t=e.state;let i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+i),e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))},ve=(e,t)=>{V(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,_e(e.strm)},be=(e,t)=>{e.pending_buf[e.pending++]=t},ye=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Be=(e,t,i,s)=>{let r=e.avail_in;return r>s&&(r=s),0===r?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),i),1===e.state.wrap?e.adler=L(e.adler,t,r,i):2===e.state.wrap&&(e.adler=U(e.adler,t,r,i)),e.next_in+=r,e.total_in+=r,r)},we=(e,t)=>{let i,s,r=e.max_chain_length,o=e.strstart,n=e.prev_length,a=e.nice_match;const l=e.strstart>e.w_size-Ae?e.strstart-(e.w_size-Ae):0,A=e.window,h=e.w_mask,c=e.prev,u=e.strstart+le;let d=A[o+n-1],p=A[o+n];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do{if(i=t,A[i+n]===p&&A[i+n-1]===d&&A[i]===A[o]&&A[++i]===A[o+1]){o+=2,i++;do{}while(A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&on){if(e.match_start=t,n=s,s>=a)break;d=A[o+n-1],p=A[o+n]}}}while((t=c[t&h])>l&&0!=--r);return n<=e.lookahead?n:e.lookahead},xe=e=>{const t=e.w_size;let i,s,r;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ae)&&(e.window.set(e.window.subarray(t,t+t-s),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),ge(e),s+=t),0===e.strm.avail_in)break;if(i=Be(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=i,e.lookahead+e.insert>=3)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=me(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=me(e,e.ins_h,e.window[r+3-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead{let i,s,r,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,n=0,a=e.strm.avail_in;do{if(i=65535,r=e.bi_valid+42>>3,e.strm.avail_outs+e.strm.avail_in&&(i=s+e.strm.avail_in),i>r&&(i=r),i>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,_e(e.strm),s&&(s>i&&(s=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+s),e.strm.next_out),e.strm.next_out+=s,e.strm.avail_out-=s,e.strm.total_out+=s,e.block_start+=s,i-=s),i&&(Be(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(0===n);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_waterr&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,r+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),r>e.strm.avail_in&&(r=e.strm.avail_in),r&&(Be(e.strm,e.window,e.strstart,r),e.strstart+=r,e.insert+=r>e.w_size-e.insert?e.w_size-e.insert:r),e.high_water>3,r=e.pending_buf_size-r>65535?65535:e.pending_buf_size-r,o=r>e.w_size?e.w_size:r,s=e.strstart-e.block_start,(s>=o||(s||t===K)&&t!==G&&0===e.strm.avail_in&&s<=r)&&(i=s>r?r:s,n=t===K&&0===e.strm.avail_in&&i===s?1:0,Q(e,e.block_start,i,n),e.block_start+=i,_e(e.strm)),n?3:1)},Ce=(e,t)=>{let i,s;for(;;){if(e.lookahead=3&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-Ae&&(e.match_length=we(e,i)),e.match_length>=3)if(s=H(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=me(e,e.ins_h,e.window[e.strstart+1]);else s=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2},Me=(e,t)=>{let i,s,r;for(;;){if(e.lookahead=3&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,s=H(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=r&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,s&&(ve(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(s=H(e,0,e.window[e.strstart-1]),s&&ve(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(s=H(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2};function Ee(e,t,i,s,r){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=s,this.func=r}const Fe=[new Ee(0,0,0,0,Pe),new Ee(4,4,8,4,Ce),new Ee(4,5,16,8,Ce),new Ee(4,6,32,32,Ce),new Ee(4,4,16,16,Me),new Ee(8,16,32,32,Me),new Ee(8,16,128,128,Me),new Ee(8,32,128,256,Me),new Ee(32,128,258,1024,Me),new Ee(32,258,258,4096,Me)];function Ie(){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=ae,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),fe(this.dyn_ltree),fe(this.dyn_dtree),fe(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),fe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),fe(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}const De=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==he&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==ce&&t.status!==ue?1:0},Se=e=>{if(De(e))return de(e,Z);e.total_in=e.total_out=0,e.data_type=ne;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?he:ce,e.adler=2===t.wrap?0:1,t.last_flush=-2,N(t),J},Te=e=>{const t=Se(e);var i;return t===J&&((i=e.state).window_size=2*i.w_size,fe(i.head),i.max_lazy_match=Fe[i.level].max_lazy,i.good_match=Fe[i.level].good_length,i.nice_match=Fe[i.level].nice_length,i.max_chain_length=Fe[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),t},Le=(e,t,i,s,r,o)=>{if(!e)return Z;let n=1;if(t===ee&&(t=6),s<0?(n=0,s=-s):s>15&&(n=2,s-=16),r<1||r>9||i!==ae||s<8||s>15||t<0||t>9||o<0||o>re||8===s&&1!==n)return de(e,Z);8===s&&(s=9);const a=new Ie;return e.state=a,a.strm=e,a.status=he,a.wrap=n,a.gzhead=null,a.w_bits=s,a.w_size=1<De(e)||2!==e.state.wrap?Z:(e.state.gzhead=t,J),ke=(e,t)=>{if(De(e)||t>X||t<0)return e?de(e,Z):Z;const i=e.state;if(!e.output||0!==e.avail_in&&!e.input||i.status===ue&&t!==K)return de(e,0===e.avail_out?$:Z);const s=i.last_flush;if(i.last_flush=t,0!==i.pending){if(_e(e),0===e.avail_out)return i.last_flush=-1,J}else if(0===e.avail_in&&pe(t)<=pe(s)&&t!==K)return de(e,$);if(i.status===ue&&0!==e.avail_in)return de(e,$);if(i.status===he&&0===i.wrap&&(i.status=ce),i.status===he){let t=ae+(i.w_bits-8<<4)<<8,s=-1;if(s=i.strategy>=ie||i.level<2?0:i.level<6?1:6===i.level?2:3,t|=s<<6,0!==i.strstart&&(t|=32),t+=31-t%31,ye(i,t),0!==i.strstart&&(ye(i,e.adler>>>16),ye(i,65535&e.adler)),e.adler=1,i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J}if(57===i.status)if(e.adler=0,be(i,31),be(i,139),be(i,8),i.gzhead)be(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),be(i,255&i.gzhead.time),be(i,i.gzhead.time>>8&255),be(i,i.gzhead.time>>16&255),be(i,i.gzhead.time>>24&255),be(i,9===i.level?2:i.strategy>=ie||i.level<2?4:0),be(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(be(i,255&i.gzhead.extra.length),be(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=U(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(be(i,0),be(i,0),be(i,0),be(i,0),be(i,0),be(i,9===i.level?2:i.strategy>=ie||i.level<2?4:0),be(i,3),i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J;if(69===i.status){if(i.gzhead.extra){let t=i.pending,s=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+s>i.pending_buf_size;){let r=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+r),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>t&&(e.adler=U(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex+=r,_e(e),0!==i.pending)return i.last_flush=-1,J;t=0,s-=r}let r=new Uint8Array(i.gzhead.extra);i.pending_buf.set(r.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending+=s,i.gzhead.hcrc&&i.pending>t&&(e.adler=U(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),_e(e),0!==i.pending)return i.last_flush=-1,J;s=0}t=i.gzindexs&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),_e(e),0!==i.pending)return i.last_flush=-1,J;s=0}t=i.gzindexs&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(_e(e),0!==i.pending))return i.last_flush=-1,J;be(i,255&e.adler),be(i,e.adler>>8&255),e.adler=0}if(i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J}if(0!==e.avail_in||0!==i.lookahead||t!==G&&i.status!==ue){let s=0===i.level?Pe(i,t):i.strategy===ie?((e,t)=>{let i;for(;;){if(0===e.lookahead&&(xe(e),0===e.lookahead)){if(t===G)return 1;break}if(e.match_length=0,i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2})(i,t):i.strategy===se?((e,t)=>{let i,s,r,o;const n=e.window;for(;;){if(e.lookahead<=le){if(xe(e),e.lookahead<=le&&t===G)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,s=n[r],s===n[++r]&&s===n[++r]&&s===n[++r])){o=e.strstart+le;do{}while(s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&re.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=H(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2})(i,t):Fe[i.level].func(i,t);if(3!==s&&4!==s||(i.status=ue),1===s||3===s)return 0===e.avail_out&&(i.last_flush=-1),J;if(2===s&&(t===z?j(i):t!==X&&(Q(i,0,0,!1),t===W&&(fe(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),_e(e),0===e.avail_out))return i.last_flush=-1,J}return t!==K?J:i.wrap<=0?Y:(2===i.wrap?(be(i,255&e.adler),be(i,e.adler>>8&255),be(i,e.adler>>16&255),be(i,e.adler>>24&255),be(i,255&e.total_in),be(i,e.total_in>>8&255),be(i,e.total_in>>16&255),be(i,e.total_in>>24&255)):(ye(i,e.adler>>>16),ye(i,65535&e.adler)),_e(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?J:Y)},Oe=e=>{if(De(e))return Z;const t=e.state.status;return e.state=null,t===ce?de(e,q):J},Ne=(e,t)=>{let i=t.length;if(De(e))return Z;const s=e.state,r=s.wrap;if(2===r||1===r&&s.status!==he||s.lookahead)return Z;if(1===r&&(e.adler=L(e.adler,t,i,0)),s.wrap=0,i>=s.w_size){0===r&&(fe(s.head),s.strstart=0,s.block_start=0,s.insert=0);let e=new Uint8Array(s.w_size);e.set(t.subarray(i-s.w_size,i),0),t=e,i=s.w_size}const o=e.avail_in,n=e.next_in,a=e.input;for(e.avail_in=i,e.next_in=0,e.input=t,xe(s);s.lookahead>=3;){let e=s.strstart,t=s.lookahead-2;do{s.ins_h=me(s,s.ins_h,s.window[e+3-1]),s.prev[e&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=e,e++}while(--t);s.strstart=e,s.lookahead=2,xe(s)}return s.strstart+=s.lookahead,s.block_start=s.strstart,s.insert=s.lookahead,s.lookahead=0,s.match_length=s.prev_length=2,s.match_available=0,e.next_in=n,e.input=a,e.avail_in=o,s.wrap=r,J};const Qe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ve=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)Qe(i,t)&&(e[t]=i[t])}}return e},He=e=>{let t=0;for(let i=0,s=e.length;i=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Ge[254]=Ge[254]=1;var ze=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,s,r,o,n=e.length,a=0;for(r=0;r>>6,t[o++]=128|63&i):i<65536?(t[o++]=224|i>>>12,t[o++]=128|i>>>6&63,t[o++]=128|63&i):(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63,t[o++]=128|i>>>6&63,t[o++]=128|63&i);return t},We=(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let s,r;const o=new Array(2*i);for(r=0,s=0;s4)o[r++]=65533,s+=n-1;else{for(t&=2===n?31:3===n?15:7;n>1&&s1?o[r++]=65533:t<65536?o[r++]=t:(t-=65536,o[r++]=55296|t>>10&1023,o[r++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&je)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let s=0;s{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+Ge[e[i]]>t?i:t},Xe=function(){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};const Je=Object.prototype.toString,{Z_NO_FLUSH:Ye,Z_SYNC_FLUSH:Ze,Z_FULL_FLUSH:qe,Z_FINISH:$e,Z_OK:et,Z_STREAM_END:tt,Z_DEFAULT_COMPRESSION:it,Z_DEFAULT_STRATEGY:st,Z_DEFLATED:rt}=O;function ot(e){this.options=Ve({level:it,method:rt,chunkSize:16384,windowBits:15,memLevel:8,strategy:st},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xe,this.strm.avail_out=0;let i=Re(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==et)throw new Error(k[i]);if(t.header&&Ue(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?ze(t.dictionary):"[object ArrayBuffer]"===Je.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,i=Ne(this.strm,e),i!==et)throw new Error(k[i]);this._dict_set=!0}}function nt(e,t){const i=new ot(t);if(i.push(e,!0),i.err)throw i.msg||k[i.err];return i.result}ot.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize;let r,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?$e:Ye,"string"==typeof e?i.input=ze(e):"[object ArrayBuffer]"===Je.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),(o===Ze||o===qe)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(r=ke(i,o),r===tt)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),r=Oe(this.strm),this.onEnd(r),this.ended=!0,r===et;if(0!==i.avail_out){if(o>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},ot.prototype.onData=function(e){this.chunks.push(e)},ot.prototype.onEnd=function(e){e===et&&(this.result=He(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var at={Deflate:ot,deflate:nt,deflateRaw:function(e,t){return(t=t||{}).raw=!0,nt(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,nt(e,t)},constants:O};const lt=16209;var At=function(e,t){let i,s,r,o,n,a,l,A,h,c,u,d,p,f,g,m,_,v,b,y,B,w,x,P;const C=e.state;i=e.next_in,x=e.input,s=i+(e.avail_in-5),r=e.next_out,P=e.output,o=r-(t-e.avail_out),n=r+(e.avail_out-257),a=C.dmax,l=C.wsize,A=C.whave,h=C.wnext,c=C.window,u=C.hold,d=C.bits,p=C.lencode,f=C.distcode,g=(1<>>24,u>>>=v,d-=v,v=_>>>16&255,0===v)P[r++]=65535&_;else{if(!(16&v)){if(0==(64&v)){_=p[(65535&_)+(u&(1<>>=v,d-=v),d<15&&(u+=x[i++]<>>24,u>>>=v,d-=v,v=_>>>16&255,!(16&v)){if(0==(64&v)){_=f[(65535&_)+(u&(1<a){e.msg="invalid distance too far back",C.mode=lt;break e}if(u>>>=v,d-=v,v=r-o,y>v){if(v=y-v,v>A&&C.sane){e.msg="invalid distance too far back",C.mode=lt;break e}if(B=0,w=c,0===h){if(B+=l-v,v2;)P[r++]=w[B++],P[r++]=w[B++],P[r++]=w[B++],b-=3;b&&(P[r++]=w[B++],b>1&&(P[r++]=w[B++]))}else{B=r-y;do{P[r++]=P[B++],P[r++]=P[B++],P[r++]=P[B++],b-=3}while(b>2);b&&(P[r++]=P[B++],b>1&&(P[r++]=P[B++]))}break}}break}}while(i>3,i-=b,d-=b<<3,u&=(1<{const l=a.bits;let A,h,c,u,d,p,f=0,g=0,m=0,_=0,v=0,b=0,y=0,B=0,w=0,x=0,P=null;const C=new Uint16Array(16),M=new Uint16Array(16);let E,F,I,D=null;for(f=0;f<=15;f++)C[f]=0;for(g=0;g=1&&0===C[_];_--);if(v>_&&(v=_),0===_)return r[o++]=20971520,r[o++]=20971520,a.bits=1,0;for(m=1;m<_&&0===C[m];m++);for(v0&&(0===e||1!==_))return-1;for(M[1]=0,f=1;f<15;f++)M[f+1]=M[f]+C[f];for(g=0;g852||2===e&&w>592)return 1;for(;;){E=f-y,n[g]+1=p?(F=D[n[g]-p],I=P[n[g]-p]):(F=96,I=0),A=1<>y)+h]=E<<24|F<<16|I|0}while(0!==h);for(A=1<>=1;if(0!==A?(x&=A-1,x+=A):x=0,g++,0==--C[f]){if(f===_)break;f=t[i+n[g]]}if(f>v&&(x&u)!==c){for(0===y&&(y=v),d+=m,b=f-y,B=1<852||2===e&&w>592)return 1;c=x&u,r[c]=v<<24|b<<16|d-o|0}}return 0!==x&&(r[d+x]=f-y<<24|64<<16|0),a.bits=v,0};const{Z_FINISH:ft,Z_BLOCK:gt,Z_TREES:mt,Z_OK:_t,Z_STREAM_END:vt,Z_NEED_DICT:bt,Z_STREAM_ERROR:yt,Z_DATA_ERROR:Bt,Z_MEM_ERROR:wt,Z_BUF_ERROR:xt,Z_DEFLATED:Pt}=O,Ct=16180,Mt=16190,Et=16191,Ft=16192,It=16194,Dt=16199,St=16200,Tt=16206,Lt=16209,Rt=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Ut(){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}const kt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode16211?1:0},Ot=e=>{if(kt(e))return yt;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Ct,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,_t},Nt=e=>{if(kt(e))return yt;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Ot(e)},Qt=(e,t)=>{let i;if(kt(e))return yt;const s=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?yt:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=i,s.wbits=t,Nt(e))},Vt=(e,t)=>{if(!e)return yt;const i=new Ut;e.state=i,i.strm=e,i.window=null,i.mode=Ct;const s=Qt(e,t);return s!==_t&&(e.state=null),s};let Ht,jt,Gt=!0;const zt=e=>{if(Gt){Ht=new Int32Array(512),jt=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(pt(1,e.lens,0,288,Ht,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;pt(2,e.lens,0,32,jt,0,e.work,{bits:5}),Gt=!1}e.lencode=Ht,e.lenbits=9,e.distcode=jt,e.distbits=5},Wt=(e,t,i,s)=>{let r;const o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(o.window.set(t.subarray(i-o.wsize,i),0),o.wnext=0,o.whave=o.wsize):(r=o.wsize-o.wnext,r>s&&(r=s),o.window.set(t.subarray(i-s,i-s+r),o.wnext),(s-=r)?(o.window.set(t.subarray(i-s,i),0),o.wnext=s,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave{let i,s,r,o,n,a,l,A,h,c,u,d,p,f,g,m,_,v,b,y,B,w,x=0;const P=new Uint8Array(4);let C,M;const E=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(kt(e)||!e.output||!e.input&&0!==e.avail_in)return yt;i=e.state,i.mode===Et&&(i.mode=Ft),n=e.next_out,r=e.output,l=e.avail_out,o=e.next_in,s=e.input,a=e.avail_in,A=i.hold,h=i.bits,c=a,u=l,w=_t;e:for(;;)switch(i.mode){case Ct:if(0===i.wrap){i.mode=Ft;break}for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>>8&255,i.check=U(i.check,P,2,0),A=0,h=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&A)<<8)+(A>>8))%31){e.msg="incorrect header check",i.mode=Lt;break}if((15&A)!==Pt){e.msg="unknown compression method",i.mode=Lt;break}if(A>>>=4,h-=4,B=8+(15&A),0===i.wbits&&(i.wbits=B),B>15||B>i.wbits){e.msg="invalid window size",i.mode=Lt;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(P[0]=255&A,P[1]=A>>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0,i.mode=16182;case 16182:for(;h<32;){if(0===a)break e;a--,A+=s[o++]<>>8&255,P[2]=A>>>16&255,P[3]=A>>>24&255,i.check=U(i.check,P,4,0)),A=0,h=0,i.mode=16183;case 16183:for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>8),512&i.flags&&4&i.wrap&&(P[0]=255&A,P[1]=A>>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0,i.mode=16184;case 16184:if(1024&i.flags){for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(d=i.length,d>a&&(d=a),d&&(i.head&&(B=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(s.subarray(o,o+d),B)),512&i.flags&&4&i.wrap&&(i.check=U(i.check,s,d,o)),a-=d,o+=d,i.length-=d),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break e;d=0;do{B=s[o+d++],i.head&&B&&i.length<65536&&(i.head.name+=String.fromCharCode(B))}while(B&&d>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Et;break;case 16189:for(;h<32;){if(0===a)break e;a--,A+=s[o++]<>>=7&h,h-=7&h,i.mode=Tt;break}for(;h<3;){if(0===a)break e;a--,A+=s[o++]<>>=1,h-=1,3&A){case 0:i.mode=16193;break;case 1:if(zt(i),i.mode=Dt,t===mt){A>>>=2,h-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=Lt}A>>>=2,h-=2;break;case 16193:for(A>>>=7&h,h-=7&h;h<32;){if(0===a)break e;a--,A+=s[o++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=Lt;break}if(i.length=65535&A,A=0,h=0,i.mode=It,t===mt)break e;case It:i.mode=16195;case 16195:if(d=i.length,d){if(d>a&&(d=a),d>l&&(d=l),0===d)break e;r.set(s.subarray(o,o+d),n),a-=d,o+=d,l-=d,n+=d,i.length-=d;break}i.mode=Et;break;case 16196:for(;h<14;){if(0===a)break e;a--,A+=s[o++]<>>=5,h-=5,i.ndist=1+(31&A),A>>>=5,h-=5,i.ncode=4+(15&A),A>>>=4,h-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=Lt;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,h-=3}for(;i.have<19;)i.lens[E[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,C={bits:i.lenbits},w=pt(0,i.lens,0,19,i.lencode,0,i.work,C),i.lenbits=C.bits,w){e.msg="invalid code lengths set",i.mode=Lt;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=x>>>16&255,_=65535&x,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=g,h-=g,i.lens[i.have++]=_;else{if(16===_){for(M=g+2;h>>=g,h-=g,0===i.have){e.msg="invalid bit length repeat",i.mode=Lt;break}B=i.lens[i.have-1],d=3+(3&A),A>>>=2,h-=2}else if(17===_){for(M=g+3;h>>=g,h-=g,B=0,d=3+(7&A),A>>>=3,h-=3}else{for(M=g+7;h>>=g,h-=g,B=0,d=11+(127&A),A>>>=7,h-=7}if(i.have+d>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=Lt;break}for(;d--;)i.lens[i.have++]=B}}if(i.mode===Lt)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=Lt;break}if(i.lenbits=9,C={bits:i.lenbits},w=pt(1,i.lens,0,i.nlen,i.lencode,0,i.work,C),i.lenbits=C.bits,w){e.msg="invalid literal/lengths set",i.mode=Lt;break}if(i.distbits=6,i.distcode=i.distdyn,C={bits:i.distbits},w=pt(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,C),i.distbits=C.bits,w){e.msg="invalid distances set",i.mode=Lt;break}if(i.mode=Dt,t===mt)break e;case Dt:i.mode=St;case St:if(a>=6&&l>=258){e.next_out=n,e.avail_out=l,e.next_in=o,e.avail_in=a,i.hold=A,i.bits=h,At(e,u),n=e.next_out,r=e.output,l=e.avail_out,o=e.next_in,s=e.input,a=e.avail_in,A=i.hold,h=i.bits,i.mode===Et&&(i.back=-1);break}for(i.back=0;x=i.lencode[A&(1<>>24,m=x>>>16&255,_=65535&x,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>v)],g=x>>>24,m=x>>>16&255,_=65535&x,!(v+g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=v,h-=v,i.back+=v}if(A>>>=g,h-=g,i.back+=g,i.length=_,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=Et;break}if(64&m){e.msg="invalid literal/length code",i.mode=Lt;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;x=i.distcode[A&(1<>>24,m=x>>>16&255,_=65535&x,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>v)],g=x>>>24,m=x>>>16&255,_=65535&x,!(v+g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=v,h-=v,i.back+=v}if(A>>>=g,h-=g,i.back+=g,64&m){e.msg="invalid distance code",i.mode=Lt;break}i.offset=_,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=Lt;break}i.mode=16204;case 16204:if(0===l)break e;if(d=u-l,i.offset>d){if(d=i.offset-d,d>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=Lt;break}d>i.wnext?(d-=i.wnext,p=i.wsize-d):p=i.wnext-d,d>i.length&&(d=i.length),f=i.window}else f=r,p=n-i.offset,d=i.length;d>l&&(d=l),l-=d,i.length-=d;do{r[n++]=f[p++]}while(--d);0===i.length&&(i.mode=St);break;case 16205:if(0===l)break e;r[n++]=i.length,l--,i.mode=St;break;case Tt:if(i.wrap){for(;h<32;){if(0===a)break e;a--,A|=s[o++]<{if(kt(e))return yt;let t=e.state;return t.window&&(t.window=null),e.state=null,_t},Zt=(e,t)=>{if(kt(e))return yt;const i=e.state;return 0==(2&i.wrap)?yt:(i.head=t,t.done=!1,_t)},qt=(e,t)=>{const i=t.length;let s,r,o;return kt(e)?yt:(s=e.state,0!==s.wrap&&s.mode!==Mt?yt:s.mode===Mt&&(r=1,r=L(r,t,i,0),r!==s.check)?Bt:(o=Wt(e,t,i,i),o?(s.mode=16210,wt):(s.havedict=1,_t)))},$t=function(){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};const ei=Object.prototype.toString,{Z_NO_FLUSH:ti,Z_FINISH:ii,Z_OK:si,Z_STREAM_END:ri,Z_NEED_DICT:oi,Z_STREAM_ERROR:ni,Z_DATA_ERROR:ai,Z_MEM_ERROR:li}=O;function Ai(e){this.options=Ve({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xe,this.strm.avail_out=0;let i=Xt(this.strm,t.windowBits);if(i!==si)throw new Error(k[i]);if(this.header=new $t,Zt(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=ze(t.dictionary):"[object ArrayBuffer]"===ei.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=qt(this.strm,t.dictionary),i!==si)))throw new Error(k[i])}function hi(e,t){const i=new Ai(t);if(i.push(e),i.err)throw i.msg||k[i.err];return i.result}Ai.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize,r=this.options.dictionary;let o,n,a;if(this.ended)return!1;for(n=t===~~t?t:!0===t?ii:ti,"[object ArrayBuffer]"===ei.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),o=Jt(i,n),o===oi&&r&&(o=qt(i,r),o===si?o=Jt(i,n):o===ai&&(o=oi));i.avail_in>0&&o===ri&&i.state.wrap>0&&0!==e[i.next_in];)Kt(i),o=Jt(i,n);switch(o){case ni:case ai:case oi:case li:return this.onEnd(o),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||o===ri))if("string"===this.options.to){let e=Ke(i.output,i.next_out),t=i.next_out-e,r=We(i.output,e);i.next_out=t,i.avail_out=s-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(r)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(o!==si||0!==a){if(o===ri)return o=Yt(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ai.prototype.onData=function(e){this.chunks.push(e)},Ai.prototype.onEnd=function(e){e===si&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=He(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ci={Inflate:Ai,inflate:hi,inflateRaw:function(e,t){return(t=t||{}).raw=!0,hi(e,t)},ungzip:hi,constants:O};const{Deflate:ui,deflate:di,deflateRaw:pi,gzip:fi}=at,{Inflate:gi,inflate:mi,inflateRaw:_i,ungzip:vi}=ci;var bi=ui,yi=di,Bi=pi,wi=fi,xi=gi,Pi=mi,Ci=_i,Mi=vi,Ei=O,Fi={Deflate:bi,deflate:yi,deflateRaw:Bi,gzip:wi,Inflate:xi,inflate:Pi,inflateRaw:Ci,ungzip:Mi,constants:Ei};e.Deflate=bi,e.Inflate=xi,e.constants=Ei,e.default=Fi,e.deflate=yi,e.deflateRaw=Bi,e.gzip=wi,e.inflate=Pi,e.inflateRaw=Ci,e.ungzip=Mi,Object.defineProperty(e,"__esModule",{value:!0})}));var SC=Object.freeze({__proto__:null});let TC=window.pako||SC;TC.inflate||(TC=TC.default);const LC=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const RC={version:1,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],meshPositions:e[4],meshIndices:e[5],meshEdgesIndices:e[6],meshColors:e[7],entityIDs:e[8],entityMeshes:e[9],entityIsObjects:e[10],positionsDecodeMatrix:e[11]}}(i),a=function(e){return{positions:new Uint16Array(TC.inflate(e.positions).buffer),normals:new Int8Array(TC.inflate(e.normals).buffer),indices:new Uint32Array(TC.inflate(e.indices).buffer),edgeIndices:new Uint32Array(TC.inflate(e.edgeIndices).buffer),meshPositions:new Uint32Array(TC.inflate(e.meshPositions).buffer),meshIndices:new Uint32Array(TC.inflate(e.meshIndices).buffer),meshEdgesIndices:new Uint32Array(TC.inflate(e.meshEdgesIndices).buffer),meshColors:new Uint8Array(TC.inflate(e.meshColors).buffer),entityIDs:TC.inflate(e.entityIDs,{to:"string"}),entityMeshes:new Uint32Array(TC.inflate(e.entityMeshes).buffer),entityIsObjects:new Uint8Array(TC.inflate(e.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(TC.inflate(e.positionsDecodeMatrix).buffer)}}(n);!function(e,t,i,s,r,o){o.getNextId(),s.positionsCompression="precompressed",s.normalsCompression="precompressed";const n=i.positions,a=i.normals,l=i.indices,A=i.edgeIndices,h=i.meshPositions,c=i.meshIndices,u=i.meshEdgesIndices,p=i.meshColors,f=JSON.parse(i.entityIDs),g=i.entityMeshes,m=i.entityIsObjects,_=h.length,v=g.length;for(let r=0;rg[e]g[t]?1:0));for(let e=0;e1||(E[i]=e)}}for(let e=0;e1,o=jC(m.subarray(4*t,4*t+3)),u=m[4*t+3]/255,_=a.subarray(d[t],i?a.length:d[t+1]),b=l.subarray(d[t],i?l.length:d[t+1]),B=A.subarray(p[t],i?A.length:p[t+1]),x=h.subarray(f[t],i?h.length:f[t+1]),M=c.subarray(g[t],g[t]+16);if(r){const e=`${n}-geometry.${t}`;s.createGeometry({id:e,primitive:"triangles",positionsCompressed:_,normalsCompressed:b,indices:B,edgeIndices:x,positionsDecodeMatrix:M})}else{const e=`${n}-${t}`;v[E[t]];const i={};s.createMesh(y.apply(i,{id:e,primitive:"triangles",positionsCompressed:_,normalsCompressed:b,indices:B,edgeIndices:x,positionsDecodeMatrix:M,color:o,opacity:u}))}}let F=0;for(let e=0;e1){const t={},r=`${n}-instance.${F++}`,o=`${n}-geometry.${i}`,a=16*B[e],A=u.subarray(a,a+16);s.createMesh(y.apply(t,{id:r,geometryId:o,matrix:A})),l.push(r)}else l.push(i)}if(l.length>0){const e={};s.createEntity(y.apply(e,{id:r,isObject:!0,meshIds:l}))}}}(0,0,a,s,0,o)}};let zC=window.pako||SC;zC.inflate||(zC=zC.default);const WC=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const KC={version:5,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],eachPrimitivePositionsAndNormalsPortion:e[5],eachPrimitiveIndicesPortion:e[6],eachPrimitiveEdgeIndicesPortion:e[7],eachPrimitiveColor:e[8],primitiveInstances:e[9],eachEntityId:e[10],eachEntityPrimitiveInstancesPortion:e[11],eachEntityMatricesPortion:e[12]}}(i),a=function(e){return{positions:new Float32Array(zC.inflate(e.positions).buffer),normals:new Int8Array(zC.inflate(e.normals).buffer),indices:new Uint32Array(zC.inflate(e.indices).buffer),edgeIndices:new Uint32Array(zC.inflate(e.edgeIndices).buffer),matrices:new Float32Array(zC.inflate(e.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(zC.inflate(e.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(zC.inflate(e.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(zC.inflate(e.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveColor:new Uint8Array(zC.inflate(e.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(zC.inflate(e.primitiveInstances).buffer),eachEntityId:zC.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(zC.inflate(e.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(zC.inflate(e.eachEntityMatricesPortion).buffer)}}(n);!function(e,t,i,s,r,o){const n=o.getNextId();s.positionsCompression="disabled",s.normalsCompression="precompressed";const a=i.positions,l=i.normals,A=i.indices,h=i.edgeIndices,c=i.matrices,u=i.eachPrimitivePositionsAndNormalsPortion,d=i.eachPrimitiveIndicesPortion,p=i.eachPrimitiveEdgeIndicesPortion,f=i.eachPrimitiveColor,g=i.primitiveInstances,m=JSON.parse(i.eachEntityId),_=i.eachEntityPrimitiveInstancesPortion,v=i.eachEntityMatricesPortion,b=u.length,B=g.length,w=new Uint8Array(b),x=m.length;for(let e=0;e1||(P[i]=e)}}for(let e=0;e1,r=WC(f.subarray(4*e,4*e+3)),o=f[4*e+3]/255,c=a.subarray(u[e],t?a.length:u[e+1]),g=l.subarray(u[e],t?l.length:u[e+1]),_=A.subarray(d[e],t?A.length:d[e+1]),v=h.subarray(p[e],t?h.length:p[e+1]);if(i){const t=`${n}-geometry.${e}`;s.createGeometry({id:t,primitive:"triangles",positionsCompressed:c,normalsCompressed:g,indices:_,edgeIndices:v})}else{const t=e;m[P[e]];const i={};s.createMesh(y.apply(i,{id:t,primitive:"triangles",positionsCompressed:c,normalsCompressed:g,indices:_,edgeIndices:v,color:r,opacity:o}))}}let C=0;for(let e=0;e1){const t={},r="instance."+C++,o="geometry"+i,n=16*v[e],l=c.subarray(n,n+16);s.createMesh(y.apply(t,{id:r,geometryId:o,matrix:l})),a.push(r)}else a.push(i)}if(a.length>0){const e={};s.createEntity(y.apply(e,{id:r,isObject:!0,meshIds:a}))}}}(0,0,a,s,0,o)}};let XC=window.pako||SC;XC.inflate||(XC=XC.default);const JC=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const YC={version:6,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],reusedPrimitivesDecodeMatrix:e[5],eachPrimitivePositionsAndNormalsPortion:e[6],eachPrimitiveIndicesPortion:e[7],eachPrimitiveEdgeIndicesPortion:e[8],eachPrimitiveColorAndOpacity:e[9],primitiveInstances:e[10],eachEntityId:e[11],eachEntityPrimitiveInstancesPortion:e[12],eachEntityMatricesPortion:e[13],eachTileAABB:e[14],eachTileEntitiesPortion:e[15]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:XC.inflate(e,t).buffer}return{positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedPrimitivesDecodeMatrix:new Float32Array(t(e.reusedPrimitivesDecodeMatrix)),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(t(e.eachPrimitivePositionsAndNormalsPortion)),eachPrimitiveIndicesPortion:new Uint32Array(t(e.eachPrimitiveIndicesPortion)),eachPrimitiveEdgeIndicesPortion:new Uint32Array(t(e.eachPrimitiveEdgeIndicesPortion)),eachPrimitiveColorAndOpacity:new Uint8Array(t(e.eachPrimitiveColorAndOpacity)),primitiveInstances:new Uint32Array(t(e.primitiveInstances)),eachEntityId:XC.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(t(e.eachEntityPrimitiveInstancesPortion)),eachEntityMatricesPortion:new Uint32Array(t(e.eachEntityMatricesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(n);!function(e,t,i,s,r,o){const n=o.getNextId(),a=i.positions,l=i.normals,A=i.indices,h=i.edgeIndices,c=i.matrices,u=i.reusedPrimitivesDecodeMatrix,p=i.eachPrimitivePositionsAndNormalsPortion,f=i.eachPrimitiveIndicesPortion,g=i.eachPrimitiveEdgeIndicesPortion,m=i.eachPrimitiveColorAndOpacity,_=i.primitiveInstances,v=JSON.parse(i.eachEntityId),b=i.eachEntityPrimitiveInstancesPortion,B=i.eachEntityMatricesPortion,w=i.eachTileAABB,x=i.eachTileEntitiesPortion,P=p.length,C=_.length,M=v.length,E=x.length,F=new Uint32Array(P);for(let e=0;e1,c=t===P-1,d=a.subarray(p[t],c?a.length:p[t+1]),v=l.subarray(p[t],c?l.length:p[t+1]),b=A.subarray(f[t],c?A.length:f[t+1]),B=h.subarray(g[t],c?h.length:g[t+1]),w=JC(m.subarray(4*t,4*t+3)),x=m[4*t+3]/255,C=o.getNextId();if(r){const e=`${n}-geometry.${i}.${t}`;U[e]||(s.createGeometry({id:e,primitive:"triangles",positionsCompressed:d,indices:b,edgeIndices:B,positionsDecodeMatrix:u}),U[e]=!0),s.createMesh(y.apply(N,{id:C,geometryId:e,origin:I,matrix:E,color:w,opacity:x})),L.push(C)}else s.createMesh(y.apply(N,{id:C,origin:I,primitive:"triangles",positionsCompressed:d,normalsCompressed:v,indices:b,edgeIndices:B,positionsDecodeMatrix:R,color:w,opacity:x})),L.push(C)}L.length>0&&s.createEntity(y.apply(O,{id:x,isObject:!0,meshIds:L}))}}}(e,t,a,s,0,o)}};let ZC=window.pako||SC;ZC.inflate||(ZC=ZC.default);const qC=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function $C(e){const t=[];for(let i=0,s=e.length;i1,d=t===F-1,P=qC(x.subarray(6*e,6*e+3)),C=x[6*e+3]/255,M=x[6*e+4]/255,E=x[6*e+5]/255,I=o.getNextId();if(r){const r=w[e],o=u.slice(r,r+16),B=`${n}-geometry.${i}.${t}`;if(!Q[B]){let e,i,r,o,n,u;switch(f[t]){case 0:e="solid",i=a.subarray(g[t],d?a.length:g[t+1]),r=l.subarray(m[t],d?l.length:m[t+1]),n=h.subarray(v[t],d?h.length:v[t+1]),u=c.subarray(b[t],d?c.length:b[t+1]);break;case 1:e="surface",i=a.subarray(g[t],d?a.length:g[t+1]),r=l.subarray(m[t],d?l.length:m[t+1]),n=h.subarray(v[t],d?h.length:v[t+1]),u=c.subarray(b[t],d?c.length:b[t+1]);break;case 2:e="points",i=a.subarray(g[t],d?a.length:g[t+1]),o=$C(A.subarray(_[t],d?A.length:_[t+1]));break;case 3:e="lines",i=a.subarray(g[t],d?a.length:g[t+1]),n=h.subarray(v[t],d?h.length:v[t+1]);break;default:continue}s.createGeometry({id:B,primitive:e,positionsCompressed:i,normalsCompressed:r,colors:o,indices:n,edgeIndices:u,positionsDecodeMatrix:p}),Q[B]=!0}s.createMesh(y.apply(V,{id:I,geometryId:B,origin:L,matrix:o,color:P,metallic:M,roughness:E,opacity:C})),U.push(I)}else{let e,i,r,o,n,u;switch(f[t]){case 0:e="solid",i=a.subarray(g[t],d?a.length:g[t+1]),r=l.subarray(m[t],d?l.length:m[t+1]),n=h.subarray(v[t],d?h.length:v[t+1]),u=c.subarray(b[t],d?c.length:b[t+1]);break;case 1:e="surface",i=a.subarray(g[t],d?a.length:g[t+1]),r=l.subarray(m[t],d?l.length:m[t+1]),n=h.subarray(v[t],d?h.length:v[t+1]),u=c.subarray(b[t],d?c.length:b[t+1]);break;case 2:e="points",i=a.subarray(g[t],d?a.length:g[t+1]),o=$C(A.subarray(_[t],d?A.length:_[t+1]));break;case 3:e="lines",i=a.subarray(g[t],d?a.length:g[t+1]),n=h.subarray(v[t],d?h.length:v[t+1]);break;default:continue}s.createMesh(y.apply(V,{id:I,origin:L,primitive:e,positionsCompressed:i,normalsCompressed:r,colors:o,indices:n,edgeIndices:u,positionsDecodeMatrix:N,color:P,metallic:M,roughness:E,opacity:C})),U.push(I)}}U.length>0&&s.createEntity(y.apply(O,{id:E,isObject:!0,meshIds:U}))}}}(e,t,a,s,0,o)}};let tM=window.pako||SC;tM.inflate||(tM=tM.default);const iM=d.vec4(),sM=d.vec4();const rM=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function oM(e){const t=[];for(let i=0,s=e.length;i1,l=r===R-1,A=rM(F.subarray(6*e,6*e+3)),h=F[6*e+3]/255,c=F[6*e+4]/255,I=F[6*e+5]/255,D=o.getNextId();if(a){const o=E[e],a=_.slice(o,o+16),M=`${n}-geometry.${i}.${r}`;let F=H[M];if(!F){F={batchThisMesh:!t.reuseGeometries};let e=!1;switch(b[r]){case 0:F.primitiveName="solid",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryNormals=p.subarray(w[r],l?p.length:w[r+1]),F.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),F.geometryEdgeIndices=m.subarray(C[r],l?m.length:C[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 1:F.primitiveName="surface",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryNormals=p.subarray(w[r],l?p.length:w[r+1]),F.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),F.geometryEdgeIndices=m.subarray(C[r],l?m.length:C[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 2:F.primitiveName="points",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryColors=oM(f.subarray(x[r],l?f.length:x[r+1])),e=F.geometryPositions.length>0;break;case 3:F.primitiveName="lines",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;default:continue}if(e||(F=null),F&&(F.geometryPositions.length,F.batchThisMesh)){F.decompressedPositions=new Float32Array(F.geometryPositions.length);const e=F.geometryPositions,t=F.decompressedPositions;for(let i=0,s=e.length;i0&&n.length>0;break;case 1:e="surface",t=u.subarray(B[r],l?u.length:B[r+1]),i=p.subarray(w[r],l?p.length:w[r+1]),n=g.subarray(P[r],l?g.length:P[r+1]),a=m.subarray(C[r],l?m.length:C[r+1]),d=t.length>0&&n.length>0;break;case 2:e="points",t=u.subarray(B[r],l?u.length:B[r+1]),o=oM(f.subarray(x[r],l?f.length:x[r+1])),d=t.length>0;break;case 3:e="lines",t=u.subarray(B[r],l?u.length:B[r+1]),n=g.subarray(P[r],l?g.length:P[r+1]),d=t.length>0&&n.length>0;break;default:continue}d&&(s.createMesh(y.apply(G,{id:D,origin:Q,primitive:e,positionsCompressed:t,normalsCompressed:i,colorsCompressed:o,indices:n,edgeIndices:a,positionsDecodeMatrix:L,color:A,metallic:c,roughness:I,opacity:h})),T.push(D))}}T.length>0&&s.createEntity(y.apply(j,{id:A,isObject:!0,meshIds:T}))}}}(e,t,a,s,r,o)}};let aM=window.pako||SC;aM.inflate||(aM=aM.default);const lM=d.vec4(),AM=d.vec4();const hM=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const cM={version:9,parse:function(e,t,i,s,r,o){const n=function(e){return{metadata:e[0],positions:e[1],normals:e[2],colors:e[3],indices:e[4],edgeIndices:e[5],matrices:e[6],reusedGeometriesDecodeMatrix:e[7],eachGeometryPrimitiveType:e[8],eachGeometryPositionsPortion:e[9],eachGeometryNormalsPortion:e[10],eachGeometryColorsPortion:e[11],eachGeometryIndicesPortion:e[12],eachGeometryEdgeIndicesPortion:e[13],eachMeshGeometriesPortion:e[14],eachMeshMatricesPortion:e[15],eachMeshMaterial:e[16],eachEntityId:e[17],eachEntityMeshesPortion:e[18],eachTileAABB:e[19],eachTileEntitiesPortion:e[20]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:aM.inflate(e,t).buffer}return{metadata:JSON.parse(aM.inflate(e.metadata,{to:"string"})),positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),colors:new Uint8Array(t(e.colors)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(t(e.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(t(e.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(t(e.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(t(e.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(t(e.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(t(e.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(t(e.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(t(e.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(t(e.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(t(e.eachMeshMaterial)),eachEntityId:JSON.parse(aM.inflate(e.eachEntityId,{to:"string"})),eachEntityMeshesPortion:new Uint32Array(t(e.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(n);!function(e,t,i,s,r,o){const n=o.getNextId(),a=i.metadata,l=i.positions,A=i.normals,h=i.colors,c=i.indices,u=i.edgeIndices,p=i.matrices,f=i.reusedGeometriesDecodeMatrix,g=i.eachGeometryPrimitiveType,m=i.eachGeometryPositionsPortion,_=i.eachGeometryNormalsPortion,v=i.eachGeometryColorsPortion,b=i.eachGeometryIndicesPortion,B=i.eachGeometryEdgeIndicesPortion,w=i.eachMeshGeometriesPortion,x=i.eachMeshMatricesPortion,P=i.eachMeshMaterial,C=i.eachEntityId,M=i.eachEntityMeshesPortion,E=i.eachTileAABB,F=i.eachTileEntitiesPortion,I=m.length,D=w.length,S=M.length,T=F.length;r&&r.loadData(a,{includeTypes:t.includeTypes,excludeTypes:t.excludeTypes,globalizeObjectIds:t.globalizeObjectIds});const L=new Uint32Array(I);for(let e=0;e1,C=r===I-1,M=hM(P.subarray(6*e,6*e+3)),E=P[6*e+3]/255,F=P[6*e+4]/255,D=P[6*e+5]/255,S=o.getNextId();if(a){const o=x[e],a=p.slice(o,o+16),w=`${n}-geometry.${i}.${r}`;let P=k[w];if(!P){P={batchThisMesh:!t.reuseGeometries};let e=!1;switch(g[r]){case 0:P.primitiveName="solid",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryNormals=A.subarray(_[r],C?A.length:_[r+1]),P.geometryIndices=c.subarray(b[r],C?c.length:b[r+1]),P.geometryEdgeIndices=u.subarray(B[r],C?u.length:B[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;case 1:P.primitiveName="surface",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryNormals=A.subarray(_[r],C?A.length:_[r+1]),P.geometryIndices=c.subarray(b[r],C?c.length:b[r+1]),P.geometryEdgeIndices=u.subarray(B[r],C?u.length:B[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;case 2:P.primitiveName="points",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryColors=h.subarray(v[r],C?h.length:v[r+1]),e=P.geometryPositions.length>0;break;case 3:P.primitiveName="lines",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryIndices=c.subarray(b[r],C?c.length:b[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;default:continue}if(e||(P=null),P&&(P.geometryPositions.length,P.batchThisMesh)){P.decompressedPositions=new Float32Array(P.geometryPositions.length),P.transformedAndRecompressedPositions=new Uint16Array(P.geometryPositions.length);const e=P.geometryPositions,t=P.decompressedPositions;for(let i=0,s=e.length;i0&&n.length>0;break;case 1:e="surface",t=l.subarray(m[r],C?l.length:m[r+1]),i=A.subarray(_[r],C?A.length:_[r+1]),n=c.subarray(b[r],C?c.length:b[r+1]),a=u.subarray(B[r],C?u.length:B[r+1]),d=t.length>0&&n.length>0;break;case 2:e="points",t=l.subarray(m[r],C?l.length:m[r+1]),o=h.subarray(v[r],C?h.length:v[r+1]),d=t.length>0;break;case 3:e="lines",t=l.subarray(m[r],C?l.length:m[r+1]),n=c.subarray(b[r],C?c.length:b[r+1]),d=t.length>0&&n.length>0;break;default:continue}d&&(s.createMesh(y.apply(j,{id:S,origin:R,primitive:e,positionsCompressed:t,normalsCompressed:i,colorsCompressed:o,indices:n,edgeIndices:a,positionsDecodeMatrix:Q,color:M,metallic:F,roughness:D,opacity:E})),O.push(S))}}O.length>0&&s.createEntity(y.apply(H,{id:E,isObject:!0,meshIds:O}))}}}(e,t,a,s,r,o)}};let uM=window.pako||SC;uM.inflate||(uM=uM.default);const dM=d.vec4(),pM=d.vec4();const fM=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function gM(e,t){const i=[];if(t.length>1)for(let e=0,s=t.length-1;e1)for(let t=0,s=e.length/3-1;t0,a=9*e,c=1===h[a+0],u=h[a+1];h[a+2],h[a+3];const d=h[a+4],p=h[a+5],f=h[a+6],g=h[a+7],m=h[a+8];if(o){const t=new Uint8Array(l.subarray(i,r)).buffer,o=`${n}-texture-${e}`;if(c)s.createTexture({id:o,buffers:[t],minFilter:d,magFilter:p,wrapS:f,wrapT:g,wrapR:m});else{const e=new Blob([t],{type:10001===u?"image/jpeg":10002===u?"image/png":"image/gif"}),i=(window.URL||window.webkitURL).createObjectURL(e),r=document.createElement("img");r.src=i,s.createTexture({id:o,image:r,minFilter:d,magFilter:p,wrapS:f,wrapT:g,wrapR:m})}}}for(let e=0;e=0?`${n}-texture-${r}`:null,normalsTextureId:a>=0?`${n}-texture-${a}`:null,metallicRoughnessTextureId:o>=0?`${n}-texture-${o}`:null,emissiveTextureId:l>=0?`${n}-texture-${l}`:null,occlusionTextureId:A>=0?`${n}-texture-${A}`:null})}const j=new Uint32Array(N);for(let e=0;e1,l=r===N-1,A=D[e],h=A>=0?`${n}-textureSet-${A}`:null,T=fM(S.subarray(6*e,6*e+3)),L=S[6*e+3]/255,R=S[6*e+4]/255,O=S[6*e+5]/255,Q=o.getNextId();if(a){const o=I[e],a=v.slice(o,o+16),A=`${n}-geometry.${i}.${r}`;let F=W[A];if(!F){F={batchThisMesh:!t.reuseGeometries};let e=!1;switch(B[r]){case 0:F.primitiveName="solid",F.geometryPositions=c.subarray(w[r],l?c.length:w[r+1]),F.geometryNormals=u.subarray(x[r],l?u.length:x[r+1]),F.geometryUVs=f.subarray(C[r],l?f.length:C[r+1]),F.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),F.geometryEdgeIndices=m.subarray(E[r],l?m.length:E[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 1:F.primitiveName="surface",F.geometryPositions=c.subarray(w[r],l?c.length:w[r+1]),F.geometryNormals=u.subarray(x[r],l?u.length:x[r+1]),F.geometryUVs=f.subarray(C[r],l?f.length:C[r+1]),F.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),F.geometryEdgeIndices=m.subarray(E[r],l?m.length:E[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 2:F.primitiveName="points",F.geometryPositions=c.subarray(w[r],l?c.length:w[r+1]),F.geometryColors=p.subarray(P[r],l?p.length:P[r+1]),e=F.geometryPositions.length>0;break;case 3:F.primitiveName="lines",F.geometryPositions=c.subarray(w[r],l?c.length:w[r+1]),F.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 4:F.primitiveName="lines",F.geometryPositions=c.subarray(w[r],l?c.length:w[r+1]),F.geometryIndices=gM(F.geometryPositions,g.subarray(M[r],l?g.length:M[r+1])),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;default:continue}if(e||(F=null),F&&(F.geometryPositions.length,F.batchThisMesh)){F.decompressedPositions=new Float32Array(F.geometryPositions.length),F.transformedAndRecompressedPositions=new Uint16Array(F.geometryPositions.length);const e=F.geometryPositions,t=F.decompressedPositions;for(let i=0,s=e.length;i0&&a.length>0;break;case 1:e="surface",t=c.subarray(w[r],l?c.length:w[r+1]),i=u.subarray(x[r],l?u.length:x[r+1]),o=f.subarray(C[r],l?f.length:C[r+1]),a=g.subarray(M[r],l?g.length:M[r+1]),A=m.subarray(E[r],l?m.length:E[r+1]),d=t.length>0&&a.length>0;break;case 2:e="points",t=c.subarray(w[r],l?c.length:w[r+1]),n=p.subarray(P[r],l?p.length:P[r+1]),d=t.length>0;break;case 3:e="lines",t=c.subarray(w[r],l?c.length:w[r+1]),a=g.subarray(M[r],l?g.length:M[r+1]),d=t.length>0&&a.length>0;break;case 4:e="lines",t=c.subarray(w[r],l?c.length:w[r+1]),a=gM(t,g.subarray(M[r],l?g.length:M[r+1])),d=t.length>0&&a.length>0;break;default:continue}d&&(s.createMesh(y.apply(H,{id:Q,textureSetId:h,origin:G,primitive:e,positionsCompressed:t,normalsCompressed:i,uv:o&&o.length>0?o:null,colorsCompressed:n,indices:a,edgeIndices:A,positionsDecodeMatrix:_,color:T,metallic:R,roughness:O,opacity:L})),U.push(Q))}}U.length>0&&s.createEntity(y.apply(Q,{id:l,isObject:!0,meshIds:U}))}}}(e,t,a,s,r,o)}},_M={};_M[RC.version]=RC,_M[OC.version]=OC,_M[VC.version]=VC,_M[GC.version]=GC,_M[KC.version]=KC,_M[YC.version]=YC,_M[eM.version]=eM,_M[nM.version]=nM,_M[cM.version]=cM,_M[mM.version]=mM;class vM extends z{constructor(e,t={}){super("XKTLoader",e,t),this._maxGeometryBatchSize=t.maxGeometryBatchSize,this.textureTranscoder=t.textureTranscoder,this.dataSource=t.dataSource,this.objectDefaults=t.objectDefaults,this.includeTypes=t.includeTypes,this.excludeTypes=t.excludeTypes,this.excludeUnclassifiedObjects=t.excludeUnclassifiedObjects,this.reuseGeometries=t.reuseGeometries}get supportedVersions(){return Object.keys(_M)}get textureTranscoder(){return this._textureTranscoder}set textureTranscoder(e){this._textureTranscoder=e}get dataSource(){return this._dataSource}set dataSource(e){this._dataSource=e||new DC}get objectDefaults(){return this._objectDefaults}set objectDefaults(e){this._objectDefaults=e||DP}get includeTypes(){return this._includeTypes}set includeTypes(e){this._includeTypes=e}get excludeTypes(){return this._excludeTypes}set excludeTypes(e){this._excludeTypes=e}get excludeUnclassifiedObjects(){return this._excludeUnclassifiedObjects}set excludeUnclassifiedObjects(e){this._excludeUnclassifiedObjects=!!e}get globalizeObjectIds(){return this._globalizeObjectIds}set globalizeObjectIds(e){this._globalizeObjectIds=!!e}get reuseGeometries(){return this._reuseGeometries}set reuseGeometries(e){this._reuseGeometries=!1!==e}load(e={}){if(e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id),!(e.src||e.xkt||e.manifestSrc||e.manifest))return this.error("load() param expected: src, xkt, manifestSrc or manifestData"),o;const t={},i=e.includeTypes||this._includeTypes,s=e.excludeTypes||this._excludeTypes,r=e.objectDefaults||this._objectDefaults;if(t.reuseGeometries=null!==e.reuseGeometries&&void 0!==e.reuseGeometries?e.reuseGeometries:!1!==this._reuseGeometries,i){t.includeTypesMap={};for(let e=0,s=i.length;e{o.finalize(),a.finalize(),this.viewer.scene.canvas.spinner.processes--,o.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(a.id)})),this.scheduleTask((()=>{o.destroyed||(o.scene.fire("modelLoaded",o.id),o.fire("loaded",!0,!1))}))},A=e=>{this.viewer.scene.canvas.spinner.processes--,this.error(e),o.fire("error",e)};let h=0;const c={getNextId:()=>`${n}.${h++}`};if(e.metaModelSrc||e.metaModelData)if(e.metaModelSrc){const r=e.metaModelSrc;this._dataSource.getMetaModel(r,(r=>{o.destroyed||(a.loadData(r,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),e.src?this._loadModel(e.src,e,t,o,null,c,l,A):(this._parseModel(e.xkt,e,t,o,null,c),l()))}),(e=>{A(`load(): Failed to load model metadata for model '${n} from '${r}' - ${e}`)}))}else e.metaModelData&&(a.loadData(e.metaModelData,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),e.src?this._loadModel(e.src,e,t,o,null,c,l,A):(this._parseModel(e.xkt,e,t,o,null,c),l()));else if(e.src)this._loadModel(e.src,e,t,o,a,c,l,A);else if(e.xkt)this._parseModel(e.xkt,e,t,o,a,c),l();else if(e.manifestSrc||e.manifest){const r=e.manifestSrc?function(e){const t=e.split("/");return t.pop(),t.join("/")+"/"}(e.manifestSrc):"",n=(e,o,n)=>{let l=0;const A=()=>{l>=e.length?o():this._dataSource.getMetaModel(`${r}${e[l]}`,(e=>{a.loadData(e,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),l++,this.scheduleTask(A,100)}),n)};A()},h=(i,s,n)=>{let a=0;const l=()=>{a>=i.length?s():this._dataSource.getXKT(`${r}${i[a]}`,(i=>{this._parseModel(i,e,t,o,null,c),a++,this.scheduleTask(l,100)}),n)};l()},u=(i,s,n)=>{let l=0;const A=()=>{l>=i.length?s():this._dataSource.getXKT(`${r}${i[l]}`,(i=>{this._parseModel(i,e,t,o,a,c),l++,this.scheduleTask(A,100)}),n)};A()};if(e.manifest){const t=e.manifest,i=t.xktFiles;if(!i||0===i.length)return void A("load(): Failed to load model manifest - manifest not valid");const s=t.metaModelFiles;s?n(s,(()=>{h(i,l,A)}),A):u(i,l,A)}else this._dataSource.getManifest(e.manifestSrc,(e=>{if(o.destroyed)return;const t=e.xktFiles;if(!t||0===t.length)return void A("load(): Failed to load model manifest - manifest not valid");const i=e.metaModelFiles;i?n(i,(()=>{h(t,l,A)}),A):u(t,l,A)}),A)}return o}_loadModel(e,t,i,s,r,o,n,a){this._dataSource.getXKT(t.src,(e=>{this._parseModel(e,t,i,s,r,o),n()}),a)}_parseModel(e,t,i,s,r,o){if(s.destroyed)return;const n=new DataView(e),a=new Uint8Array(e),l=n.getUint32(0,!0),A=_M[l];if(!A)return void this.error("Unsupported .XKT file version: "+l+" - this XKTLoaderPlugin supports versions "+Object.keys(_M));this.log("Loading .xkt V"+l);const h=n.getUint32(4,!0),c=[];let u=4*(h+2);for(let e=0;ee.size)throw new RangeError("offset:"+t+", length:"+i+", size:"+e.size);return e.slice?e.slice(t,t+i):e.webkitSlice?e.webkitSlice(t,t+i):e.mozSlice?e.mozSlice(t,t+i):e.msSlice?e.msSlice(t,t+i):void 0}(e,t,i))}catch(e){r(e)}}}function p(){}function f(e){var i,s=this;s.init=function(e){i=new Blob([],{type:n}),e()},s.writeUint8Array=function(e,s){i=new Blob([i,t?e:e.buffer],{type:n}),s()},s.getData=function(t,s){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=s,r.readAsText(i,e)}}function g(t){var i=this,s="",r="";i.init=function(e){s+="data:"+(t||"")+";base64,",e()},i.writeUint8Array=function(t,i){var o,n=r.length,a=r;for(r="",o=0;o<3*Math.floor((n+t.length)/3)-n;o++)a+=String.fromCharCode(t[o]);for(;o2?s+=e.btoa(a):r=a,i()},i.getData=function(t){t(s+e.btoa(r))}}function m(e){var i,s=this;s.init=function(t){i=new Blob([],{type:e}),t()},s.writeUint8Array=function(s,r){i=new Blob([i,t?s:s.buffer],{type:e}),r()},s.getData=function(e){e(i)}}function _(e,t,i,s,r,n,a,l,A,h){var c,u,d,p=0,f=t.sn;function g(){e.removeEventListener("message",m,!1),l(u,d)}function m(t){var i=t.data,r=i.data,o=i.error;if(o)return o.toString=function(){return"Error: "+this.message},void A(o);if(i.sn===f)switch("number"==typeof i.codecTime&&(e.codecTime+=i.codecTime),"number"==typeof i.crcTime&&(e.crcTime+=i.crcTime),i.type){case"append":r?(u+=r.length,s.writeUint8Array(r,(function(){_()}),h)):_();break;case"flush":d=i.crc,r?(u+=r.length,s.writeUint8Array(r,(function(){g()}),h)):g();break;case"progress":a&&a(c+i.loaded,n);break;case"importScripts":case"newTask":case"echo":break;default:console.warn("zip.js:launchWorkerProcess: unknown message: ",i)}}function _(){(c=p*o)<=n?i.readUint8Array(r+c,Math.min(o,n-c),(function(i){a&&a(c,n);var s=0===c?t:{sn:f};s.type="append",s.data=i;try{e.postMessage(s,[i.buffer])}catch(t){e.postMessage(s)}p++}),A):e.postMessage({sn:f,type:"flush"})}u=0,e.addEventListener("message",m,!1),_()}function v(e,t,i,s,r,n,l,A,h,c){var u,d=0,p=0,f="input"===n,g="output"===n,m=new a;!function n(){var a;if((u=d*o)127?r[i-128]:String.fromCharCode(i);return s}function B(e){return decodeURIComponent(escape(e))}function w(e){var t,i="";for(t=0;t>16,i=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&i)>>11,(2016&i)>>5,2*(31&i),0)}catch(e){}}(e.lastModDateRaw),1!=(1&e.bitFlag)?((s||8!=(8&e.bitFlag))&&(e.crc32=t.view.getUint32(i+10,!0),e.compressedSize=t.view.getUint32(i+14,!0),e.uncompressedSize=t.view.getUint32(i+18,!0)),4294967295!==e.compressedSize&&4294967295!==e.uncompressedSize?(e.filenameLength=t.view.getUint16(i+22,!0),e.extraFieldLength=t.view.getUint16(i+24,!0)):r("File is using Zip64 (4gb+ file size).")):r("File contains encrypted entry.")}function P(t,o,n){var a=0;function l(){}l.prototype.getData=function(s,o,l,h){var c=this;function u(e,t){h&&!function(e){var t=A(4);return t.view.setUint32(0,e),c.crc32==t.view.getUint32(0)}(t)?n("CRC failed."):s.getData((function(e){o(e)}))}function d(e){n(e||r)}function p(e){n(e||"Error while writing file data.")}t.readUint8Array(c.offset,30,(function(r){var o,f=A(r.length,r);1347093252==f.view.getUint32(0)?(x(c,f,4,!1,n),o=c.offset+30+c.filenameLength+c.extraFieldLength,s.init((function(){0===c.compressionMethod?b(c._worker,a++,t,s,o,c.compressedSize,h,u,l,d,p):function(t,i,s,r,o,n,a,l,A,h,c){var u=a?"output":"none";e.zip.useWebWorkers?_(t,{sn:i,codecClass:"Inflater",crcType:u},s,r,o,n,A,l,h,c):v(new e.zip.Inflater,s,r,o,n,u,A,l,h,c)}(c._worker,a++,t,s,o,c.compressedSize,h,u,l,d,p)}),p)):n(i)}),d)};var h={getEntries:function(e){var r=this._worker;!function(e){t.size<22?n(i):r(22,(function(){r(Math.min(65558,t.size),(function(){n(i)}))}));function r(i,r){t.readUint8Array(t.size-i,i,(function(t){for(var i=t.length-22;i>=0;i--)if(80===t[i]&&75===t[i+1]&&5===t[i+2]&&6===t[i+3])return void e(new DataView(t.buffer,i,22));r()}),(function(){n(s)}))}}((function(o){var a,h;a=o.getUint32(16,!0),h=o.getUint16(8,!0),a<0||a>=t.size?n(i):t.readUint8Array(a,t.size-a,(function(t){var s,o,a,c,u=0,d=[],p=A(t.length,t);for(s=0;s>>8^i[255&(t^e[s])];this.crc=t},a.prototype.get=function(){return~this.crc},a.prototype.table=function(){var e,t,i,s=[];for(e=0;e<256;e++){for(i=e,t=0;t<8;t++)1&i?i=i>>>1^3988292384:i>>>=1;s[e]=i}return s}(),l.prototype.append=function(e,t){return e},l.prototype.flush=function(){},c.prototype=new h,c.prototype.constructor=c,u.prototype=new h,u.prototype.constructor=u,d.prototype=new h,d.prototype.constructor=d,p.prototype.getData=function(e){e(this.data)},f.prototype=new p,f.prototype.constructor=f,g.prototype=new p,g.prototype.constructor=g,m.prototype=new p,m.prototype.constructor=m;var F={deflater:["z-worker.js","deflate.js"],inflater:["z-worker.js","inflate.js"]};function I(t,i,s){if(null===e.zip.workerScripts||null===e.zip.workerScriptsPath){var r;if(e.zip.workerScripts){if(r=e.zip.workerScripts[t],!Array.isArray(r))return void s(new Error("zip.workerScripts."+t+" is not an array!"));r=function(e){var t=document.createElement("a");return e.map((function(e){return t.href=e,t.href}))}(r)}else(r=F[t].slice(0))[0]=(e.zip.workerScriptsPath||"")+r[0];var o=new Worker(r[0]);o.codecTime=o.crcTime=0,o.postMessage({type:"importScripts",scripts:r.slice(1)}),o.addEventListener("message",(function e(t){var r=t.data;if(r.error)return o.terminate(),void s(r.error);"importScripts"===r.type&&(o.removeEventListener("message",e),o.removeEventListener("error",n),i(o))})),o.addEventListener("error",n)}else s(new Error("Either zip.workerScripts or zip.workerScriptsPath may be set, not both."));function n(e){o.terminate(),s(e)}}function D(e){console.error(e)}e.zip={Reader:h,Writer:p,BlobReader:d,Data64URIReader:u,TextReader:c,BlobWriter:m,Data64URIWriter:g,TextWriter:f,createReader:function(e,t,i){i=i||D,e.init((function(){P(e,t,i)}),i)},createWriter:function(e,t,i,s){i=i||D,s=!!s,e.init((function(){E(e,t,i,s)}),i)},useWebWorkers:!0,workerScriptsPath:null,workerScripts:null}}(bM);const yM=bM.zip;!function(e){var t,i,s=e.Reader,r=e.Writer;try{i=0===new Blob([new DataView(new ArrayBuffer(0))]).size}catch(e){}function o(e){var t=this;function i(i,s){var r;t.data?i():((r=new XMLHttpRequest).addEventListener("load",(function(){t.size||(t.size=Number(r.getResponseHeader("Content-Length"))||Number(r.response.byteLength)),t.data=new Uint8Array(r.response),i()}),!1),r.addEventListener("error",s,!1),r.open("GET",e),r.responseType="arraybuffer",r.send())}t.size=0,t.init=function(s,r){if(function(e){var t=document.createElement("a");return t.href=e,"http:"===t.protocol||"https:"===t.protocol}(e)){var o=new XMLHttpRequest;o.addEventListener("load",(function(){t.size=Number(o.getResponseHeader("Content-Length")),t.size?s():i(s,r)}),!1),o.addEventListener("error",r,!1),o.open("HEAD",e),o.send()}else i(s,r)},t.readUint8Array=function(e,s,r,o){i((function(){r(new Uint8Array(t.data.subarray(e,e+s)))}),o)}}function n(e){var t=this;t.size=0,t.init=function(i,s){var r=new XMLHttpRequest;r.addEventListener("load",(function(){t.size=Number(r.getResponseHeader("Content-Length")),"bytes"==r.getResponseHeader("Accept-Ranges")?i():s("HTTP Range not supported.")}),!1),r.addEventListener("error",s,!1),r.open("HEAD",e),r.send()},t.readUint8Array=function(t,i,s,r){!function(t,i,s,r){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="arraybuffer",o.setRequestHeader("Range","bytes="+t+"-"+(t+i-1)),o.addEventListener("load",(function(){s(o.response)}),!1),o.addEventListener("error",r,!1),o.send()}(t,i,(function(e){s(new Uint8Array(e))}),r)}}function a(e){var t=this;t.size=0,t.init=function(i,s){t.size=e.byteLength,i()},t.readUint8Array=function(t,i,s,r){s(new Uint8Array(e.slice(t,t+i)))}}function l(){var e,t=this;t.init=function(t,i){e=new Uint8Array,t()},t.writeUint8Array=function(t,i,s){var r=new Uint8Array(e.length+t.length);r.set(e),r.set(t,e.length),e=r,i()},t.getData=function(t){t(e.buffer)}}function A(e,t){var s,r=this;r.init=function(t,i){e.createWriter((function(e){s=e,t()}),i)},r.writeUint8Array=function(e,r,o){var n=new Blob([i?e:e.buffer],{type:t});s.onwrite=function(){s.onwrite=null,r()},s.onerror=o,s.write(n)},r.getData=function(t){e.file(t)}}o.prototype=new s,o.prototype.constructor=o,n.prototype=new s,n.prototype.constructor=n,a.prototype=new s,a.prototype.constructor=a,l.prototype=new r,l.prototype.constructor=l,A.prototype=new r,A.prototype.constructor=A,e.FileWriter=A,e.HttpReader=o,e.HttpRangeReader=n,e.ArrayBufferReader=a,e.ArrayBufferWriter=l,e.fs&&((t=e.fs.ZipDirectoryEntry).prototype.addHttpContent=function(i,s,r){return function(i,s,r,o){if(i.directory)return o?new t(i.fs,s,r,i):new e.fs.ZipFileEntry(i.fs,s,r,i);throw"Parent entry is not a directory."}(this,i,{data:s,Reader:r?n:o})},t.prototype.importHttpContent=function(e,t,i,s){this.importZip(t?new n(e):new o(e),i,s)},e.fs.FS.prototype.importHttpContent=function(e,i,s,r){this.entries=[],this.root=new t(this),this.root.importHttpContent(e,i,s,r)})}(yM);const BM=["4.2"];class wM{constructor(e,t={}){this.supportedSchemas=BM,this._xrayOpacity=.7,this._src=null,this._options=t,this.viewpoint=null,t.workerScriptsPath?(yM.workerScriptsPath=t.workerScriptsPath,this.src=t.src,this.xrayOpacity=.7,this.displayEffect=t.displayEffect,this.createMetaModel=t.createMetaModel):e.error("Config expected: workerScriptsPath")}load(e,t,i,s,r,o){switch(s.materialType){case"MetallicMaterial":t._defaultMaterial=new Gr(t,{baseColor:[1,1,1],metallic:.6,roughness:.6});break;case"SpecularMaterial":t._defaultMaterial=new Kr(t,{diffuse:[1,1,1],specular:d.vec3([1,1,1]),glossiness:.5});break;default:t._defaultMaterial=new ri(t,{reflectivity:.75,shiness:100,diffuse:[1,1,1]})}t._wireframeMaterial=new Vr(t,{color:[0,0,0],lineWidth:2});var n=t.scene.canvas.spinner;n.processes++,xM(e,t,i,s,(function(){n.processes--,r&&r(),t.fire("loaded",!0,!1)}),(function(e){n.processes--,t.error(e),o&&o(e),t.fire("error",e)}),(function(e){console.log("Error, Will Robinson: "+e)}))}}var xM=function(e,t,i,s,r,o){!function(e,t,i){var s=new SM;s.load(e,(function(){t(s)}),(function(e){i("Error loading ZIP archive: "+e)}))}(i,(function(i){PM(e,i,s,t,r,o)}),o)},PM=function(){return function(t,i,s,r,o){var n={plugin:t,zip:i,edgeThreshold:30,materialType:s.materialType,scene:r.scene,modelNode:r,info:{references:{}},materials:{}};s.createMetaModel&&(n.metaModelData={modelId:r.id,metaObjects:[{name:r.id,type:"Default",id:r.id}]}),r.scene.loading++,function(t,i){t.zip.getFile("Manifest.xml",(function(s,r){for(var o=r.children,n=0,a=o.length;n0){for(var n=o.trim().split(" "),a=new Int16Array(n.length),l=0,A=0,h=n.length;A0){i.primitive="triangles";for(var o=[],n=0,a=r.length;n=t.length)i();else{var a=t[o].id,l=a.lastIndexOf(":");l>0&&(a=a.substring(l+1));var A=a.lastIndexOf("#");A>0&&(a=a.substring(0,A)),s[a]?r(o+1):function(e,t,i){e.zip.getFile(t,(function(t,s){!function(e,t,i){for(var s,r=t.children,o=0,n=r.length;o0)for(var s=0,r=t.length;s-1?e+"&_="+t:e+"?_="+t}getIFC(e,t,i){e=this._cacheBusterURL(e);var s=()=>{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n{this._parseModel(e,t,i,s),r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){if(s.destroyed)return;const r=t.stats||{};if(r.sourceFormat="IFC",r.schemaVersion="",r.title="",r.author="",r.created="",r.numMetaObjects=0,r.numPropertySets=0,r.numObjects=0,r.numGeometries=0,r.numTriangles=0,r.numVertices=0,!this._ifcAPI)throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";const o=new Uint8Array(e),n=this._ifcAPI.OpenModel(o),a=this._ifcAPI.GetModelSchema(n),l=this._ifcAPI.GetLineIDsWithType(n,this._webIFC.IFCPROJECT).get(0),A=!1!==t.loadMetadata,h={modelID:n,modelSchema:a,sceneModel:s,loadMetadata:A,metadata:A?{id:"",projectId:""+l,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:null,metaObjects:{},options:i,log:function(e){},nextId:0,stats:r};if(A){if(i.includeTypes){h.includeTypes={};for(let e=0,t=i.includeTypes.length;e{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))}))}_parseMetaObjects(e){const t=this._ifcAPI.GetLineIDsWithType(e.modelID,this._webIFC.IFCPROJECT).get(0),i=this._ifcAPI.GetLine(e.modelID,t);this._parseSpatialChildren(e,i)}_parseSpatialChildren(e,t,i){const s=this._ifcAPI.GetNameFromTypeCode(t.type);if(e.includeTypes&&!e.includeTypes[s])return;if(e.excludeTypes&&e.excludeTypes[s])return;this._createMetaObject(e,t,i);const r=t.GlobalId.value;this._parseRelatedItemsOfType(e,t.expressID,"RelatingObject","RelatedObjects",this._webIFC.IFCRELAGGREGATES,r),this._parseRelatedItemsOfType(e,t.expressID,"RelatingStructure","RelatedElements",this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,r)}_createMetaObject(e,t,i){const s=t.GlobalId.value,r=this._ifcAPI.GetNameFromTypeCode(t.type),o={id:s,name:t.Name&&""!==t.Name.value?t.Name.value:r,type:r,parent:i};e.metadata.metaObjects.push(o),e.metaObjects[s]=o,e.stats.numMetaObjects++}_parseRelatedItemsOfType(e,t,i,s,r,o){const n=this._ifcAPI.GetLineIDsWithType(e.modelID,r);for(let r=0;re.value)).includes(t)}else h=A.value===t;if(h){const t=l[s];if(Array.isArray(t))t.forEach((t=>{const i=this._ifcAPI.GetLine(e.modelID,t.value);this._parseSpatialChildren(e,i,o)}));else{const i=this._ifcAPI.GetLine(e.modelID,t.value);this._parseSpatialChildren(e,i,o)}}}}_parsePropertySets(e){const t=this._ifcAPI.GetLineIDsWithType(e.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(let i=0;i0){const o="Default",n=t.Name.value,a=[];for(let e=0,t=s.length;e{const i=t.expressID,s=t.geometries,r=[],o=this._ifcAPI.GetLine(e.modelID,i).GlobalId.value;if(e.loadMetadata){const t=o,i=e.metaObjects[t];if(e.includeTypes&&(!i||!e.includeTypes[i.type]))return;if(e.excludeTypes&&(!i||e.excludeTypes[i.type]))return}const n=d.mat4(),a=d.vec3();for(let t=0,i=s.size();t-1?e+"&_="+t:e+"?_="+t}getLAS(e,t,i){e=this._cacheBusterURL(e);var s=()=>{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n{let t=0,i=0,s=0;const r=new DataView(e),o=new Uint8Array(6e3),n=({item:s,format:o,size:n})=>{let a,l;switch(o){case"char":return l=new Uint8Array(e,t,n),t+=n,a=jM(l),[s,a];case"uShort":return a=r.getUint16(t,!0),t+=n,[s,a];case"uLong":return a=r.getUint32(t,!0),"NumberOfVariableLengthRecords"===s&&(i=a),t+=n,[s,a];case"uChar":return a=r.getUint8(t),t+=n,[s,a];case"double":return a=r.getFloat64(t,!0),t+=n,[s,a];default:t+=n}};return(()=>{const e={};NM.forEach((t=>{const i=n({...t});if(void 0!==i){if("FileSignature"===i[0]&&"LASF"!==i[1])throw new Error("Ivalid FileSignature. Is this a LAS/LAZ file");e[i[0]]=i[1]}}));const r=[];let a=i;for(;a--;){const e={};QM.forEach((i=>{const r=n({...i});e[r[0]]=r[1],"UserId"===r[0]&&"LASF_Projection"===r[1]&&(s=t-18+54)})),r.push(e)}const l=(e=>{if(void 0===e)return;const t=s+e.RecordLengthAfterHeader,i=o.slice(s,t),r=HM(i),n=new DataView(r);let a=6,l=Number(n.getUint16(a,!0));const A=[];for(;l--;){const e={};e.key=n.getUint16(a+=2,!0),e.tiffTagLocation=n.getUint16(a+=2,!0),e.count=n.getUint16(a+=2,!0),e.valueOffset=n.getUint16(a+=2,!0),A.push(e)}const h=A.find((e=>3072===e.key));if(h&&h.hasOwnProperty("valueOffset"))return h.valueOffset})(r.find((e=>"LASF_Projection"===e.UserId)));return l&&(e.epsg=l),e})()},HM=e=>{let t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let t=0;t{let t="";return e.forEach((e=>{let i=String.fromCharCode(e);"\0"!==i&&(t+=i)})),t.trim()};class GM extends z{constructor(e,t={}){super("lasLoader",e,t),this.dataSource=t.dataSource,this.skip=t.skip,this.fp64=t.fp64,this.colorDepth=t.colorDepth}get dataSource(){return this._dataSource}set dataSource(e){this._dataSource=e||new kM}get skip(){return this._skip}set skip(e){this._skip=e||1}get fp64(){return this._fp64}set fp64(e){this._fp64=!!e}get colorDepth(){return this._colorDepth}set colorDepth(e){this._colorDepth=e||"auto"}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new Fc(this.viewer.scene,y.apply(e,{isModel:!0}));if(!e.src&&!e.las)return this.error("load() param expected: src or las"),t;const i={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(e.src)this._loadModel(e.src,e,i,t);else{const s=this.viewer.scene.canvas.spinner;s.processes++,this._parseModel(e.las,e,i,t).then((()=>{s.processes--}),(e=>{s.processes--,this.error(e),t.fire("error",e)}))}return t}_loadModel(e,t,i,s){const r=this.viewer.scene.canvas.spinner;r.processes++,this._dataSource.getLAS(t.src,(e=>{this._parseModel(e,t,i,s).then((()=>{r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){function r(e){const i=e.value;if(t.rotateX&&i)for(let e=0,t=i.length;e{if(s.destroyed)return void l();const A=t.stats||{};A.sourceFormat="LAS",A.schemaVersion="",A.title="",A.author="",A.created="",A.numMetaObjects=0,A.numPropertySets=0,A.numObjects=0,A.numGeometries=0,A.numTriangles=0,A.numVertices=0;try{const A=VM(e);OB(e,OM,i).then((e=>{const h=e.attributes,c=e.loaderData,u=void 0!==c.pointsFormatId?c.pointsFormatId:-1;if(!h.POSITION)return s.finalize(),void l("No positions found in file");let p,f;switch(u){case 0:p=r(h.POSITION),f=n(h.intensity);break;case 1:if(!h.intensity)return s.finalize(),void l("No positions found in file");p=r(h.POSITION),f=n(h.intensity);break;case 2:case 3:if(!h.intensity)return s.finalize(),void l("No positions found in file");p=r(h.POSITION),f=o(h.COLOR_0,h.intensity)}const g=zM(p,15e5),m=zM(f,2e6),_=[];for(let e=0,t=g.length;e{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))})),a()}))}catch(e){s.finalize(),l(e)}}))}}function zM(e,t){if(t>=e.length)return[e];let i=[];for(let s=0;s-1?e+"&_="+t:e+"?_="+t}getCityJSON(e,t,i){y.loadJSON(this._cacheBusterURL(e),(e=>{t(e)}),(function(e){i(e)}))}}function KM(e,t,i){i=i||2;var s,r,o,n,a,l,A,h=t&&t.length,c=h?t[0]*i:e.length,u=XM(e,0,c,i,!0),d=[];if(!u||u.next===u.prev)return d;if(h&&(u=function(e,t,i,s){var r,o,n,a=[];for(r=0,o=t.length;r80*i){s=o=e[0],r=n=e[1];for(var p=i;po&&(o=a),l>n&&(n=l);A=0!==(A=Math.max(o-s,n-r))?1/A:0}return YM(u,d,i,s,r,A),d}function XM(e,t,i,s,r){var o,n;if(r===_E(e,t,i,s)>0)for(o=t;o=t;o-=s)n=fE(o,e[o],e[o+1],n);return n&&AE(n,n.next)&&(gE(n),n=n.next),n}function JM(e,t){if(!e)return e;t||(t=e);var i,s=e;do{if(i=!1,s.steiner||!AE(s,s.next)&&0!==lE(s.prev,s,s.next))s=s.next;else{if(gE(s),(s=t=s.prev)===s.next)break;i=!0}}while(i||s!==t);return t}function YM(e,t,i,s,r,o,n){if(e){!n&&o&&function(e,t,i,s){var r=e;do{null===r.z&&(r.z=rE(r.x,r.y,t,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,i,s,r,o,n,a,l,A=1;do{for(i=e,e=null,o=null,n=0;i;){for(n++,s=i,a=0,t=0;t0||l>0&&s;)0!==a&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;i=s}o.nextZ=null,A*=2}while(n>1)}(r)}(e,s,r,o);for(var a,l,A=e;e.prev!==e.next;)if(a=e.prev,l=e.next,o?qM(e,s,r,o):ZM(e))t.push(a.i/i),t.push(e.i/i),t.push(l.i/i),gE(e),e=l.next,A=l.next;else if((e=l)===A){n?1===n?YM(e=$M(JM(e),t,i),t,i,s,r,o,2):2===n&&eE(e,t,i,s,r,o):YM(JM(e),t,i,s,r,o,1);break}}}function ZM(e){var t=e.prev,i=e,s=e.next;if(lE(t,i,s)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(nE(t.x,t.y,i.x,i.y,s.x,s.y,r.x,r.y)&&lE(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function qM(e,t,i,s){var r=e.prev,o=e,n=e.next;if(lE(r,o,n)>=0)return!1;for(var a=r.xo.x?r.x>n.x?r.x:n.x:o.x>n.x?o.x:n.x,h=r.y>o.y?r.y>n.y?r.y:n.y:o.y>n.y?o.y:n.y,c=rE(a,l,t,i,s),u=rE(A,h,t,i,s),d=e.prevZ,p=e.nextZ;d&&d.z>=c&&p&&p.z<=u;){if(d!==e.prev&&d!==e.next&&nE(r.x,r.y,o.x,o.y,n.x,n.y,d.x,d.y)&&lE(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==e.prev&&p!==e.next&&nE(r.x,r.y,o.x,o.y,n.x,n.y,p.x,p.y)&&lE(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==e.prev&&d!==e.next&&nE(r.x,r.y,o.x,o.y,n.x,n.y,d.x,d.y)&&lE(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=u;){if(p!==e.prev&&p!==e.next&&nE(r.x,r.y,o.x,o.y,n.x,n.y,p.x,p.y)&&lE(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function $M(e,t,i){var s=e;do{var r=s.prev,o=s.next.next;!AE(r,o)&&hE(r,s,s.next,o)&&dE(r,o)&&dE(o,r)&&(t.push(r.i/i),t.push(s.i/i),t.push(o.i/i),gE(s),gE(s.next),s=e=o),s=s.next}while(s!==e);return JM(s)}function eE(e,t,i,s,r,o){var n=e;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&aE(n,a)){var l=pE(n,a);return n=JM(n,n.next),l=JM(l,l.next),YM(n,t,i,s,r,o),void YM(l,t,i,s,r,o)}a=a.next}n=n.next}while(n!==e)}function tE(e,t){return e.x-t.x}function iE(e,t){if(t=function(e,t){var i,s=t,r=e.x,o=e.y,n=-1/0;do{if(o<=s.y&&o>=s.next.y&&s.next.y!==s.y){var a=s.x+(o-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(a<=r&&a>n){if(n=a,a===r){if(o===s.y)return s;if(o===s.next.y)return s.next}i=s.x=s.x&&s.x>=h&&r!==s.x&&nE(oi.x||s.x===i.x&&sE(i,s)))&&(i=s,u=l)),s=s.next}while(s!==A);return i}(e,t),t){var i=pE(t,e);JM(t,t.next),JM(i,i.next)}}function sE(e,t){return lE(e.prev,e,t.prev)<0&&lE(t.next,e,e.next)<0}function rE(e,t,i,s,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-s)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function oE(e){var t=e,i=e;do{(t.x=0&&(e-n)*(s-a)-(i-n)*(t-a)>=0&&(i-n)*(o-a)-(r-n)*(s-a)>=0}function aE(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&hE(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(dE(e,t)&&dE(t,e)&&function(e,t){var i=e,s=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==e);return s}(e,t)&&(lE(e.prev,e,t.prev)||lE(e,t.prev,t))||AE(e,t)&&lE(e.prev,e,e.next)>0&&lE(t.prev,t,t.next)>0)}function lE(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function AE(e,t){return e.x===t.x&&e.y===t.y}function hE(e,t,i,s){var r=uE(lE(e,t,i)),o=uE(lE(e,t,s)),n=uE(lE(i,s,e)),a=uE(lE(i,s,t));return r!==o&&n!==a||(!(0!==r||!cE(e,i,t))||(!(0!==o||!cE(e,s,t))||(!(0!==n||!cE(i,e,s))||!(0!==a||!cE(i,t,s)))))}function cE(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function uE(e){return e>0?1:e<0?-1:0}function dE(e,t){return lE(e.prev,e,e.next)<0?lE(e,t,e.next)>=0&&lE(e,e.prev,t)>=0:lE(e,t,e.prev)<0||lE(e,e.next,t)<0}function pE(e,t){var i=new mE(e.i,e.x,e.y),s=new mE(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=r,r.prev=i,s.next=i,i.prev=s,o.next=s,s.prev=o,s}function fE(e,t,i,s){var r=new mE(e,t,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function gE(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function mE(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function _E(e,t,i,s){for(var r=0,o=t,n=i-s;o0&&(s+=e[r-1].length,i.holes.push(s))}return i};const vE=d.vec2(),bE=d.vec3(),yE=d.vec3(),BE=d.vec3();class wE extends z{constructor(e,t={}){super("cityJSONLoader",e,t),this.dataSource=t.dataSource}get dataSource(){return this._dataSource}set dataSource(e){this._dataSource=e||new WM}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new Fc(this.viewer.scene,y.apply(e,{isModel:!0,edges:!0}));if(!e.src&&!e.cityJSON)return this.error("load() param expected: src or cityJSON"),t;const i={};if(e.src)this._loadModel(e.src,e,i,t);else{const s=this.viewer.scene.canvas.spinner;s.processes++,this._parseModel(e.cityJSON,e,i,t),s.processes--}return t}_loadModel(e,t,i,s){const r=this.viewer.scene.canvas.spinner;r.processes++,this._dataSource.getCityJSON(t.src,(e=>{this._parseModel(e,t,i,s),r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){if(s.destroyed)return;const r=e.transform?this._transformVertices(e.vertices,e.transform,i.rotateX):e.vertices,o=t.stats||{};o.sourceFormat=e.type||"CityJSON",o.schemaVersion=e.version||"",o.title="",o.author="",o.created="",o.numMetaObjects=0,o.numPropertySets=0,o.numObjects=0,o.numGeometries=0,o.numTriangles=0,o.numVertices=0;const n=!1!==t.loadMetadata,a=n?{id:d.createUUID(),name:"Model",type:"Model"}:null,l=n?{id:"",projectId:"",author:"",createdAt:"",schema:e.version||"",creatingApplication:"",metaObjects:[a],propertySets:[]}:null,A={data:e,vertices:r,sceneModel:s,loadMetadata:n,metadata:l,rootMetaObject:a,nextId:0,stats:o};if(this._parseCityJSON(A),s.finalize(),n){const e=s.id;this.viewer.metaScene.createMetaModel(e,A.metadata,i)}s.scene.once("tick",(()=>{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))}))}_transformVertices(e,t,i){const s=[],r=t.scale||d.vec3([1,1,1]),o=t.translate||d.vec3([0,0,0]);for(let t=0,n=0;t0))return;const o=[];for(let i=0,s=t.geometry.length;i0){const r=t[s[0]];if(void 0!==r.value)n=e[r.value];else{const t=r.values;if(t){a=[];for(let s=0,r=t.length;s0&&(s.createEntity({id:i,meshIds:o,isObject:!0}),e.stats.numObjects++)}_parseGeometrySurfacesWithOwnMaterials(e,t,i,s){switch(t.type){case"MultiPoint":case"MultiLineString":break;case"MultiSurface":case"CompositeSurface":const r=t.boundaries;this._parseSurfacesWithOwnMaterials(e,i,r,s);break;case"Solid":const o=t.boundaries;for(let t=0;t0&&h.push(A.length);const i=this._extractLocalIndices(e,a[t],c,u);A.push(...i)}if(3===A.length)u.indices.push(A[0]),u.indices.push(A[1]),u.indices.push(A[2]);else if(A.length>3){const e=[];for(let t=0;t0&&n.indices.length>0){const t=""+e.nextId++;r.createMesh({id:t,primitive:"triangles",positions:n.positions,indices:n.indices,color:i&&i.diffuseColor?i.diffuseColor:[.8,.8,.8],opacity:1}),s.push(t),e.stats.numGeometries++,e.stats.numVertices+=n.positions.length/3,e.stats.numTriangles+=n.indices.length/3}}_parseSurfacesWithSharedMaterial(e,t,i,s){const r=e.vertices;for(let o=0;o0&&a.push(n.length);const l=this._extractLocalIndices(e,t[o][r],i,s);n.push(...l)}if(3===n.length)s.indices.push(n[0]),s.indices.push(n[1]),s.indices.push(n[2]);else if(n.length>3){let e=[];for(let t=0;t-1?e+"&_="+t:e+"?_="+t}getDotBIM(e,t,i){y.loadJSON(this._cacheBusterURL(e),(e=>{t(e)}),(function(e){i(e)}))}}class PE extends z{constructor(e,t={}){super("DotBIMLoader",e,t),this.dataSource=t.dataSource,this.objectDefaults=t.objectDefaults}set dataSource(e){this._dataSource=e||new xE}get dataSource(){return this._dataSource}set objectDefaults(e){this._objectDefaults=e||DP}get objectDefaults(){return this._objectDefaults}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new Fc(this.viewer.scene,y.apply(e,{isModel:!0,backfaces:e.backfaces,dtxEnabled:e.dtxEnabled,rotation:e.rotation,origin:e.origin})),i=t.id;if(!e.src&&!e.dotBIM)return this.error("load() param expected: src or dotBIM"),t;const s=e.objectDefaults||this._objectDefaults||DP;let r,o;if(e.includeTypes){r={};for(let t=0,i=e.includeTypes.length;t{const t=e.fileData,n=e.sceneModel,a={},l={},A=d.createUUID(),h=d.createUUID(),c=d.createUUID(),u=d.createUUID(),p={metaObjects:[{id:A,name:"IfcProject",type:"IfcProject",parent:null},{id:h,name:"IfcSite",type:"IfcSite",parent:A},{id:c,name:"IfcBuilding",type:"IfcBuilding",parent:h},{id:u,name:"IfcBuildingStorey",type:"IfcBuildingStorey",parent:c}],propertySets:[]};for(let e=0,i=t.meshes.length;e{if(l[e])return;const i=a[e],s=t.meshes[i];n.createGeometry({id:e,primitive:"triangles",positions:s.coordinates,indices:s.indices}),l[e]=!0},g=t.elements;for(let e=0,t=g.length;e{n.destroyed||(n.scene.fire("modelLoaded",n.id),n.fire("loaded",!0,!1))}))};if(e.src){const i=e.src;this.viewer.scene.canvas.spinner.processes++,this._dataSource.getDotBIM(i,(e=>{n({fileData:e,sceneModel:t,nextId:0,error:function(e){}}),this.viewer.scene.canvas.spinner.processes--}),(e=>{this.viewer.scene.canvas.spinner.processes--,this.error(e)}))}else if(e.dotBIM){const i={fileData:e.dotBIM,sceneModel:t,nextId:0,error:function(e){}};n(i)}return t.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(i)})),t}destroy(){super.destroy()}}const CE=function(e){const t=t=>parseInt(e.substr(t+1,2),16)/255;return[t(0),t(2),t(4)]},ME=function(e){const t=[];for(let i=0;i=0?h:2*Math.PI-h}return r(e[0]-i[0])*(t[1]-i[1])-(t[0]-i[0])*(e[1]-i[1]);return(t,i,s,r)=>{const o=e(t,i,s),n=e(t,s,r),a=e(t,r,i);return!((o<0||n<0||a<0)&&(o>0||n>0||a>0))}}(),r=[],o=(i?t:t.slice(0).reverse()).map((e=>({idx:e})));o.forEach(((e,t)=>{e.prev=o[(t-1+o.length)%o.length],e.next=o[(t+1)%o.length]}));const n=d.vec2(),a=d.vec2();for(;o.length>2;){let t=0;for(;;){if(t>=o.length)throw`isCCW = ${i}; earIdx = ${t}; len = ${o.length}`;const r=o[t],l=e[r.prev.idx],A=e[r.idx],h=e[r.next.idx];if(d.subVec2(l,A,n),d.subVec2(h,A,a),n[0]*a[1]-n[1]*a[0]>=0&&o.every((t=>t===r||t===r.prev||t===r.next||!s(e[t.idx],l,A,h))))break;++t}const l=o[t];o.splice(t,1),r.push([l.idx,l.next.idx,l.prev.idx]);l.prev.next=l.next;l.next.prev=l.prev}return[e,r]},EE=function(e,t){const i=e.canvas.canvas,s=i.parentNode,r=document.createElement("div");s.insertBefore(r,i);let o=5;r.style.background=t,r.style.border="2px solid white",r.style.margin="0 0",r.style.zIndex="100",r.style.position="absolute",r.style.pointerEvents="none",r.style.display="none";const n=new pe(e,{}),a=e=>e+"px",l=function(){const e=n.canvasPos.slice();ge(i,s,e),r.style.left=a(e[0]-3-o/2),r.style.top=a(e[1]-3-o/2),r.style.borderRadius=a(2*o),r.style.width=a(o),r.style.height=a(o)},A=e.camera.on("viewMatrix",l),h=e.camera.on("projMatrix",l);return{update:function(e){e&&(n.worldPos=e,l()),r.style.display=e?"":"none"},setHighlighted:function(e){o=e?10:5,l()},getCanvasPos:()=>n.canvasPos,getWorldPos:()=>n.worldPos,destroy:function(){r.parentNode.removeChild(r),e.camera.off(A),e.camera.off(h),n.destroy()}}},FE=function(e,t,i){let s=null;const r=r=>{if(r){s&&s.destroy();try{const[o,n]=ME(r.map((e=>[e[0],e[2]]))),a=[].concat(...o.map((e=>[e[0],r[0][1],e[1]]))),l=[].concat(...n);s=new wr(e,{pickable:!1,geometry:new $t(e,{positions:a,indices:l,normals:d.buildNormals(a,l)}),material:new ri(e,{alpha:void 0!==i?i:.5,backfaces:!0,diffuse:CE(t)})})}catch(e){s=null}}s&&(s.visible=!!r)};return r(null),{updateBase:r,destroy:()=>s&&s.destroy()}},IE=function(e,t,i,s,r,o,n,a,l){const A=EE(e,s),h=EE(e,s),c=FE(e,s,r),u=o?function(e){o.visible=!!e,e&&(o.canvasPos=e)}:()=>{};let p=a((()=>{u(null),A.update(null)}),((e,t)=>{u(e),A.update(t)}),(function(e,o){A.update(o),p=a((function(){u(null),h.update(null),c.updateBase(null)}),(function(e,t){if(u(e),h.update(t),d.distVec3(o,t)>.01){const e=e=>Math.min(o[e],t[e]),i=e=>Math.max(o[e],t[e]),s=e(0),r=e(1),n=e(2),a=i(0);i(1);const l=i(2);c.updateBase([[s,r,l],[a,r,l],[a,r,n],[s,r,n]])}else c.updateBase(null)}),(function(e,a){h.update(a),A.destroy(),h.destroy(),c.destroy(),u(null);const p=e=>Math.min(o[e],a[e]),f=e=>Math.max(o[e],a[e]),g=p(0),m=p(2),_=f(0),v=f(2),b=n.createZone({id:d.createUUID(),geometry:{planeCoordinates:[[g,v],[_,v],[_,m],[g,m]],altitude:t,height:i},alpha:r,color:s});l(b)}))}));return{deactivate:function(){p(),A.destroy(),h.destroy(),c.destroy(),u(null)}}},DE=function(e,t){return function(i,s,r){const o=e.scene,n=o.canvas.canvas,a=(e,t)=>(t[0]=e.clientX,t[1]=e.clientY,ge(n.ownerDocument.body,n,t),t),l=e=>{const i=d.vec3(),s=d.vec3();return d.canvasPosToWorldRay(n,o.camera.viewMatrix,o.camera.projMatrix,o.camera.projection,e,i,s),t(i,s)};let A=!1;const h=function(){A=!1},c=function(){h(),n.removeEventListener("mousedown",p),n.removeEventListener("mousemove",f),e.cameraControl.off(g),n.removeEventListener("mouseup",m)},u=d.vec2(),p=function(e){1===e.which&&(a(e,u),A=!0)};n.addEventListener("mousedown",p);const f=function(e){const t=a(e,d.vec2());A&&d.distVec2(u,t)>20&&(h(),i())};n.addEventListener("mousemove",f);const g=e.cameraControl.on("rayMove",(e=>{const t=e.canvasPos;s(t,l(t))})),m=function(e){if(1===e.which&&A){c();const t=a(e,d.vec2());r(t,l(t))}};return n.addEventListener("mouseup",m),c}},SE=function(e,t,i){return function(s,r,o){const n=e.scene,a=n.canvas.canvas,l=(e,t)=>(t[0]=e.clientX,t[1]=e.clientY,ge(a.ownerDocument.body,a,t),t),A=e=>{const t=d.vec3(),s=d.vec3();return d.canvasPosToWorldRay(a,n.camera.viewMatrix,n.camera.projMatrix,n.camera.projection,e,t,s),i(t,s)};let h=null;const c=()=>{};let u,p=c;const f=function(){t.stop(),clearTimeout(h),e.cameraControl.active=!0,p=c,u=null},g=function(){f(),a.removeEventListener("touchstart",m),a.removeEventListener("touchmove",_),a.removeEventListener("touchend",v)},m=function(i){const o=i.touches;if(1!==o.length)f(),s();else{const i=o[0],s=l(i,d.vec2());A(s)&&(u=i.identifier,p=e=>{d.distVec2(s,e)>20&&f()},h=setTimeout((function(){t.start(s),h=setTimeout((function(){t.stop(),e.cameraControl.active=!1,p=e=>{r(e,A(e))},p(s)}),300)}),250))}};a.addEventListener("touchstart",m,{passive:!0});const _=function(e){const t=[...e.changedTouches].find((e=>e.identifier===u));t&&p(l(t,d.vec2()))};a.addEventListener("touchmove",_,{passive:!0});const v=function(e){const t=[...e.changedTouches].find((e=>e.identifier===u));if(t){g();const e=l(t,d.vec2());o(e,A(e))}};return a.addEventListener("touchend",v,{passive:!0}),g}},TE=function(e,t,i,s){const r=-(d.dotVec3(i,t)-e)/d.dotVec3(s,t);{const e=d.vec3();return d.mulVec3Scalar(s,r,e),d.addVec3(i,e,e),e}};class LE extends L{constructor(e,t={}){if(super(e.viewer.scene,t),this.plugin=e,this._container=t.container,!this._container)throw"config missing: container";this._eventSubs={},this.plugin.viewer.scene,this._geometry=t.geometry,t.onMouseOver,t.onMouseLeave,t.onContextMenu,this._alpha="alpha"in t&&void 0!==t.alpha?t.alpha:.5,this.color=t.color,this._visible=!0,this._rebuildMesh()}_rebuildMesh(){const e=this.plugin.viewer.scene,t=this._geometry.planeCoordinates.slice(),i=this._geometry.height<0,s=this._geometry.altitude+(i?this._geometry.height:0),r=this._geometry.height*(i?-1:1),[o,n]=ME(t),a=[],l=[],A=e=>{const t=a.length;for(let t of o)a.push([t[0],s+(e?r:0),t[1]]);for(let i of n)l.push(...(e?i:i.slice(0).reverse()).map((e=>e+t)))};A(!1),A(!0);for(let e=0;ee+h)))}this._zoneMesh&&this._zoneMesh.destroy();const h=[].concat(...a);this._zoneMesh=new wr(e,{edges:this._edges,geometry:new $t(e,{positions:h,indices:l,normals:d.buildNormals(h,l)}),material:new ri(e,{alpha:this._alpha,backfaces:!0,diffuse:CE(this._color)}),visible:this._visible}),this._zoneMesh.highlighted=this._highlighted,this._zoneMesh.zone=this;const c=e=>Math.min(...a.map((t=>t[e]))),u=e=>Math.max(...a.map((t=>t[e]))),p=c(0),f=c(1),g=c(2),m=u(0),_=u(1),v=u(2);this._center=d.vec3([(p+m)/2,(f+_)/2,(g+v)/2])}sectionedAverage(e){const t=this._geometry.planeCoordinates.slice();let i=[];{const e=this._geometry.height,s=this._geometry.altitude,r=s+Math.max(0,e),o=s+Math.min(0,e),n=e=>{const s=t.map((t=>[t[0],e?r:o,t[1]]));i.push(e?s:s.slice(0).reverse())};n(!0),n(!1);const a=(e,i)=>[t[e][0],i,t[e][1]];for(let e=0;ei?a:n;h|=A,c.push(A)}switch(h){case n:case a:o.push(t);break;case l:break;case A:const i=[];for(let o=0;o=3&&o.push(i)}}i=o}if(0===i.length)return null;{const e=d.vec3([0,0,0]),t=new Set;for(const s of i)for(const i of s){const s=i.map((e=>e.toFixed(3))).join(":");t.has(s)||(t.add(s),d.addVec3(e,i,e))}return d.mulVec3Scalar(e,1/t.size,e),e}}get center(){return this._center}get altitude(){return this._geometry.altitude}set altitude(e){this._geometry.altitude=e,this._rebuildMesh()}get height(){return this._geometry.height}set height(e){this._geometry.height=e,this._rebuildMesh()}get highlighted(){return this._highlighted}set highlighted(e){this._highlighted=e,this._zoneMesh&&(this._zoneMesh.highlighted=e)}set color(e){this._color=e,this._zoneMesh&&(this._zoneMesh.material.diffuse=CE(this._color))}get color(){return this._color}set alpha(e){this._alpha=e,this._zoneMesh&&(this._zoneMesh.material.alpha=this._alpha)}get alpha(){return this._alpha}get edges(){return this._edges}set edges(e){this._edges=e,this._zoneMesh&&(this._zoneMesh.edges=this._edges)}set visible(e){this._visible=!!e,this._zoneMesh.visible=this._visible,this._needUpdate()}get visible(){return this._visible}getJSON(){return{id:this.id,geometry:this._geometry,alpha:this._alpha,color:this._color}}duplicate(){return this.plugin.createZone({id:d.createUUID(),geometry:{planeCoordinates:this._geometry.planeCoordinates.map((e=>e.slice())),altitude:this._geometry.altitude,height:this._geometry.height},alpha:this._alpha,color:this._color})}destroy(){this._zoneMesh.destroy(),super.destroy()}}class RE extends L{constructor(e,t={}){super(e.viewer.scene),this.zonesPlugin=e,this.pointerLens=t.pointerLens,this._deactivate=null}get active(){return!!this._deactivate}activate(e,t,i,s){if(this._deactivate)return;if("object"==typeof e&&null!==e){const r=e,o=(e,t)=>{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=DE(o,(function(t,i){return TE(e,d.vec3([0,1,0]),t,i)}));!function o(){a._deactivate=IE(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._deactivate=()=>{t=!1},a.fire("zoneEnd",e),t&&o()})).deactivate}()}deactivate(){this._deactivate&&(this._deactivate(),this._deactivate=null)}destroy(){this.deactivate(),super.destroy()}}class UE extends z{constructor(e,t={}){super("Zones",e),this._pointerLens=t.pointerLens,this._container=t.container||document.body,this._zones=[],this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.zIndex=t.zIndex||1e4,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,zone:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,zone:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,zone:t,event:e})}}createZone(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=new LE(this,{id:e.id,plugin:this,container:this._container,geometry:e.geometry,alpha:e.alpha,color:e.color,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._zones.push(t),t.on("destroyed",(()=>{const e=this._zones.indexOf(t);e>=0&&this._zones.splice(e,1)})),this.fire("zoneCreated",t),t}get zones(){return this._zones}destroy(){super.destroy()}}class kE extends L{constructor(e,t={}){super(e.viewer.scene),this.zonesPlugin=e,this.pointerLens=t.pointerLens,this.pointerCircle=new G(e.viewer),this._deactivate=null}get active(){return!!this._deactivate}activate(e,t,i,s){if("object"==typeof e&&null!==e){const r=e,o=(e,t)=>{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}if(this._deactivate)return;const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=SE(o,this.pointerCircle,(function(t,i){return TE(e,d.vec3([0,1,0]),t,i)}));!function o(){a._deactivate=IE(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._deactivate=()=>{t=!1},a.fire("zoneEnd",e),t&&o()})).deactivate}()}deactivate(){this._deactivate&&(this._deactivate(),this._deactivate=null)}destroy(){this.deactivate(),super.destroy()}}const OE=function(e,t,i,s,r,o,n,a,l){const A=o?function(e){o.visible=!!e,e&&(o.canvasPos=e)}:()=>{};let h;const c=[()=>A(null)],u=FE(e,s,r);return c.push((()=>u.destroy())),function o(p){const f=EE(e,s),g=p.length>0&&function(e,t,i){const s=e.canvas.canvas,r=new pe(e,{});r.worldPos=i;const o=new pe(e,{}),n=s.ownerDocument.body,a=new be(n,{color:t,thickness:1,thicknessClickable:6});a.setVisible(!1);const l=function(){const e=r.canvasPos.slice(),t=o.canvasPos.slice();ge(s,n,e),ge(s,n,t),a.setStartAndEnd(e[0],e[1],t[0],t[1])},A=e.camera.on("viewMatrix",l),h=e.camera.on("projMatrix",l);return{update:function(e){e&&(o.worldPos=e,l()),a.setVisible(!!e)},destroy:function(){e.camera.off(A),e.camera.off(h),r.destroy(),o.destroy(),a.destroy()}}}(e,s,p[p.length-1].getWorldPos());c.push((()=>{f.destroy(),g&&g.destroy()}));const m=p.length>0&&p[0],_=function(e){const t=m&&m.getCanvasPos();return t&&d.distVec2(t,e)<10&&{canvasPos:t,worldPos:m.getWorldPos()}},v=function(){const e=(e,t,i)=>t[0]<=Math.max(e[0],i[0])&&t[0]>=Math.min(e[0],i[0])&&t[1]<=Math.max(e[1],i[1])&&t[1]>=Math.min(e[1],i[1]),t=(e,t,i)=>{const s=(t[1]-e[1])*(i[0]-t[0])-(t[0]-e[0])*(i[1]-t[1]);return 0===s?0:s>0?1:2};return function(i,s){const r=i[i.length-2],o=i[i.length-1];for(let n=s?1:0;n{A(null),f.update(null),g&&g.update(null),u.updateBase(p.length>2?p.map((e=>e.getWorldPos())):null)}),((e,t)=>{const i=p.length>2&&_(e);if(m&&m.setHighlighted(!!i),A(i?i.canvasPos:e),f.update(!i&&t),g&&g.update(i?i.worldPos:t),p.length>=2){const e=p.map((e=>e.getWorldPos())).concat(i?[]:[t]),s=v(e.map((e=>[e[0],e[2]])),i);u.updateBase(s?null:e)}else u.updateBase(null)}),(function(e,a){const A=p.length>2&&_(e),h=p.map((e=>e.getWorldPos())).concat(A?[]:[a]);u.updateBase(h);const m=h.map((e=>[e[0],e[2]]));p.length>2&&v(m,A)?(c.pop()(),o(p)):A?(f.update(a),c.forEach((e=>e())),l(n.createZone({id:d.createUUID(),geometry:{planeCoordinates:m,altitude:t,height:i},alpha:r,color:s}))):(f.update(a),g&&g.update(a),o(p.concat(f)))}))}([]),{closeSurface:function(){throw"TODO"},deactivate:function(){h(),c.forEach((e=>e()))}}};class NE extends L{constructor(e,t={}){super(e.viewer.scene),this.zonesPlugin=e,this.pointerLens=t.pointerLens,this._action=null}get active(){return!!this._action}activate(e,t,i,s){if("object"==typeof e&&null!==e){const r=e,o=(e,t)=>{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}if(this._action)return;const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=DE(o,(function(t,i){return TE(e,d.vec3([0,1,0]),t,i)}));!function o(){a._action=OE(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._action={deactivate:()=>{t=!1}},a.fire("zoneEnd",e),t&&o()}))}()}deactivate(){this._action&&(this._action.deactivate(),this._action=null)}destroy(){this.deactivate(),super.destroy()}}class QE extends L{constructor(e,t={}){super(e.viewer.scene),this.zonesPlugin=e,this.pointerLens=t.pointerLens,this.pointerCircle=new G(e.viewer),this._action=null}get active(){return!!this._action}activate(e,t,i,s){if("object"==typeof e&&null!==e){const r=e,o=(e,t)=>{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}if(this._action)return;const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=SE(o,this.pointerCircle,(function(t,i){return TE(e,d.vec3([0,1,0]),t,i)}));!function o(){a._action=OE(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._action={deactivate:()=>{t=!1}},a.fire("zoneEnd",e),t&&o()}))}()}deactivate(){this._action&&(this._action.deactivate(),this._action=null)}destroy(){this.deactivate(),super.destroy()}}class VE extends L{constructor(e,t,i,s){const r=e.plugin.viewer,o=r.scene;super(o);const n=e._geometry.altitude,a=e._geometry.planeCoordinates.map((t=>{const i=o.canvas.canvas.ownerDocument.body,s=new me(o,{},i,{fillColor:e._color});return s.worldPos=d.vec3([t[0],n,t[1]]),s.on("worldPos",(function(){t[0]=s.worldPos[0],t[1]=s.worldPos[2];try{e._rebuildMesh()}catch(t){e._zoneMesh&&(e._zoneMesh.destroy(),e._zoneMesh=null)}})),s})),l=ve({viewer:r,handleMouseEvents:i,handleTouchEvents:s,pointerLens:t&&t.pointerLens,dots:a,ray2WorldPos:(e,t)=>TE(n,d.vec3([0,1,0]),e,t),onEnd:(t,i)=>(e._zoneMesh&&this.fire("edited"),!!e._zoneMesh)}),A=function(){l(),a.forEach((e=>e.destroy()))},h=e.on("destroyed",A);this._deactivate=function(){e.off("destroyed",h),A()}}deactivate(){this._deactivate(),super.destroy()}}class HE extends VE{constructor(e,t){super(e,t,!0,!1)}}class jE extends VE{constructor(e,t){super(e,t,!1,!0)}}class GE extends L{constructor(e,t,i,s){const r=e.plugin.viewer,o=r.scene,n=o.canvas.canvas;super(o);const a=this,l=e._geometry.altitude,A=t&&t.pointerLens,h=A?function(e){A.visible=!!e,e&&(A.canvasPos=e)}:()=>{},c=e=>{const t=d.vec3(),i=d.vec3();return d.canvasPosToWorldRay(n,o.camera.viewMatrix,o.camera.projMatrix,o.camera.projection,e,t,i),s=t,r=i,TE(l,d.vec3([0,1,0]),s,r);var s,r},u=(e,t)=>(t[0]=e.clientX,t[1]=e.clientY,ge(n.ownerDocument.body,n,t),t),p=function(e,t){const i=e=>{e.preventDefault(),t(e)};return n.addEventListener(e,i),()=>n.removeEventListener(e,i)};let f=()=>{};const g=function(t,i,s,o){const l=o(t),A=u(l,d.vec2()),g=r.scene.pick({canvasPos:A,includeEntities:[e._zoneMesh.id]});if((g&&g.entity&&g.entity.zone)===e){f(),n.style.cursor="move",r.cameraControl.active=!1;const t=function(){const t=e._geometry.planeCoordinates.map((e=>e.slice())),i=c(A),s=d.vec2([i[0],i[2]]),r=d.vec2();return function(i){const o=c(i);r[0]=o[0],r[1]=o[2],d.subVec2(s,r,r),e._geometry.planeCoordinates.forEach(((e,i)=>{d.subVec2(t[i],r,e)}));try{e._rebuildMesh()}catch(t){e._zoneMesh&&(e._zoneMesh.destroy(),e._zoneMesh=null)}}}(),l=p(i,(function(e){const i=o(e);if(i){const e=u(i,d.vec2());t(e),h(e)}})),g=p(s,(function(e){const i=o(e);if(i){const e=u(i,d.vec2());t(e),h(null),f(),a.fire("translated")}}));f=function(){f=()=>{},n.style.cursor="default",r.cameraControl.active=!0,l(),g()}}},m=[];i&&m.push(p("mousedown",(e=>{1===e.which&&g(e,"mousemove","mouseup",(e=>1===e.which&&e))}))),s&&m.push(p("touchstart",(e=>{if(1===e.touches.length){const t=e.touches[0].identifier;g(e,"touchmove","touchend",(e=>[...e.changedTouches].find((e=>e.identifier===t))))}})));const _=function(){f(),m.forEach((e=>e())),h(null)},v=e.on("destroyed",_);this._deactivate=function(){e.off("destroyed",v),_()}}deactivate(){this._deactivate(),super.destroy()}}class zE extends GE{constructor(e,t){super(e,t,!0,!1)}}class WE extends GE{constructor(e,t){super(e,t,!1,!0)}}export{ji as AlphaFormat,Vt as AmbientLight,Ie as AngleMeasurementEditMouseControl,De as AngleMeasurementEditTouchControl,Pe as AngleMeasurementsControl,Ce as AngleMeasurementsMouseControl,Me as AngleMeasurementsPlugin,Ee as AngleMeasurementsTouchControl,Ue as AnnotationsPlugin,Fr as AxisGizmoPlugin,Uc as BCFViewpointsPlugin,vo as Bitmap,Ti as ByteType,Cu as CameraMemento,ou as CameraPath,uu as CameraPathAnimation,wE as CityJSONLoaderPlugin,bi as ClampToEdgeWrapping,L as Component,Ss as CompressedMediaType,pn as Configs,o as ContextMenu,Du as CubicBezierCurve,iu as Curve,Jh as DefaultLoadingManager,Xi as DepthFormat,Ji as DepthStencilFormat,Qt as DirLight,Jc as DistanceMeasurementEditMouseControl,Yc as DistanceMeasurementEditTouchControl,Gc as DistanceMeasurementsControl,zc as DistanceMeasurementsMouseControl,Wc as DistanceMeasurementsPlugin,Kc as DistanceMeasurementsTouchControl,xE as DotBIMDefaultDataSource,PE as DotBIMLoaderPlugin,li as EdgeMaterial,ni as EmphasisMaterial,uC as FaceAlignedSectionPlanesPlugin,Zc as FastNavPlugin,Oi as FloatType,so as Fresnel,N as Frustum,O as FrustumPlane,Fs as GIFMediaType,qc as GLTFDefaultDataSource,SP as GLTFLoaderPlugin,Ni as HalfFloatType,mu as ImagePlane,Ui as IntType,Is as JPEGMediaType,tc as KTX2TextureTranscoder,GM as LASLoaderPlugin,Vr as LambertMaterial,xu as LightMap,Dc as LineSet,Ms as LinearEncoding,Mi as LinearFilter,Di as LinearMipMapLinearFilter,Fi as LinearMipMapNearestFilter,Ii as LinearMipmapLinearFilter,Ei as LinearMipmapNearestFilter,Yh as Loader,Xh as LoadingManager,$c as LocaleService,Ki as LuminanceAlphaFormat,Wi as LuminanceFormat,e as Map,pe as Marker,H as MarqueePicker,j as MarqueePickerMouseControl,wr as Mesh,Gr as MetallicMaterial,yi as MirroredRepeatWrapping,Eu as ModelMemento,UP as NavCubePlugin,Bi as NearestFilter,Ci as NearestMipMapLinearFilter,wi as NearestMipMapNearestFilter,Pi as NearestMipmapLinearFilter,xi as NearestMipmapNearestFilter,Qr as Node,zP as OBJLoaderPlugin,f as ObjectsKdTree3,Iu as ObjectsMemento,Ds as PNGMediaType,Su as Path,Lu as PerformanceModel,ri as PhongMaterial,je as PickResult,z as Plugin,_u as PointLight,G as PointerCircle,n as PointerLens,Tu as QuadraticBezierCurve,g as Queue,zi as RGBAFormat,es as RGBAIntegerFormat,ws as RGBA_ASTC_10x10_Format,bs as RGBA_ASTC_10x5_Format,ys as RGBA_ASTC_10x6_Format,Bs as RGBA_ASTC_10x8_Format,xs as RGBA_ASTC_12x10_Format,Ps as RGBA_ASTC_12x12_Format,us as RGBA_ASTC_4x4_Format,ds as RGBA_ASTC_5x4_Format,ps as RGBA_ASTC_5x5_Format,fs as RGBA_ASTC_6x5_Format,gs as RGBA_ASTC_6x6_Format,ms as RGBA_ASTC_8x5_Format,_s as RGBA_ASTC_8x6_Format,vs as RGBA_ASTC_8x8_Format,Cs as RGBA_BPTC_Format,cs as RGBA_ETC2_EAC_Format,ls as RGBA_PVRTC_2BPPV1_Format,as as RGBA_PVRTC_4BPPV1_Format,is as RGBA_S3TC_DXT1_Format,ss as RGBA_S3TC_DXT3_Format,rs as RGBA_S3TC_DXT5_Format,Gi as RGBFormat,As as RGB_ETC1_Format,hs as RGB_ETC2_Format,ns as RGB_PVRTC_2BPPV1_Format,os as RGB_PVRTC_4BPPV1_Format,ts as RGB_S3TC_DXT1_Format,qi as RGFormat,$i as RGIntegerFormat,$t as ReadableGeometry,Yi as RedFormat,Zi as RedIntegerFormat,wu as ReflectionMap,vi as RepeatWrapping,pC as STLDefaultDataSource,wC as STLLoaderPlugin,Fc as SceneModel,wo as SceneModelMesh,bc as SceneModelTransform,Ir as SectionPlane,$P as SectionPlanesPlugin,Li as ShortType,Ru as Skybox,dC as SkyboxesPlugin,Kr as SpecularMaterial,su as SplineCurve,Pu as SpriteMarker,rC as StoreyViewsPlugin,io as Texture,Uu as TextureTranscoder,CC as TreeViewPlugin,Si as UnsignedByteType,Hi as UnsignedInt248Type,ki as UnsignedIntType,Qi as UnsignedShort4444Type,Vi as UnsignedShort5551Type,Ri as UnsignedShortType,no as VBOGeometry,IC as ViewCullPlugin,xb as Viewer,UM as WebIFCLoaderPlugin,$h as WorkerPool,DC as XKTDefaultDataSource,vM as XKTLoaderPlugin,LM as XML3DLoaderPlugin,VE as ZoneEditControl,HE as ZoneEditMouseControl,jE as ZoneEditTouchControl,GE as ZoneTranslateControl,zE as ZoneTranslateMouseControl,WE as ZoneTranslateTouchControl,RE as ZonesMouseControl,UE as ZonesPlugin,NE as ZonesPolysurfaceMouseControl,QE as ZonesPolysurfaceTouchControl,kE as ZonesTouchControl,ei as buildBoxGeometry,ho as buildBoxLinesGeometry,co as buildBoxLinesGeometryFromAABB,Pr as buildCylinderGeometry,uo as buildGridGeometry,_o as buildLineGeometry,po as buildPlaneGeometry,go as buildPolylineGeometry,mo as buildPolylineGeometryFromCurve,Cr as buildSphereGeometry,fo as buildTorusGeometry,Er as buildVectorTextGeometry,J as createRTCViewMat,V as frustumIntersectsAABB3,sc as getKTX2TextureTranscoder,$ as getPlaneRTCPos,lo as load3DSGeometry,Ao as loadOBJGeometry,d as math,q as rtcToWorldPos,Es as sRGBEncoding,Q as setFrustum,m as stats,y as utils,Y as worldToRTCPos,Z as worldToRTCPositions}; +/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).pako={})}(void 0,(function(e){function t(e){let t=e.length;for(;--t>=0;)e[t]=0}const i=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]),s=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]),r=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),n=new Array(576);t(n);const a=new Array(60);t(a);const l=new Array(512);t(l);const A=new Array(256);t(A);const h=new Array(29);t(h);const c=new Array(30);function u(e,t,i,s,r){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=s,this.max_length=r,this.has_stree=e&&e.length}let d,p,f;function g(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}t(c);const m=e=>e<256?l[e]:l[256+(e>>>7)],_=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},v=(e,t,i)=>{e.bi_valid>16-i?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<{v(e,i[2*t],i[2*t+1])},y=(e,t)=>{let i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1},B=(e,t,i)=>{const s=new Array(16);let r,o,n=0;for(r=1;r<=15;r++)n=n+i[r-1]<<1,s[r]=n;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=y(s[t]++,t))}},w=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},x=e=>{e.bi_valid>8?_(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},P=(e,t,i,s)=>{const r=2*t,o=2*i;return e[r]{const s=e.heap[i];let r=i<<1;for(;r<=e.heap_len&&(r{let o,n,a,l,u=0;if(0!==e.sym_next)do{o=255&e.pending_buf[e.sym_buf+u++],o+=(255&e.pending_buf[e.sym_buf+u++])<<8,n=e.pending_buf[e.sym_buf+u++],0===o?b(e,n,t):(a=A[n],b(e,a+256+1,t),l=i[a],0!==l&&(n-=h[a],v(e,n,l)),o--,a=m(o),b(e,a,r),l=s[a],0!==l&&(o-=c[a],v(e,o,l)))}while(u{const i=t.dyn_tree,s=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.elems;let n,a,l,A=-1;for(e.heap_len=0,e.heap_max=573,n=0;n>1;n>=1;n--)C(e,i,n);l=o;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],C(e,i,1),a=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=a,i[2*l]=i[2*n]+i[2*a],e.depth[l]=(e.depth[n]>=e.depth[a]?e.depth[n]:e.depth[a])+1,i[2*n+1]=i[2*a+1]=l,e.heap[1]=l++,C(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const i=t.dyn_tree,s=t.max_code,r=t.stat_desc.static_tree,o=t.stat_desc.has_stree,n=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,l=t.stat_desc.max_length;let A,h,c,u,d,p,f=0;for(u=0;u<=15;u++)e.bl_count[u]=0;for(i[2*e.heap[e.heap_max]+1]=0,A=e.heap_max+1;A<573;A++)h=e.heap[A],u=i[2*i[2*h+1]+1]+1,u>l&&(u=l,f++),i[2*h+1]=u,h>s||(e.bl_count[u]++,d=0,h>=a&&(d=n[h-a]),p=i[2*h],e.opt_len+=p*(u+d),o&&(e.static_len+=p*(r[2*h+1]+d)));if(0!==f){do{for(u=l-1;0===e.bl_count[u];)u--;e.bl_count[u]--,e.bl_count[u+1]+=2,e.bl_count[l]--,f-=2}while(f>0);for(u=l;0!==u;u--)for(h=e.bl_count[u];0!==h;)c=e.heap[--A],c>s||(i[2*c+1]!==u&&(e.opt_len+=(u-i[2*c+1])*i[2*c],i[2*c+1]=u),h--)}})(e,t),B(i,A,e.bl_count)},F=(e,t,i)=>{let s,r,o=-1,n=t[1],a=0,l=7,A=4;for(0===n&&(l=138,A=3),t[2*(i+1)+1]=65535,s=0;s<=i;s++)r=n,n=t[2*(s+1)+1],++a{let s,r,o=-1,n=t[1],a=0,l=7,A=4;for(0===n&&(l=138,A=3),s=0;s<=i;s++)if(r=n,n=t[2*(s+1)+1],!(++a{v(e,0+(s?1:0),3),x(e),_(e,i),_(e,~i),i&&e.pending_buf.set(e.window.subarray(t,t+i),e.pending),e.pending+=i};var T={_tr_init:e=>{D||((()=>{let e,t,o,g,m;const _=new Array(16);for(o=0,g=0;g<28;g++)for(h[g]=o,e=0;e<1<>=7;g<30;g++)for(c[g]=m<<7,e=0;e<1<{let r,l,A=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),E(e,e.l_desc),E(e,e.d_desc),A=(e=>{let t;for(F(e,e.dyn_ltree,e.l_desc.max_code),F(e,e.dyn_dtree,e.d_desc.max_code),E(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*o[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,l=e.static_len+3+7>>>3,l<=r&&(r=l)):r=l=i+5,i+4<=r&&-1!==t?S(e,t,i,s):4===e.strategy||l===r?(v(e,2+(s?1:0),3),M(e,n,a)):(v(e,4+(s?1:0),3),((e,t,i,s)=>{let r;for(v(e,t-257,5),v(e,i-1,5),v(e,s-4,4),r=0;r(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=i,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(A[i]+256+1)]++,e.dyn_dtree[2*m(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{v(e,2,3),b(e,256,n),(e=>{16===e.bi_valid?(_(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}},L=(e,t,i,s)=>{let r=65535&e|0,o=e>>>16&65535|0,n=0;for(;0!==i;){n=i>2e3?2e3:i,i-=n;do{r=r+t[s++]|0,o=o+r|0}while(--n);r%=65521,o%=65521}return r|o<<16|0};const R=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var U=(e,t,i,s)=>{const r=R,o=s+i;e^=-1;for(let i=s;i>>8^r[255&(e^t[i])];return-1^e},k={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"},O={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};const{_tr_init:N,_tr_stored_block:Q,_tr_flush_block:V,_tr_tally:H,_tr_align:j}=T,{Z_NO_FLUSH:G,Z_PARTIAL_FLUSH:z,Z_FULL_FLUSH:W,Z_FINISH:K,Z_BLOCK:X,Z_OK:J,Z_STREAM_END:Y,Z_STREAM_ERROR:Z,Z_DATA_ERROR:q,Z_BUF_ERROR:$,Z_DEFAULT_COMPRESSION:ee,Z_FILTERED:te,Z_HUFFMAN_ONLY:ie,Z_RLE:se,Z_FIXED:re,Z_DEFAULT_STRATEGY:oe,Z_UNKNOWN:ne,Z_DEFLATED:ae}=O,le=258,Ae=262,he=42,ce=113,ue=666,de=(e,t)=>(e.msg=k[t],t),pe=e=>2*e-(e>4?9:0),fe=e=>{let t=e.length;for(;--t>=0;)e[t]=0},ge=e=>{let t,i,s,r=e.w_size;t=e.hash_size,s=t;do{i=e.head[--s],e.head[s]=i>=r?i-r:0}while(--t);t=r,s=t;do{i=e.prev[--s],e.prev[s]=i>=r?i-r:0}while(--t)};let me=(e,t,i)=>(t<{const t=e.state;let i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+i),e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))},ve=(e,t)=>{V(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,_e(e.strm)},be=(e,t)=>{e.pending_buf[e.pending++]=t},ye=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Be=(e,t,i,s)=>{let r=e.avail_in;return r>s&&(r=s),0===r?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),i),1===e.state.wrap?e.adler=L(e.adler,t,r,i):2===e.state.wrap&&(e.adler=U(e.adler,t,r,i)),e.next_in+=r,e.total_in+=r,r)},we=(e,t)=>{let i,s,r=e.max_chain_length,o=e.strstart,n=e.prev_length,a=e.nice_match;const l=e.strstart>e.w_size-Ae?e.strstart-(e.w_size-Ae):0,A=e.window,h=e.w_mask,c=e.prev,u=e.strstart+le;let d=A[o+n-1],p=A[o+n];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do{if(i=t,A[i+n]===p&&A[i+n-1]===d&&A[i]===A[o]&&A[++i]===A[o+1]){o+=2,i++;do{}while(A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&A[++o]===A[++i]&&on){if(e.match_start=t,n=s,s>=a)break;d=A[o+n-1],p=A[o+n]}}}while((t=c[t&h])>l&&0!=--r);return n<=e.lookahead?n:e.lookahead},xe=e=>{const t=e.w_size;let i,s,r;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ae)&&(e.window.set(e.window.subarray(t,t+t-s),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),ge(e),s+=t),0===e.strm.avail_in)break;if(i=Be(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=i,e.lookahead+e.insert>=3)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=me(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=me(e,e.ins_h,e.window[r+3-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead{let i,s,r,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,n=0,a=e.strm.avail_in;do{if(i=65535,r=e.bi_valid+42>>3,e.strm.avail_outs+e.strm.avail_in&&(i=s+e.strm.avail_in),i>r&&(i=r),i>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,_e(e.strm),s&&(s>i&&(s=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+s),e.strm.next_out),e.strm.next_out+=s,e.strm.avail_out-=s,e.strm.total_out+=s,e.block_start+=s,i-=s),i&&(Be(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(0===n);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_waterr&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,r+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),r>e.strm.avail_in&&(r=e.strm.avail_in),r&&(Be(e.strm,e.window,e.strstart,r),e.strstart+=r,e.insert+=r>e.w_size-e.insert?e.w_size-e.insert:r),e.high_water>3,r=e.pending_buf_size-r>65535?65535:e.pending_buf_size-r,o=r>e.w_size?e.w_size:r,s=e.strstart-e.block_start,(s>=o||(s||t===K)&&t!==G&&0===e.strm.avail_in&&s<=r)&&(i=s>r?r:s,n=t===K&&0===e.strm.avail_in&&i===s?1:0,Q(e,e.block_start,i,n),e.block_start+=i,_e(e.strm)),n?3:1)},Ce=(e,t)=>{let i,s;for(;;){if(e.lookahead=3&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-Ae&&(e.match_length=we(e,i)),e.match_length>=3)if(s=H(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=me(e,e.ins_h,e.window[e.strstart+1]);else s=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2},Me=(e,t)=>{let i,s,r;for(;;){if(e.lookahead=3&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,s=H(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=r&&(e.ins_h=me(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,s&&(ve(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(s=H(e,0,e.window[e.strstart-1]),s&&ve(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(s=H(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2};function Ee(e,t,i,s,r){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=s,this.func=r}const Fe=[new Ee(0,0,0,0,Pe),new Ee(4,4,8,4,Ce),new Ee(4,5,16,8,Ce),new Ee(4,6,32,32,Ce),new Ee(4,4,16,16,Me),new Ee(8,16,32,32,Me),new Ee(8,16,128,128,Me),new Ee(8,32,128,256,Me),new Ee(32,128,258,1024,Me),new Ee(32,258,258,4096,Me)];function Ie(){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=ae,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),fe(this.dyn_ltree),fe(this.dyn_dtree),fe(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),fe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),fe(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}const De=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==he&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==ce&&t.status!==ue?1:0},Se=e=>{if(De(e))return de(e,Z);e.total_in=e.total_out=0,e.data_type=ne;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?he:ce,e.adler=2===t.wrap?0:1,t.last_flush=-2,N(t),J},Te=e=>{const t=Se(e);var i;return t===J&&((i=e.state).window_size=2*i.w_size,fe(i.head),i.max_lazy_match=Fe[i.level].max_lazy,i.good_match=Fe[i.level].good_length,i.nice_match=Fe[i.level].nice_length,i.max_chain_length=Fe[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),t},Le=(e,t,i,s,r,o)=>{if(!e)return Z;let n=1;if(t===ee&&(t=6),s<0?(n=0,s=-s):s>15&&(n=2,s-=16),r<1||r>9||i!==ae||s<8||s>15||t<0||t>9||o<0||o>re||8===s&&1!==n)return de(e,Z);8===s&&(s=9);const a=new Ie;return e.state=a,a.strm=e,a.status=he,a.wrap=n,a.gzhead=null,a.w_bits=s,a.w_size=1<De(e)||2!==e.state.wrap?Z:(e.state.gzhead=t,J),ke=(e,t)=>{if(De(e)||t>X||t<0)return e?de(e,Z):Z;const i=e.state;if(!e.output||0!==e.avail_in&&!e.input||i.status===ue&&t!==K)return de(e,0===e.avail_out?$:Z);const s=i.last_flush;if(i.last_flush=t,0!==i.pending){if(_e(e),0===e.avail_out)return i.last_flush=-1,J}else if(0===e.avail_in&&pe(t)<=pe(s)&&t!==K)return de(e,$);if(i.status===ue&&0!==e.avail_in)return de(e,$);if(i.status===he&&0===i.wrap&&(i.status=ce),i.status===he){let t=ae+(i.w_bits-8<<4)<<8,s=-1;if(s=i.strategy>=ie||i.level<2?0:i.level<6?1:6===i.level?2:3,t|=s<<6,0!==i.strstart&&(t|=32),t+=31-t%31,ye(i,t),0!==i.strstart&&(ye(i,e.adler>>>16),ye(i,65535&e.adler)),e.adler=1,i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J}if(57===i.status)if(e.adler=0,be(i,31),be(i,139),be(i,8),i.gzhead)be(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),be(i,255&i.gzhead.time),be(i,i.gzhead.time>>8&255),be(i,i.gzhead.time>>16&255),be(i,i.gzhead.time>>24&255),be(i,9===i.level?2:i.strategy>=ie||i.level<2?4:0),be(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(be(i,255&i.gzhead.extra.length),be(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=U(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(be(i,0),be(i,0),be(i,0),be(i,0),be(i,0),be(i,9===i.level?2:i.strategy>=ie||i.level<2?4:0),be(i,3),i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J;if(69===i.status){if(i.gzhead.extra){let t=i.pending,s=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+s>i.pending_buf_size;){let r=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+r),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>t&&(e.adler=U(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex+=r,_e(e),0!==i.pending)return i.last_flush=-1,J;t=0,s-=r}let r=new Uint8Array(i.gzhead.extra);i.pending_buf.set(r.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending+=s,i.gzhead.hcrc&&i.pending>t&&(e.adler=U(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),_e(e),0!==i.pending)return i.last_flush=-1,J;s=0}t=i.gzindexs&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let t,s=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>s&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s)),_e(e),0!==i.pending)return i.last_flush=-1,J;s=0}t=i.gzindexs&&(e.adler=U(e.adler,i.pending_buf,i.pending-s,s))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(_e(e),0!==i.pending))return i.last_flush=-1,J;be(i,255&e.adler),be(i,e.adler>>8&255),e.adler=0}if(i.status=ce,_e(e),0!==i.pending)return i.last_flush=-1,J}if(0!==e.avail_in||0!==i.lookahead||t!==G&&i.status!==ue){let s=0===i.level?Pe(i,t):i.strategy===ie?((e,t)=>{let i;for(;;){if(0===e.lookahead&&(xe(e),0===e.lookahead)){if(t===G)return 1;break}if(e.match_length=0,i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2})(i,t):i.strategy===se?((e,t)=>{let i,s,r,o;const n=e.window;for(;;){if(e.lookahead<=le){if(xe(e),e.lookahead<=le&&t===G)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,s=n[r],s===n[++r]&&s===n[++r]&&s===n[++r])){o=e.strstart+le;do{}while(s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&s===n[++r]&&re.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=H(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=H(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(ve(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===K?(ve(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ve(e,!1),0===e.strm.avail_out)?1:2})(i,t):Fe[i.level].func(i,t);if(3!==s&&4!==s||(i.status=ue),1===s||3===s)return 0===e.avail_out&&(i.last_flush=-1),J;if(2===s&&(t===z?j(i):t!==X&&(Q(i,0,0,!1),t===W&&(fe(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),_e(e),0===e.avail_out))return i.last_flush=-1,J}return t!==K?J:i.wrap<=0?Y:(2===i.wrap?(be(i,255&e.adler),be(i,e.adler>>8&255),be(i,e.adler>>16&255),be(i,e.adler>>24&255),be(i,255&e.total_in),be(i,e.total_in>>8&255),be(i,e.total_in>>16&255),be(i,e.total_in>>24&255)):(ye(i,e.adler>>>16),ye(i,65535&e.adler)),_e(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?J:Y)},Oe=e=>{if(De(e))return Z;const t=e.state.status;return e.state=null,t===ce?de(e,q):J},Ne=(e,t)=>{let i=t.length;if(De(e))return Z;const s=e.state,r=s.wrap;if(2===r||1===r&&s.status!==he||s.lookahead)return Z;if(1===r&&(e.adler=L(e.adler,t,i,0)),s.wrap=0,i>=s.w_size){0===r&&(fe(s.head),s.strstart=0,s.block_start=0,s.insert=0);let e=new Uint8Array(s.w_size);e.set(t.subarray(i-s.w_size,i),0),t=e,i=s.w_size}const o=e.avail_in,n=e.next_in,a=e.input;for(e.avail_in=i,e.next_in=0,e.input=t,xe(s);s.lookahead>=3;){let e=s.strstart,t=s.lookahead-2;do{s.ins_h=me(s,s.ins_h,s.window[e+3-1]),s.prev[e&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=e,e++}while(--t);s.strstart=e,s.lookahead=2,xe(s)}return s.strstart+=s.lookahead,s.block_start=s.strstart,s.insert=s.lookahead,s.lookahead=0,s.match_length=s.prev_length=2,s.match_available=0,e.next_in=n,e.input=a,e.avail_in=o,s.wrap=r,J};const Qe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ve=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)Qe(i,t)&&(e[t]=i[t])}}return e},He=e=>{let t=0;for(let i=0,s=e.length;i=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Ge[254]=Ge[254]=1;var ze=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,s,r,o,n=e.length,a=0;for(r=0;r>>6,t[o++]=128|63&i):i<65536?(t[o++]=224|i>>>12,t[o++]=128|i>>>6&63,t[o++]=128|63&i):(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63,t[o++]=128|i>>>6&63,t[o++]=128|63&i);return t},We=(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let s,r;const o=new Array(2*i);for(r=0,s=0;s4)o[r++]=65533,s+=n-1;else{for(t&=2===n?31:3===n?15:7;n>1&&s1?o[r++]=65533:t<65536?o[r++]=t:(t-=65536,o[r++]=55296|t>>10&1023,o[r++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&je)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let s=0;s{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+Ge[e[i]]>t?i:t},Xe=function(){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};const Je=Object.prototype.toString,{Z_NO_FLUSH:Ye,Z_SYNC_FLUSH:Ze,Z_FULL_FLUSH:qe,Z_FINISH:$e,Z_OK:et,Z_STREAM_END:tt,Z_DEFAULT_COMPRESSION:it,Z_DEFAULT_STRATEGY:st,Z_DEFLATED:rt}=O;function ot(e){this.options=Ve({level:it,method:rt,chunkSize:16384,windowBits:15,memLevel:8,strategy:st},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xe,this.strm.avail_out=0;let i=Re(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==et)throw new Error(k[i]);if(t.header&&Ue(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?ze(t.dictionary):"[object ArrayBuffer]"===Je.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,i=Ne(this.strm,e),i!==et)throw new Error(k[i]);this._dict_set=!0}}function nt(e,t){const i=new ot(t);if(i.push(e,!0),i.err)throw i.msg||k[i.err];return i.result}ot.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize;let r,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?$e:Ye,"string"==typeof e?i.input=ze(e):"[object ArrayBuffer]"===Je.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),(o===Ze||o===qe)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(r=ke(i,o),r===tt)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),r=Oe(this.strm),this.onEnd(r),this.ended=!0,r===et;if(0!==i.avail_out){if(o>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},ot.prototype.onData=function(e){this.chunks.push(e)},ot.prototype.onEnd=function(e){e===et&&(this.result=He(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var at={Deflate:ot,deflate:nt,deflateRaw:function(e,t){return(t=t||{}).raw=!0,nt(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,nt(e,t)},constants:O};const lt=16209;var At=function(e,t){let i,s,r,o,n,a,l,A,h,c,u,d,p,f,g,m,_,v,b,y,B,w,x,P;const C=e.state;i=e.next_in,x=e.input,s=i+(e.avail_in-5),r=e.next_out,P=e.output,o=r-(t-e.avail_out),n=r+(e.avail_out-257),a=C.dmax,l=C.wsize,A=C.whave,h=C.wnext,c=C.window,u=C.hold,d=C.bits,p=C.lencode,f=C.distcode,g=(1<>>24,u>>>=v,d-=v,v=_>>>16&255,0===v)P[r++]=65535&_;else{if(!(16&v)){if(0==(64&v)){_=p[(65535&_)+(u&(1<>>=v,d-=v),d<15&&(u+=x[i++]<>>24,u>>>=v,d-=v,v=_>>>16&255,!(16&v)){if(0==(64&v)){_=f[(65535&_)+(u&(1<a){e.msg="invalid distance too far back",C.mode=lt;break e}if(u>>>=v,d-=v,v=r-o,y>v){if(v=y-v,v>A&&C.sane){e.msg="invalid distance too far back",C.mode=lt;break e}if(B=0,w=c,0===h){if(B+=l-v,v2;)P[r++]=w[B++],P[r++]=w[B++],P[r++]=w[B++],b-=3;b&&(P[r++]=w[B++],b>1&&(P[r++]=w[B++]))}else{B=r-y;do{P[r++]=P[B++],P[r++]=P[B++],P[r++]=P[B++],b-=3}while(b>2);b&&(P[r++]=P[B++],b>1&&(P[r++]=P[B++]))}break}}break}}while(i>3,i-=b,d-=b<<3,u&=(1<{const l=a.bits;let A,h,c,u,d,p,f=0,g=0,m=0,_=0,v=0,b=0,y=0,B=0,w=0,x=0,P=null;const C=new Uint16Array(16),M=new Uint16Array(16);let E,F,I,D=null;for(f=0;f<=15;f++)C[f]=0;for(g=0;g=1&&0===C[_];_--);if(v>_&&(v=_),0===_)return r[o++]=20971520,r[o++]=20971520,a.bits=1,0;for(m=1;m<_&&0===C[m];m++);for(v0&&(0===e||1!==_))return-1;for(M[1]=0,f=1;f<15;f++)M[f+1]=M[f]+C[f];for(g=0;g852||2===e&&w>592)return 1;for(;;){E=f-y,n[g]+1=p?(F=D[n[g]-p],I=P[n[g]-p]):(F=96,I=0),A=1<>y)+h]=E<<24|F<<16|I|0}while(0!==h);for(A=1<>=1;if(0!==A?(x&=A-1,x+=A):x=0,g++,0==--C[f]){if(f===_)break;f=t[i+n[g]]}if(f>v&&(x&u)!==c){for(0===y&&(y=v),d+=m,b=f-y,B=1<852||2===e&&w>592)return 1;c=x&u,r[c]=v<<24|b<<16|d-o|0}}return 0!==x&&(r[d+x]=f-y<<24|64<<16|0),a.bits=v,0};const{Z_FINISH:ft,Z_BLOCK:gt,Z_TREES:mt,Z_OK:_t,Z_STREAM_END:vt,Z_NEED_DICT:bt,Z_STREAM_ERROR:yt,Z_DATA_ERROR:Bt,Z_MEM_ERROR:wt,Z_BUF_ERROR:xt,Z_DEFLATED:Pt}=O,Ct=16180,Mt=16190,Et=16191,Ft=16192,It=16194,Dt=16199,St=16200,Tt=16206,Lt=16209,Rt=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Ut(){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}const kt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode16211?1:0},Ot=e=>{if(kt(e))return yt;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Ct,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,_t},Nt=e=>{if(kt(e))return yt;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Ot(e)},Qt=(e,t)=>{let i;if(kt(e))return yt;const s=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?yt:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=i,s.wbits=t,Nt(e))},Vt=(e,t)=>{if(!e)return yt;const i=new Ut;e.state=i,i.strm=e,i.window=null,i.mode=Ct;const s=Qt(e,t);return s!==_t&&(e.state=null),s};let Ht,jt,Gt=!0;const zt=e=>{if(Gt){Ht=new Int32Array(512),jt=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(pt(1,e.lens,0,288,Ht,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;pt(2,e.lens,0,32,jt,0,e.work,{bits:5}),Gt=!1}e.lencode=Ht,e.lenbits=9,e.distcode=jt,e.distbits=5},Wt=(e,t,i,s)=>{let r;const o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(o.window.set(t.subarray(i-o.wsize,i),0),o.wnext=0,o.whave=o.wsize):(r=o.wsize-o.wnext,r>s&&(r=s),o.window.set(t.subarray(i-s,i-s+r),o.wnext),(s-=r)?(o.window.set(t.subarray(i-s,i),0),o.wnext=s,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave{let i,s,r,o,n,a,l,A,h,c,u,d,p,f,g,m,_,v,b,y,B,w,x=0;const P=new Uint8Array(4);let C,M;const E=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(kt(e)||!e.output||!e.input&&0!==e.avail_in)return yt;i=e.state,i.mode===Et&&(i.mode=Ft),n=e.next_out,r=e.output,l=e.avail_out,o=e.next_in,s=e.input,a=e.avail_in,A=i.hold,h=i.bits,c=a,u=l,w=_t;e:for(;;)switch(i.mode){case Ct:if(0===i.wrap){i.mode=Ft;break}for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>>8&255,i.check=U(i.check,P,2,0),A=0,h=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&A)<<8)+(A>>8))%31){e.msg="incorrect header check",i.mode=Lt;break}if((15&A)!==Pt){e.msg="unknown compression method",i.mode=Lt;break}if(A>>>=4,h-=4,B=8+(15&A),0===i.wbits&&(i.wbits=B),B>15||B>i.wbits){e.msg="invalid window size",i.mode=Lt;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(P[0]=255&A,P[1]=A>>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0,i.mode=16182;case 16182:for(;h<32;){if(0===a)break e;a--,A+=s[o++]<>>8&255,P[2]=A>>>16&255,P[3]=A>>>24&255,i.check=U(i.check,P,4,0)),A=0,h=0,i.mode=16183;case 16183:for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>8),512&i.flags&&4&i.wrap&&(P[0]=255&A,P[1]=A>>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0,i.mode=16184;case 16184:if(1024&i.flags){for(;h<16;){if(0===a)break e;a--,A+=s[o++]<>>8&255,i.check=U(i.check,P,2,0)),A=0,h=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(d=i.length,d>a&&(d=a),d&&(i.head&&(B=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(s.subarray(o,o+d),B)),512&i.flags&&4&i.wrap&&(i.check=U(i.check,s,d,o)),a-=d,o+=d,i.length-=d),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break e;d=0;do{B=s[o+d++],i.head&&B&&i.length<65536&&(i.head.name+=String.fromCharCode(B))}while(B&&d>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Et;break;case 16189:for(;h<32;){if(0===a)break e;a--,A+=s[o++]<>>=7&h,h-=7&h,i.mode=Tt;break}for(;h<3;){if(0===a)break e;a--,A+=s[o++]<>>=1,h-=1,3&A){case 0:i.mode=16193;break;case 1:if(zt(i),i.mode=Dt,t===mt){A>>>=2,h-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=Lt}A>>>=2,h-=2;break;case 16193:for(A>>>=7&h,h-=7&h;h<32;){if(0===a)break e;a--,A+=s[o++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=Lt;break}if(i.length=65535&A,A=0,h=0,i.mode=It,t===mt)break e;case It:i.mode=16195;case 16195:if(d=i.length,d){if(d>a&&(d=a),d>l&&(d=l),0===d)break e;r.set(s.subarray(o,o+d),n),a-=d,o+=d,l-=d,n+=d,i.length-=d;break}i.mode=Et;break;case 16196:for(;h<14;){if(0===a)break e;a--,A+=s[o++]<>>=5,h-=5,i.ndist=1+(31&A),A>>>=5,h-=5,i.ncode=4+(15&A),A>>>=4,h-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=Lt;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,h-=3}for(;i.have<19;)i.lens[E[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,C={bits:i.lenbits},w=pt(0,i.lens,0,19,i.lencode,0,i.work,C),i.lenbits=C.bits,w){e.msg="invalid code lengths set",i.mode=Lt;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>24,m=x>>>16&255,_=65535&x,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=g,h-=g,i.lens[i.have++]=_;else{if(16===_){for(M=g+2;h>>=g,h-=g,0===i.have){e.msg="invalid bit length repeat",i.mode=Lt;break}B=i.lens[i.have-1],d=3+(3&A),A>>>=2,h-=2}else if(17===_){for(M=g+3;h>>=g,h-=g,B=0,d=3+(7&A),A>>>=3,h-=3}else{for(M=g+7;h>>=g,h-=g,B=0,d=11+(127&A),A>>>=7,h-=7}if(i.have+d>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=Lt;break}for(;d--;)i.lens[i.have++]=B}}if(i.mode===Lt)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=Lt;break}if(i.lenbits=9,C={bits:i.lenbits},w=pt(1,i.lens,0,i.nlen,i.lencode,0,i.work,C),i.lenbits=C.bits,w){e.msg="invalid literal/lengths set",i.mode=Lt;break}if(i.distbits=6,i.distcode=i.distdyn,C={bits:i.distbits},w=pt(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,C),i.distbits=C.bits,w){e.msg="invalid distances set",i.mode=Lt;break}if(i.mode=Dt,t===mt)break e;case Dt:i.mode=St;case St:if(a>=6&&l>=258){e.next_out=n,e.avail_out=l,e.next_in=o,e.avail_in=a,i.hold=A,i.bits=h,At(e,u),n=e.next_out,r=e.output,l=e.avail_out,o=e.next_in,s=e.input,a=e.avail_in,A=i.hold,h=i.bits,i.mode===Et&&(i.back=-1);break}for(i.back=0;x=i.lencode[A&(1<>>24,m=x>>>16&255,_=65535&x,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>v)],g=x>>>24,m=x>>>16&255,_=65535&x,!(v+g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=v,h-=v,i.back+=v}if(A>>>=g,h-=g,i.back+=g,i.length=_,0===m){i.mode=16205;break}if(32&m){i.back=-1,i.mode=Et;break}if(64&m){e.msg="invalid literal/length code",i.mode=Lt;break}i.extra=15&m,i.mode=16201;case 16201:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;x=i.distcode[A&(1<>>24,m=x>>>16&255,_=65535&x,!(g<=h);){if(0===a)break e;a--,A+=s[o++]<>v)],g=x>>>24,m=x>>>16&255,_=65535&x,!(v+g<=h);){if(0===a)break e;a--,A+=s[o++]<>>=v,h-=v,i.back+=v}if(A>>>=g,h-=g,i.back+=g,64&m){e.msg="invalid distance code",i.mode=Lt;break}i.offset=_,i.extra=15&m,i.mode=16203;case 16203:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=Lt;break}i.mode=16204;case 16204:if(0===l)break e;if(d=u-l,i.offset>d){if(d=i.offset-d,d>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=Lt;break}d>i.wnext?(d-=i.wnext,p=i.wsize-d):p=i.wnext-d,d>i.length&&(d=i.length),f=i.window}else f=r,p=n-i.offset,d=i.length;d>l&&(d=l),l-=d,i.length-=d;do{r[n++]=f[p++]}while(--d);0===i.length&&(i.mode=St);break;case 16205:if(0===l)break e;r[n++]=i.length,l--,i.mode=St;break;case Tt:if(i.wrap){for(;h<32;){if(0===a)break e;a--,A|=s[o++]<{if(kt(e))return yt;let t=e.state;return t.window&&(t.window=null),e.state=null,_t},Zt=(e,t)=>{if(kt(e))return yt;const i=e.state;return 0==(2&i.wrap)?yt:(i.head=t,t.done=!1,_t)},qt=(e,t)=>{const i=t.length;let s,r,o;return kt(e)?yt:(s=e.state,0!==s.wrap&&s.mode!==Mt?yt:s.mode===Mt&&(r=1,r=L(r,t,i,0),r!==s.check)?Bt:(o=Wt(e,t,i,i),o?(s.mode=16210,wt):(s.havedict=1,_t)))},$t=function(){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};const ei=Object.prototype.toString,{Z_NO_FLUSH:ti,Z_FINISH:ii,Z_OK:si,Z_STREAM_END:ri,Z_NEED_DICT:oi,Z_STREAM_ERROR:ni,Z_DATA_ERROR:ai,Z_MEM_ERROR:li}=O;function Ai(e){this.options=Ve({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Xe,this.strm.avail_out=0;let i=Xt(this.strm,t.windowBits);if(i!==si)throw new Error(k[i]);if(this.header=new $t,Zt(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=ze(t.dictionary):"[object ArrayBuffer]"===ei.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=qt(this.strm,t.dictionary),i!==si)))throw new Error(k[i])}function hi(e,t){const i=new Ai(t);if(i.push(e),i.err)throw i.msg||k[i.err];return i.result}Ai.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize,r=this.options.dictionary;let o,n,a;if(this.ended)return!1;for(n=t===~~t?t:!0===t?ii:ti,"[object ArrayBuffer]"===ei.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),o=Jt(i,n),o===oi&&r&&(o=qt(i,r),o===si?o=Jt(i,n):o===ai&&(o=oi));i.avail_in>0&&o===ri&&i.state.wrap>0&&0!==e[i.next_in];)Kt(i),o=Jt(i,n);switch(o){case ni:case ai:case oi:case li:return this.onEnd(o),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||o===ri))if("string"===this.options.to){let e=Ke(i.output,i.next_out),t=i.next_out-e,r=We(i.output,e);i.next_out=t,i.avail_out=s-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(r)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(o!==si||0!==a){if(o===ri)return o=Yt(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Ai.prototype.onData=function(e){this.chunks.push(e)},Ai.prototype.onEnd=function(e){e===si&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=He(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ci={Inflate:Ai,inflate:hi,inflateRaw:function(e,t){return(t=t||{}).raw=!0,hi(e,t)},ungzip:hi,constants:O};const{Deflate:ui,deflate:di,deflateRaw:pi,gzip:fi}=at,{Inflate:gi,inflate:mi,inflateRaw:_i,ungzip:vi}=ci;var bi=ui,yi=di,Bi=pi,wi=fi,xi=gi,Pi=mi,Ci=_i,Mi=vi,Ei=O,Fi={Deflate:bi,deflate:yi,deflateRaw:Bi,gzip:wi,Inflate:xi,inflate:Pi,inflateRaw:Ci,ungzip:Mi,constants:Ei};e.Deflate=bi,e.Inflate=xi,e.constants=Ei,e.default=Fi,e.deflate=yi,e.deflateRaw=Bi,e.gzip=wi,e.inflate=Pi,e.inflateRaw=Ci,e.ungzip=Mi,Object.defineProperty(e,"__esModule",{value:!0})}));var SC=Object.freeze({__proto__:null});let TC=window.pako||SC;TC.inflate||(TC=TC.default);const LC=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const RC={version:1,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],meshPositions:e[4],meshIndices:e[5],meshEdgesIndices:e[6],meshColors:e[7],entityIDs:e[8],entityMeshes:e[9],entityIsObjects:e[10],positionsDecodeMatrix:e[11]}}(i),a=function(e){return{positions:new Uint16Array(TC.inflate(e.positions).buffer),normals:new Int8Array(TC.inflate(e.normals).buffer),indices:new Uint32Array(TC.inflate(e.indices).buffer),edgeIndices:new Uint32Array(TC.inflate(e.edgeIndices).buffer),meshPositions:new Uint32Array(TC.inflate(e.meshPositions).buffer),meshIndices:new Uint32Array(TC.inflate(e.meshIndices).buffer),meshEdgesIndices:new Uint32Array(TC.inflate(e.meshEdgesIndices).buffer),meshColors:new Uint8Array(TC.inflate(e.meshColors).buffer),entityIDs:TC.inflate(e.entityIDs,{to:"string"}),entityMeshes:new Uint32Array(TC.inflate(e.entityMeshes).buffer),entityIsObjects:new Uint8Array(TC.inflate(e.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(TC.inflate(e.positionsDecodeMatrix).buffer)}}(n);!function(e,t,i,s,r,o){o.getNextId(),s.positionsCompression="precompressed",s.normalsCompression="precompressed";const n=i.positions,a=i.normals,l=i.indices,A=i.edgeIndices,h=i.meshPositions,c=i.meshIndices,u=i.meshEdgesIndices,p=i.meshColors,f=JSON.parse(i.entityIDs),g=i.entityMeshes,m=i.entityIsObjects,_=h.length,v=g.length;for(let r=0;rg[e]g[t]?1:0));for(let e=0;e1||(E[i]=e)}}for(let e=0;e1,o=jC(m.subarray(4*t,4*t+3)),u=m[4*t+3]/255,_=a.subarray(d[t],i?a.length:d[t+1]),b=l.subarray(d[t],i?l.length:d[t+1]),B=A.subarray(p[t],i?A.length:p[t+1]),x=h.subarray(f[t],i?h.length:f[t+1]),M=c.subarray(g[t],g[t]+16);if(r){const e=`${n}-geometry.${t}`;s.createGeometry({id:e,primitive:"triangles",positionsCompressed:_,normalsCompressed:b,indices:B,edgeIndices:x,positionsDecodeMatrix:M})}else{const e=`${n}-${t}`;v[E[t]];const i={};s.createMesh(y.apply(i,{id:e,primitive:"triangles",positionsCompressed:_,normalsCompressed:b,indices:B,edgeIndices:x,positionsDecodeMatrix:M,color:o,opacity:u}))}}let F=0;for(let e=0;e1){const t={},r=`${n}-instance.${F++}`,o=`${n}-geometry.${i}`,a=16*B[e],A=u.subarray(a,a+16);s.createMesh(y.apply(t,{id:r,geometryId:o,matrix:A})),l.push(r)}else l.push(i)}if(l.length>0){const e={};s.createEntity(y.apply(e,{id:r,isObject:!0,meshIds:l}))}}}(0,0,a,s,0,o)}};let zC=window.pako||SC;zC.inflate||(zC=zC.default);const WC=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const KC={version:5,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],eachPrimitivePositionsAndNormalsPortion:e[5],eachPrimitiveIndicesPortion:e[6],eachPrimitiveEdgeIndicesPortion:e[7],eachPrimitiveColor:e[8],primitiveInstances:e[9],eachEntityId:e[10],eachEntityPrimitiveInstancesPortion:e[11],eachEntityMatricesPortion:e[12]}}(i),a=function(e){return{positions:new Float32Array(zC.inflate(e.positions).buffer),normals:new Int8Array(zC.inflate(e.normals).buffer),indices:new Uint32Array(zC.inflate(e.indices).buffer),edgeIndices:new Uint32Array(zC.inflate(e.edgeIndices).buffer),matrices:new Float32Array(zC.inflate(e.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(zC.inflate(e.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(zC.inflate(e.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(zC.inflate(e.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveColor:new Uint8Array(zC.inflate(e.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(zC.inflate(e.primitiveInstances).buffer),eachEntityId:zC.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(zC.inflate(e.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(zC.inflate(e.eachEntityMatricesPortion).buffer)}}(n);!function(e,t,i,s,r,o){const n=o.getNextId();s.positionsCompression="disabled",s.normalsCompression="precompressed";const a=i.positions,l=i.normals,A=i.indices,h=i.edgeIndices,c=i.matrices,u=i.eachPrimitivePositionsAndNormalsPortion,d=i.eachPrimitiveIndicesPortion,p=i.eachPrimitiveEdgeIndicesPortion,f=i.eachPrimitiveColor,g=i.primitiveInstances,m=JSON.parse(i.eachEntityId),_=i.eachEntityPrimitiveInstancesPortion,v=i.eachEntityMatricesPortion,b=u.length,B=g.length,w=new Uint8Array(b),x=m.length;for(let e=0;e1||(P[i]=e)}}for(let e=0;e1,r=WC(f.subarray(4*e,4*e+3)),o=f[4*e+3]/255,c=a.subarray(u[e],t?a.length:u[e+1]),g=l.subarray(u[e],t?l.length:u[e+1]),_=A.subarray(d[e],t?A.length:d[e+1]),v=h.subarray(p[e],t?h.length:p[e+1]);if(i){const t=`${n}-geometry.${e}`;s.createGeometry({id:t,primitive:"triangles",positionsCompressed:c,normalsCompressed:g,indices:_,edgeIndices:v})}else{const t=e;m[P[e]];const i={};s.createMesh(y.apply(i,{id:t,primitive:"triangles",positionsCompressed:c,normalsCompressed:g,indices:_,edgeIndices:v,color:r,opacity:o}))}}let C=0;for(let e=0;e1){const t={},r="instance."+C++,o="geometry"+i,n=16*v[e],l=c.subarray(n,n+16);s.createMesh(y.apply(t,{id:r,geometryId:o,matrix:l})),a.push(r)}else a.push(i)}if(a.length>0){const e={};s.createEntity(y.apply(e,{id:r,isObject:!0,meshIds:a}))}}}(0,0,a,s,0,o)}};let XC=window.pako||SC;XC.inflate||(XC=XC.default);const JC=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const YC={version:6,parse:function(e,t,i,s,r,o){const n=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],reusedPrimitivesDecodeMatrix:e[5],eachPrimitivePositionsAndNormalsPortion:e[6],eachPrimitiveIndicesPortion:e[7],eachPrimitiveEdgeIndicesPortion:e[8],eachPrimitiveColorAndOpacity:e[9],primitiveInstances:e[10],eachEntityId:e[11],eachEntityPrimitiveInstancesPortion:e[12],eachEntityMatricesPortion:e[13],eachTileAABB:e[14],eachTileEntitiesPortion:e[15]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:XC.inflate(e,t).buffer}return{positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedPrimitivesDecodeMatrix:new Float32Array(t(e.reusedPrimitivesDecodeMatrix)),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(t(e.eachPrimitivePositionsAndNormalsPortion)),eachPrimitiveIndicesPortion:new Uint32Array(t(e.eachPrimitiveIndicesPortion)),eachPrimitiveEdgeIndicesPortion:new Uint32Array(t(e.eachPrimitiveEdgeIndicesPortion)),eachPrimitiveColorAndOpacity:new Uint8Array(t(e.eachPrimitiveColorAndOpacity)),primitiveInstances:new Uint32Array(t(e.primitiveInstances)),eachEntityId:XC.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(t(e.eachEntityPrimitiveInstancesPortion)),eachEntityMatricesPortion:new Uint32Array(t(e.eachEntityMatricesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(n);!function(e,t,i,s,r,o){const n=o.getNextId(),a=i.positions,l=i.normals,A=i.indices,h=i.edgeIndices,c=i.matrices,u=i.reusedPrimitivesDecodeMatrix,p=i.eachPrimitivePositionsAndNormalsPortion,f=i.eachPrimitiveIndicesPortion,g=i.eachPrimitiveEdgeIndicesPortion,m=i.eachPrimitiveColorAndOpacity,_=i.primitiveInstances,v=JSON.parse(i.eachEntityId),b=i.eachEntityPrimitiveInstancesPortion,B=i.eachEntityMatricesPortion,w=i.eachTileAABB,x=i.eachTileEntitiesPortion,P=p.length,C=_.length,M=v.length,E=x.length,F=new Uint32Array(P);for(let e=0;e1,c=t===P-1,d=a.subarray(p[t],c?a.length:p[t+1]),v=l.subarray(p[t],c?l.length:p[t+1]),b=A.subarray(f[t],c?A.length:f[t+1]),B=h.subarray(g[t],c?h.length:g[t+1]),w=JC(m.subarray(4*t,4*t+3)),x=m[4*t+3]/255,C=o.getNextId();if(r){const e=`${n}-geometry.${i}.${t}`;U[e]||(s.createGeometry({id:e,primitive:"triangles",positionsCompressed:d,indices:b,edgeIndices:B,positionsDecodeMatrix:u}),U[e]=!0),s.createMesh(y.apply(N,{id:C,geometryId:e,origin:I,matrix:E,color:w,opacity:x})),L.push(C)}else s.createMesh(y.apply(N,{id:C,origin:I,primitive:"triangles",positionsCompressed:d,normalsCompressed:v,indices:b,edgeIndices:B,positionsDecodeMatrix:R,color:w,opacity:x})),L.push(C)}L.length>0&&s.createEntity(y.apply(O,{id:x,isObject:!0,meshIds:L}))}}}(e,t,a,s,0,o)}};let ZC=window.pako||SC;ZC.inflate||(ZC=ZC.default);const qC=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function $C(e){const t=[];for(let i=0,s=e.length;i1,d=t===F-1,P=qC(x.subarray(6*e,6*e+3)),C=x[6*e+3]/255,M=x[6*e+4]/255,E=x[6*e+5]/255,I=o.getNextId();if(r){const r=w[e],o=u.slice(r,r+16),B=`${n}-geometry.${i}.${t}`;if(!Q[B]){let e,i,r,o,n,u;switch(f[t]){case 0:e="solid",i=a.subarray(g[t],d?a.length:g[t+1]),r=l.subarray(m[t],d?l.length:m[t+1]),n=h.subarray(v[t],d?h.length:v[t+1]),u=c.subarray(b[t],d?c.length:b[t+1]);break;case 1:e="surface",i=a.subarray(g[t],d?a.length:g[t+1]),r=l.subarray(m[t],d?l.length:m[t+1]),n=h.subarray(v[t],d?h.length:v[t+1]),u=c.subarray(b[t],d?c.length:b[t+1]);break;case 2:e="points",i=a.subarray(g[t],d?a.length:g[t+1]),o=$C(A.subarray(_[t],d?A.length:_[t+1]));break;case 3:e="lines",i=a.subarray(g[t],d?a.length:g[t+1]),n=h.subarray(v[t],d?h.length:v[t+1]);break;default:continue}s.createGeometry({id:B,primitive:e,positionsCompressed:i,normalsCompressed:r,colors:o,indices:n,edgeIndices:u,positionsDecodeMatrix:p}),Q[B]=!0}s.createMesh(y.apply(V,{id:I,geometryId:B,origin:L,matrix:o,color:P,metallic:M,roughness:E,opacity:C})),U.push(I)}else{let e,i,r,o,n,u;switch(f[t]){case 0:e="solid",i=a.subarray(g[t],d?a.length:g[t+1]),r=l.subarray(m[t],d?l.length:m[t+1]),n=h.subarray(v[t],d?h.length:v[t+1]),u=c.subarray(b[t],d?c.length:b[t+1]);break;case 1:e="surface",i=a.subarray(g[t],d?a.length:g[t+1]),r=l.subarray(m[t],d?l.length:m[t+1]),n=h.subarray(v[t],d?h.length:v[t+1]),u=c.subarray(b[t],d?c.length:b[t+1]);break;case 2:e="points",i=a.subarray(g[t],d?a.length:g[t+1]),o=$C(A.subarray(_[t],d?A.length:_[t+1]));break;case 3:e="lines",i=a.subarray(g[t],d?a.length:g[t+1]),n=h.subarray(v[t],d?h.length:v[t+1]);break;default:continue}s.createMesh(y.apply(V,{id:I,origin:L,primitive:e,positionsCompressed:i,normalsCompressed:r,colors:o,indices:n,edgeIndices:u,positionsDecodeMatrix:N,color:P,metallic:M,roughness:E,opacity:C})),U.push(I)}}U.length>0&&s.createEntity(y.apply(O,{id:E,isObject:!0,meshIds:U}))}}}(e,t,a,s,0,o)}};let tM=window.pako||SC;tM.inflate||(tM=tM.default);const iM=d.vec4(),sM=d.vec4();const rM=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function oM(e){const t=[];for(let i=0,s=e.length;i1,l=r===R-1,A=rM(F.subarray(6*e,6*e+3)),h=F[6*e+3]/255,c=F[6*e+4]/255,I=F[6*e+5]/255,D=o.getNextId();if(a){const o=E[e],a=_.slice(o,o+16),M=`${n}-geometry.${i}.${r}`;let F=H[M];if(!F){F={batchThisMesh:!t.reuseGeometries};let e=!1;switch(b[r]){case 0:F.primitiveName="solid",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryNormals=p.subarray(w[r],l?p.length:w[r+1]),F.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),F.geometryEdgeIndices=m.subarray(C[r],l?m.length:C[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 1:F.primitiveName="surface",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryNormals=p.subarray(w[r],l?p.length:w[r+1]),F.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),F.geometryEdgeIndices=m.subarray(C[r],l?m.length:C[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 2:F.primitiveName="points",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryColors=oM(f.subarray(x[r],l?f.length:x[r+1])),e=F.geometryPositions.length>0;break;case 3:F.primitiveName="lines",F.geometryPositions=u.subarray(B[r],l?u.length:B[r+1]),F.geometryIndices=g.subarray(P[r],l?g.length:P[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;default:continue}if(e||(F=null),F&&(F.geometryPositions.length,F.batchThisMesh)){F.decompressedPositions=new Float32Array(F.geometryPositions.length);const e=F.geometryPositions,t=F.decompressedPositions;for(let i=0,s=e.length;i0&&n.length>0;break;case 1:e="surface",t=u.subarray(B[r],l?u.length:B[r+1]),i=p.subarray(w[r],l?p.length:w[r+1]),n=g.subarray(P[r],l?g.length:P[r+1]),a=m.subarray(C[r],l?m.length:C[r+1]),d=t.length>0&&n.length>0;break;case 2:e="points",t=u.subarray(B[r],l?u.length:B[r+1]),o=oM(f.subarray(x[r],l?f.length:x[r+1])),d=t.length>0;break;case 3:e="lines",t=u.subarray(B[r],l?u.length:B[r+1]),n=g.subarray(P[r],l?g.length:P[r+1]),d=t.length>0&&n.length>0;break;default:continue}d&&(s.createMesh(y.apply(G,{id:D,origin:Q,primitive:e,positionsCompressed:t,normalsCompressed:i,colorsCompressed:o,indices:n,edgeIndices:a,positionsDecodeMatrix:L,color:A,metallic:c,roughness:I,opacity:h})),T.push(D))}}T.length>0&&s.createEntity(y.apply(j,{id:A,isObject:!0,meshIds:T}))}}}(e,t,a,s,r,o)}};let aM=window.pako||SC;aM.inflate||(aM=aM.default);const lM=d.vec4(),AM=d.vec4();const hM=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();const cM={version:9,parse:function(e,t,i,s,r,o){const n=function(e){return{metadata:e[0],positions:e[1],normals:e[2],colors:e[3],indices:e[4],edgeIndices:e[5],matrices:e[6],reusedGeometriesDecodeMatrix:e[7],eachGeometryPrimitiveType:e[8],eachGeometryPositionsPortion:e[9],eachGeometryNormalsPortion:e[10],eachGeometryColorsPortion:e[11],eachGeometryIndicesPortion:e[12],eachGeometryEdgeIndicesPortion:e[13],eachMeshGeometriesPortion:e[14],eachMeshMatricesPortion:e[15],eachMeshMaterial:e[16],eachEntityId:e[17],eachEntityMeshesPortion:e[18],eachTileAABB:e[19],eachTileEntitiesPortion:e[20]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:aM.inflate(e,t).buffer}return{metadata:JSON.parse(aM.inflate(e.metadata,{to:"string"})),positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),colors:new Uint8Array(t(e.colors)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(t(e.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(t(e.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(t(e.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(t(e.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(t(e.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(t(e.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(t(e.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(t(e.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(t(e.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(t(e.eachMeshMaterial)),eachEntityId:JSON.parse(aM.inflate(e.eachEntityId,{to:"string"})),eachEntityMeshesPortion:new Uint32Array(t(e.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(n);!function(e,t,i,s,r,o){const n=o.getNextId(),a=i.metadata,l=i.positions,A=i.normals,h=i.colors,c=i.indices,u=i.edgeIndices,p=i.matrices,f=i.reusedGeometriesDecodeMatrix,g=i.eachGeometryPrimitiveType,m=i.eachGeometryPositionsPortion,_=i.eachGeometryNormalsPortion,v=i.eachGeometryColorsPortion,b=i.eachGeometryIndicesPortion,B=i.eachGeometryEdgeIndicesPortion,w=i.eachMeshGeometriesPortion,x=i.eachMeshMatricesPortion,P=i.eachMeshMaterial,C=i.eachEntityId,M=i.eachEntityMeshesPortion,E=i.eachTileAABB,F=i.eachTileEntitiesPortion,I=m.length,D=w.length,S=M.length,T=F.length;r&&r.loadData(a,{includeTypes:t.includeTypes,excludeTypes:t.excludeTypes,globalizeObjectIds:t.globalizeObjectIds});const L=new Uint32Array(I);for(let e=0;e1,C=r===I-1,M=hM(P.subarray(6*e,6*e+3)),E=P[6*e+3]/255,F=P[6*e+4]/255,D=P[6*e+5]/255,S=o.getNextId();if(a){const o=x[e],a=p.slice(o,o+16),w=`${n}-geometry.${i}.${r}`;let P=k[w];if(!P){P={batchThisMesh:!t.reuseGeometries};let e=!1;switch(g[r]){case 0:P.primitiveName="solid",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryNormals=A.subarray(_[r],C?A.length:_[r+1]),P.geometryIndices=c.subarray(b[r],C?c.length:b[r+1]),P.geometryEdgeIndices=u.subarray(B[r],C?u.length:B[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;case 1:P.primitiveName="surface",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryNormals=A.subarray(_[r],C?A.length:_[r+1]),P.geometryIndices=c.subarray(b[r],C?c.length:b[r+1]),P.geometryEdgeIndices=u.subarray(B[r],C?u.length:B[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;case 2:P.primitiveName="points",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryColors=h.subarray(v[r],C?h.length:v[r+1]),e=P.geometryPositions.length>0;break;case 3:P.primitiveName="lines",P.geometryPositions=l.subarray(m[r],C?l.length:m[r+1]),P.geometryIndices=c.subarray(b[r],C?c.length:b[r+1]),e=P.geometryPositions.length>0&&P.geometryIndices.length>0;break;default:continue}if(e||(P=null),P&&(P.geometryPositions.length,P.batchThisMesh)){P.decompressedPositions=new Float32Array(P.geometryPositions.length),P.transformedAndRecompressedPositions=new Uint16Array(P.geometryPositions.length);const e=P.geometryPositions,t=P.decompressedPositions;for(let i=0,s=e.length;i0&&n.length>0;break;case 1:e="surface",t=l.subarray(m[r],C?l.length:m[r+1]),i=A.subarray(_[r],C?A.length:_[r+1]),n=c.subarray(b[r],C?c.length:b[r+1]),a=u.subarray(B[r],C?u.length:B[r+1]),d=t.length>0&&n.length>0;break;case 2:e="points",t=l.subarray(m[r],C?l.length:m[r+1]),o=h.subarray(v[r],C?h.length:v[r+1]),d=t.length>0;break;case 3:e="lines",t=l.subarray(m[r],C?l.length:m[r+1]),n=c.subarray(b[r],C?c.length:b[r+1]),d=t.length>0&&n.length>0;break;default:continue}d&&(s.createMesh(y.apply(j,{id:S,origin:R,primitive:e,positionsCompressed:t,normalsCompressed:i,colorsCompressed:o,indices:n,edgeIndices:a,positionsDecodeMatrix:Q,color:M,metallic:F,roughness:D,opacity:E})),O.push(S))}}O.length>0&&s.createEntity(y.apply(H,{id:E,isObject:!0,meshIds:O}))}}}(e,t,a,s,r,o)}};let uM=window.pako||SC;uM.inflate||(uM=uM.default);const dM=d.vec4(),pM=d.vec4();const fM=function(){const e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function gM(e,t){const i=[];if(t.length>1)for(let e=0,s=t.length-1;e1)for(let t=0,s=e.length/3-1;t0,a=9*e,c=1===h[a+0],u=h[a+1];h[a+2],h[a+3];const d=h[a+4],p=h[a+5],f=h[a+6],g=h[a+7],m=h[a+8];if(o){const t=new Uint8Array(l.subarray(i,r)).buffer,o=`${n}-texture-${e}`;if(c)s.createTexture({id:o,buffers:[t],minFilter:d,magFilter:p,wrapS:f,wrapT:g,wrapR:m});else{const e=new Blob([t],{type:10001===u?"image/jpeg":10002===u?"image/png":"image/gif"}),i=(window.URL||window.webkitURL).createObjectURL(e),r=document.createElement("img");r.src=i,s.createTexture({id:o,image:r,minFilter:d,magFilter:p,wrapS:f,wrapT:g,wrapR:m})}}}for(let e=0;e=0?`${n}-texture-${r}`:null,normalsTextureId:a>=0?`${n}-texture-${a}`:null,metallicRoughnessTextureId:o>=0?`${n}-texture-${o}`:null,emissiveTextureId:l>=0?`${n}-texture-${l}`:null,occlusionTextureId:A>=0?`${n}-texture-${A}`:null})}const j=new Uint32Array(N);for(let e=0;e1,l=r===N-1,A=D[e],h=A>=0?`${n}-textureSet-${A}`:null,T=fM(S.subarray(6*e,6*e+3)),L=S[6*e+3]/255,R=S[6*e+4]/255,O=S[6*e+5]/255,Q=o.getNextId();if(a){const o=I[e],a=v.slice(o,o+16),A=`${n}-geometry.${i}.${r}`;let F=W[A];if(!F){F={batchThisMesh:!t.reuseGeometries};let e=!1;switch(B[r]){case 0:F.primitiveName="solid",F.geometryPositions=c.subarray(w[r],l?c.length:w[r+1]),F.geometryNormals=u.subarray(x[r],l?u.length:x[r+1]),F.geometryUVs=f.subarray(C[r],l?f.length:C[r+1]),F.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),F.geometryEdgeIndices=m.subarray(E[r],l?m.length:E[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 1:F.primitiveName="surface",F.geometryPositions=c.subarray(w[r],l?c.length:w[r+1]),F.geometryNormals=u.subarray(x[r],l?u.length:x[r+1]),F.geometryUVs=f.subarray(C[r],l?f.length:C[r+1]),F.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),F.geometryEdgeIndices=m.subarray(E[r],l?m.length:E[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 2:F.primitiveName="points",F.geometryPositions=c.subarray(w[r],l?c.length:w[r+1]),F.geometryColors=p.subarray(P[r],l?p.length:P[r+1]),e=F.geometryPositions.length>0;break;case 3:F.primitiveName="lines",F.geometryPositions=c.subarray(w[r],l?c.length:w[r+1]),F.geometryIndices=g.subarray(M[r],l?g.length:M[r+1]),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;case 4:F.primitiveName="lines",F.geometryPositions=c.subarray(w[r],l?c.length:w[r+1]),F.geometryIndices=gM(F.geometryPositions,g.subarray(M[r],l?g.length:M[r+1])),e=F.geometryPositions.length>0&&F.geometryIndices.length>0;break;default:continue}if(e||(F=null),F&&(F.geometryPositions.length,F.batchThisMesh)){F.decompressedPositions=new Float32Array(F.geometryPositions.length),F.transformedAndRecompressedPositions=new Uint16Array(F.geometryPositions.length);const e=F.geometryPositions,t=F.decompressedPositions;for(let i=0,s=e.length;i0&&a.length>0;break;case 1:e="surface",t=c.subarray(w[r],l?c.length:w[r+1]),i=u.subarray(x[r],l?u.length:x[r+1]),o=f.subarray(C[r],l?f.length:C[r+1]),a=g.subarray(M[r],l?g.length:M[r+1]),A=m.subarray(E[r],l?m.length:E[r+1]),d=t.length>0&&a.length>0;break;case 2:e="points",t=c.subarray(w[r],l?c.length:w[r+1]),n=p.subarray(P[r],l?p.length:P[r+1]),d=t.length>0;break;case 3:e="lines",t=c.subarray(w[r],l?c.length:w[r+1]),a=g.subarray(M[r],l?g.length:M[r+1]),d=t.length>0&&a.length>0;break;case 4:e="lines",t=c.subarray(w[r],l?c.length:w[r+1]),a=gM(t,g.subarray(M[r],l?g.length:M[r+1])),d=t.length>0&&a.length>0;break;default:continue}d&&(s.createMesh(y.apply(H,{id:Q,textureSetId:h,origin:G,primitive:e,positionsCompressed:t,normalsCompressed:i,uv:o&&o.length>0?o:null,colorsCompressed:n,indices:a,edgeIndices:A,positionsDecodeMatrix:_,color:T,metallic:R,roughness:O,opacity:L})),U.push(Q))}}U.length>0&&s.createEntity(y.apply(Q,{id:l,isObject:!0,meshIds:U}))}}}(e,t,a,s,r,o)}},_M={};_M[RC.version]=RC,_M[OC.version]=OC,_M[VC.version]=VC,_M[GC.version]=GC,_M[KC.version]=KC,_M[YC.version]=YC,_M[eM.version]=eM,_M[nM.version]=nM,_M[cM.version]=cM,_M[mM.version]=mM;class vM extends z{constructor(e,t={}){super("XKTLoader",e,t),this._maxGeometryBatchSize=t.maxGeometryBatchSize,this.textureTranscoder=t.textureTranscoder,this.dataSource=t.dataSource,this.objectDefaults=t.objectDefaults,this.includeTypes=t.includeTypes,this.excludeTypes=t.excludeTypes,this.excludeUnclassifiedObjects=t.excludeUnclassifiedObjects,this.reuseGeometries=t.reuseGeometries}get supportedVersions(){return Object.keys(_M)}get textureTranscoder(){return this._textureTranscoder}set textureTranscoder(e){this._textureTranscoder=e}get dataSource(){return this._dataSource}set dataSource(e){this._dataSource=e||new DC}get objectDefaults(){return this._objectDefaults}set objectDefaults(e){this._objectDefaults=e||DP}get includeTypes(){return this._includeTypes}set includeTypes(e){this._includeTypes=e}get excludeTypes(){return this._excludeTypes}set excludeTypes(e){this._excludeTypes=e}get excludeUnclassifiedObjects(){return this._excludeUnclassifiedObjects}set excludeUnclassifiedObjects(e){this._excludeUnclassifiedObjects=!!e}get globalizeObjectIds(){return this._globalizeObjectIds}set globalizeObjectIds(e){this._globalizeObjectIds=!!e}get reuseGeometries(){return this._reuseGeometries}set reuseGeometries(e){this._reuseGeometries=!1!==e}load(e={}){if(e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id),!(e.src||e.xkt||e.manifestSrc||e.manifest))return this.error("load() param expected: src, xkt, manifestSrc or manifestData"),o;const t={},i=e.includeTypes||this._includeTypes,s=e.excludeTypes||this._excludeTypes,r=e.objectDefaults||this._objectDefaults;if(t.reuseGeometries=null!==e.reuseGeometries&&void 0!==e.reuseGeometries?e.reuseGeometries:!1!==this._reuseGeometries,i){t.includeTypesMap={};for(let e=0,s=i.length;e{o.finalize(),a.finalize(),this.viewer.scene.canvas.spinner.processes--,o.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(a.id)})),this.scheduleTask((()=>{o.destroyed||(o.scene.fire("modelLoaded",o.id),o.fire("loaded",!0,!1))}))},A=e=>{this.viewer.scene.canvas.spinner.processes--,this.error(e),o.fire("error",e)};let h=0;const c={getNextId:()=>`${n}.${h++}`};if(e.metaModelSrc||e.metaModelData)if(e.metaModelSrc){const r=e.metaModelSrc;this._dataSource.getMetaModel(r,(r=>{o.destroyed||(a.loadData(r,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),e.src?this._loadModel(e.src,e,t,o,null,c,l,A):(this._parseModel(e.xkt,e,t,o,null,c),l()))}),(e=>{A(`load(): Failed to load model metadata for model '${n} from '${r}' - ${e}`)}))}else e.metaModelData&&(a.loadData(e.metaModelData,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),e.src?this._loadModel(e.src,e,t,o,null,c,l,A):(this._parseModel(e.xkt,e,t,o,null,c),l()));else if(e.src)this._loadModel(e.src,e,t,o,a,c,l,A);else if(e.xkt)this._parseModel(e.xkt,e,t,o,a,c),l();else if(e.manifestSrc||e.manifest){const r=e.manifestSrc?function(e){const t=e.split("/");return t.pop(),t.join("/")+"/"}(e.manifestSrc):"",n=(e,o,n)=>{let l=0;const A=()=>{l>=e.length?o():this._dataSource.getMetaModel(`${r}${e[l]}`,(e=>{a.loadData(e,{includeTypes:i,excludeTypes:s,globalizeObjectIds:t.globalizeObjectIds}),l++,this.scheduleTask(A,100)}),n)};A()},h=(i,s,n)=>{let a=0;const l=()=>{a>=i.length?s():this._dataSource.getXKT(`${r}${i[a]}`,(i=>{this._parseModel(i,e,t,o,null,c),a++,this.scheduleTask(l,100)}),n)};l()},u=(i,s,n)=>{let l=0;const A=()=>{l>=i.length?s():this._dataSource.getXKT(`${r}${i[l]}`,(i=>{this._parseModel(i,e,t,o,a,c),l++,this.scheduleTask(A,100)}),n)};A()};if(e.manifest){const t=e.manifest,i=t.xktFiles;if(!i||0===i.length)return void A("load(): Failed to load model manifest - manifest not valid");const s=t.metaModelFiles;s?n(s,(()=>{h(i,l,A)}),A):u(i,l,A)}else this._dataSource.getManifest(e.manifestSrc,(e=>{if(o.destroyed)return;const t=e.xktFiles;if(!t||0===t.length)return void A("load(): Failed to load model manifest - manifest not valid");const i=e.metaModelFiles;i?n(i,(()=>{h(t,l,A)}),A):u(t,l,A)}),A)}return o}_loadModel(e,t,i,s,r,o,n,a){this._dataSource.getXKT(t.src,(e=>{this._parseModel(e,t,i,s,r,o),n()}),a)}_parseModel(e,t,i,s,r,o){if(s.destroyed)return;const n=new DataView(e),a=new Uint8Array(e),l=n.getUint32(0,!0),A=_M[l];if(!A)return void this.error("Unsupported .XKT file version: "+l+" - this XKTLoaderPlugin supports versions "+Object.keys(_M));this.log("Loading .xkt V"+l);const h=n.getUint32(4,!0),c=[];let u=4*(h+2);for(let e=0;ee.size)throw new RangeError("offset:"+t+", length:"+i+", size:"+e.size);return e.slice?e.slice(t,t+i):e.webkitSlice?e.webkitSlice(t,t+i):e.mozSlice?e.mozSlice(t,t+i):e.msSlice?e.msSlice(t,t+i):void 0}(e,t,i))}catch(e){r(e)}}}function p(){}function f(e){var i,s=this;s.init=function(e){i=new Blob([],{type:n}),e()},s.writeUint8Array=function(e,s){i=new Blob([i,t?e:e.buffer],{type:n}),s()},s.getData=function(t,s){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=s,r.readAsText(i,e)}}function g(t){var i=this,s="",r="";i.init=function(e){s+="data:"+(t||"")+";base64,",e()},i.writeUint8Array=function(t,i){var o,n=r.length,a=r;for(r="",o=0;o<3*Math.floor((n+t.length)/3)-n;o++)a+=String.fromCharCode(t[o]);for(;o2?s+=e.btoa(a):r=a,i()},i.getData=function(t){t(s+e.btoa(r))}}function m(e){var i,s=this;s.init=function(t){i=new Blob([],{type:e}),t()},s.writeUint8Array=function(s,r){i=new Blob([i,t?s:s.buffer],{type:e}),r()},s.getData=function(e){e(i)}}function _(e,t,i,s,r,n,a,l,A,h){var c,u,d,p=0,f=t.sn;function g(){e.removeEventListener("message",m,!1),l(u,d)}function m(t){var i=t.data,r=i.data,o=i.error;if(o)return o.toString=function(){return"Error: "+this.message},void A(o);if(i.sn===f)switch("number"==typeof i.codecTime&&(e.codecTime+=i.codecTime),"number"==typeof i.crcTime&&(e.crcTime+=i.crcTime),i.type){case"append":r?(u+=r.length,s.writeUint8Array(r,(function(){_()}),h)):_();break;case"flush":d=i.crc,r?(u+=r.length,s.writeUint8Array(r,(function(){g()}),h)):g();break;case"progress":a&&a(c+i.loaded,n);break;case"importScripts":case"newTask":case"echo":break;default:console.warn("zip.js:launchWorkerProcess: unknown message: ",i)}}function _(){(c=p*o)<=n?i.readUint8Array(r+c,Math.min(o,n-c),(function(i){a&&a(c,n);var s=0===c?t:{sn:f};s.type="append",s.data=i;try{e.postMessage(s,[i.buffer])}catch(t){e.postMessage(s)}p++}),A):e.postMessage({sn:f,type:"flush"})}u=0,e.addEventListener("message",m,!1),_()}function v(e,t,i,s,r,n,l,A,h,c){var u,d=0,p=0,f="input"===n,g="output"===n,m=new a;!function n(){var a;if((u=d*o)127?r[i-128]:String.fromCharCode(i);return s}function B(e){return decodeURIComponent(escape(e))}function w(e){var t,i="";for(t=0;t>16,i=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&i)>>11,(2016&i)>>5,2*(31&i),0)}catch(e){}}(e.lastModDateRaw),1!=(1&e.bitFlag)?((s||8!=(8&e.bitFlag))&&(e.crc32=t.view.getUint32(i+10,!0),e.compressedSize=t.view.getUint32(i+14,!0),e.uncompressedSize=t.view.getUint32(i+18,!0)),4294967295!==e.compressedSize&&4294967295!==e.uncompressedSize?(e.filenameLength=t.view.getUint16(i+22,!0),e.extraFieldLength=t.view.getUint16(i+24,!0)):r("File is using Zip64 (4gb+ file size).")):r("File contains encrypted entry.")}function P(t,o,n){var a=0;function l(){}l.prototype.getData=function(s,o,l,h){var c=this;function u(e,t){h&&!function(e){var t=A(4);return t.view.setUint32(0,e),c.crc32==t.view.getUint32(0)}(t)?n("CRC failed."):s.getData((function(e){o(e)}))}function d(e){n(e||r)}function p(e){n(e||"Error while writing file data.")}t.readUint8Array(c.offset,30,(function(r){var o,f=A(r.length,r);1347093252==f.view.getUint32(0)?(x(c,f,4,!1,n),o=c.offset+30+c.filenameLength+c.extraFieldLength,s.init((function(){0===c.compressionMethod?b(c._worker,a++,t,s,o,c.compressedSize,h,u,l,d,p):function(t,i,s,r,o,n,a,l,A,h,c){var u=a?"output":"none";e.zip.useWebWorkers?_(t,{sn:i,codecClass:"Inflater",crcType:u},s,r,o,n,A,l,h,c):v(new e.zip.Inflater,s,r,o,n,u,A,l,h,c)}(c._worker,a++,t,s,o,c.compressedSize,h,u,l,d,p)}),p)):n(i)}),d)};var h={getEntries:function(e){var r=this._worker;!function(e){t.size<22?n(i):r(22,(function(){r(Math.min(65558,t.size),(function(){n(i)}))}));function r(i,r){t.readUint8Array(t.size-i,i,(function(t){for(var i=t.length-22;i>=0;i--)if(80===t[i]&&75===t[i+1]&&5===t[i+2]&&6===t[i+3])return void e(new DataView(t.buffer,i,22));r()}),(function(){n(s)}))}}((function(o){var a,h;a=o.getUint32(16,!0),h=o.getUint16(8,!0),a<0||a>=t.size?n(i):t.readUint8Array(a,t.size-a,(function(t){var s,o,a,c,u=0,d=[],p=A(t.length,t);for(s=0;s>>8^i[255&(t^e[s])];this.crc=t},a.prototype.get=function(){return~this.crc},a.prototype.table=function(){var e,t,i,s=[];for(e=0;e<256;e++){for(i=e,t=0;t<8;t++)1&i?i=i>>>1^3988292384:i>>>=1;s[e]=i}return s}(),l.prototype.append=function(e,t){return e},l.prototype.flush=function(){},c.prototype=new h,c.prototype.constructor=c,u.prototype=new h,u.prototype.constructor=u,d.prototype=new h,d.prototype.constructor=d,p.prototype.getData=function(e){e(this.data)},f.prototype=new p,f.prototype.constructor=f,g.prototype=new p,g.prototype.constructor=g,m.prototype=new p,m.prototype.constructor=m;var F={deflater:["z-worker.js","deflate.js"],inflater:["z-worker.js","inflate.js"]};function I(t,i,s){if(null===e.zip.workerScripts||null===e.zip.workerScriptsPath){var r;if(e.zip.workerScripts){if(r=e.zip.workerScripts[t],!Array.isArray(r))return void s(new Error("zip.workerScripts."+t+" is not an array!"));r=function(e){var t=document.createElement("a");return e.map((function(e){return t.href=e,t.href}))}(r)}else(r=F[t].slice(0))[0]=(e.zip.workerScriptsPath||"")+r[0];var o=new Worker(r[0]);o.codecTime=o.crcTime=0,o.postMessage({type:"importScripts",scripts:r.slice(1)}),o.addEventListener("message",(function e(t){var r=t.data;if(r.error)return o.terminate(),void s(r.error);"importScripts"===r.type&&(o.removeEventListener("message",e),o.removeEventListener("error",n),i(o))})),o.addEventListener("error",n)}else s(new Error("Either zip.workerScripts or zip.workerScriptsPath may be set, not both."));function n(e){o.terminate(),s(e)}}function D(e){console.error(e)}e.zip={Reader:h,Writer:p,BlobReader:d,Data64URIReader:u,TextReader:c,BlobWriter:m,Data64URIWriter:g,TextWriter:f,createReader:function(e,t,i){i=i||D,e.init((function(){P(e,t,i)}),i)},createWriter:function(e,t,i,s){i=i||D,s=!!s,e.init((function(){E(e,t,i,s)}),i)},useWebWorkers:!0,workerScriptsPath:null,workerScripts:null}}(bM);const yM=bM.zip;!function(e){var t,i,s=e.Reader,r=e.Writer;try{i=0===new Blob([new DataView(new ArrayBuffer(0))]).size}catch(e){}function o(e){var t=this;function i(i,s){var r;t.data?i():((r=new XMLHttpRequest).addEventListener("load",(function(){t.size||(t.size=Number(r.getResponseHeader("Content-Length"))||Number(r.response.byteLength)),t.data=new Uint8Array(r.response),i()}),!1),r.addEventListener("error",s,!1),r.open("GET",e),r.responseType="arraybuffer",r.send())}t.size=0,t.init=function(s,r){if(function(e){var t=document.createElement("a");return t.href=e,"http:"===t.protocol||"https:"===t.protocol}(e)){var o=new XMLHttpRequest;o.addEventListener("load",(function(){t.size=Number(o.getResponseHeader("Content-Length")),t.size?s():i(s,r)}),!1),o.addEventListener("error",r,!1),o.open("HEAD",e),o.send()}else i(s,r)},t.readUint8Array=function(e,s,r,o){i((function(){r(new Uint8Array(t.data.subarray(e,e+s)))}),o)}}function n(e){var t=this;t.size=0,t.init=function(i,s){var r=new XMLHttpRequest;r.addEventListener("load",(function(){t.size=Number(r.getResponseHeader("Content-Length")),"bytes"==r.getResponseHeader("Accept-Ranges")?i():s("HTTP Range not supported.")}),!1),r.addEventListener("error",s,!1),r.open("HEAD",e),r.send()},t.readUint8Array=function(t,i,s,r){!function(t,i,s,r){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="arraybuffer",o.setRequestHeader("Range","bytes="+t+"-"+(t+i-1)),o.addEventListener("load",(function(){s(o.response)}),!1),o.addEventListener("error",r,!1),o.send()}(t,i,(function(e){s(new Uint8Array(e))}),r)}}function a(e){var t=this;t.size=0,t.init=function(i,s){t.size=e.byteLength,i()},t.readUint8Array=function(t,i,s,r){s(new Uint8Array(e.slice(t,t+i)))}}function l(){var e,t=this;t.init=function(t,i){e=new Uint8Array,t()},t.writeUint8Array=function(t,i,s){var r=new Uint8Array(e.length+t.length);r.set(e),r.set(t,e.length),e=r,i()},t.getData=function(t){t(e.buffer)}}function A(e,t){var s,r=this;r.init=function(t,i){e.createWriter((function(e){s=e,t()}),i)},r.writeUint8Array=function(e,r,o){var n=new Blob([i?e:e.buffer],{type:t});s.onwrite=function(){s.onwrite=null,r()},s.onerror=o,s.write(n)},r.getData=function(t){e.file(t)}}o.prototype=new s,o.prototype.constructor=o,n.prototype=new s,n.prototype.constructor=n,a.prototype=new s,a.prototype.constructor=a,l.prototype=new r,l.prototype.constructor=l,A.prototype=new r,A.prototype.constructor=A,e.FileWriter=A,e.HttpReader=o,e.HttpRangeReader=n,e.ArrayBufferReader=a,e.ArrayBufferWriter=l,e.fs&&((t=e.fs.ZipDirectoryEntry).prototype.addHttpContent=function(i,s,r){return function(i,s,r,o){if(i.directory)return o?new t(i.fs,s,r,i):new e.fs.ZipFileEntry(i.fs,s,r,i);throw"Parent entry is not a directory."}(this,i,{data:s,Reader:r?n:o})},t.prototype.importHttpContent=function(e,t,i,s){this.importZip(t?new n(e):new o(e),i,s)},e.fs.FS.prototype.importHttpContent=function(e,i,s,r){this.entries=[],this.root=new t(this),this.root.importHttpContent(e,i,s,r)})}(yM);const BM=["4.2"];class wM{constructor(e,t={}){this.supportedSchemas=BM,this._xrayOpacity=.7,this._src=null,this._options=t,this.viewpoint=null,t.workerScriptsPath?(yM.workerScriptsPath=t.workerScriptsPath,this.src=t.src,this.xrayOpacity=.7,this.displayEffect=t.displayEffect,this.createMetaModel=t.createMetaModel):e.error("Config expected: workerScriptsPath")}load(e,t,i,s,r,o){switch(s.materialType){case"MetallicMaterial":t._defaultMaterial=new Gr(t,{baseColor:[1,1,1],metallic:.6,roughness:.6});break;case"SpecularMaterial":t._defaultMaterial=new Kr(t,{diffuse:[1,1,1],specular:d.vec3([1,1,1]),glossiness:.5});break;default:t._defaultMaterial=new ri(t,{reflectivity:.75,shiness:100,diffuse:[1,1,1]})}t._wireframeMaterial=new Vr(t,{color:[0,0,0],lineWidth:2});var n=t.scene.canvas.spinner;n.processes++,xM(e,t,i,s,(function(){n.processes--,r&&r(),t.fire("loaded",!0,!1)}),(function(e){n.processes--,t.error(e),o&&o(e),t.fire("error",e)}),(function(e){console.log("Error, Will Robinson: "+e)}))}}var xM=function(e,t,i,s,r,o){!function(e,t,i){var s=new SM;s.load(e,(function(){t(s)}),(function(e){i("Error loading ZIP archive: "+e)}))}(i,(function(i){PM(e,i,s,t,r,o)}),o)},PM=function(){return function(t,i,s,r,o){var n={plugin:t,zip:i,edgeThreshold:30,materialType:s.materialType,scene:r.scene,modelNode:r,info:{references:{}},materials:{}};s.createMetaModel&&(n.metaModelData={modelId:r.id,metaObjects:[{name:r.id,type:"Default",id:r.id}]}),r.scene.loading++,function(t,i){t.zip.getFile("Manifest.xml",(function(s,r){for(var o=r.children,n=0,a=o.length;n0){for(var n=o.trim().split(" "),a=new Int16Array(n.length),l=0,A=0,h=n.length;A0){i.primitive="triangles";for(var o=[],n=0,a=r.length;n=t.length)i();else{var a=t[o].id,l=a.lastIndexOf(":");l>0&&(a=a.substring(l+1));var A=a.lastIndexOf("#");A>0&&(a=a.substring(0,A)),s[a]?r(o+1):function(e,t,i){e.zip.getFile(t,(function(t,s){!function(e,t,i){for(var s,r=t.children,o=0,n=r.length;o0)for(var s=0,r=t.length;s-1?e+"&_="+t:e+"?_="+t}getIFC(e,t,i){e=this._cacheBusterURL(e);var s=()=>{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n{this._parseModel(e,t,i,s),r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){if(s.destroyed)return;const r=t.stats||{};if(r.sourceFormat="IFC",r.schemaVersion="",r.title="",r.author="",r.created="",r.numMetaObjects=0,r.numPropertySets=0,r.numObjects=0,r.numGeometries=0,r.numTriangles=0,r.numVertices=0,!this._ifcAPI)throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";const o=new Uint8Array(e),n=this._ifcAPI.OpenModel(o),a=this._ifcAPI.GetModelSchema(n),l=this._ifcAPI.GetLineIDsWithType(n,this._webIFC.IFCPROJECT).get(0),A=!1!==t.loadMetadata,h={modelID:n,modelSchema:a,sceneModel:s,loadMetadata:A,metadata:A?{id:"",projectId:""+l,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:null,metaObjects:{},options:i,log:function(e){},nextId:0,stats:r};if(A){if(i.includeTypes){h.includeTypes={};for(let e=0,t=i.includeTypes.length;e{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))}))}_parseMetaObjects(e){const t=this._ifcAPI.GetLineIDsWithType(e.modelID,this._webIFC.IFCPROJECT).get(0),i=this._ifcAPI.GetLine(e.modelID,t);this._parseSpatialChildren(e,i)}_parseSpatialChildren(e,t,i){const s=this._ifcAPI.GetNameFromTypeCode(t.type);if(e.includeTypes&&!e.includeTypes[s])return;if(e.excludeTypes&&e.excludeTypes[s])return;this._createMetaObject(e,t,i);const r=t.GlobalId.value;this._parseRelatedItemsOfType(e,t.expressID,"RelatingObject","RelatedObjects",this._webIFC.IFCRELAGGREGATES,r),this._parseRelatedItemsOfType(e,t.expressID,"RelatingStructure","RelatedElements",this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,r)}_createMetaObject(e,t,i){const s=t.GlobalId.value,r=this._ifcAPI.GetNameFromTypeCode(t.type),o={id:s,name:t.Name&&""!==t.Name.value?t.Name.value:r,type:r,parent:i};e.metadata.metaObjects.push(o),e.metaObjects[s]=o,e.stats.numMetaObjects++}_parseRelatedItemsOfType(e,t,i,s,r,o){const n=this._ifcAPI.GetLineIDsWithType(e.modelID,r);for(let r=0;re.value)).includes(t)}else h=A.value===t;if(h){const t=l[s];if(Array.isArray(t))t.forEach((t=>{const i=this._ifcAPI.GetLine(e.modelID,t.value);this._parseSpatialChildren(e,i,o)}));else{const i=this._ifcAPI.GetLine(e.modelID,t.value);this._parseSpatialChildren(e,i,o)}}}}_parsePropertySets(e){const t=this._ifcAPI.GetLineIDsWithType(e.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(let i=0;i0){const o="Default",n=t.Name.value,a=[];for(let e=0,t=s.length;e{const i=t.expressID,s=t.geometries,r=[],o=this._ifcAPI.GetLine(e.modelID,i).GlobalId.value;if(e.loadMetadata){const t=o,i=e.metaObjects[t];if(e.includeTypes&&(!i||!e.includeTypes[i.type]))return;if(e.excludeTypes&&(!i||e.excludeTypes[i.type]))return}const n=d.mat4(),a=d.vec3();for(let t=0,i=s.size();t-1?e+"&_="+t:e+"?_="+t}getLAS(e,t,i){e=this._cacheBusterURL(e);var s=()=>{};t=t||s,i=i||s;const r=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){const e=!!r[2];var o=r[3];o=window.decodeURIComponent(o),e&&(o=window.atob(o));try{const e=new ArrayBuffer(o.length),i=new Uint8Array(e);for(var n=0;n{let t=0,i=0,s=0;const r=new DataView(e),o=new Uint8Array(6e3),n=({item:s,format:o,size:n})=>{let a,l;switch(o){case"char":return l=new Uint8Array(e,t,n),t+=n,a=jM(l),[s,a];case"uShort":return a=r.getUint16(t,!0),t+=n,[s,a];case"uLong":return a=r.getUint32(t,!0),"NumberOfVariableLengthRecords"===s&&(i=a),t+=n,[s,a];case"uChar":return a=r.getUint8(t),t+=n,[s,a];case"double":return a=r.getFloat64(t,!0),t+=n,[s,a];default:t+=n}};return(()=>{const e={};NM.forEach((t=>{const i=n({...t});if(void 0!==i){if("FileSignature"===i[0]&&"LASF"!==i[1])throw new Error("Ivalid FileSignature. Is this a LAS/LAZ file");e[i[0]]=i[1]}}));const r=[];let a=i;for(;a--;){const e={};QM.forEach((i=>{const r=n({...i});e[r[0]]=r[1],"UserId"===r[0]&&"LASF_Projection"===r[1]&&(s=t-18+54)})),r.push(e)}const l=(e=>{if(void 0===e)return;const t=s+e.RecordLengthAfterHeader,i=o.slice(s,t),r=HM(i),n=new DataView(r);let a=6,l=Number(n.getUint16(a,!0));const A=[];for(;l--;){const e={};e.key=n.getUint16(a+=2,!0),e.tiffTagLocation=n.getUint16(a+=2,!0),e.count=n.getUint16(a+=2,!0),e.valueOffset=n.getUint16(a+=2,!0),A.push(e)}const h=A.find((e=>3072===e.key));if(h&&h.hasOwnProperty("valueOffset"))return h.valueOffset})(r.find((e=>"LASF_Projection"===e.UserId)));return l&&(e.epsg=l),e})()},HM=e=>{let t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let t=0;t{let t="";return e.forEach((e=>{let i=String.fromCharCode(e);"\0"!==i&&(t+=i)})),t.trim()};class GM extends z{constructor(e,t={}){super("lasLoader",e,t),this.dataSource=t.dataSource,this.skip=t.skip,this.fp64=t.fp64,this.colorDepth=t.colorDepth}get dataSource(){return this._dataSource}set dataSource(e){this._dataSource=e||new kM}get skip(){return this._skip}set skip(e){this._skip=e||1}get fp64(){return this._fp64}set fp64(e){this._fp64=!!e}get colorDepth(){return this._colorDepth}set colorDepth(e){this._colorDepth=e||"auto"}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new Fc(this.viewer.scene,y.apply(e,{isModel:!0}));if(!e.src&&!e.las)return this.error("load() param expected: src or las"),t;const i={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(e.src)this._loadModel(e.src,e,i,t);else{const s=this.viewer.scene.canvas.spinner;s.processes++,this._parseModel(e.las,e,i,t).then((()=>{s.processes--}),(e=>{s.processes--,this.error(e),t.fire("error",e)}))}return t}_loadModel(e,t,i,s){const r=this.viewer.scene.canvas.spinner;r.processes++,this._dataSource.getLAS(t.src,(e=>{this._parseModel(e,t,i,s).then((()=>{r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){function r(e){const i=e.value;if(t.rotateX&&i)for(let e=0,t=i.length;e{if(s.destroyed)return void l();const A=t.stats||{};A.sourceFormat="LAS",A.schemaVersion="",A.title="",A.author="",A.created="",A.numMetaObjects=0,A.numPropertySets=0,A.numObjects=0,A.numGeometries=0,A.numTriangles=0,A.numVertices=0;try{const A=VM(e);OB(e,OM,i).then((e=>{const h=e.attributes,c=e.loaderData,u=void 0!==c.pointsFormatId?c.pointsFormatId:-1;if(!h.POSITION)return s.finalize(),void l("No positions found in file");let p,f;switch(u){case 0:p=r(h.POSITION),f=n(h.intensity);break;case 1:if(!h.intensity)return s.finalize(),void l("No positions found in file");p=r(h.POSITION),f=n(h.intensity);break;case 2:case 3:if(!h.intensity)return s.finalize(),void l("No positions found in file");p=r(h.POSITION),f=o(h.COLOR_0,h.intensity)}const g=zM(p,15e5),m=zM(f,2e6),_=[];for(let e=0,t=g.length;e{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))})),a()}))}catch(e){s.finalize(),l(e)}}))}}function zM(e,t){if(t>=e.length)return[e];let i=[];for(let s=0;s-1?e+"&_="+t:e+"?_="+t}getCityJSON(e,t,i){y.loadJSON(this._cacheBusterURL(e),(e=>{t(e)}),(function(e){i(e)}))}}function KM(e,t,i){i=i||2;var s,r,o,n,a,l,A,h=t&&t.length,c=h?t[0]*i:e.length,u=XM(e,0,c,i,!0),d=[];if(!u||u.next===u.prev)return d;if(h&&(u=function(e,t,i,s){var r,o,n,a=[];for(r=0,o=t.length;r80*i){s=o=e[0],r=n=e[1];for(var p=i;po&&(o=a),l>n&&(n=l);A=0!==(A=Math.max(o-s,n-r))?1/A:0}return YM(u,d,i,s,r,A),d}function XM(e,t,i,s,r){var o,n;if(r===_E(e,t,i,s)>0)for(o=t;o=t;o-=s)n=fE(o,e[o],e[o+1],n);return n&&AE(n,n.next)&&(gE(n),n=n.next),n}function JM(e,t){if(!e)return e;t||(t=e);var i,s=e;do{if(i=!1,s.steiner||!AE(s,s.next)&&0!==lE(s.prev,s,s.next))s=s.next;else{if(gE(s),(s=t=s.prev)===s.next)break;i=!0}}while(i||s!==t);return t}function YM(e,t,i,s,r,o,n){if(e){!n&&o&&function(e,t,i,s){var r=e;do{null===r.z&&(r.z=rE(r.x,r.y,t,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,i,s,r,o,n,a,l,A=1;do{for(i=e,e=null,o=null,n=0;i;){for(n++,s=i,a=0,t=0;t0||l>0&&s;)0!==a&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;i=s}o.nextZ=null,A*=2}while(n>1)}(r)}(e,s,r,o);for(var a,l,A=e;e.prev!==e.next;)if(a=e.prev,l=e.next,o?qM(e,s,r,o):ZM(e))t.push(a.i/i),t.push(e.i/i),t.push(l.i/i),gE(e),e=l.next,A=l.next;else if((e=l)===A){n?1===n?YM(e=$M(JM(e),t,i),t,i,s,r,o,2):2===n&&eE(e,t,i,s,r,o):YM(JM(e),t,i,s,r,o,1);break}}}function ZM(e){var t=e.prev,i=e,s=e.next;if(lE(t,i,s)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(nE(t.x,t.y,i.x,i.y,s.x,s.y,r.x,r.y)&&lE(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function qM(e,t,i,s){var r=e.prev,o=e,n=e.next;if(lE(r,o,n)>=0)return!1;for(var a=r.xo.x?r.x>n.x?r.x:n.x:o.x>n.x?o.x:n.x,h=r.y>o.y?r.y>n.y?r.y:n.y:o.y>n.y?o.y:n.y,c=rE(a,l,t,i,s),u=rE(A,h,t,i,s),d=e.prevZ,p=e.nextZ;d&&d.z>=c&&p&&p.z<=u;){if(d!==e.prev&&d!==e.next&&nE(r.x,r.y,o.x,o.y,n.x,n.y,d.x,d.y)&&lE(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==e.prev&&p!==e.next&&nE(r.x,r.y,o.x,o.y,n.x,n.y,p.x,p.y)&&lE(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==e.prev&&d!==e.next&&nE(r.x,r.y,o.x,o.y,n.x,n.y,d.x,d.y)&&lE(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=u;){if(p!==e.prev&&p!==e.next&&nE(r.x,r.y,o.x,o.y,n.x,n.y,p.x,p.y)&&lE(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function $M(e,t,i){var s=e;do{var r=s.prev,o=s.next.next;!AE(r,o)&&hE(r,s,s.next,o)&&dE(r,o)&&dE(o,r)&&(t.push(r.i/i),t.push(s.i/i),t.push(o.i/i),gE(s),gE(s.next),s=e=o),s=s.next}while(s!==e);return JM(s)}function eE(e,t,i,s,r,o){var n=e;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&aE(n,a)){var l=pE(n,a);return n=JM(n,n.next),l=JM(l,l.next),YM(n,t,i,s,r,o),void YM(l,t,i,s,r,o)}a=a.next}n=n.next}while(n!==e)}function tE(e,t){return e.x-t.x}function iE(e,t){if(t=function(e,t){var i,s=t,r=e.x,o=e.y,n=-1/0;do{if(o<=s.y&&o>=s.next.y&&s.next.y!==s.y){var a=s.x+(o-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(a<=r&&a>n){if(n=a,a===r){if(o===s.y)return s;if(o===s.next.y)return s.next}i=s.x=s.x&&s.x>=h&&r!==s.x&&nE(oi.x||s.x===i.x&&sE(i,s)))&&(i=s,u=l)),s=s.next}while(s!==A);return i}(e,t),t){var i=pE(t,e);JM(t,t.next),JM(i,i.next)}}function sE(e,t){return lE(e.prev,e,t.prev)<0&&lE(t.next,e,e.next)<0}function rE(e,t,i,s,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-s)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function oE(e){var t=e,i=e;do{(t.x=0&&(e-n)*(s-a)-(i-n)*(t-a)>=0&&(i-n)*(o-a)-(r-n)*(s-a)>=0}function aE(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&hE(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(dE(e,t)&&dE(t,e)&&function(e,t){var i=e,s=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==e);return s}(e,t)&&(lE(e.prev,e,t.prev)||lE(e,t.prev,t))||AE(e,t)&&lE(e.prev,e,e.next)>0&&lE(t.prev,t,t.next)>0)}function lE(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function AE(e,t){return e.x===t.x&&e.y===t.y}function hE(e,t,i,s){var r=uE(lE(e,t,i)),o=uE(lE(e,t,s)),n=uE(lE(i,s,e)),a=uE(lE(i,s,t));return r!==o&&n!==a||(!(0!==r||!cE(e,i,t))||(!(0!==o||!cE(e,s,t))||(!(0!==n||!cE(i,e,s))||!(0!==a||!cE(i,t,s)))))}function cE(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function uE(e){return e>0?1:e<0?-1:0}function dE(e,t){return lE(e.prev,e,e.next)<0?lE(e,t,e.next)>=0&&lE(e,e.prev,t)>=0:lE(e,t,e.prev)<0||lE(e,e.next,t)<0}function pE(e,t){var i=new mE(e.i,e.x,e.y),s=new mE(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=r,r.prev=i,s.next=i,i.prev=s,o.next=s,s.prev=o,s}function fE(e,t,i,s){var r=new mE(e,t,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function gE(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function mE(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function _E(e,t,i,s){for(var r=0,o=t,n=i-s;o0&&(s+=e[r-1].length,i.holes.push(s))}return i};const vE=d.vec2(),bE=d.vec3(),yE=d.vec3(),BE=d.vec3();class wE extends z{constructor(e,t={}){super("cityJSONLoader",e,t),this.dataSource=t.dataSource}get dataSource(){return this._dataSource}set dataSource(e){this._dataSource=e||new WM}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new Fc(this.viewer.scene,y.apply(e,{isModel:!0,edges:!0}));if(!e.src&&!e.cityJSON)return this.error("load() param expected: src or cityJSON"),t;const i={};if(e.src)this._loadModel(e.src,e,i,t);else{const s=this.viewer.scene.canvas.spinner;s.processes++,this._parseModel(e.cityJSON,e,i,t),s.processes--}return t}_loadModel(e,t,i,s){const r=this.viewer.scene.canvas.spinner;r.processes++,this._dataSource.getCityJSON(t.src,(e=>{this._parseModel(e,t,i,s),r.processes--}),(e=>{r.processes--,this.error(e),s.fire("error",e)}))}_parseModel(e,t,i,s){if(s.destroyed)return;const r=e.transform?this._transformVertices(e.vertices,e.transform,i.rotateX):e.vertices,o=t.stats||{};o.sourceFormat=e.type||"CityJSON",o.schemaVersion=e.version||"",o.title="",o.author="",o.created="",o.numMetaObjects=0,o.numPropertySets=0,o.numObjects=0,o.numGeometries=0,o.numTriangles=0,o.numVertices=0;const n=!1!==t.loadMetadata,a=n?{id:d.createUUID(),name:"Model",type:"Model"}:null,l=n?{id:"",projectId:"",author:"",createdAt:"",schema:e.version||"",creatingApplication:"",metaObjects:[a],propertySets:[]}:null,A={data:e,vertices:r,sceneModel:s,loadMetadata:n,metadata:l,rootMetaObject:a,nextId:0,stats:o};if(this._parseCityJSON(A),s.finalize(),n){const e=s.id;this.viewer.metaScene.createMetaModel(e,A.metadata,i)}s.scene.once("tick",(()=>{s.destroyed||(s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1))}))}_transformVertices(e,t,i){const s=[],r=t.scale||d.vec3([1,1,1]),o=t.translate||d.vec3([0,0,0]);for(let t=0,n=0;t0))return;const o=[];for(let i=0,s=t.geometry.length;i0){const r=t[s[0]];if(void 0!==r.value)n=e[r.value];else{const t=r.values;if(t){a=[];for(let s=0,r=t.length;s0&&(s.createEntity({id:i,meshIds:o,isObject:!0}),e.stats.numObjects++)}_parseGeometrySurfacesWithOwnMaterials(e,t,i,s){switch(t.type){case"MultiPoint":case"MultiLineString":break;case"MultiSurface":case"CompositeSurface":const r=t.boundaries;this._parseSurfacesWithOwnMaterials(e,i,r,s);break;case"Solid":const o=t.boundaries;for(let t=0;t0&&h.push(A.length);const i=this._extractLocalIndices(e,a[t],c,u);A.push(...i)}if(3===A.length)u.indices.push(A[0]),u.indices.push(A[1]),u.indices.push(A[2]);else if(A.length>3){const e=[];for(let t=0;t0&&n.indices.length>0){const t=""+e.nextId++;r.createMesh({id:t,primitive:"triangles",positions:n.positions,indices:n.indices,color:i&&i.diffuseColor?i.diffuseColor:[.8,.8,.8],opacity:1}),s.push(t),e.stats.numGeometries++,e.stats.numVertices+=n.positions.length/3,e.stats.numTriangles+=n.indices.length/3}}_parseSurfacesWithSharedMaterial(e,t,i,s){const r=e.vertices;for(let o=0;o0&&a.push(n.length);const l=this._extractLocalIndices(e,t[o][r],i,s);n.push(...l)}if(3===n.length)s.indices.push(n[0]),s.indices.push(n[1]),s.indices.push(n[2]);else if(n.length>3){let e=[];for(let t=0;t-1?e+"&_="+t:e+"?_="+t}getDotBIM(e,t,i){y.loadJSON(this._cacheBusterURL(e),(e=>{t(e)}),(function(e){i(e)}))}}class PE extends z{constructor(e,t={}){super("DotBIMLoader",e,t),this.dataSource=t.dataSource,this.objectDefaults=t.objectDefaults}set dataSource(e){this._dataSource=e||new xE}get dataSource(){return this._dataSource}set objectDefaults(e){this._objectDefaults=e||DP}get objectDefaults(){return this._objectDefaults}load(e={}){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);const t=new Fc(this.viewer.scene,y.apply(e,{isModel:!0,backfaces:e.backfaces,dtxEnabled:e.dtxEnabled,rotation:e.rotation,origin:e.origin})),i=t.id;if(!e.src&&!e.dotBIM)return this.error("load() param expected: src or dotBIM"),t;const s=e.objectDefaults||this._objectDefaults||DP;let r,o;if(e.includeTypes){r={};for(let t=0,i=e.includeTypes.length;t{const t=e.fileData,n=e.sceneModel,a={},l={},A=d.createUUID(),h=d.createUUID(),c=d.createUUID(),u=d.createUUID(),p={metaObjects:[{id:A,name:"IfcProject",type:"IfcProject",parent:null},{id:h,name:"IfcSite",type:"IfcSite",parent:A},{id:c,name:"IfcBuilding",type:"IfcBuilding",parent:h},{id:u,name:"IfcBuildingStorey",type:"IfcBuildingStorey",parent:c}],propertySets:[]};for(let e=0,i=t.meshes.length;e{if(l[e])return;const i=a[e],s=t.meshes[i];n.createGeometry({id:e,primitive:"triangles",positions:s.coordinates,indices:s.indices}),l[e]=!0},g=t.elements;for(let e=0,t=g.length;e{n.destroyed||(n.scene.fire("modelLoaded",n.id),n.fire("loaded",!0,!1))}))};if(e.src){const i=e.src;this.viewer.scene.canvas.spinner.processes++,this._dataSource.getDotBIM(i,(e=>{n({fileData:e,sceneModel:t,nextId:0,error:function(e){}}),this.viewer.scene.canvas.spinner.processes--}),(e=>{this.viewer.scene.canvas.spinner.processes--,this.error(e)}))}else if(e.dotBIM){const i={fileData:e.dotBIM,sceneModel:t,nextId:0,error:function(e){}};n(i)}return t.once("destroyed",(()=>{this.viewer.metaScene.destroyMetaModel(i)})),t}destroy(){super.destroy()}}const CE=function(e){const t=t=>parseInt(e.substr(t+1,2),16)/255;return[t(0),t(2),t(4)]},ME=function(e){const t=[];for(let i=0;i=0?h:2*Math.PI-h}return r(e[0]-i[0])*(t[1]-i[1])-(t[0]-i[0])*(e[1]-i[1]);return(t,i,s,r)=>{const o=e(t,i,s),n=e(t,s,r),a=e(t,r,i);return!((o<0||n<0||a<0)&&(o>0||n>0||a>0))}}(),r=[],o=(i?t:t.slice(0).reverse()).map((e=>({idx:e})));o.forEach(((e,t)=>{e.prev=o[(t-1+o.length)%o.length],e.next=o[(t+1)%o.length]}));const n=d.vec2(),a=d.vec2();for(;o.length>2;){let t=0;for(;;){if(t>=o.length)throw`isCCW = ${i}; earIdx = ${t}; len = ${o.length}`;const r=o[t],l=e[r.prev.idx],A=e[r.idx],h=e[r.next.idx];if(d.subVec2(l,A,n),d.subVec2(h,A,a),n[0]*a[1]-n[1]*a[0]>=0&&o.every((t=>t===r||t===r.prev||t===r.next||!s(e[t.idx],l,A,h))))break;++t}const l=o[t];o.splice(t,1),r.push([l.idx,l.next.idx,l.prev.idx]);l.prev.next=l.next;l.next.prev=l.prev}return[e,r]},EE=function(e,t){const i=e.canvas.canvas,s=i.parentNode,r=document.createElement("div");s.insertBefore(r,i);let o=5;r.style.background=t,r.style.border="2px solid white",r.style.margin="0 0",r.style.zIndex="100",r.style.position="absolute",r.style.pointerEvents="none",r.style.display="none";const n=new pe(e,{}),a=e=>e+"px",l=function(){const e=n.canvasPos.slice();ge(i,s,e),r.style.left=a(e[0]-3-o/2),r.style.top=a(e[1]-3-o/2),r.style.borderRadius=a(2*o),r.style.width=a(o),r.style.height=a(o)},A=e.camera.on("viewMatrix",l),h=e.camera.on("projMatrix",l);return{update:function(e){e&&(n.worldPos=e,l()),r.style.display=e?"":"none"},setHighlighted:function(e){o=e?10:5,l()},getCanvasPos:()=>n.canvasPos,getWorldPos:()=>n.worldPos,destroy:function(){r.parentNode.removeChild(r),e.camera.off(A),e.camera.off(h),n.destroy()}}},FE=function(e,t,i){let s=null;const r=r=>{if(r){s&&s.destroy();try{const[o,n]=ME(r.map((e=>[e[0],e[2]]))),a=[].concat(...o.map((e=>[e[0],r[0][1],e[1]]))),l=[].concat(...n);s=new wr(e,{pickable:!1,geometry:new $t(e,{positions:a,indices:l,normals:d.buildNormals(a,l)}),material:new ri(e,{alpha:void 0!==i?i:.5,backfaces:!0,diffuse:CE(t)})})}catch(e){s=null}}s&&(s.visible=!!r)};return r(null),{updateBase:r,destroy:()=>s&&s.destroy()}},IE=function(e,t,i,s,r,o,n,a,l){const A=EE(e,s),h=EE(e,s),c=FE(e,s,r),u=o?function(e){o.visible=!!e,e&&(o.canvasPos=e)}:()=>{};let p=a((()=>{u(null),A.update(null)}),((e,t)=>{u(e),A.update(t)}),(function(e,o){A.update(o),p=a((function(){u(null),h.update(null),c.updateBase(null)}),(function(e,t){if(u(e),h.update(t),d.distVec3(o,t)>.01){const e=e=>Math.min(o[e],t[e]),i=e=>Math.max(o[e],t[e]),s=e(0),r=e(1),n=e(2),a=i(0);i(1);const l=i(2);c.updateBase([[s,r,l],[a,r,l],[a,r,n],[s,r,n]])}else c.updateBase(null)}),(function(e,a){h.update(a),A.destroy(),h.destroy(),c.destroy(),u(null);const p=e=>Math.min(o[e],a[e]),f=e=>Math.max(o[e],a[e]),g=p(0),m=p(2),_=f(0),v=f(2),b=n.createZone({id:d.createUUID(),geometry:{planeCoordinates:[[g,v],[_,v],[_,m],[g,m]],altitude:t,height:i},alpha:r,color:s});l(b)}))}));return{deactivate:function(){p(),A.destroy(),h.destroy(),c.destroy(),u(null)}}},DE=function(e,t){return function(i,s,r){const o=e.scene,n=o.canvas.canvas,a=(e,t)=>(t[0]=e.clientX,t[1]=e.clientY,ge(n.ownerDocument.body,n,t),t),l=e=>{const i=d.vec3(),s=d.vec3();return d.canvasPosToWorldRay(n,o.camera.viewMatrix,o.camera.projMatrix,o.camera.projection,e,i,s),t(i,s)};let A=!1;const h=function(){A=!1},c=function(){h(),n.removeEventListener("mousedown",p),n.removeEventListener("mousemove",f),e.cameraControl.off(g),n.removeEventListener("mouseup",m)},u=d.vec2(),p=function(e){1===e.which&&(a(e,u),A=!0)};n.addEventListener("mousedown",p);const f=function(e){const t=a(e,d.vec2());A&&d.distVec2(u,t)>20&&(h(),i())};n.addEventListener("mousemove",f);const g=e.cameraControl.on("rayMove",(e=>{const t=e.canvasPos;s(t,l(t))})),m=function(e){if(1===e.which&&A){c();const t=a(e,d.vec2());r(t,l(t))}};return n.addEventListener("mouseup",m),c}},SE=function(e,t,i){return function(s,r,o){const n=e.scene,a=n.canvas.canvas,l=(e,t)=>(t[0]=e.clientX,t[1]=e.clientY,ge(a.ownerDocument.body,a,t),t),A=e=>{const t=d.vec3(),s=d.vec3();return d.canvasPosToWorldRay(a,n.camera.viewMatrix,n.camera.projMatrix,n.camera.projection,e,t,s),i(t,s)};let h=null;const c=()=>{};let u,p=c;const f=function(){t.stop(),clearTimeout(h),e.cameraControl.active=!0,p=c,u=null},g=function(){f(),a.removeEventListener("touchstart",m),a.removeEventListener("touchmove",_),a.removeEventListener("touchend",v)},m=function(i){const o=i.touches;if(1!==o.length)f(),s();else{const i=o[0],s=l(i,d.vec2());A(s)&&(u=i.identifier,p=e=>{d.distVec2(s,e)>20&&f()},h=setTimeout((function(){t.start(s),h=setTimeout((function(){t.stop(),e.cameraControl.active=!1,p=e=>{r(e,A(e))},p(s)}),300)}),250))}};a.addEventListener("touchstart",m,{passive:!0});const _=function(e){const t=[...e.changedTouches].find((e=>e.identifier===u));t&&p(l(t,d.vec2()))};a.addEventListener("touchmove",_,{passive:!0});const v=function(e){const t=[...e.changedTouches].find((e=>e.identifier===u));if(t){g();const e=l(t,d.vec2());o(e,A(e))}};return a.addEventListener("touchend",v,{passive:!0}),g}},TE=function(e,t,i,s){const r=-(d.dotVec3(i,t)-e)/d.dotVec3(s,t);{const e=d.vec3();return d.mulVec3Scalar(s,r,e),d.addVec3(i,e,e),e}};class LE extends L{constructor(e,t={}){if(super(e.viewer.scene,t),this.plugin=e,this._container=t.container,!this._container)throw"config missing: container";this._eventSubs={},this.plugin.viewer.scene,this._geometry=t.geometry,t.onMouseOver,t.onMouseLeave,t.onContextMenu,this._alpha="alpha"in t&&void 0!==t.alpha?t.alpha:.5,this.color=t.color,this._visible=!0,this._rebuildMesh()}_rebuildMesh(){const e=this.plugin.viewer.scene,t=this._geometry.planeCoordinates.slice(),i=this._geometry.height<0,s=this._geometry.altitude+(i?this._geometry.height:0),r=this._geometry.height*(i?-1:1),[o,n]=ME(t),a=[],l=[],A=e=>{const t=a.length;for(let t of o)a.push([t[0],s+(e?r:0),t[1]]);for(let i of n)l.push(...(e?i:i.slice(0).reverse()).map((e=>e+t)))};A(!1),A(!0);for(let e=0;ee+h)))}this._zoneMesh&&this._zoneMesh.destroy();const h=[].concat(...a);this._zoneMesh=new wr(e,{edges:this._edges,geometry:new $t(e,{positions:h,indices:l,normals:d.buildNormals(h,l)}),material:new ri(e,{alpha:this._alpha,backfaces:!0,diffuse:CE(this._color)}),visible:this._visible}),this._zoneMesh.highlighted=this._highlighted,this._zoneMesh.zone=this,this._volume=null;const c=e=>Math.min(...a.map((t=>t[e]))),u=e=>Math.max(...a.map((t=>t[e]))),p=c(0),f=c(1),g=c(2),m=u(0),_=u(1),v=u(2);this._center=d.vec3([(p+m)/2,(f+_)/2,(g+v)/2])}get volume(){if(null===this._volume){let e=0;const t=this._zoneMesh.geometry,i=[d.vec3(),d.vec3(),d.vec3()];for(let s=0;s{const s=t.map((t=>[t[0],e?r:o,t[1]]));i.push(e?s:s.slice(0).reverse())};n(!0),n(!1);const a=(e,i)=>[t[e][0],i,t[e][1]];for(let e=0;ei?a:n;h|=A,c.push(A)}switch(h){case n:case a:o.push(t);break;case l:break;case A:const i=[];for(let o=0;o=3&&o.push(i)}}i=o}if(0===i.length)return null;{const e=d.vec3([0,0,0]),t=new Set;for(const s of i)for(const i of s){const s=i.map((e=>e.toFixed(3))).join(":");t.has(s)||(t.add(s),d.addVec3(e,i,e))}return d.mulVec3Scalar(e,1/t.size,e),e}}get center(){return this._center}get altitude(){return this._geometry.altitude}set altitude(e){this._geometry.altitude=e,this._rebuildMesh()}get height(){return this._geometry.height}set height(e){this._geometry.height=e,this._rebuildMesh()}get highlighted(){return this._highlighted}set highlighted(e){this._highlighted=e,this._zoneMesh&&(this._zoneMesh.highlighted=e)}set color(e){this._color=e,this._zoneMesh&&(this._zoneMesh.material.diffuse=CE(this._color))}get color(){return this._color}set alpha(e){this._alpha=e,this._zoneMesh&&(this._zoneMesh.material.alpha=this._alpha)}get alpha(){return this._alpha}get edges(){return this._edges}set edges(e){this._edges=e,this._zoneMesh&&(this._zoneMesh.edges=this._edges)}set visible(e){this._visible=!!e,this._zoneMesh.visible=this._visible,this._needUpdate()}get visible(){return this._visible}getJSON(){return{id:this.id,geometry:this._geometry,alpha:this._alpha,color:this._color}}duplicate(){return this.plugin.createZone({id:d.createUUID(),geometry:{planeCoordinates:this._geometry.planeCoordinates.map((e=>e.slice())),altitude:this._geometry.altitude,height:this._geometry.height},alpha:this._alpha,color:this._color})}destroy(){this._zoneMesh.destroy(),super.destroy()}}class RE extends L{constructor(e,t={}){super(e.viewer.scene),this.zonesPlugin=e,this.pointerLens=t.pointerLens,this._deactivate=null}get active(){return!!this._deactivate}activate(e,t,i,s){if(this._deactivate)return;if("object"==typeof e&&null!==e){const r=e,o=(e,t)=>{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=DE(o,(function(t,i){return TE(e,d.vec3([0,1,0]),t,i)}));!function o(){a._deactivate=IE(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._deactivate=()=>{t=!1},a.fire("zoneEnd",e),t&&o()})).deactivate}()}deactivate(){this._deactivate&&(this._deactivate(),this._deactivate=null)}destroy(){this.deactivate(),super.destroy()}}class UE extends z{constructor(e,t={}){super("Zones",e),this._pointerLens=t.pointerLens,this._container=t.container||document.body,this._zones=[],this.defaultColor=void 0!==t.defaultColor?t.defaultColor:"#00BBFF",this.zIndex=t.zIndex||1e4,this._onMouseOver=(e,t)=>{this.fire("mouseOver",{plugin:this,zone:t,event:e})},this._onMouseLeave=(e,t)=>{this.fire("mouseLeave",{plugin:this,zone:t,event:e})},this._onContextMenu=(e,t)=>{this.fire("contextMenu",{plugin:this,zone:t,event:e})}}createZone(e={}){this.viewer.scene.components[e.id]&&(this.error("Viewer scene component with this ID already exists: "+e.id),delete e.id);const t=new LE(this,{id:e.id,plugin:this,container:this._container,geometry:e.geometry,alpha:e.alpha,color:e.color,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._zones.push(t),t.on("destroyed",(()=>{const e=this._zones.indexOf(t);e>=0&&this._zones.splice(e,1)})),this.fire("zoneCreated",t),t}get zones(){return this._zones}destroy(){super.destroy()}}class kE extends L{constructor(e,t={}){super(e.viewer.scene),this.zonesPlugin=e,this.pointerLens=t.pointerLens,this.pointerCircle=new G(e.viewer),this._deactivate=null}get active(){return!!this._deactivate}activate(e,t,i,s){if("object"==typeof e&&null!==e){const r=e,o=(e,t)=>{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}if(this._deactivate)return;const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=SE(o,this.pointerCircle,(function(t,i){return TE(e,d.vec3([0,1,0]),t,i)}));!function o(){a._deactivate=IE(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._deactivate=()=>{t=!1},a.fire("zoneEnd",e),t&&o()})).deactivate}()}deactivate(){this._deactivate&&(this._deactivate(),this._deactivate=null)}destroy(){this.deactivate(),super.destroy()}}const OE=function(e,t,i,s,r,o,n,a,l){const A=o?function(e){o.visible=!!e,e&&(o.canvasPos=e)}:()=>{};let h;const c=[()=>A(null)],u=FE(e,s,r);return c.push((()=>u.destroy())),function o(p){const f=EE(e,s),g=p.length>0&&function(e,t,i){const s=e.canvas.canvas,r=new pe(e,{});r.worldPos=i;const o=new pe(e,{}),n=s.ownerDocument.body,a=new be(n,{color:t,thickness:1,thicknessClickable:6});a.setVisible(!1);const l=function(){const e=r.canvasPos.slice(),t=o.canvasPos.slice();ge(s,n,e),ge(s,n,t),a.setStartAndEnd(e[0],e[1],t[0],t[1])},A=e.camera.on("viewMatrix",l),h=e.camera.on("projMatrix",l);return{update:function(e){e&&(o.worldPos=e,l()),a.setVisible(!!e)},destroy:function(){e.camera.off(A),e.camera.off(h),r.destroy(),o.destroy(),a.destroy()}}}(e,s,p[p.length-1].getWorldPos());c.push((()=>{f.destroy(),g&&g.destroy()}));const m=p.length>0&&p[0],_=function(e){const t=m&&m.getCanvasPos();return t&&d.distVec2(t,e)<10&&{canvasPos:t,worldPos:m.getWorldPos()}},v=function(){const e=(e,t,i)=>t[0]<=Math.max(e[0],i[0])&&t[0]>=Math.min(e[0],i[0])&&t[1]<=Math.max(e[1],i[1])&&t[1]>=Math.min(e[1],i[1]),t=(e,t,i)=>{const s=(t[1]-e[1])*(i[0]-t[0])-(t[0]-e[0])*(i[1]-t[1]);return 0===s?0:s>0?1:2};return function(i,s){const r=i[i.length-2],o=i[i.length-1];for(let n=s?1:0;n{A(null),f.update(null),g&&g.update(null),u.updateBase(p.length>2?p.map((e=>e.getWorldPos())):null)}),((e,t)=>{const i=p.length>2&&_(e);if(m&&m.setHighlighted(!!i),A(i?i.canvasPos:e),f.update(!i&&t),g&&g.update(i?i.worldPos:t),p.length>=2){const e=p.map((e=>e.getWorldPos())).concat(i?[]:[t]),s=v(e.map((e=>[e[0],e[2]])),i);u.updateBase(s?null:e)}else u.updateBase(null)}),(function(e,a){const A=p.length>2&&_(e),h=p.map((e=>e.getWorldPos())).concat(A?[]:[a]);u.updateBase(h);const m=h.map((e=>[e[0],e[2]]));p.length>2&&v(m,A)?(c.pop()(),o(p)):A?(f.update(a),c.forEach((e=>e())),l(n.createZone({id:d.createUUID(),geometry:{planeCoordinates:m,altitude:t,height:i},alpha:r,color:s}))):(f.update(a),g&&g.update(a),o(p.concat(f)))}))}([]),{closeSurface:function(){throw"TODO"},deactivate:function(){h(),c.forEach((e=>e()))}}};class NE extends L{constructor(e,t={}){super(e.viewer.scene),this.zonesPlugin=e,this.pointerLens=t.pointerLens,this._action=null}get active(){return!!this._action}activate(e,t,i,s){if("object"==typeof e&&null!==e){const r=e,o=(e,t)=>{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}if(this._action)return;const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=DE(o,(function(t,i){return TE(e,d.vec3([0,1,0]),t,i)}));!function o(){a._action=OE(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._action={deactivate:()=>{t=!1}},a.fire("zoneEnd",e),t&&o()}))}()}deactivate(){this._action&&(this._action.deactivate(),this._action=null)}destroy(){this.deactivate(),super.destroy()}}class QE extends L{constructor(e,t={}){super(e.viewer.scene),this.zonesPlugin=e,this.pointerLens=t.pointerLens,this.pointerCircle=new G(e.viewer),this._action=null}get active(){return!!this._action}activate(e,t,i,s){if("object"==typeof e&&null!==e){const r=e,o=(e,t)=>{if(e in r)return r[e];if(void 0!==t)return t;throw"config missing: "+e};e=o("altitude"),t=o("height"),i=o("color","#008000"),s=o("alpha",.5)}if(this._action)return;const r=this.zonesPlugin,o=r.viewer,n=o.scene,a=this,l=SE(o,this.pointerCircle,(function(t,i){return TE(e,d.vec3([0,1,0]),t,i)}));!function o(){a._action=OE(n,e,t,i,s,a.pointerLens,r,l,(e=>{let t=!0;a._action={deactivate:()=>{t=!1}},a.fire("zoneEnd",e),t&&o()}))}()}deactivate(){this._action&&(this._action.deactivate(),this._action=null)}destroy(){this.deactivate(),super.destroy()}}class VE extends L{constructor(e,t,i,s){const r=e.plugin.viewer,o=r.scene;super(o);const n=e._geometry.altitude,a=e._geometry.planeCoordinates.map((t=>{const i=o.canvas.canvas.ownerDocument.body,s=new me(o,{},i,{fillColor:e._color});return s.worldPos=d.vec3([t[0],n,t[1]]),s.on("worldPos",(function(){t[0]=s.worldPos[0],t[1]=s.worldPos[2];try{e._rebuildMesh()}catch(t){e._zoneMesh&&(e._zoneMesh.destroy(),e._zoneMesh=null)}})),s})),l=ve({viewer:r,handleMouseEvents:i,handleTouchEvents:s,pointerLens:t&&t.pointerLens,dots:a,ray2WorldPos:(e,t)=>TE(n,d.vec3([0,1,0]),e,t),onEnd:(t,i)=>(e._zoneMesh&&this.fire("edited"),!!e._zoneMesh)}),A=function(){l(),a.forEach((e=>e.destroy()))},h=e.on("destroyed",A);this._deactivate=function(){e.off("destroyed",h),A()}}deactivate(){this._deactivate(),super.destroy()}}class HE extends VE{constructor(e,t){super(e,t,!0,!1)}}class jE extends VE{constructor(e,t){super(e,t,!1,!0)}}class GE extends L{constructor(e,t,i,s){const r=e.plugin.viewer,o=r.scene,n=o.canvas.canvas;super(o);const a=this,l=e._geometry.altitude,A=t&&t.pointerLens,h=A?function(e){A.visible=!!e,e&&(A.canvasPos=e)}:()=>{},c=e=>{const t=d.vec3(),i=d.vec3();return d.canvasPosToWorldRay(n,o.camera.viewMatrix,o.camera.projMatrix,o.camera.projection,e,t,i),s=t,r=i,TE(l,d.vec3([0,1,0]),s,r);var s,r},u=(e,t)=>(t[0]=e.clientX,t[1]=e.clientY,ge(n.ownerDocument.body,n,t),t),p=function(e,t){const i=e=>{e.preventDefault(),t(e)};return n.addEventListener(e,i),()=>n.removeEventListener(e,i)};let f=()=>{};const g=function(t,i,s,o){const l=o(t),A=u(l,d.vec2()),g=r.scene.pick({canvasPos:A,includeEntities:[e._zoneMesh.id]});if((g&&g.entity&&g.entity.zone)===e){f(),n.style.cursor="move",r.cameraControl.active=!1;const t=function(){const t=e._geometry.planeCoordinates.map((e=>e.slice())),i=c(A),s=d.vec2([i[0],i[2]]),r=d.vec2();return function(i){const o=c(i);r[0]=o[0],r[1]=o[2],d.subVec2(s,r,r),e._geometry.planeCoordinates.forEach(((e,i)=>{d.subVec2(t[i],r,e)}));try{e._rebuildMesh()}catch(t){e._zoneMesh&&(e._zoneMesh.destroy(),e._zoneMesh=null)}}}(),l=p(i,(function(e){const i=o(e);if(i){const e=u(i,d.vec2());t(e),h(e)}})),g=p(s,(function(e){const i=o(e);if(i){const e=u(i,d.vec2());t(e),h(null),f(),a.fire("translated")}}));f=function(){f=()=>{},n.style.cursor="default",r.cameraControl.active=!0,l(),g()}}},m=[];i&&m.push(p("mousedown",(e=>{1===e.which&&g(e,"mousemove","mouseup",(e=>1===e.which&&e))}))),s&&m.push(p("touchstart",(e=>{if(1===e.touches.length){const t=e.touches[0].identifier;g(e,"touchmove","touchend",(e=>[...e.changedTouches].find((e=>e.identifier===t))))}})));const _=function(){f(),m.forEach((e=>e())),h(null)},v=e.on("destroyed",_);this._deactivate=function(){e.off("destroyed",v),_()}}deactivate(){this._deactivate(),super.destroy()}}class zE extends GE{constructor(e,t){super(e,t,!0,!1)}}class WE extends GE{constructor(e,t){super(e,t,!1,!0)}}export{ji as AlphaFormat,Vt as AmbientLight,Ie as AngleMeasurementEditMouseControl,De as AngleMeasurementEditTouchControl,Pe as AngleMeasurementsControl,Ce as AngleMeasurementsMouseControl,Me as AngleMeasurementsPlugin,Ee as AngleMeasurementsTouchControl,Ue as AnnotationsPlugin,Fr as AxisGizmoPlugin,Uc as BCFViewpointsPlugin,vo as Bitmap,Ti as ByteType,Cu as CameraMemento,ou as CameraPath,uu as CameraPathAnimation,wE as CityJSONLoaderPlugin,bi as ClampToEdgeWrapping,L as Component,Ss as CompressedMediaType,pn as Configs,o as ContextMenu,Du as CubicBezierCurve,iu as Curve,Jh as DefaultLoadingManager,Xi as DepthFormat,Ji as DepthStencilFormat,Qt as DirLight,Xc as DistanceMeasurementEditControl,Jc as DistanceMeasurementEditMouseControl,Yc as DistanceMeasurementEditTouchControl,Gc as DistanceMeasurementsControl,zc as DistanceMeasurementsMouseControl,Wc as DistanceMeasurementsPlugin,Kc as DistanceMeasurementsTouchControl,xE as DotBIMDefaultDataSource,PE as DotBIMLoaderPlugin,li as EdgeMaterial,ni as EmphasisMaterial,uC as FaceAlignedSectionPlanesPlugin,Zc as FastNavPlugin,Oi as FloatType,so as Fresnel,N as Frustum,O as FrustumPlane,Fs as GIFMediaType,qc as GLTFDefaultDataSource,SP as GLTFLoaderPlugin,Ni as HalfFloatType,mu as ImagePlane,Ui as IntType,Is as JPEGMediaType,tc as KTX2TextureTranscoder,GM as LASLoaderPlugin,Vr as LambertMaterial,xu as LightMap,Dc as LineSet,Ms as LinearEncoding,Mi as LinearFilter,Di as LinearMipMapLinearFilter,Fi as LinearMipMapNearestFilter,Ii as LinearMipmapLinearFilter,Ei as LinearMipmapNearestFilter,Yh as Loader,Xh as LoadingManager,$c as LocaleService,Ki as LuminanceAlphaFormat,Wi as LuminanceFormat,e as Map,pe as Marker,H as MarqueePicker,j as MarqueePickerMouseControl,wr as Mesh,Gr as MetallicMaterial,yi as MirroredRepeatWrapping,Eu as ModelMemento,UP as NavCubePlugin,Bi as NearestFilter,Ci as NearestMipMapLinearFilter,wi as NearestMipMapNearestFilter,Pi as NearestMipmapLinearFilter,xi as NearestMipmapNearestFilter,Qr as Node,zP as OBJLoaderPlugin,f as ObjectsKdTree3,Iu as ObjectsMemento,Ds as PNGMediaType,Su as Path,Lu as PerformanceModel,ri as PhongMaterial,je as PickResult,z as Plugin,_u as PointLight,G as PointerCircle,n as PointerLens,Tu as QuadraticBezierCurve,g as Queue,zi as RGBAFormat,es as RGBAIntegerFormat,ws as RGBA_ASTC_10x10_Format,bs as RGBA_ASTC_10x5_Format,ys as RGBA_ASTC_10x6_Format,Bs as RGBA_ASTC_10x8_Format,xs as RGBA_ASTC_12x10_Format,Ps as RGBA_ASTC_12x12_Format,us as RGBA_ASTC_4x4_Format,ds as RGBA_ASTC_5x4_Format,ps as RGBA_ASTC_5x5_Format,fs as RGBA_ASTC_6x5_Format,gs as RGBA_ASTC_6x6_Format,ms as RGBA_ASTC_8x5_Format,_s as RGBA_ASTC_8x6_Format,vs as RGBA_ASTC_8x8_Format,Cs as RGBA_BPTC_Format,cs as RGBA_ETC2_EAC_Format,ls as RGBA_PVRTC_2BPPV1_Format,as as RGBA_PVRTC_4BPPV1_Format,is as RGBA_S3TC_DXT1_Format,ss as RGBA_S3TC_DXT3_Format,rs as RGBA_S3TC_DXT5_Format,Gi as RGBFormat,As as RGB_ETC1_Format,hs as RGB_ETC2_Format,ns as RGB_PVRTC_2BPPV1_Format,os as RGB_PVRTC_4BPPV1_Format,ts as RGB_S3TC_DXT1_Format,qi as RGFormat,$i as RGIntegerFormat,$t as ReadableGeometry,Yi as RedFormat,Zi as RedIntegerFormat,wu as ReflectionMap,vi as RepeatWrapping,pC as STLDefaultDataSource,wC as STLLoaderPlugin,Fc as SceneModel,wo as SceneModelMesh,bc as SceneModelTransform,Ir as SectionPlane,$P as SectionPlanesPlugin,Li as ShortType,Ru as Skybox,dC as SkyboxesPlugin,Kr as SpecularMaterial,su as SplineCurve,Pu as SpriteMarker,rC as StoreyViewsPlugin,io as Texture,Uu as TextureTranscoder,CC as TreeViewPlugin,Si as UnsignedByteType,Hi as UnsignedInt248Type,ki as UnsignedIntType,Qi as UnsignedShort4444Type,Vi as UnsignedShort5551Type,Ri as UnsignedShortType,no as VBOGeometry,IC as ViewCullPlugin,xb as Viewer,UM as WebIFCLoaderPlugin,$h as WorkerPool,DC as XKTDefaultDataSource,vM as XKTLoaderPlugin,LM as XML3DLoaderPlugin,VE as ZoneEditControl,HE as ZoneEditMouseControl,jE as ZoneEditTouchControl,GE as ZoneTranslateControl,zE as ZoneTranslateMouseControl,WE as ZoneTranslateTouchControl,RE as ZonesMouseControl,UE as ZonesPlugin,NE as ZonesPolysurfaceMouseControl,QE as ZonesPolysurfaceTouchControl,kE as ZonesTouchControl,ei as buildBoxGeometry,ho as buildBoxLinesGeometry,co as buildBoxLinesGeometryFromAABB,Pr as buildCylinderGeometry,uo as buildGridGeometry,_o as buildLineGeometry,po as buildPlaneGeometry,go as buildPolylineGeometry,mo as buildPolylineGeometryFromCurve,Cr as buildSphereGeometry,fo as buildTorusGeometry,Er as buildVectorTextGeometry,J as createRTCViewMat,V as frustumIntersectsAABB3,sc as getKTX2TextureTranscoder,$ as getPlaneRTCPos,lo as load3DSGeometry,Ao as loadOBJGeometry,d as math,q as rtcToWorldPos,Es as sRGBEncoding,Q as setFrustum,m as stats,y as utils,Y as worldToRTCPos,Z as worldToRTCPositions}; diff --git a/dist/xeokit-sdk.min.es5.js b/dist/xeokit-sdk.min.es5.js index 3b84fa9c5..bff6f05c9 100644 --- a/dist/xeokit-sdk.min.es5.js +++ b/dist/xeokit-sdk.min.es5.js @@ -33,4 +33,4 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var wp=function(e,t){return wp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},wp(e,t)};function Bp(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}wp(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var xp=function(){return xp=Object.assign||function(e){for(var t,i=1,r=arguments.length;i0&&s[s.length-1])||6!==n[0]&&2!==n[0])){o=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]=55296&&s<=56319&&i>10),o%1024+56320)),(s+1===i||r.length>16384)&&(n+=String.fromCharCode.apply(String,r),r.length=0)}return n},Dp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Sp="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Tp=0;Tp=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>5])<<2)+(31&e),this.data[t];if(e<=65535)return t=((t=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[t];if(e>11),t=this.index[t],t+=e>>5&63,t=((t=this.index[t])<<2)+(31&e),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Qp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vp="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Hp=0;Hp>4,A[l++]=(15&r)<<4|s>>2,A[l++]=(3&s)<<6|63&n;return u}(e),o=Array.isArray(n)?function(e){for(var t=e.length,i=[],r=0;r0;){var o=r[--n];if(Array.isArray(e)?-1!==e.indexOf(o):e===o)for(var a=i;a<=r.length;){var l;if((l=r[++a])===t)return!0;if(l!==jp)break}if(o!==jp)break}return!1},xf=function(e,t){for(var i=e;i>=0;){var r=t[i];if(r!==jp)return r;i--}return 0},Pf=function(e,t,i,r,s){if(0===i[r])return"×";var n=r-1;if(Array.isArray(s)&&!0===s[n])return"×";var o=n-1,a=n+1,l=t[n],u=o>=0?t[o]:0,A=t[a];if(2===l&&3===A)return"×";if(-1!==gf.indexOf(l))return"!";if(-1!==gf.indexOf(A))return"×";if(-1!==mf.indexOf(A))return"×";if(8===xf(n,t))return"÷";if(11===ff.get(e[n]))return"×";if((l===nf||l===of)&&11===ff.get(e[a]))return"×";if(7===l||7===A)return"×";if(9===l)return"×";if(-1===[jp,Gp,zp].indexOf(l)&&9===A)return"×";if(-1!==[Wp,Kp,Xp,qp,rf].indexOf(A))return"×";if(xf(n,t)===Zp)return"×";if(Bf(23,Zp,n,t))return"×";if(Bf([Wp,Kp],Jp,n,t))return"×";if(Bf(12,12,n,t))return"×";if(l===jp)return"÷";if(23===l||23===A)return"×";if(16===A||16===l)return"÷";if(-1!==[Gp,zp,Jp].indexOf(A)||14===l)return"×";if(36===u&&-1!==wf.indexOf(l))return"×";if(l===rf&&36===A)return"×";if(A===Yp)return"×";if(-1!==vf.indexOf(A)&&l===$p||-1!==vf.indexOf(l)&&A===$p)return"×";if(l===tf&&-1!==[uf,nf,of].indexOf(A)||-1!==[uf,nf,of].indexOf(l)&&A===ef)return"×";if(-1!==vf.indexOf(l)&&-1!==_f.indexOf(A)||-1!==_f.indexOf(l)&&-1!==vf.indexOf(A))return"×";if(-1!==[tf,ef].indexOf(l)&&(A===$p||-1!==[Zp,zp].indexOf(A)&&t[a+1]===$p)||-1!==[Zp,zp].indexOf(l)&&A===$p||l===$p&&-1!==[$p,rf,qp].indexOf(A))return"×";if(-1!==[$p,rf,qp,Wp,Kp].indexOf(A))for(var c=n;c>=0;){if((h=t[c])===$p)return"×";if(-1===[rf,qp].indexOf(h))break;c--}if(-1!==[tf,ef].indexOf(A))for(c=-1!==[Wp,Kp].indexOf(l)?o:n;c>=0;){var h;if((h=t[c])===$p)return"×";if(-1===[rf,qp].indexOf(h))break;c--}if(Af===l&&-1!==[Af,cf,af,lf].indexOf(A)||-1!==[cf,af].indexOf(l)&&-1!==[cf,hf].indexOf(A)||-1!==[hf,lf].indexOf(l)&&A===hf)return"×";if(-1!==bf.indexOf(l)&&-1!==[Yp,ef].indexOf(A)||-1!==bf.indexOf(A)&&l===tf)return"×";if(-1!==vf.indexOf(l)&&-1!==vf.indexOf(A))return"×";if(l===qp&&-1!==vf.indexOf(A))return"×";if(-1!==vf.concat($p).indexOf(l)&&A===Zp&&-1===pf.indexOf(e[a])||-1!==vf.concat($p).indexOf(A)&&l===Kp)return"×";if(41===l&&41===A){for(var d=i[n],p=1;d>0&&41===t[--d];)p++;if(p%2!=0)return"×"}return l===nf&&A===of?"×":"÷"},Cf=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var i=function(e,t){void 0===t&&(t="strict");var i=[],r=[],s=[];return e.forEach((function(e,n){var o=ff.get(e);if(o>50?(s.push(!0),o-=50):s.push(!1),-1!==["normal","auto","loose"].indexOf(t)&&-1!==[8208,8211,12316,12448].indexOf(e))return r.push(n),i.push(16);if(4===o||11===o){if(0===n)return r.push(n),i.push(sf);var a=i[n-1];return-1===yf.indexOf(a)?(r.push(r[n-1]),i.push(a)):(r.push(n),i.push(sf))}return r.push(n),31===o?i.push("strict"===t?Jp:uf):o===df||29===o?i.push(sf):43===o?e>=131072&&e<=196605||e>=196608&&e<=262141?i.push(uf):i.push(sf):void i.push(o)})),[r,i,s]}(e,t.lineBreak),r=i[0],s=i[1],n=i[2];"break-all"!==t.wordBreak&&"break-word"!==t.wordBreak||(s=s.map((function(e){return-1!==[$p,sf,df].indexOf(e)?uf:e})));var o="keep-all"===t.wordBreak?n.map((function(t,i){return t&&e[i]>=19968&&e[i]<=40959})):void 0;return[r,s,o]},Mf=function(){function e(e,t,i,r){this.codePoints=e,this.required="!"===t,this.start=i,this.end=r}return e.prototype.slice=function(){return Ip.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),Ef=function(e){return e>=48&&e<=57},Ff=function(e){return Ef(e)||e>=65&&e<=70||e>=97&&e<=102},kf=function(e){return 10===e||9===e||32===e},If=function(e){return function(e){return function(e){return e>=97&&e<=122}(e)||function(e){return e>=65&&e<=90}(e)}(e)||function(e){return e>=128}(e)||95===e},Df=function(e){return If(e)||Ef(e)||45===e},Sf=function(e){return e>=0&&e<=8||11===e||e>=14&&e<=31||127===e},Tf=function(e,t){return 92===e&&10!==t},Lf=function(e,t,i){return 45===e?If(t)||Tf(t,i):!!If(e)||!(92!==e||!Tf(e,t))},Rf=function(e,t,i){return 43===e||45===e?!!Ef(t)||46===t&&Ef(i):Ef(46===e?t:e)},Uf=function(e){var t=0,i=1;43!==e[t]&&45!==e[t]||(45===e[t]&&(i=-1),t++);for(var r=[];Ef(e[t]);)r.push(e[t++]);var s=r.length?parseInt(Ip.apply(void 0,r),10):0;46===e[t]&&t++;for(var n=[];Ef(e[t]);)n.push(e[t++]);var o=n.length,a=o?parseInt(Ip.apply(void 0,n),10):0;69!==e[t]&&101!==e[t]||t++;var l=1;43!==e[t]&&45!==e[t]||(45===e[t]&&(l=-1),t++);for(var u=[];Ef(e[t]);)u.push(e[t++]);var A=u.length?parseInt(Ip.apply(void 0,u),10):0;return i*(s+a*Math.pow(10,-o))*Math.pow(10,l*A)},Of={type:2},Nf={type:3},Qf={type:4},Vf={type:13},Hf={type:8},jf={type:21},Gf={type:9},zf={type:10},Wf={type:11},Kf={type:12},Xf={type:14},Yf={type:23},Jf={type:1},Zf={type:25},qf={type:24},$f={type:26},ev={type:27},tv={type:28},iv={type:29},rv={type:31},sv={type:32},nv=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(kp(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==sv;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case 34:return this.consumeStringToken(34);case 35:var t=this.peekCodePoint(0),i=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Df(t)||Tf(i,r)){var s=Lf(t,i,r)?2:1;return{type:5,value:this.consumeName(),flags:s}}break;case 36:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Vf;break;case 39:return this.consumeStringToken(39);case 40:return Of;case 41:return Nf;case 42:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Xf;break;case 43:if(Rf(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case 44:return Qf;case 45:var n=e,o=this.peekCodePoint(0),a=this.peekCodePoint(1);if(Rf(n,o,a))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(Lf(n,o,a))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(45===o&&62===a)return this.consumeCodePoint(),this.consumeCodePoint(),qf;break;case 46:if(Rf(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case 47:if(42===this.peekCodePoint(0))for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(42===l&&47===(l=this.consumeCodePoint()))return this.consumeToken();if(-1===l)return this.consumeToken()}break;case 58:return $f;case 59:return ev;case 60:if(33===this.peekCodePoint(0)&&45===this.peekCodePoint(1)&&45===this.peekCodePoint(2))return this.consumeCodePoint(),this.consumeCodePoint(),Zf;break;case 64:var u=this.peekCodePoint(0),A=this.peekCodePoint(1),c=this.peekCodePoint(2);if(Lf(u,A,c))return{type:7,value:this.consumeName()};break;case 91:return tv;case 92:if(Tf(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case 93:return iv;case 61:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Hf;break;case 123:return Wf;case 125:return Kf;case 117:case 85:var h=this.peekCodePoint(0),d=this.peekCodePoint(1);return 43!==h||!Ff(d)&&63!==d||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case 124:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Gf;if(124===this.peekCodePoint(0))return this.consumeCodePoint(),jf;break;case 126:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),zf;break;case-1:return sv}return kf(e)?(this.consumeWhiteSpace(),rv):Ef(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):If(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Ip(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return void 0===e?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();Ff(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var i=!1;63===t&&e.length<6;)e.push(t),t=this.consumeCodePoint(),i=!0;if(i)return{type:30,start:parseInt(Ip.apply(void 0,e.map((function(e){return 63===e?48:e}))),16),end:parseInt(Ip.apply(void 0,e.map((function(e){return 63===e?70:e}))),16)};var r=parseInt(Ip.apply(void 0,e),16);if(45===this.peekCodePoint(0)&&Ff(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var s=[];Ff(t)&&s.length<6;)s.push(t),t=this.consumeCodePoint();return{type:30,start:r,end:parseInt(Ip.apply(void 0,s),16)}}return{type:30,start:r,end:r}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return"url"===e.toLowerCase()&&40===this.peekCodePoint(0)?(this.consumeCodePoint(),this.consumeUrlToken()):40===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),-1===this.peekCodePoint(0))return{type:22,value:""};var t=this.peekCodePoint(0);if(39===t||34===t){var i=this.consumeStringToken(this.consumeCodePoint());return 0===i.type&&(this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0))?(this.consumeCodePoint(),{type:22,value:i.value}):(this.consumeBadUrlRemnants(),Yf)}for(;;){var r=this.consumeCodePoint();if(-1===r||41===r)return{type:22,value:Ip.apply(void 0,e)};if(kf(r))return this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:22,value:Ip.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Yf);if(34===r||39===r||40===r||Sf(r))return this.consumeBadUrlRemnants(),Yf;if(92===r){if(!Tf(r,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),Yf;e.push(this.consumeEscapedCodePoint())}else e.push(r)}},e.prototype.consumeWhiteSpace=function(){for(;kf(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(41===e||-1===e)return;Tf(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t="";e>0;){var i=Math.min(5e4,e);t+=Ip.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),t},e.prototype.consumeStringToken=function(e){for(var t="",i=0;;){var r=this._value[i];if(-1===r||void 0===r||r===e)return{type:0,value:t+=this.consumeStringSlice(i)};if(10===r)return this._value.splice(0,i),Jf;if(92===r){var s=this._value[i+1];-1!==s&&void 0!==s&&(10===s?(t+=this.consumeStringSlice(i),i=-1,this._value.shift()):Tf(r,s)&&(t+=this.consumeStringSlice(i),t+=Ip(this.consumeEscapedCodePoint()),i=-1))}i++}},e.prototype.consumeNumber=function(){var e=[],t=4,i=this.peekCodePoint(0);for(43!==i&&45!==i||e.push(this.consumeCodePoint());Ef(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(46===i&&Ef(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;Ef(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0),r=this.peekCodePoint(1);var s=this.peekCodePoint(2);if((69===i||101===i)&&((43===r||45===r)&&Ef(s)||Ef(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;Ef(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[Uf(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],i=e[1],r=this.peekCodePoint(0),s=this.peekCodePoint(1),n=this.peekCodePoint(2);return Lf(r,s,n)?{type:15,number:t,flags:i,unit:this.consumeName()}:37===r?(this.consumeCodePoint(),{type:16,number:t,flags:i}):{type:17,number:t,flags:i}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Ff(e)){for(var t=Ip(e);Ff(this.peekCodePoint(0))&&t.length<6;)t+=Ip(this.consumeCodePoint());kf(this.peekCodePoint(0))&&this.consumeCodePoint();var i=parseInt(t,16);return 0===i||function(e){return e>=55296&&e<=57343}(i)||i>1114111?65533:i}return-1===e?65533:e},e.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Df(t))e+=Ip(t);else{if(!Tf(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),e;e+=Ip(this.consumeEscapedCodePoint())}}},e}(),ov=function(){function e(e){this._tokens=e}return e.create=function(t){var i=new nv;return i.write(t),new e(i.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();31===e.type;)e=this.consumeToken();if(32===e.type)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do{e=this.consumeToken()}while(31===e.type);if(32===e.type)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(32===t.type)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},i=this.consumeToken();;){if(32===i.type||fv(i,e))return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue()),i=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var i=this.consumeToken();if(32===i.type||3===i.type)return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return void 0===e?sv:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),av=function(e){return 15===e.type},lv=function(e){return 17===e.type},uv=function(e){return 20===e.type},Av=function(e){return 0===e.type},cv=function(e,t){return uv(e)&&e.value===t},hv=function(e){return 31!==e.type},dv=function(e){return 31!==e.type&&4!==e.type},pv=function(e){var t=[],i=[];return e.forEach((function(e){if(4===e.type){if(0===i.length)throw new Error("Error parsing function args, zero tokens for arg");return t.push(i),void(i=[])}31!==e.type&&i.push(e)})),i.length&&t.push(i),t},fv=function(e,t){return 11===t&&12===e.type||(28===t&&29===e.type||2===t&&3===e.type)},vv=function(e){return 17===e.type||15===e.type},gv=function(e){return 16===e.type||vv(e)},mv=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},_v={type:17,number:0,flags:4},yv={type:16,number:50,flags:4},bv={type:16,number:100,flags:4},wv=function(e,t,i){var r=e[0],s=e[1];return[Bv(r,t),Bv(void 0!==s?s:r,i)]},Bv=function(e,t){if(16===e.type)return e.number/100*t;if(av(e))switch(e.unit){case"rem":case"em":return 16*e.number;default:return e.number}return e.number},xv=function(e,t){if(15===t.type)switch(t.unit){case"deg":return Math.PI*t.number/180;case"grad":return Math.PI/200*t.number;case"rad":return t.number;case"turn":return 2*Math.PI*t.number}throw new Error("Unsupported angle type")},Pv=function(e){return 15===e.type&&("deg"===e.unit||"grad"===e.unit||"rad"===e.unit||"turn"===e.unit)},Cv=function(e){switch(e.filter(uv).map((function(e){return e.value})).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[_v,_v];case"to top":case"bottom":return Mv(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[_v,bv];case"to right":case"left":return Mv(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[bv,bv];case"to bottom":case"top":return Mv(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[bv,_v];case"to left":case"right":return Mv(270)}return 0},Mv=function(e){return Math.PI*e/180},Ev=function(e,t){if(18===t.type){var i=Rv[t.name];if(void 0===i)throw new Error('Attempting to parse an unsupported color function "'+t.name+'"');return i(e,t.values)}if(5===t.type){if(3===t.value.length){var r=t.value.substring(0,1),s=t.value.substring(1,2),n=t.value.substring(2,3);return Iv(parseInt(r+r,16),parseInt(s+s,16),parseInt(n+n,16),1)}if(4===t.value.length){r=t.value.substring(0,1),s=t.value.substring(1,2),n=t.value.substring(2,3);var o=t.value.substring(3,4);return Iv(parseInt(r+r,16),parseInt(s+s,16),parseInt(n+n,16),parseInt(o+o,16)/255)}if(6===t.value.length){r=t.value.substring(0,2),s=t.value.substring(2,4),n=t.value.substring(4,6);return Iv(parseInt(r,16),parseInt(s,16),parseInt(n,16),1)}if(8===t.value.length){r=t.value.substring(0,2),s=t.value.substring(2,4),n=t.value.substring(4,6),o=t.value.substring(6,8);return Iv(parseInt(r,16),parseInt(s,16),parseInt(n,16),parseInt(o,16)/255)}}if(20===t.type){var a=Ov[t.value.toUpperCase()];if(void 0!==a)return a}return Ov.TRANSPARENT},Fv=function(e){return 0==(255&e)},kv=function(e){var t=255&e,i=255&e>>8,r=255&e>>16,s=255&e>>24;return t<255?"rgba("+s+","+r+","+i+","+t/255+")":"rgb("+s+","+r+","+i+")"},Iv=function(e,t,i,r){return(e<<24|t<<16|i<<8|Math.round(255*r)<<0)>>>0},Dv=function(e,t){if(17===e.type)return e.number;if(16===e.type){var i=3===t?1:255;return 3===t?e.number/100*i:Math.round(e.number/100*i)}return 0},Sv=function(e,t){var i=t.filter(dv);if(3===i.length){var r=i.map(Dv),s=r[0],n=r[1],o=r[2];return Iv(s,n,o,1)}if(4===i.length){var a=i.map(Dv),l=(s=a[0],n=a[1],o=a[2],a[3]);return Iv(s,n,o,l)}return 0};function Tv(e,t,i){return i<0&&(i+=1),i>=1&&(i-=1),i<1/6?(t-e)*i*6+e:i<.5?t:i<2/3?6*(t-e)*(2/3-i)+e:e}var Lv=function(e,t){var i=t.filter(dv),r=i[0],s=i[1],n=i[2],o=i[3],a=(17===r.type?Mv(r.number):xv(e,r))/(2*Math.PI),l=gv(s)?s.number/100:0,u=gv(n)?n.number/100:0,A=void 0!==o&&gv(o)?Bv(o,1):1;if(0===l)return Iv(255*u,255*u,255*u,1);var c=u<=.5?u*(l+1):u+l-u*l,h=2*u-c,d=Tv(h,c,a+1/3),p=Tv(h,c,a),f=Tv(h,c,a-1/3);return Iv(255*d,255*p,255*f,A)},Rv={hsl:Lv,hsla:Lv,rgb:Sv,rgba:Sv},Uv=function(e,t){return Ev(e,ov.create(t).parseComponentValue())},Ov={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Nv={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(uv(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},Qv={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Vv=function(e,t){var i=Ev(e,t[0]),r=t[1];return r&&gv(r)?{color:i,stop:r}:{color:i,stop:null}},Hv=function(e,t){var i=e[0],r=e[e.length-1];null===i.stop&&(i.stop=_v),null===r.stop&&(r.stop=bv);for(var s=[],n=0,o=0;on?s.push(l):s.push(n),n=l}else s.push(null)}var u=null;for(o=0;oe.optimumDistance)?{optimumCorner:t,optimumDistance:a}:e}),{optimumDistance:s?1/0:-1/0,optimumCorner:null}).optimumCorner},Wv=function(e,t){var i=Mv(180),r=[];return pv(t).forEach((function(t,s){if(0===s){var n=t[0];if(20===n.type&&-1!==["top","left","right","bottom"].indexOf(n.value))return void(i=Cv(t));if(Pv(n))return void(i=(xv(e,n)+Mv(270))%Mv(360))}var o=Vv(e,t);r.push(o)})),{angle:i,stops:r,type:1}},Kv=function(e,t){var i=0,r=3,s=[],n=[];return pv(t).forEach((function(t,o){var a=!0;if(0===o?a=t.reduce((function(e,t){if(uv(t))switch(t.value){case"center":return n.push(yv),!1;case"top":case"left":return n.push(_v),!1;case"right":case"bottom":return n.push(bv),!1}else if(gv(t)||vv(t))return n.push(t),!1;return e}),a):1===o&&(a=t.reduce((function(e,t){if(uv(t))switch(t.value){case"circle":return i=0,!1;case"ellipse":return i=1,!1;case"contain":case"closest-side":return r=0,!1;case"farthest-side":return r=1,!1;case"closest-corner":return r=2,!1;case"cover":case"farthest-corner":return r=3,!1}else if(vv(t)||gv(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e}),a)),a){var l=Vv(e,t);s.push(l)}})),{size:r,shape:i,stops:s,position:n,type:2}},Xv=function(e,t){if(22===t.type){var i={url:t.value,type:0};return e.cache.addImage(t.value),i}if(18===t.type){var r=Jv[t.name];if(void 0===r)throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return r(e,t.values)}throw new Error("Unsupported image type "+t.type)};var Yv,Jv={"linear-gradient":function(e,t){var i=Mv(180),r=[];return pv(t).forEach((function(t,s){if(0===s){var n=t[0];if(20===n.type&&"to"===n.value)return void(i=Cv(t));if(Pv(n))return void(i=xv(e,n))}var o=Vv(e,t);r.push(o)})),{angle:i,stops:r,type:1}},"-moz-linear-gradient":Wv,"-ms-linear-gradient":Wv,"-o-linear-gradient":Wv,"-webkit-linear-gradient":Wv,"radial-gradient":function(e,t){var i=0,r=3,s=[],n=[];return pv(t).forEach((function(t,o){var a=!0;if(0===o){var l=!1;a=t.reduce((function(e,t){if(l)if(uv(t))switch(t.value){case"center":return n.push(yv),e;case"top":case"left":return n.push(_v),e;case"right":case"bottom":return n.push(bv),e}else(gv(t)||vv(t))&&n.push(t);else if(uv(t))switch(t.value){case"circle":return i=0,!1;case"ellipse":return i=1,!1;case"at":return l=!0,!1;case"closest-side":return r=0,!1;case"cover":case"farthest-side":return r=1,!1;case"contain":case"closest-corner":return r=2,!1;case"farthest-corner":return r=3,!1}else if(vv(t)||gv(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e}),a)}if(a){var u=Vv(e,t);s.push(u)}})),{size:r,shape:i,stops:s,position:n,type:2}},"-moz-radial-gradient":Kv,"-ms-radial-gradient":Kv,"-o-radial-gradient":Kv,"-webkit-radial-gradient":Kv,"-webkit-gradient":function(e,t){var i=Mv(180),r=[],s=1;return pv(t).forEach((function(t,i){var n=t[0];if(0===i){if(uv(n)&&"linear"===n.value)return void(s=1);if(uv(n)&&"radial"===n.value)return void(s=2)}if(18===n.type)if("from"===n.name){var o=Ev(e,n.values[0]);r.push({stop:_v,color:o})}else if("to"===n.name){o=Ev(e,n.values[0]);r.push({stop:bv,color:o})}else if("color-stop"===n.name){var a=n.values.filter(dv);if(2===a.length){o=Ev(e,a[1]);var l=a[0];lv(l)&&r.push({stop:{type:16,number:100*l.number,flags:l.flags},color:o})}}})),1===s?{angle:(i+Mv(180))%Mv(360),stops:r,type:s}:{size:3,shape:0,stops:r,position:[],type:s}}},Zv={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(0===t.length)return[];var i=t[0];return 20===i.type&&"none"===i.value?[]:t.filter((function(e){return dv(e)&&function(e){return!(20===e.type&&"none"===e.value||18===e.type&&!Jv[e.name])}(e)})).map((function(t){return Xv(e,t)}))}},qv={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(uv(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},$v={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return pv(t).map((function(e){return e.filter(gv)})).map(mv)}},eg={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return pv(t).map((function(e){return e.filter(uv).map((function(e){return e.value})).join(" ")})).map(tg)}},tg=function(e){switch(e){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}};!function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"}(Yv||(Yv={}));var ig,rg={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return pv(t).map((function(e){return e.filter(sg)}))}},sg=function(e){return uv(e)||gv(e)},ng=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},og=ng("top"),ag=ng("right"),lg=ng("bottom"),ug=ng("left"),Ag=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return mv(t.filter(gv))}}},cg=Ag("top-left"),hg=Ag("top-right"),dg=Ag("bottom-right"),pg=Ag("bottom-left"),fg=function(e){return{name:"border-"+e+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},vg=fg("top"),gg=fg("right"),mg=fg("bottom"),_g=fg("left"),yg=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return av(t)?t.number:0}}},bg=yg("top"),wg=yg("right"),Bg=yg("bottom"),xg=yg("left"),Pg={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Cg={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){return"rtl"===t?1:0}},Mg={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(uv).reduce((function(e,t){return e|Eg(t.value)}),0)}},Eg=function(e){switch(e){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},Fg={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},kg={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(e,t){return 20===t.type&&"normal"===t.value?0:17===t.type||15===t.type?t.number:0}};!function(e){e.NORMAL="normal",e.STRICT="strict"}(ig||(ig={}));var Ig,Dg={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"strict"===t?ig.STRICT:ig.NORMAL}},Sg={name:"line-height",initialValue:"normal",prefix:!1,type:4},Tg=function(e,t){return uv(e)&&"normal"===e.value?1.2*t:17===e.type?t*e.number:gv(e)?Bv(e,t):t},Lg={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return 20===t.type&&"none"===t.value?null:Xv(e,t)}},Rg={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(e,t){return"inside"===t?0:1}},Ug={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Og=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},Ng=Og("top"),Qg=Og("right"),Vg=Og("bottom"),Hg=Og("left"),jg={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(uv).map((function(e){switch(e.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}}))}},Gg={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"break-word"===t?"break-word":"normal"}},zg=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Wg=zg("top"),Kg=zg("right"),Xg=zg("bottom"),Yg=zg("left"),Jg={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(e,t){switch(t){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},Zg={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(e,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},qg={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return 1===t.length&&cv(t[0],"none")?[]:pv(t).map((function(t){for(var i={color:Ov.TRANSPARENT,offsetX:_v,offsetY:_v,blur:_v},r=0,s=0;s1?1:0],this.overflowWrap=Im(e,Gg,t.overflowWrap),this.paddingTop=Im(e,Wg,t.paddingTop),this.paddingRight=Im(e,Kg,t.paddingRight),this.paddingBottom=Im(e,Xg,t.paddingBottom),this.paddingLeft=Im(e,Yg,t.paddingLeft),this.paintOrder=Im(e,Pm,t.paintOrder),this.position=Im(e,Zg,t.position),this.textAlign=Im(e,Jg,t.textAlign),this.textDecorationColor=Im(e,Am,null!==(i=t.textDecorationColor)&&void 0!==i?i:t.color),this.textDecorationLine=Im(e,cm,null!==(r=t.textDecorationLine)&&void 0!==r?r:t.textDecoration),this.textShadow=Im(e,qg,t.textShadow),this.textTransform=Im(e,$g,t.textTransform),this.transform=Im(e,em,t.transform),this.transformOrigin=Im(e,sm,t.transformOrigin),this.visibility=Im(e,nm,t.visibility),this.webkitTextStrokeColor=Im(e,Cm,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Im(e,Mm,t.webkitTextStrokeWidth),this.wordBreak=Im(e,om,t.wordBreak),this.zIndex=Im(e,am,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&0===this.visibility},e.prototype.isTransparent=function(){return Fv(this.backgroundColor)},e.prototype.isTransformed=function(){return null!==this.transform},e.prototype.isPositioned=function(){return 0!==this.position},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return 0!==this.float},e.prototype.isInlineLevel=function(){return gm(this.display,4)||gm(this.display,33554432)||gm(this.display,268435456)||gm(this.display,536870912)||gm(this.display,67108864)||gm(this.display,134217728)},e}(),Fm=function(e,t){this.content=Im(e,mm,t.content),this.quotes=Im(e,wm,t.quotes)},km=function(e,t){this.counterIncrement=Im(e,_m,t.counterIncrement),this.counterReset=Im(e,ym,t.counterReset)},Im=function(e,t,i){var r=new nv,s=null!=i?i.toString():t.initialValue;r.write(s);var n=new ov(r.read());switch(t.type){case 2:var o=n.parseComponentValue();return t.parse(e,uv(o)?o.value:t.initialValue);case 0:return t.parse(e,n.parseComponentValue());case 1:return t.parse(e,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(t.format){case"angle":return xv(e,n.parseComponentValue());case"color":return Ev(e,n.parseComponentValue());case"image":return Xv(e,n.parseComponentValue());case"length":var a=n.parseComponentValue();return vv(a)?a:_v;case"length-percentage":var l=n.parseComponentValue();return gv(l)?l:_v;case"time":return lm(e,n.parseComponentValue())}}},Dm=function(e,t){var i=function(e){switch(e.getAttribute("data-html2canvas-debug")){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}}(e);return 1===i||t===i},Sm=function(e,t){this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Dm(t,3),this.styles=new Em(e,window.getComputedStyle(t,null)),S_(t)&&(this.styles.animationDuration.some((function(e){return e>0}))&&(t.style.animationDuration="0s"),null!==this.styles.transform&&(t.style.transform="none")),this.bounds=Fp(this.context,t),Dm(t,4)&&(this.flags|=16)},Tm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lm="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Rm=0;Rm=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>5])<<2)+(31&e),this.data[t];if(e<=65535)return t=((t=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[t];if(e>11),t=this.index[t],t+=e>>5&63,t=((t=this.index[t])<<2)+(31&e),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Nm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qm="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Vm=0;Vm>10),o%1024+56320)),(s+1===i||r.length>16384)&&(n+=String.fromCharCode.apply(String,r),r.length=0)}return n},Xm=function(e,t){var i,r,s,n=function(e){var t,i,r,s,n,o=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var u="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(o):new Array(o),A=Array.isArray(u)?u:new Uint8Array(u);for(t=0;t>4,A[l++]=(15&r)<<4|s>>2,A[l++]=(3&s)<<6|63&n;return u}(e),o=Array.isArray(n)?function(e){for(var t=e.length,i=[],r=0;r=55296&&s<=56319&&i=i)return{done:!0,value:null};for(var e="×";ro.x||s.y>o.y;return o=s,0===t||a}));return e.body.removeChild(t),a}(document);return Object.defineProperty(t_,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=function(e){var t=new Image,i=e.createElement("canvas"),r=i.getContext("2d");if(!r)return!1;t.src="data:image/svg+xml,";try{r.drawImage(t,0,0),i.toDataURL()}catch(e){return!1}return!0}(document);return Object.defineProperty(t_,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e="function"==typeof Array.from&&"function"==typeof window.fetch?function(e){var t=e.createElement("canvas"),i=100;t.width=i,t.height=i;var r=t.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,i,i);var s=new Image,n=t.toDataURL();s.src=n;var o=$m(i,i,0,0,s);return r.fillStyle="red",r.fillRect(0,0,i,i),e_(o).then((function(t){r.drawImage(t,0,0);var s=r.getImageData(0,0,i,i).data;r.fillStyle="red",r.fillRect(0,0,i,i);var o=e.createElement("div");return o.style.backgroundImage="url("+n+")",o.style.height="100px",qm(s)?e_($m(i,i,0,0,o)):Promise.reject(!1)})).then((function(e){return r.drawImage(e,0,0),qm(r.getImageData(0,0,i,i).data)})).catch((function(){return!1}))}(document):Promise.resolve(!1);return Object.defineProperty(t_,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=void 0!==(new Image).crossOrigin;return Object.defineProperty(t_,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e="string"==typeof(new XMLHttpRequest).responseType;return Object.defineProperty(t_,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(t_,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!("undefined"==typeof Intl||!Intl.Segmenter);return Object.defineProperty(t_,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},i_=function(e,t){this.text=e,this.bounds=t},r_=function(e,t){var i=t.ownerDocument;if(i){var r=i.createElement("html2canvaswrapper");r.appendChild(t.cloneNode(!0));var s=t.parentNode;if(s){s.replaceChild(r,t);var n=Fp(e,r);return r.firstChild&&s.replaceChild(r.firstChild,r),n}}return Ep.EMPTY},s_=function(e,t,i){var r=e.ownerDocument;if(!r)throw new Error("Node has no owner document");var s=r.createRange();return s.setStart(e,t),s.setEnd(e,t+i),s},n_=function(e){if(t_.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(e)).map((function(e){return e.segment}))}return function(e){for(var t,i=Zm(e),r=[];!(t=i.next()).done;)t.value&&r.push(t.value.slice());return r}(e)},o_=function(e,t){return 0!==t.letterSpacing?n_(e):function(e,t){if(t_.SUPPORT_NATIVE_TEXT_SEGMENTATION){var i=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(i.segment(e)).map((function(e){return e.segment}))}return l_(e,t)}(e,t)},a_=[32,160,4961,65792,65793,4153,4241],l_=function(e,t){for(var i,r=function(e,t){var i=kp(e),r=Cf(i,t),s=r[0],n=r[1],o=r[2],a=i.length,l=0,u=0;return{next:function(){if(u>=a)return{done:!0,value:null};for(var e="×";u0)if(t_.SUPPORT_RANGE_BOUNDS){var s=s_(r,o,t.length).getClientRects();if(s.length>1){var a=n_(t),l=0;a.forEach((function(t){n.push(new i_(t,Ep.fromDOMRectList(e,s_(r,l+o,t.length).getClientRects()))),l+=t.length}))}else n.push(new i_(t,Ep.fromDOMRectList(e,s)))}else{var u=r.splitText(t.length);n.push(new i_(t,r_(e,r))),r=u}else t_.SUPPORT_RANGE_BOUNDS||(r=r.splitText(t.length));o+=t.length})),n}(e,this.text,i,t)},A_=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(c_,h_);case 2:return e.toUpperCase();default:return e}},c_=/(^|\s|:|-|\(|\))([a-z])/g,h_=function(e,t,i){return e.length>0?t+i.toUpperCase():e},d_=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.src=i.currentSrc||i.src,r.intrinsicWidth=i.naturalWidth,r.intrinsicHeight=i.naturalHeight,r.context.cache.addImage(r.src),r}return Bp(t,e),t}(Sm),p_=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.canvas=i,r.intrinsicWidth=i.width,r.intrinsicHeight=i.height,r}return Bp(t,e),t}(Sm),f_=function(e){function t(t,i){var r=e.call(this,t,i)||this,s=new XMLSerializer,n=Fp(t,i);return i.setAttribute("width",n.width+"px"),i.setAttribute("height",n.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(s.serializeToString(i)),r.intrinsicWidth=i.width.baseVal.value,r.intrinsicHeight=i.height.baseVal.value,r.context.cache.addImage(r.svg),r}return Bp(t,e),t}(Sm),v_=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.value=i.value,r}return Bp(t,e),t}(Sm),g_=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.start=i.start,r.reversed="boolean"==typeof i.reversed&&!0===i.reversed,r}return Bp(t,e),t}(Sm),m_=[{type:15,flags:0,unit:"px",number:3}],__=[{type:16,flags:0,number:50}],y_="password",b_=function(e){function t(t,i){var r,s=e.call(this,t,i)||this;switch(s.type=i.type.toLowerCase(),s.checked=i.checked,s.value=function(e){var t=e.type===y_?new Array(e.value.length+1).join("•"):e.value;return 0===t.length?e.placeholder||"":t}(i),"checkbox"!==s.type&&"radio"!==s.type||(s.styles.backgroundColor=3739148031,s.styles.borderTopColor=s.styles.borderRightColor=s.styles.borderBottomColor=s.styles.borderLeftColor=2779096575,s.styles.borderTopWidth=s.styles.borderRightWidth=s.styles.borderBottomWidth=s.styles.borderLeftWidth=1,s.styles.borderTopStyle=s.styles.borderRightStyle=s.styles.borderBottomStyle=s.styles.borderLeftStyle=1,s.styles.backgroundClip=[0],s.styles.backgroundOrigin=[0],s.bounds=(r=s.bounds).width>r.height?new Ep(r.left+(r.width-r.height)/2,r.top,r.height,r.height):r.width0)r.textNodes.push(new u_(t,n,r.styles));else if(D_(n))if(K_(n)&&n.assignedNodes)n.assignedNodes().forEach((function(i){return e(t,i,r,s)}));else{var a=M_(t,n);a.styles.isVisible()&&(F_(n,a,s)?a.flags|=4:k_(a.styles)&&(a.flags|=2),-1!==P_.indexOf(n.tagName)&&(a.flags|=8),r.elements.push(a),n.slot,n.shadowRoot?e(t,n.shadowRoot,a,s):z_(n)||O_(n)||W_(n)||e(t,n,a,s))}},M_=function(e,t){return H_(t)?new d_(e,t):Q_(t)?new p_(e,t):O_(t)?new f_(e,t):L_(t)?new v_(e,t):R_(t)?new g_(e,t):U_(t)?new b_(e,t):W_(t)?new w_(e,t):z_(t)?new B_(e,t):j_(t)?new x_(e,t):new Sm(e,t)},E_=function(e,t){var i=M_(e,t);return i.flags|=4,C_(e,t,i,i),i},F_=function(e,t,i){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||N_(e)&&i.styles.isTransparent()},k_=function(e){return e.isPositioned()||e.isFloating()},I_=function(e){return e.nodeType===Node.TEXT_NODE},D_=function(e){return e.nodeType===Node.ELEMENT_NODE},S_=function(e){return D_(e)&&void 0!==e.style&&!T_(e)},T_=function(e){return"object"===B(e.className)},L_=function(e){return"LI"===e.tagName},R_=function(e){return"OL"===e.tagName},U_=function(e){return"INPUT"===e.tagName},O_=function(e){return"svg"===e.tagName},N_=function(e){return"BODY"===e.tagName},Q_=function(e){return"CANVAS"===e.tagName},V_=function(e){return"VIDEO"===e.tagName},H_=function(e){return"IMG"===e.tagName},j_=function(e){return"IFRAME"===e.tagName},G_=function(e){return"STYLE"===e.tagName},z_=function(e){return"TEXTAREA"===e.tagName},W_=function(e){return"SELECT"===e.tagName},K_=function(e){return"SLOT"===e.tagName},X_=function(e){return e.tagName.indexOf("-")>0},Y_=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},e.prototype.pop=function(e){var t=this;e.forEach((function(e){return t.counters[e].pop()}))},e.prototype.parse=function(e){var t=this,i=e.counterIncrement,r=e.counterReset,s=!0;null!==i&&i.forEach((function(e){var i=t.counters[e.counter];i&&0!==e.increment&&(s=!1,i.length||i.push(1),i[Math.max(0,i.length-1)]+=e.increment)}));var n=[];return s&&r.forEach((function(e){var i=t.counters[e.counter];n.push(e.counter),i||(i=t.counters[e.counter]=[]),i.push(e.reset)})),n},e}(),J_={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Z_={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},q_={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},$_={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},ey=function(e,t,i,r,s,n){return ei?ny(e,s,n.length>0):r.integers.reduce((function(t,i,s){for(;e>=i;)e-=i,t+=r.values[s];return t}),"")+n},ty=function(e,t,i,r){var s="";do{i||e--,s=r(e)+s,e/=t}while(e*t>=t);return s},iy=function(e,t,i,r,s){var n=i-t+1;return(e<0?"-":"")+(ty(Math.abs(e),n,r,(function(e){return Ip(Math.floor(e%n)+t)}))+s)},ry=function(e,t,i){void 0===i&&(i=". ");var r=t.length;return ty(Math.abs(e),r,!1,(function(e){return t[Math.floor(e%r)]}))+i},sy=function(e,t,i,r,s,n){if(e<-9999||e>9999)return ny(e,4,s.length>0);var o=Math.abs(e),a=s;if(0===o)return t[0]+a;for(var l=0;o>0&&l<=4;l++){var u=o%10;0===u&&gm(n,1)&&""!==a?a=t[u]+a:u>1||1===u&&0===l||1===u&&1===l&&gm(n,2)||1===u&&1===l&&gm(n,4)&&e>100||1===u&&l>1&&gm(n,8)?a=t[u]+(l>0?i[l-1]:"")+a:1===u&&l>0&&(a=i[l-1]+a),o=Math.floor(o/10)}return(e<0?r:"")+a},ny=function(e,t,i){var r=i?". ":"",s=i?"、":"",n=i?", ":"",o=i?" ":"";switch(t){case 0:return"•"+o;case 1:return"◦"+o;case 2:return"◾"+o;case 5:var a=iy(e,48,57,!0,r);return a.length<4?"0"+a:a;case 4:return ry(e,"〇一二三四五六七八九",s);case 6:return ey(e,1,3999,J_,3,r).toLowerCase();case 7:return ey(e,1,3999,J_,3,r);case 8:return iy(e,945,969,!1,r);case 9:return iy(e,97,122,!1,r);case 10:return iy(e,65,90,!1,r);case 11:return iy(e,1632,1641,!0,r);case 12:case 49:return ey(e,1,9999,Z_,3,r);case 35:return ey(e,1,9999,Z_,3,r).toLowerCase();case 13:return iy(e,2534,2543,!0,r);case 14:case 30:return iy(e,6112,6121,!0,r);case 15:return ry(e,"子丑寅卯辰巳午未申酉戌亥",s);case 16:return ry(e,"甲乙丙丁戊己庚辛壬癸",s);case 17:case 48:return sy(e,"零一二三四五六七八九","十百千萬","負",s,14);case 47:return sy(e,"零壹貳參肆伍陸柒捌玖","拾佰仟萬","負",s,15);case 42:return sy(e,"零一二三四五六七八九","十百千萬","负",s,14);case 41:return sy(e,"零壹贰叁肆伍陆柒捌玖","拾佰仟萬","负",s,15);case 26:return sy(e,"〇一二三四五六七八九","十百千万","マイナス",s,0);case 25:return sy(e,"零壱弐参四伍六七八九","拾百千万","マイナス",s,7);case 31:return sy(e,"영일이삼사오육칠팔구","십백천만","마이너스",n,7);case 33:return sy(e,"零一二三四五六七八九","十百千萬","마이너스",n,0);case 32:return sy(e,"零壹貳參四五六七八九","拾百千","마이너스",n,7);case 18:return iy(e,2406,2415,!0,r);case 20:return ey(e,1,19999,$_,3,r);case 21:return iy(e,2790,2799,!0,r);case 22:return iy(e,2662,2671,!0,r);case 22:return ey(e,1,10999,q_,3,r);case 23:return ry(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return ry(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return iy(e,3302,3311,!0,r);case 28:return ry(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",s);case 29:return ry(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",s);case 34:return iy(e,3792,3801,!0,r);case 37:return iy(e,6160,6169,!0,r);case 38:return iy(e,4160,4169,!0,r);case 39:return iy(e,2918,2927,!0,r);case 40:return iy(e,1776,1785,!0,r);case 43:return iy(e,3046,3055,!0,r);case 44:return iy(e,3174,3183,!0,r);case 45:return iy(e,3664,3673,!0,r);case 46:return iy(e,3872,3881,!0,r);default:return iy(e,48,57,!0,r)}},oy=function(){function e(e,t,i){if(this.context=e,this.options=i,this.scrolledElements=[],this.referenceElement=t,this.counters=new Y_,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var i=this,r=ly(e,t);if(!r.contentWindow)return Promise.reject("Unable to find iframe window");var s=e.defaultView.pageXOffset,n=e.defaultView.pageYOffset,o=r.contentWindow,a=o.document,l=cy(r).then((function(){return Pp(i,void 0,void 0,(function(){var e,i;return Cp(this,(function(s){switch(s.label){case 0:return this.scrolledElements.forEach(vy),o&&(o.scrollTo(t.left,t.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||o.scrollY===t.top&&o.scrollX===t.left||(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),e=this.options.onclone,void 0===(i=this.clonedReferenceElement)?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:a.fonts&&a.fonts.ready?[4,a.fonts.ready]:[3,2];case 1:s.sent(),s.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,Ay(a)]:[3,4];case 3:s.sent(),s.label=4;case 4:return"function"==typeof e?[2,Promise.resolve().then((function(){return e(a,i)})).then((function(){return r}))]:[2,r]}}))}))}));return a.open(),a.write(py(document.doctype)+""),fy(this.referenceElement.ownerDocument,s,n),a.replaceChild(a.adoptNode(this.documentElement),a.documentElement),a.close(),l},e.prototype.createElementClone=function(e){if(Dm(e,2),Q_(e))return this.createCanvasClone(e);if(V_(e))return this.createVideoClone(e);if(G_(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return H_(t)&&(H_(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),"lazy"===t.loading&&(t.loading="eager")),X_(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return dy(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var i=[].slice.call(t.cssRules,0).reduce((function(e,t){return t&&"string"==typeof t.cssText?e+t.cssText:e}),""),r=e.cloneNode(!1);return r.textContent=i,r}}catch(e){if(this.context.logger.error("Unable to access cssRules property",e),"SecurityError"!==e.name)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var i=e.ownerDocument.createElement("img");try{return i.src=e.toDataURL(),i}catch(t){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var s=e.getContext("2d"),n=r.getContext("2d");if(n)if(!this.options.allowTaint&&s)n.putImageData(s.getImageData(0,0,e.width,e.height),0,0);else{var o=null!==(t=e.getContext("webgl2"))&&void 0!==t?t:e.getContext("webgl");if(o){var a=o.getContextAttributes();!1===(null==a?void 0:a.preserveDrawingBuffer)&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}n.drawImage(e,0,0)}return r}catch(t){this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var i=t.getContext("2d");try{return i&&(i.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||i.getImageData(0,0,t.width,t.height)),t}catch(t){this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},e.prototype.appendChildNode=function(e,t,i){D_(t)&&(function(e){return"SCRIPT"===e.tagName}(t)||t.hasAttribute("data-html2canvas-ignore")||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(t))||this.options.copyStyles&&D_(t)&&G_(t)||e.appendChild(this.cloneNode(t,i))},e.prototype.cloneChildNodes=function(e,t,i){for(var r=this,s=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;s;s=s.nextSibling)if(D_(s)&&K_(s)&&"function"==typeof s.assignedNodes){var n=s.assignedNodes();n.length&&n.forEach((function(e){return r.appendChildNode(t,e,i)}))}else this.appendChildNode(t,s,i)},e.prototype.cloneNode=function(e,t){if(I_(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var i=e.ownerDocument.defaultView;if(i&&D_(e)&&(S_(e)||T_(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var s=i.getComputedStyle(e),n=i.getComputedStyle(e,":before"),o=i.getComputedStyle(e,":after");this.referenceElement===e&&S_(r)&&(this.clonedReferenceElement=r),N_(r)&&_y(r);var a=this.counters.parse(new km(this.context,s)),l=this.resolvePseudoContent(e,r,n,Hm.BEFORE);X_(e)&&(t=!0),V_(e)||this.cloneChildNodes(e,r,t),l&&r.insertBefore(l,r.firstChild);var u=this.resolvePseudoContent(e,r,o,Hm.AFTER);return u&&r.appendChild(u),this.counters.pop(a),(s&&(this.options.copyStyles||T_(e))&&!j_(e)||t)&&dy(s,r),0===e.scrollTop&&0===e.scrollLeft||this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(z_(e)||W_(e))&&(z_(r)||W_(r))&&(r.value=e.value),r}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,i,r){var s=this;if(i){var n=i.content,o=t.ownerDocument;if(o&&n&&"none"!==n&&"-moz-alt-content"!==n&&"none"!==i.display){this.counters.parse(new km(this.context,i));var a=new Fm(this.context,i),l=o.createElement("html2canvaspseudoelement");dy(i,l),a.content.forEach((function(t){if(0===t.type)l.appendChild(o.createTextNode(t.value));else if(22===t.type){var i=o.createElement("img");i.src=t.value,i.style.opacity="1",l.appendChild(i)}else if(18===t.type){if("attr"===t.name){var r=t.values.filter(uv);r.length&&l.appendChild(o.createTextNode(e.getAttribute(r[0].value)||""))}else if("counter"===t.name){var n=t.values.filter(dv),u=n[0],A=n[1];if(u&&uv(u)){var c=s.counters.getCounterValue(u.value),h=A&&uv(A)?Ug.parse(s.context,A.value):3;l.appendChild(o.createTextNode(ny(c,h,!1)))}}else if("counters"===t.name){var d=t.values.filter(dv),p=(u=d[0],d[1]);A=d[2];if(u&&uv(u)){var f=s.counters.getCounterValues(u.value),v=A&&uv(A)?Ug.parse(s.context,A.value):3,g=p&&0===p.type?p.value:"",m=f.map((function(e){return ny(e,v,!1)})).join(g);l.appendChild(o.createTextNode(m))}}}else if(20===t.type)switch(t.value){case"open-quote":l.appendChild(o.createTextNode(Bm(a.quotes,s.quoteDepth++,!0)));break;case"close-quote":l.appendChild(o.createTextNode(Bm(a.quotes,--s.quoteDepth,!1)));break;default:l.appendChild(o.createTextNode(t.value))}})),l.className=gy+" "+my;var u=r===Hm.BEFORE?" "+gy:" "+my;return T_(t)?t.className.baseValue+=u:t.className+=u,l}}},e.destroy=function(e){return!!e.parentNode&&(e.parentNode.removeChild(e),!0)},e}();!function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"}(Hm||(Hm={}));var ay,ly=function(e,t){var i=e.createElement("iframe");return i.className="html2canvas-container",i.style.visibility="hidden",i.style.position="fixed",i.style.left="-10000px",i.style.top="0px",i.style.border="0",i.width=t.width.toString(),i.height=t.height.toString(),i.scrolling="no",i.setAttribute("data-html2canvas-ignore","true"),e.body.appendChild(i),i},uy=function(e){return new Promise((function(t){e.complete?t():e.src?(e.onload=t,e.onerror=t):t()}))},Ay=function(e){return Promise.all([].slice.call(e.images,0).map(uy))},cy=function(e){return new Promise((function(t,i){var r=e.contentWindow;if(!r)return i("No window assigned for iframe");var s=r.document;r.onload=e.onload=function(){r.onload=e.onload=null;var i=setInterval((function(){s.body.childNodes.length>0&&"complete"===s.readyState&&(clearInterval(i),t(e))}),50)}}))},hy=["all","d","content"],dy=function(e,t){for(var i=e.length-1;i>=0;i--){var r=e.item(i);-1===hy.indexOf(r)&&t.style.setProperty(r,e.getPropertyValue(r))}return t},py=function(e){var t="";return e&&(t+=""),t},fy=function(e,t,i){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||i!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,i)},vy=function(e){var t=e[0],i=e[1],r=e[2];t.scrollLeft=i,t.scrollTop=r},gy="___html2canvas___pseudoelement_before",my="___html2canvas___pseudoelement_after",_y=function(e){yy(e,"."+gy+':before{\n content: "" !important;\n display: none !important;\n}\n .'+my+':after{\n content: "" !important;\n display: none !important;\n}')},yy=function(e,t){var i=e.ownerDocument;if(i){var r=i.createElement("style");r.textContent=t,e.appendChild(r)}},by=function(){function e(){}return e.getOrigin=function(t){var i=e._link;return i?(i.href=t,i.href=i.href,i.protocol+i.hostname+i.port):"about:blank"},e.isSameOrigin=function(t){return e.getOrigin(t)===e._origin},e.setContext=function(t){e._link=t.document.createElement("a"),e._origin=e.getOrigin(t.location.href)},e._origin="about:blank",e}(),wy=function(){function e(e,t){this.context=e,this._options=t,this._cache={}}return e.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)?t:Fy(e)||Cy(e)?((this._cache[e]=this.loadImage(e)).catch((function(){})),t):t},e.prototype.match=function(e){return this._cache[e]},e.prototype.loadImage=function(e){return Pp(this,void 0,void 0,(function(){var t,i,r,s,n=this;return Cp(this,(function(o){switch(o.label){case 0:return t=by.isSameOrigin(e),i=!My(e)&&!0===this._options.useCORS&&t_.SUPPORT_CORS_IMAGES&&!t,r=!My(e)&&!t&&!Fy(e)&&"string"==typeof this._options.proxy&&t_.SUPPORT_CORS_XHR&&!i,t||!1!==this._options.allowTaint||My(e)||Fy(e)||r||i?(s=e,r?[4,this.proxy(s)]:[3,2]):[2];case 1:s=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise((function(e,t){var r=new Image;r.onload=function(){return e(r)},r.onerror=t,(Ey(s)||i)&&(r.crossOrigin="anonymous"),r.src=s,!0===r.complete&&setTimeout((function(){return e(r)}),500),n._options.imageTimeout>0&&setTimeout((function(){return t("Timed out ("+n._options.imageTimeout+"ms) loading image")}),n._options.imageTimeout)}))];case 3:return[2,o.sent()]}}))}))},e.prototype.has=function(e){return void 0!==this._cache[e]},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(e){var t=this,i=this._options.proxy;if(!i)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise((function(s,n){var o=t_.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(200===a.status)if("text"===o)s(a.response);else{var e=new FileReader;e.addEventListener("load",(function(){return s(e.result)}),!1),e.addEventListener("error",(function(e){return n(e)}),!1),e.readAsDataURL(a.response)}else n("Failed to proxy resource "+r+" with status code "+a.status)},a.onerror=n;var l=i.indexOf("?")>-1?"&":"?";if(a.open("GET",""+i+l+"url="+encodeURIComponent(e)+"&responseType="+o),"text"!==o&&a instanceof XMLHttpRequest&&(a.responseType=o),t._options.imageTimeout){var u=t._options.imageTimeout;a.timeout=u,a.ontimeout=function(){return n("Timed out ("+u+"ms) proxying "+r)}}a.send()}))},e}(),By=/^data:image\/svg\+xml/i,xy=/^data:image\/.*;base64,/i,Py=/^data:image\/.*/i,Cy=function(e){return t_.SUPPORT_SVG_DRAWING||!ky(e)},My=function(e){return Py.test(e)},Ey=function(e){return xy.test(e)},Fy=function(e){return"blob"===e.substr(0,4)},ky=function(e){return"svg"===e.substr(-3).toLowerCase()||By.test(e)},Iy=function(){function e(e,t){this.type=0,this.x=e,this.y=t}return e.prototype.add=function(t,i){return new e(this.x+t,this.y+i)},e}(),Dy=function(e,t,i){return new Iy(e.x+(t.x-e.x)*i,e.y+(t.y-e.y)*i)},Sy=function(){function e(e,t,i,r){this.type=1,this.start=e,this.startControl=t,this.endControl=i,this.end=r}return e.prototype.subdivide=function(t,i){var r=Dy(this.start,this.startControl,t),s=Dy(this.startControl,this.endControl,t),n=Dy(this.endControl,this.end,t),o=Dy(r,s,t),a=Dy(s,n,t),l=Dy(o,a,t);return i?new e(this.start,r,o,l):new e(l,a,n,this.end)},e.prototype.add=function(t,i){return new e(this.start.add(t,i),this.startControl.add(t,i),this.endControl.add(t,i),this.end.add(t,i))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),Ty=function(e){return 1===e.type},Ly=function(e){var t=e.styles,i=e.bounds,r=wv(t.borderTopLeftRadius,i.width,i.height),s=r[0],n=r[1],o=wv(t.borderTopRightRadius,i.width,i.height),a=o[0],l=o[1],u=wv(t.borderBottomRightRadius,i.width,i.height),A=u[0],c=u[1],h=wv(t.borderBottomLeftRadius,i.width,i.height),d=h[0],p=h[1],f=[];f.push((s+a)/i.width),f.push((d+A)/i.width),f.push((n+p)/i.height),f.push((l+c)/i.height);var v=Math.max.apply(Math,f);v>1&&(s/=v,n/=v,a/=v,l/=v,A/=v,c/=v,d/=v,p/=v);var g=i.width-a,m=i.height-c,_=i.width-A,y=i.height-p,b=t.borderTopWidth,w=t.borderRightWidth,B=t.borderBottomWidth,x=t.borderLeftWidth,P=Bv(t.paddingTop,e.bounds.width),C=Bv(t.paddingRight,e.bounds.width),M=Bv(t.paddingBottom,e.bounds.width),E=Bv(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||n>0?Ry(i.left+x/3,i.top+b/3,s-x/3,n-b/3,ay.TOP_LEFT):new Iy(i.left+x/3,i.top+b/3),this.topRightBorderDoubleOuterBox=s>0||n>0?Ry(i.left+g,i.top+b/3,a-w/3,l-b/3,ay.TOP_RIGHT):new Iy(i.left+i.width-w/3,i.top+b/3),this.bottomRightBorderDoubleOuterBox=A>0||c>0?Ry(i.left+_,i.top+m,A-w/3,c-B/3,ay.BOTTOM_RIGHT):new Iy(i.left+i.width-w/3,i.top+i.height-B/3),this.bottomLeftBorderDoubleOuterBox=d>0||p>0?Ry(i.left+x/3,i.top+y,d-x/3,p-B/3,ay.BOTTOM_LEFT):new Iy(i.left+x/3,i.top+i.height-B/3),this.topLeftBorderDoubleInnerBox=s>0||n>0?Ry(i.left+2*x/3,i.top+2*b/3,s-2*x/3,n-2*b/3,ay.TOP_LEFT):new Iy(i.left+2*x/3,i.top+2*b/3),this.topRightBorderDoubleInnerBox=s>0||n>0?Ry(i.left+g,i.top+2*b/3,a-2*w/3,l-2*b/3,ay.TOP_RIGHT):new Iy(i.left+i.width-2*w/3,i.top+2*b/3),this.bottomRightBorderDoubleInnerBox=A>0||c>0?Ry(i.left+_,i.top+m,A-2*w/3,c-2*B/3,ay.BOTTOM_RIGHT):new Iy(i.left+i.width-2*w/3,i.top+i.height-2*B/3),this.bottomLeftBorderDoubleInnerBox=d>0||p>0?Ry(i.left+2*x/3,i.top+y,d-2*x/3,p-2*B/3,ay.BOTTOM_LEFT):new Iy(i.left+2*x/3,i.top+i.height-2*B/3),this.topLeftBorderStroke=s>0||n>0?Ry(i.left+x/2,i.top+b/2,s-x/2,n-b/2,ay.TOP_LEFT):new Iy(i.left+x/2,i.top+b/2),this.topRightBorderStroke=s>0||n>0?Ry(i.left+g,i.top+b/2,a-w/2,l-b/2,ay.TOP_RIGHT):new Iy(i.left+i.width-w/2,i.top+b/2),this.bottomRightBorderStroke=A>0||c>0?Ry(i.left+_,i.top+m,A-w/2,c-B/2,ay.BOTTOM_RIGHT):new Iy(i.left+i.width-w/2,i.top+i.height-B/2),this.bottomLeftBorderStroke=d>0||p>0?Ry(i.left+x/2,i.top+y,d-x/2,p-B/2,ay.BOTTOM_LEFT):new Iy(i.left+x/2,i.top+i.height-B/2),this.topLeftBorderBox=s>0||n>0?Ry(i.left,i.top,s,n,ay.TOP_LEFT):new Iy(i.left,i.top),this.topRightBorderBox=a>0||l>0?Ry(i.left+g,i.top,a,l,ay.TOP_RIGHT):new Iy(i.left+i.width,i.top),this.bottomRightBorderBox=A>0||c>0?Ry(i.left+_,i.top+m,A,c,ay.BOTTOM_RIGHT):new Iy(i.left+i.width,i.top+i.height),this.bottomLeftBorderBox=d>0||p>0?Ry(i.left,i.top+y,d,p,ay.BOTTOM_LEFT):new Iy(i.left,i.top+i.height),this.topLeftPaddingBox=s>0||n>0?Ry(i.left+x,i.top+b,Math.max(0,s-x),Math.max(0,n-b),ay.TOP_LEFT):new Iy(i.left+x,i.top+b),this.topRightPaddingBox=a>0||l>0?Ry(i.left+Math.min(g,i.width-w),i.top+b,g>i.width+w?0:Math.max(0,a-w),Math.max(0,l-b),ay.TOP_RIGHT):new Iy(i.left+i.width-w,i.top+b),this.bottomRightPaddingBox=A>0||c>0?Ry(i.left+Math.min(_,i.width-x),i.top+Math.min(m,i.height-B),Math.max(0,A-w),Math.max(0,c-B),ay.BOTTOM_RIGHT):new Iy(i.left+i.width-w,i.top+i.height-B),this.bottomLeftPaddingBox=d>0||p>0?Ry(i.left+x,i.top+Math.min(y,i.height-B),Math.max(0,d-x),Math.max(0,p-B),ay.BOTTOM_LEFT):new Iy(i.left+x,i.top+i.height-B),this.topLeftContentBox=s>0||n>0?Ry(i.left+x+E,i.top+b+P,Math.max(0,s-(x+E)),Math.max(0,n-(b+P)),ay.TOP_LEFT):new Iy(i.left+x+E,i.top+b+P),this.topRightContentBox=a>0||l>0?Ry(i.left+Math.min(g,i.width+x+E),i.top+b+P,g>i.width+x+E?0:a-x+E,l-(b+P),ay.TOP_RIGHT):new Iy(i.left+i.width-(w+C),i.top+b+P),this.bottomRightContentBox=A>0||c>0?Ry(i.left+Math.min(_,i.width-(x+E)),i.top+Math.min(m,i.height+b+P),Math.max(0,A-(w+C)),c-(B+M),ay.BOTTOM_RIGHT):new Iy(i.left+i.width-(w+C),i.top+i.height-(B+M)),this.bottomLeftContentBox=d>0||p>0?Ry(i.left+x+E,i.top+y,Math.max(0,d-(x+E)),p-(B+M),ay.BOTTOM_LEFT):new Iy(i.left+x+E,i.top+i.height-(B+M))};!function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"}(ay||(ay={}));var Ry=function(e,t,i,r,s){var n=(Math.sqrt(2)-1)/3*4,o=i*n,a=r*n,l=e+i,u=t+r;switch(s){case ay.TOP_LEFT:return new Sy(new Iy(e,u),new Iy(e,u-a),new Iy(l-o,t),new Iy(l,t));case ay.TOP_RIGHT:return new Sy(new Iy(e,t),new Iy(e+o,t),new Iy(l,u-a),new Iy(l,u));case ay.BOTTOM_RIGHT:return new Sy(new Iy(l,t),new Iy(l,t+a),new Iy(e+o,u),new Iy(e,u));case ay.BOTTOM_LEFT:default:return new Sy(new Iy(l,u),new Iy(l-o,u),new Iy(e,t+a),new Iy(e,t))}},Uy=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Oy=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Ny=function(e,t,i){this.offsetX=e,this.offsetY=t,this.matrix=i,this.type=0,this.target=6},Qy=function(e,t){this.path=e,this.target=t,this.type=1},Vy=function(e){this.opacity=e,this.type=2,this.target=6},Hy=function(e){return 1===e.type},jy=function(e,t){return e.length===t.length&&e.some((function(e,i){return e===t[i]}))},Gy=function(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]},zy=function(){function e(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new Ly(this.container),this.container.styles.opacity<1&&this.effects.push(new Vy(this.container.styles.opacity)),null!==this.container.styles.transform){var i=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new Ny(i,r,s))}if(0!==this.container.styles.overflowX){var n=Uy(this.curves),o=Oy(this.curves);jy(n,o)?this.effects.push(new Qy(n,6)):(this.effects.push(new Qy(n,2)),this.effects.push(new Qy(o,4)))}}return e.prototype.getEffects=function(e){for(var t=-1===[2,3].indexOf(this.container.styles.position),i=this.parent,r=this.effects.slice(0);i;){var s=i.effects.filter((function(e){return!Hy(e)}));if(t||0!==i.container.styles.position||!i.parent){if(r.unshift.apply(r,s),t=-1===[2,3].indexOf(i.container.styles.position),0!==i.container.styles.overflowX){var n=Uy(i.curves),o=Oy(i.curves);jy(n,o)||r.unshift(new Qy(o,6))}}else r.unshift.apply(r,s);i=i.parent}return r.filter((function(t){return gm(t.target,e)}))},e}(),Wy=function e(t,i,r,s){t.container.elements.forEach((function(n){var o=gm(n.flags,4),a=gm(n.flags,2),l=new zy(n,t);gm(n.styles.display,2048)&&s.push(l);var u=gm(n.flags,8)?[]:s;if(o||a){var A=o||n.styles.isPositioned()?r:i,c=new Gy(l);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var h=n.styles.zIndex.order;if(h<0){var d=0;A.negativeZIndex.some((function(e,t){return h>e.element.container.styles.zIndex.order?(d=t,!1):d>0})),A.negativeZIndex.splice(d,0,c)}else if(h>0){var p=0;A.positiveZIndex.some((function(e,t){return h>=e.element.container.styles.zIndex.order?(p=t+1,!1):p>0})),A.positiveZIndex.splice(p,0,c)}else A.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else n.styles.isFloating()?A.nonPositionedFloats.push(c):A.nonPositionedInlineLevel.push(c);e(l,c,o?c:r,u)}else n.styles.isInlineLevel()?i.inlineLevel.push(l):i.nonInlineLevel.push(l),e(l,i,r,u);gm(n.flags,8)&&Ky(n,u)}))},Ky=function(e,t){for(var i=e instanceof g_?e.start:1,r=e instanceof g_&&e.reversed,s=0;s0&&e.intrinsicHeight>0){var r=$y(e),s=Oy(t);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,e.intrinsicWidth,e.intrinsicHeight,r.left,r.top,r.width,r.height),this.ctx.restore()}},t.prototype.renderNodeContent=function(e){return Pp(this,void 0,void 0,(function(){var i,r,s,n,o,a,l,u,A,c,h,d,p,f,v,g,m,_;return Cp(this,(function(y){switch(y.label){case 0:this.applyEffects(e.getEffects(4)),i=e.container,r=e.curves,s=i.styles,n=0,o=i.textNodes,y.label=1;case 1:return n0&&B>0&&(g=r.ctx.createPattern(p,"repeat"),r.renderRepeat(_,g,P,C))):function(e){return 2===e.type}(i)&&(m=eb(e,t,[null,null,null]),_=m[0],y=m[1],b=m[2],w=m[3],B=m[4],x=0===i.position.length?[yv]:i.position,P=Bv(x[0],w),C=Bv(x[x.length-1],B),M=function(e,t,i,r,s){var n=0,o=0;switch(e.size){case 0:0===e.shape?n=o=Math.min(Math.abs(t),Math.abs(t-r),Math.abs(i),Math.abs(i-s)):1===e.shape&&(n=Math.min(Math.abs(t),Math.abs(t-r)),o=Math.min(Math.abs(i),Math.abs(i-s)));break;case 2:if(0===e.shape)n=o=Math.min(Gv(t,i),Gv(t,i-s),Gv(t-r,i),Gv(t-r,i-s));else if(1===e.shape){var a=Math.min(Math.abs(i),Math.abs(i-s))/Math.min(Math.abs(t),Math.abs(t-r)),l=zv(r,s,t,i,!0),u=l[0],A=l[1];o=a*(n=Gv(u-t,(A-i)/a))}break;case 1:0===e.shape?n=o=Math.max(Math.abs(t),Math.abs(t-r),Math.abs(i),Math.abs(i-s)):1===e.shape&&(n=Math.max(Math.abs(t),Math.abs(t-r)),o=Math.max(Math.abs(i),Math.abs(i-s)));break;case 3:if(0===e.shape)n=o=Math.max(Gv(t,i),Gv(t,i-s),Gv(t-r,i),Gv(t-r,i-s));else if(1===e.shape){a=Math.max(Math.abs(i),Math.abs(i-s))/Math.max(Math.abs(t),Math.abs(t-r));var c=zv(r,s,t,i,!1);u=c[0],A=c[1],o=a*(n=Gv(u-t,(A-i)/a))}}return Array.isArray(e.size)&&(n=Bv(e.size[0],r),o=2===e.size.length?Bv(e.size[1],s):n),[n,o]}(i,P,C,w,B),E=M[0],F=M[1],E>0&&F>0&&(k=r.ctx.createRadialGradient(y+P,b+C,0,y+P,b+C,E),Hv(i.stops,2*E).forEach((function(e){return k.addColorStop(e.stop,kv(e.color))})),r.path(_),r.ctx.fillStyle=k,E!==F?(I=e.bounds.left+.5*e.bounds.width,D=e.bounds.top+.5*e.bounds.height,T=1/(S=F/E),r.ctx.save(),r.ctx.translate(I,D),r.ctx.transform(1,0,0,S,0,0),r.ctx.translate(-I,-D),r.ctx.fillRect(y,T*(b-D)+D,w,B*T),r.ctx.restore()):r.ctx.fill())),L.label=6;case 6:return t--,[2]}}))},r=this,s=0,n=e.styles.backgroundImage.slice(0).reverse(),a.label=1;case 1:return s0?2!==l.style?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,n,e.curves,2)]:[3,11]:[3,13];case 4:return A.sent(),[3,11];case 5:return 3!==l.style?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,n,e.curves,3)];case 6:return A.sent(),[3,11];case 7:return 4!==l.style?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,n,e.curves)];case 8:return A.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,n,e.curves)];case 10:A.sent(),A.label=11;case 11:n++,A.label=12;case 12:return o++,[3,3];case 13:return[2]}}))}))},t.prototype.renderDashedDottedBorder=function(e,t,i,r,s){return Pp(this,void 0,void 0,(function(){var n,o,a,l,u,A,c,h,d,p,f,v,g,m,_,y;return Cp(this,(function(b){return this.ctx.save(),n=function(e,t){switch(t){case 0:return Jy(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return Jy(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return Jy(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);default:return Jy(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}}(r,i),o=Yy(r,i),2===s&&(this.path(o),this.ctx.clip()),Ty(o[0])?(a=o[0].start.x,l=o[0].start.y):(a=o[0].x,l=o[0].y),Ty(o[1])?(u=o[1].end.x,A=o[1].end.y):(u=o[1].x,A=o[1].y),c=0===i||2===i?Math.abs(a-u):Math.abs(l-A),this.ctx.beginPath(),3===s?this.formatPath(n):this.formatPath(o.slice(0,2)),h=t<3?3*t:2*t,d=t<3?2*t:t,3===s&&(h=t,d=t),p=!0,c<=2*h?p=!1:c<=2*h+d?(h*=f=c/(2*h+d),d*=f):(v=Math.floor((c+d)/(h+d)),g=(c-v*h)/(v-1),d=(m=(c-(v+1)*h)/v)<=0||Math.abs(d-g)0&&void 0!==arguments[0]?arguments[0]:{},t=!this._snapshotBegun,i=void 0!==e.width&&void 0!==e.height,r=this.scene.canvas.canvas,s=r.clientWidth,n=r.clientHeight,o=e.width?Math.floor(e.width):r.width,a=e.height?Math.floor(e.height):r.height;i&&(r.width=o,r.height=a),this._snapshotBegun||this.beginSnapshot({width:o,height:a}),e.includeGizmos||this.sendToPlugins("snapshotStarting");for(var l={},u=0,A=this._plugins.length;u0&&void 0!==b[0]?b[0]:{},i=!this._snapshotBegun,r=void 0!==t.width&&void 0!==t.height,s=this.scene.canvas.canvas,n=s.clientWidth,o=s.clientHeight,l=t.width?Math.floor(t.width):s.width,u=t.height?Math.floor(t.height):s.height,r&&(s.width=l,s.height=u),this._snapshotBegun||this.beginSnapshot(),t.includeGizmos||this.sendToPlugins("snapshotStarting"),this.scene._renderer.renderSnapshot(),A=this.scene._renderer.readSnapshotAsCanvas(),r&&(s.width=n,s.height=o,this.scene.glRedraw()),c={},h=[],d=0,p=this._plugins.length;d1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0,r=i||new Set;if(e){if(Nb(e))r.add(e);else if(Nb(e.buffer))r.add(e.buffer);else if(ArrayBuffer.isView(e));else if(t&&"object"===B(e))for(var s in e)Ob(e[s],t,r)}else;return void 0===i?Array.from(r):[]}function Nb(e){return!!e&&(e instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&e instanceof MessagePort||("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)))}var Qb=function(){},Vb=function(){function e(t){x(this,e),Db(this,"name",void 0),Db(this,"source",void 0),Db(this,"url",void 0),Db(this,"terminated",!1),Db(this,"worker",void 0),Db(this,"onMessage",void 0),Db(this,"onError",void 0),Db(this,"_loadableURL","");var i=t.name,r=t.source,s=t.url;Pb(r||s),this.name=i,this.source=r,this.url=s,this.onMessage=Qb,this.onError=function(e){return console.log(e)},this.worker=Eb?this._createBrowserWorker():this._createNodeWorker()}return C(e,[{key:"destroy",value:function(){this.onMessage=Qb,this.onError=Qb,this.worker.terminate(),this.terminated=!0}},{key:"isRunning",get:function(){return Boolean(this.onMessage)}},{key:"postMessage",value:function(e,t){t=t||Ob(e),this.worker.postMessage(e,t)}},{key:"_getErrorFromErrorEvent",value:function(e){var t="Failed to load ";return t+="worker ".concat(this.name," from ").concat(this.url,". "),e.message&&(t+="".concat(e.message," in ")),e.lineno&&(t+=":".concat(e.lineno,":").concat(e.colno)),new Error(t)}},{key:"_createBrowserWorker",value:function(){var e=this;this._loadableURL=Rb({source:this.source,url:this.url});var t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=function(t){t.data?e.onMessage(t.data):e.onError(new Error("No data received"))},t.onerror=function(t){e.onError(e._getErrorFromErrorEvent(t)),e.terminated=!0},t.onmessageerror=function(e){return console.error(e)},t}},{key:"_createNodeWorker",value:function(){var e,t=this;if(this.url){var i=this.url.includes(":/")||this.url.startsWith("/")?this.url:"./".concat(this.url);e=new Tb(i,{eval:!1})}else{if(!this.source)throw new Error("no worker");e=new Tb(this.source,{eval:!0})}return e.on("message",(function(e){t.onMessage(e)})),e.on("error",(function(e){t.onError(e)})),e.on("exit",(function(e){})),e}}],[{key:"isSupported",value:function(){return"undefined"!=typeof Worker&&Eb||void 0!==B(Tb)}}]),e}(),Hb=function(){function e(t){x(this,e),Db(this,"name","unnamed"),Db(this,"source",void 0),Db(this,"url",void 0),Db(this,"maxConcurrency",1),Db(this,"maxMobileConcurrency",1),Db(this,"onDebug",(function(){})),Db(this,"reuseWorkers",!0),Db(this,"props",{}),Db(this,"jobQueue",[]),Db(this,"idleQueue",[]),Db(this,"count",0),Db(this,"isDestroyed",!1),this.source=t.source,this.url=t.url,this.setProps(t)}var t,i;return C(e,[{key:"destroy",value:function(){this.idleQueue.forEach((function(e){return e.destroy()})),this.isDestroyed=!0}},{key:"setProps",value:function(e){this.props=n(n({},this.props),e),void 0!==e.name&&(this.name=e.name),void 0!==e.maxConcurrency&&(this.maxConcurrency=e.maxConcurrency),void 0!==e.maxMobileConcurrency&&(this.maxMobileConcurrency=e.maxMobileConcurrency),void 0!==e.reuseWorkers&&(this.reuseWorkers=e.reuseWorkers),void 0!==e.onDebug&&(this.onDebug=e.onDebug)}},{key:"startJob",value:(i=u(a().mark((function e(t){var i,r,s,n=this,o=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=o.length>1&&void 0!==o[1]?o[1]:function(e,t,i){return e.done(i)},r=o.length>2&&void 0!==o[2]?o[2]:function(e,t){return e.error(t)},s=new Promise((function(e){return n.jobQueue.push({name:t,onMessage:i,onError:r,onStart:e}),n})),this._startQueuedJob(),e.next=6,s;case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_startQueuedJob",value:(t=u(a().mark((function e(){var t,i,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.jobQueue.length){e.next=2;break}return e.abrupt("return");case 2:if(t=this._getAvailableWorker()){e.next=5;break}return e.abrupt("return");case 5:if(!(i=this.jobQueue.shift())){e.next=18;break}return this.onDebug({message:"Starting job",name:i.name,workerThread:t,backlog:this.jobQueue.length}),r=new Sb(i.name,t),t.onMessage=function(e){return i.onMessage(r,e.type,e.payload)},t.onError=function(e){return i.onError(r,e)},i.onStart(r),e.prev=12,e.next=15,r.result;case 15:return e.prev=15,this.returnWorkerToQueue(t),e.finish(15);case 18:case"end":return e.stop()}}),e,this,[[12,,15,18]])}))),function(){return t.apply(this,arguments)})},{key:"returnWorkerToQueue",value:function(e){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}},{key:"_getAvailableWorker",value:function(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count0&&void 0!==arguments[0]?arguments[0]:{};return e._workerFarm=e._workerFarm||new e({}),e._workerFarm.setProps(t),e._workerFarm}}]),e}();Db(Gb,"_workerFarm",void 0);function zb(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t[e.id]||{},r="".concat(e.id,"-worker.js"),s=i.workerUrl;if(s||"compression"!==e.id||(s=t.workerUrl),"test"===t._workerType&&(s="modules/".concat(e.module,"/dist/").concat(r)),!s){var n=e.version;"latest"===n&&(n="latest");var o=n?"@".concat(n):"";s="https://unpkg.com/@loaders.gl/".concat(e.module).concat(o,"/dist/").concat(r)}return Pb(s),s}function Wb(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"3.2.6";Pb(e,"no worker provided");var i=e.version;return!(!t||!i)}var Kb=Object.freeze({__proto__:null,default:{}}),Xb={};function Yb(e){return Jb.apply(this,arguments)}function Jb(){return Jb=u(a().mark((function e(t){var i,r,s=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=s.length>1&&void 0!==s[1]?s[1]:null,r=s.length>2&&void 0!==s[2]?s[2]:{},i&&(t=Zb(t,i,r)),Xb[t]=Xb[t]||qb(t),e.next=6,Xb[t];case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)}))),Jb.apply(this,arguments)}function Zb(e,t,i){if(e.startsWith("http"))return e;var r=i.modules||{};return r[e]?r[e]:Eb?i.CDN?(Pb(i.CDN.startsWith("http")),"".concat(i.CDN,"/").concat(t,"@").concat("3.2.6","/dist/libs/").concat(e)):Fb?"../src/libs/".concat(e):"modules/".concat(t,"/src/libs/").concat(e):"modules/".concat(t,"/dist/libs/").concat(e)}function qb(e){return $b.apply(this,arguments)}function $b(){return($b=u(a().mark((function e(t){var i,r,s;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.endsWith("wasm")){e.next=7;break}return e.next=3,fetch(t);case 3:return i=e.sent,e.next=6,i.arrayBuffer();case 6:return e.abrupt("return",e.sent);case 7:if(Eb){e.next=20;break}if(e.prev=8,e.t0=Kb&&void 0,!e.t0){e.next=14;break}return e.next=13,(void 0)(t);case 13:e.t0=e.sent;case 14:return e.abrupt("return",e.t0);case 17:return e.prev=17,e.t1=e.catch(8),e.abrupt("return",null);case 20:if(!Fb){e.next=22;break}return e.abrupt("return",importScripts(t));case 22:return e.next=24,fetch(t);case 24:return r=e.sent,e.next=27,r.text();case 27:return s=e.sent,e.abrupt("return",ew(s,t));case 29:case"end":return e.stop()}}),e,null,[[8,17]])})))).apply(this,arguments)}function ew(e,t){if(Eb){if(Fb)return eval.call(Mb,e),null;var i=document.createElement("script");i.id=t;try{i.appendChild(document.createTextNode(e))}catch(t){i.text=e}return document.body.appendChild(i),null}}function tw(e,t){return!!Gb.isSupported()&&(!!(Eb||null!=t&&t._nodeWorkers)&&(e.worker&&(null==t?void 0:t.worker)))}function iw(e,t,i,r,s){return rw.apply(this,arguments)}function rw(){return rw=u(a().mark((function e(t,i,r,s,n){var o,l,u,A,c,h;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.id,l=zb(t,r),u=Gb.getWorkerFarm(r),A=u.getWorkerPool({name:o,url:l}),r=JSON.parse(JSON.stringify(r)),s=JSON.parse(JSON.stringify(s||{})),e.next=8,A.startJob("process-on-worker",sw.bind(null,n));case 8:return(c=e.sent).postMessage("process",{input:i,options:r,context:s}),e.next=12,c.result;case 12:return h=e.sent,e.next=15,h.result;case 15:return e.abrupt("return",e.sent);case 16:case"end":return e.stop()}}),e)}))),rw.apply(this,arguments)}function sw(e,t,i,r){return nw.apply(this,arguments)}function nw(){return(nw=u(a().mark((function e(t,i,r,s){var n,o,l,u,A;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=r,e.next="done"===e.t0?3:"error"===e.t0?5:"process"===e.t0?7:20;break;case 3:return i.done(s),e.abrupt("break",21);case 5:return i.error(new Error(s.error)),e.abrupt("break",21);case 7:return n=s.id,o=s.input,l=s.options,e.prev=8,e.next=11,t(o,l);case 11:u=e.sent,i.postMessage("done",{id:n,result:u}),e.next=19;break;case 15:e.prev=15,e.t1=e.catch(8),A=e.t1 instanceof Error?e.t1.message:"unknown error",i.postMessage("error",{id:n,error:A});case 19:return e.abrupt("break",21);case 20:console.warn("parse-with-worker unknown message ".concat(r));case 21:case"end":return e.stop()}}),e,null,[[8,15]])})))).apply(this,arguments)}function ow(e,t,i){if(e.byteLength<=t+i)return"";for(var r=new DataView(e),s="",n=0;n1&&void 0!==arguments[1]?arguments[1]:5;if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return ow(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return ow(e,0,t)}return""}(e),'"'))}}function lw(e){return e&&"object"===B(e)&&e.isBuffer}function uw(e){if(lw(e))return lw(t=e)?new Uint8Array(t.buffer,t.byteOffset,t.length).slice().buffer:t;var t;if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return 0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if("string"==typeof e){var i=e;return(new TextEncoder).encode(i).buffer}if(e&&"object"===B(e)&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}function Aw(){for(var e=arguments.length,t=new Array(e),i=0;i=0),wb(t>0),e+(t-1)&~(t-1)}function dw(e,t,i){var r;if(e instanceof ArrayBuffer)r=new Uint8Array(e);else{var s=e.byteOffset,n=e.byteLength;r=new Uint8Array(e.buffer||e.arrayBuffer,s,n)}return t.set(r,i),i+hw(r.byteLength,4)}function pw(e){return fw.apply(this,arguments)}function fw(){return(fw=u(a().mark((function e(t){var i,r,s,n,o,l,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=[],r=!1,s=!1,e.prev=3,o=I(t);case 5:return e.next=7,o.next();case 7:if(!(r=!(l=e.sent).done)){e.next=13;break}u=l.value,i.push(u);case 10:r=!1,e.next=5;break;case 13:e.next=19;break;case 15:e.prev=15,e.t0=e.catch(3),s=!0,n=e.t0;case 19:if(e.prev=19,e.prev=20,!r||null==o.return){e.next=24;break}return e.next=24,o.return();case 24:if(e.prev=24,!s){e.next=27;break}throw n;case 27:return e.finish(24);case 28:return e.finish(19);case 29:return e.abrupt("return",Aw.apply(void 0,i));case 30:case"end":return e.stop()}}),e,null,[[3,15,19,29],[20,,24,28]])})))).apply(this,arguments)}var vw={};function gw(e){for(var t in vw)if(e.startsWith(t)){var i=vw[t];e=e.replace(t,i)}return e.startsWith("http://")||e.startsWith("https://")||(e="".concat("").concat(e)),e}var mw=function(e){return"function"==typeof e},_w=function(e){return null!==e&&"object"===B(e)},yw=function(e){return _w(e)&&e.constructor==={}.constructor},bw=function(e){return e&&"function"==typeof e[Symbol.iterator]},ww=function(e){return e&&"function"==typeof e[Symbol.asyncIterator]},Bw=function(e){return"undefined"!=typeof Response&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json},xw=function(e){return"undefined"!=typeof Blob&&e instanceof Blob},Pw=function(e){return function(e){return"undefined"!=typeof ReadableStream&&e instanceof ReadableStream||_w(e)&&mw(e.tee)&&mw(e.cancel)&&mw(e.getReader)}(e)||function(e){return _w(e)&&mw(e.read)&&mw(e.pipe)&&function(e){return"boolean"==typeof e}(e.readable)}(e)},Cw=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Mw=/^([-\w.]+\/[-\w.+]+)/;function Ew(e){var t=Mw.exec(e);return t?t[1]:e}function Fw(e){var t=Cw.exec(e);return t?t[1]:""}var kw=/\?.*/;function Iw(e){if(Bw(e)){var t=Sw(e.url||"");return{url:t,type:Ew(e.headers.get("content-type")||"")||Fw(t)}}return xw(e)?{url:Sw(e.name||""),type:e.type||""}:"string"==typeof e?{url:Sw(e),type:Fw(e)}:{url:"",type:""}}function Dw(e){return Bw(e)?e.headers["content-length"]||-1:xw(e)?e.size:"string"==typeof e?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}function Sw(e){return e.replace(kw,"")}function Tw(e){return Lw.apply(this,arguments)}function Lw(){return(Lw=u(a().mark((function e(t){var i,r,s,n,o,l,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Bw(t)){e.next=2;break}return e.abrupt("return",t);case 2:return i={},(r=Dw(t))>=0&&(i["content-length"]=String(r)),s=Iw(t),n=s.url,(o=s.type)&&(i["content-type"]=o),e.next=9,Qw(t);case 9:return(l=e.sent)&&(i["x-first-bytes"]=l),"string"==typeof t&&(t=(new TextEncoder).encode(t)),u=new Response(t,{headers:i}),Object.defineProperty(u,"url",{value:n}),e.abrupt("return",u);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Rw(e){return Uw.apply(this,arguments)}function Uw(){return(Uw=u(a().mark((function e(t){var i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.ok){e.next=5;break}return e.next=3,Ow(t);case 3:throw i=e.sent,new Error(i);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ow(e){return Nw.apply(this,arguments)}function Nw(){return(Nw=u(a().mark((function e(t){var i,r,s;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i="Failed to fetch resource ".concat(t.url," (").concat(t.status,"): "),e.prev=1,r=t.headers.get("Content-Type"),s=t.statusText,!r.includes("application/json")){e.next=11;break}return e.t0=s,e.t1=" ",e.next=9,t.text();case 9:e.t2=e.sent,s=e.t0+=e.t1.concat.call(e.t1,e.t2);case 11:i=(i+=s).length>60?"".concat(i.slice(0,60),"..."):i,e.next=17;break;case 15:e.prev=15,e.t3=e.catch(1);case 17:return e.abrupt("return",i);case 18:case"end":return e.stop()}}),e,null,[[1,15]])})))).apply(this,arguments)}function Qw(e){return Vw.apply(this,arguments)}function Vw(){return(Vw=u(a().mark((function e(t){var i,r,s,n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=5,"string"!=typeof t){e.next=3;break}return e.abrupt("return","data:,".concat(t.slice(0,i)));case 3:if(!(t instanceof Blob)){e.next=8;break}return r=t.slice(0,5),e.next=7,new Promise((function(e){var t=new FileReader;t.onload=function(t){var i;return e(null==t||null===(i=t.target)||void 0===i?void 0:i.result)},t.readAsDataURL(r)}));case 7:return e.abrupt("return",e.sent);case 8:if(!(t instanceof ArrayBuffer)){e.next=12;break}return s=t.slice(0,i),n=Hw(s),e.abrupt("return","data:base64,".concat(n));case 12:return e.abrupt("return",null);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Hw(e){for(var t="",i=new Uint8Array(e),r=0;r=0)}();function Jw(e){try{var t=window[e],i="__storage_test__";return t.setItem(i,i),t.removeItem(i),t}catch(e){return null}}var Zw=function(){function e(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";x(this,e),this.storage=Jw(r),this.id=t,this.config={},Object.assign(this.config,i),this._loadConfiguration()}return C(e,[{key:"getConfiguration",value:function(){return this.config}},{key:"setConfiguration",value:function(e){return this.config={},this.updateConfiguration(e)}},{key:"updateConfiguration",value:function(e){if(Object.assign(this.config,e),this.storage){var t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}return this}},{key:"_loadConfiguration",value:function(){var e={};if(this.storage){var t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}]),e}();function qw(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600,s=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>r&&(i=Math.min(i,r/e.width));var n=e.width*i,o=e.height*i,a=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(n/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(s,");"),"background-size:".concat(n,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}var $w={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function eB(e){return"string"==typeof e?$w[e.toUpperCase()]||$w.WHITE:e}function tB(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),s=Object.getOwnPropertyNames(r),n=A(s);try{var o=function(){var r=t.value;"function"==typeof e[r]&&(i.find((function(e){return r===e}))||(e[r]=e[r].bind(e)))};for(n.s();!(t=n.n()).done;)o()}catch(e){n.e(e)}finally{n.f()}}function iB(e,t){if(!e)throw new Error(t||"Assertion failed")}function rB(){var e;if(Yw&&Ww.performance)e=Ww.performance.now();else if(Kw.hrtime){var t=Kw.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}var sB={debug:Yw&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},nB={enabled:!0,level:0};function oB(){}var aB={},lB={once:!0};function uB(e){for(var t in e)for(var i in e[t])return i||"untitled";return"empty"}var AB=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""},i=t.id;x(this,e),this.id=i,this.VERSION=Xw,this._startTs=rB(),this._deltaTs=rB(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new Zw("__probe-".concat(this.id,"__"),nB),this.userData={},this.timeStamp("".concat(this.id," started")),tB(this),Object.seal(this)}return C(e,[{key:"level",get:function(){return this.getLevel()},set:function(e){this.setLevel(e)}},{key:"isEnabled",value:function(){return this._storage.config.enabled}},{key:"getLevel",value:function(){return this._storage.config.level}},{key:"getTotal",value:function(){return Number((rB()-this._startTs).toPrecision(10))}},{key:"getDelta",value:function(){return Number((rB()-this._deltaTs).toPrecision(10))}},{key:"priority",get:function(){return this.level},set:function(e){this.level=e}},{key:"getPriority",value:function(){return this.level}},{key:"enable",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:e}),this}},{key:"setLevel",value:function(e){return this._storage.updateConfiguration({level:e}),this}},{key:"assert",value:function(e,t){iB(e,t)}},{key:"warn",value:function(e){return this._getLogFunction(0,e,sB.warn,arguments,lB)}},{key:"error",value:function(e){return this._getLogFunction(0,e,sB.error,arguments)}},{key:"deprecated",value:function(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}},{key:"removed",value:function(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}},{key:"probe",value:function(e,t){return this._getLogFunction(e,t,sB.log,arguments,{time:!0,once:!0})}},{key:"log",value:function(e,t){return this._getLogFunction(e,t,sB.debug,arguments)}},{key:"info",value:function(e,t){return this._getLogFunction(e,t,console.info,arguments)}},{key:"once",value:function(e,t){return this._getLogFunction(e,t,sB.debug||sB.info,arguments,lB)}},{key:"table",value:function(e,t,i){return t?this._getLogFunction(e,t,console.table||oB,i&&[i],{tag:uB(t)}):oB}},{key:"image",value:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){var t=e.logLevel,i=e.priority,r=e.image,s=e.message,n=void 0===s?"":s,o=e.scale,a=void 0===o?1:o;return this._shouldLog(t||i)?Yw?function(e){var t=e.image,i=e.message,r=void 0===i?"":i,s=e.scale,n=void 0===s?1:s;if("string"==typeof t){var o=new Image;return o.onload=function(){var e,t=qw(o,r,n);(e=console).log.apply(e,h(t))},o.src=t,oB}var a=t.nodeName||"";if("img"===a.toLowerCase()){var l;return(l=console).log.apply(l,h(qw(t,r,n))),oB}if("canvas"===a.toLowerCase()){var u=new Image;return u.onload=function(){var e;return(e=console).log.apply(e,h(qw(u,r,n)))},u.src=t.toDataURL(),oB}return oB}({image:r,message:n,scale:a}):function(e){var t=e.image,i=(e.message,e.scale),r=void 0===i?1:i,s=null;try{s=module.require("asciify-image")}catch(e){}if(s)return function(){return s(t,{fit:"box",width:"".concat(Math.round(80*r),"%")}).then((function(e){return console.log(e)}))};return oB}({image:r,message:n,scale:a}):oB}))},{key:"settings",value:function(){console.table?console.table(this._storage.config):console.log(this._storage.config)}},{key:"get",value:function(e){return this._storage.config[e]}},{key:"set",value:function(e,t){this._storage.updateConfiguration(o({},e,t))}},{key:"time",value:function(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}},{key:"timeEnd",value:function(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}},{key:"timeStamp",value:function(e,t){return this._getLogFunction(e,t,console.timeStamp||oB)}},{key:"group",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1},r=i=hB({logLevel:e,message:t,opts:i}),s=r.collapsed;return i.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}},{key:"groupCollapsed",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(e,t,Object.assign({},i,{collapsed:!0}))}},{key:"groupEnd",value:function(e){return this._getLogFunction(e,"",console.groupEnd||oB)}},{key:"withGroup",value:function(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}},{key:"trace",value:function(){console.trace&&console.trace()}},{key:"_shouldLog",value:function(e){return this.isEnabled()&&this.getLevel()>=cB(e)}},{key:"_getLogFunction",value:function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=arguments.length>4?arguments[4]:void 0;if(this._shouldLog(e)){var n;s=hB({logLevel:e,message:t,args:r,opts:s}),iB(i=i||s.method),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=rB();var o=s.tag||s.message;if(s.once){if(aB[o])return oB;aB[o]=rB()}return t=dB(this.id,s.message,s),(n=i).bind.apply(n,[console,t].concat(h(s.args)))}return oB}}]),e}();function cB(e){if(!e)return 0;var t;switch(B(e)){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return iB(Number.isFinite(t)&&t>=0),t}function hB(e){var t=e.logLevel,i=e.message;e.logLevel=cB(t);for(var r=e.args?Array.from(e.args):[];r.length&&r.shift()!==i;);switch(e.args=r,B(t)){case"string":case"function":void 0!==i&&r.unshift(i),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());var s=B(e.message);return iB("string"===s||"object"===s),Object.assign(e,e.opts)}function dB(e,t,i){if("string"==typeof t){var r=i.time?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,i=Math.max(t-e.length,0);return"".concat(" ".repeat(i)).concat(e)}((s=i.total)<10?"".concat(s.toFixed(2),"ms"):s<100?"".concat(s.toFixed(1),"ms"):s<1e3?"".concat(s.toFixed(0),"ms"):"".concat((s/1e3).toFixed(2),"s")):"";t=function(e,t,i){return Yw||"string"!=typeof e||(t&&(t=eB(t),e="[".concat(t,"m").concat(e,"")),i&&(t=eB(i),e="[".concat(i+10,"m").concat(e,""))),e}(t=i.time?"".concat(e,": ").concat(r," ").concat(t):"".concat(e,": ").concat(t),i.color,i.background)}var s;return t}AB.VERSION=Xw;var pB=new AB({id:"loaders.gl"}),fB=function(){function e(){x(this,e)}return C(e,[{key:"log",value:function(){return function(){}}},{key:"info",value:function(){return function(){}}},{key:"warn",value:function(){return function(){}}},{key:"error",value:function(){return function(){}}}]),e}(),vB={fetch:null,mimeType:void 0,nothrow:!1,log:new(function(){function e(){x(this,e),Db(this,"console",void 0),this.console=console}return C(e,[{key:"log",value:function(){for(var e,t=arguments.length,i=new Array(t),r=0;r=0)}()}var FB={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"===("undefined"==typeof process?"undefined":B(process))&&process},kB=FB.window||FB.self||FB.global,IB=FB.process||{},DB="undefined"!=typeof __VERSION__?__VERSION__:"untranspiled source";function SB(e){try{var t=window[e],i="__storage_test__";return t.setItem(i,i),t.removeItem(i),t}catch(e){return null}}EB();var TB,LB=function(){function e(t){x(this,e);var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";Db(this,"storage",void 0),Db(this,"id",void 0),Db(this,"config",{}),this.storage=SB(r),this.id=t,this.config={},Object.assign(this.config,i),this._loadConfiguration()}return C(e,[{key:"getConfiguration",value:function(){return this.config}},{key:"setConfiguration",value:function(e){return this.config={},this.updateConfiguration(e)}},{key:"updateConfiguration",value:function(e){if(Object.assign(this.config,e),this.storage){var t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}return this}},{key:"_loadConfiguration",value:function(){var e={};if(this.storage){var t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}]),e}();function RB(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600,s=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>r&&(i=Math.min(i,r/e.width));var n=e.width*i,o=e.height*i,a=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(n/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(s,");"),"background-size:".concat(n,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}function UB(e){return"string"==typeof e?TB[e.toUpperCase()]||TB.WHITE:e}function OB(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),s=Object.getOwnPropertyNames(r),n=A(s);try{var o=function(){var r=t.value;"function"==typeof e[r]&&(i.find((function(e){return r===e}))||(e[r]=e[r].bind(e)))};for(n.s();!(t=n.n()).done;)o()}catch(e){n.e(e)}finally{n.f()}}function NB(e,t){if(!e)throw new Error(t||"Assertion failed")}function QB(){var e,t,i;if(EB&&"performance"in kB)e=null==kB||null===(t=kB.performance)||void 0===t||null===(i=t.now)||void 0===i?void 0:i.call(t);else if("hrtime"in IB){var r,s=null==IB||null===(r=IB.hrtime)||void 0===r?void 0:r.call(IB);e=1e3*s[0]+s[1]/1e6}else e=Date.now();return e}!function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(TB||(TB={}));var VB={debug:EB&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},HB={enabled:!0,level:0};function jB(){}var GB={},zB={once:!0},WB=function(){function e(){x(this,e);var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""},i=t.id;Db(this,"id",void 0),Db(this,"VERSION",DB),Db(this,"_startTs",QB()),Db(this,"_deltaTs",QB()),Db(this,"_storage",void 0),Db(this,"userData",{}),Db(this,"LOG_THROTTLE_TIMEOUT",0),this.id=i,this._storage=new LB("__probe-".concat(this.id,"__"),HB),this.userData={},this.timeStamp("".concat(this.id," started")),OB(this),Object.seal(this)}return C(e,[{key:"level",get:function(){return this.getLevel()},set:function(e){this.setLevel(e)}},{key:"isEnabled",value:function(){return this._storage.config.enabled}},{key:"getLevel",value:function(){return this._storage.config.level}},{key:"getTotal",value:function(){return Number((QB()-this._startTs).toPrecision(10))}},{key:"getDelta",value:function(){return Number((QB()-this._deltaTs).toPrecision(10))}},{key:"priority",get:function(){return this.level},set:function(e){this.level=e}},{key:"getPriority",value:function(){return this.level}},{key:"enable",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:e}),this}},{key:"setLevel",value:function(e){return this._storage.updateConfiguration({level:e}),this}},{key:"get",value:function(e){return this._storage.config[e]}},{key:"set",value:function(e,t){this._storage.updateConfiguration(o({},e,t))}},{key:"settings",value:function(){console.table?console.table(this._storage.config):console.log(this._storage.config)}},{key:"assert",value:function(e,t){NB(e,t)}},{key:"warn",value:function(e){return this._getLogFunction(0,e,VB.warn,arguments,zB)}},{key:"error",value:function(e){return this._getLogFunction(0,e,VB.error,arguments)}},{key:"deprecated",value:function(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}},{key:"removed",value:function(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}},{key:"probe",value:function(e,t){return this._getLogFunction(e,t,VB.log,arguments,{time:!0,once:!0})}},{key:"log",value:function(e,t){return this._getLogFunction(e,t,VB.debug,arguments)}},{key:"info",value:function(e,t){return this._getLogFunction(e,t,console.info,arguments)}},{key:"once",value:function(e,t){for(var i=arguments.length,r=new Array(i>2?i-2:0),s=2;s2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1},r=XB({logLevel:e,message:t,opts:i}),s=i.collapsed;return r.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}},{key:"groupCollapsed",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(e,t,Object.assign({},i,{collapsed:!0}))}},{key:"groupEnd",value:function(e){return this._getLogFunction(e,"",console.groupEnd||jB)}},{key:"withGroup",value:function(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}},{key:"trace",value:function(){console.trace&&console.trace()}},{key:"_shouldLog",value:function(e){return this.isEnabled()&&this.getLevel()>=KB(e)}},{key:"_getLogFunction",value:function(e,t,i,r,s){if(this._shouldLog(e)){var n;s=XB({logLevel:e,message:t,args:r,opts:s}),NB(i=i||s.method),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=QB();var o=s.tag||s.message;if(s.once){if(GB[o])return jB;GB[o]=QB()}return t=function(e,t,i){if("string"==typeof t){var r=i.time?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,i=Math.max(t-e.length,0);return"".concat(" ".repeat(i)).concat(e)}((s=i.total)<10?"".concat(s.toFixed(2),"ms"):s<100?"".concat(s.toFixed(1),"ms"):s<1e3?"".concat(s.toFixed(0),"ms"):"".concat((s/1e3).toFixed(2),"s")):"";t=function(e,t,i){return EB||"string"!=typeof e||(t&&(t=UB(t),e="[".concat(t,"m").concat(e,"")),i&&(t=UB(i),e="[".concat(i+10,"m").concat(e,""))),e}(t=i.time?"".concat(e,": ").concat(r," ").concat(t):"".concat(e,": ").concat(t),i.color,i.background)}var s;return t}(this.id,s.message,s),(n=i).bind.apply(n,[console,t].concat(h(s.args)))}return jB}}]),e}();function KB(e){if(!e)return 0;var t;switch(B(e)){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return NB(Number.isFinite(t)&&t>=0),t}function XB(e){var t=e.logLevel,i=e.message;e.logLevel=KB(t);for(var r=e.args?Array.from(e.args):[];r.length&&r.shift()!==i;);switch(B(t)){case"string":case"function":void 0!==i&&r.unshift(i),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());var s=B(e.message);return NB("string"===s||"object"===s),Object.assign(e,{args:r},e.opts)}function YB(e){for(var t in e)for(var i in e[t])return i||"untitled";return"empty"}Db(WB,"VERSION",DB);var JB=new WB({id:"loaders.gl"}),ZB=/\.([^.]+)$/;function qB(e){return $B.apply(this,arguments)}function $B(){return $B=u(a().mark((function e(t){var i,r,s,o,l=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=l.length>1&&void 0!==l[1]?l[1]:[],r=l.length>2?l[2]:void 0,s=l.length>3?l[3]:void 0,ix(t)){e.next=5;break}return e.abrupt("return",null);case 5:if(!(o=ex(t,i,n(n({},r),{},{nothrow:!0}),s))){e.next=8;break}return e.abrupt("return",o);case 8:if(!xw(t)){e.next=13;break}return e.next=11,t.slice(0,10).arrayBuffer();case 11:t=e.sent,o=ex(t,i,r,s);case 13:if(o||null!=r&&r.nothrow){e.next=15;break}throw new Error(rx(t));case 15:return e.abrupt("return",o);case 16:case"end":return e.stop()}}),e)}))),$B.apply(this,arguments)}function ex(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(!ix(e))return null;if(t&&!Array.isArray(t))return CB(t);var s,n=[];(t&&(n=n.concat(t)),null!=i&&i.ignoreRegisteredLoaders)||(s=n).push.apply(s,h(MB()));sx(n);var o=tx(e,n,i,r);if(!(o||null!=i&&i.nothrow))throw new Error(rx(e));return o}function tx(e,t,i,r){var s,n=Iw(e),o=n.url,a=n.type,l=o||(null==r?void 0:r.url),u=null,c="";(null!=i&&i.mimeType&&(u=nx(t,null==i?void 0:i.mimeType),c="match forced by supplied MIME type ".concat(null==i?void 0:i.mimeType)),u=u||function(e,t){var i=t&&ZB.exec(t),r=i&&i[1];return r?function(e,t){t=t.toLowerCase();var i,r=A(e);try{for(r.s();!(i=r.n()).done;){var s,n=i.value,o=A(n.extensions);try{for(o.s();!(s=o.n()).done;){if(s.value.toLowerCase()===t)return n}}catch(e){o.e(e)}finally{o.f()}}}catch(e){r.e(e)}finally{r.f()}return null}(e,r):null}(t,l),c=c||(u?"matched url ".concat(l):""),u=u||nx(t,a),c=c||(u?"matched MIME type ".concat(a):""),u=u||function(e,t){if(!t)return null;var i,r=A(e);try{for(r.s();!(i=r.n()).done;){var s=i.value;if("string"==typeof t){if(ox(t,s))return s}else if(ArrayBuffer.isView(t)){if(ax(t.buffer,t.byteOffset,s))return s}else if(t instanceof ArrayBuffer){if(ax(t,0,s))return s}}}catch(e){r.e(e)}finally{r.f()}return null}(t,e),c=c||(u?"matched initial data ".concat(lx(e)):""),u=u||nx(t,null==i?void 0:i.fallbackMimeType),c=c||(u?"matched fallback MIME type ".concat(a):""))&&JB.log(1,"selectLoader selected ".concat(null===(s=u)||void 0===s?void 0:s.name,": ").concat(c,"."));return u}function ix(e){return!(e instanceof Response&&204===e.status)}function rx(e){var t=Iw(e),i=t.url,r=t.type,s="No valid loader found (";s+=i?"".concat(function(e){var t=e&&e.lastIndexOf("/");return t>=0?e.substr(t+1):""}(i),", "):"no url provided, ",s+="MIME type: ".concat(r?'"'.concat(r,'"'):"not provided",", ");var n=e?lx(e):"";return s+=n?' first bytes: "'.concat(n,'"'):"first bytes: not available",s+=")"}function sx(e){var t,i=A(e);try{for(i.s();!(t=i.n()).done;){CB(t.value)}}catch(e){i.e(e)}finally{i.f()}}function nx(e,t){var i,r=A(e);try{for(r.s();!(i=r.n()).done;){var s=i.value;if(s.mimeTypes&&s.mimeTypes.includes(t))return s;if(t==="application/x.".concat(s.id))return s}}catch(e){r.e(e)}finally{r.f()}return null}function ox(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some((function(t){return e.startsWith(t)}))}function ax(e,t,i){return(Array.isArray(i.tests)?i.tests:[i.tests]).some((function(r){return function(e,t,i,r){if(r instanceof ArrayBuffer)return function(e,t,i){if(i=i||e.byteLength,e.byteLength1&&void 0!==arguments[1]?arguments[1]:5;if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return ux(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){var i=0;return ux(e,i,t)}return""}function ux(e,t,i){if(e.byteLength1&&void 0!==A[1]?A[1]:{},r=t.chunkSize,s=void 0===r?262144:r,n=0;case 3:if(!(n2&&void 0!==arguments[2]?arguments[2]:null;if(i)return i;var r=n({fetch:bB(t,e)},e);return Array.isArray(r.loaders)||(r.loaders=null),r}function wx(e,t){if(!t&&e&&!Array.isArray(e))return e;var i;if(e&&(i=Array.isArray(e)?e:[e]),t&&t.loaders){var r=Array.isArray(t.loaders)?t.loaders:[t.loaders];i=i?[].concat(h(i),h(r)):r}return i&&i.length?i:null}function Bx(e,t,i,r){return xx.apply(this,arguments)}function xx(){return(xx=u(a().mark((function e(t,i,r,s){var n,o,l,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Pb(!s||"object"===B(s)),!i||Array.isArray(i)||PB(i)||(s=void 0,r=i,i=void 0),e.next=4,t;case 4:return t=e.sent,r=r||{},n=Iw(t),o=n.url,l=wx(i,s),e.next=11,qB(t,l,r);case 11:if(u=e.sent){e.next=14;break}return e.abrupt("return",null);case 14:return r=yB(r,u,l,o),s=bx({url:o,parse:Bx,loaders:l},r,s),e.next=18,Px(u,t,r,s);case 18:return e.abrupt("return",e.sent);case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Px(e,t,i,r){return Cx.apply(this,arguments)}function Cx(){return(Cx=u(a().mark((function e(t,i,r,s){var n,o,l,u,A,c,h,d;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Wb(t),Bw(i)&&(o=(n=i).ok,l=n.redirected,u=n.status,A=n.statusText,c=n.type,h=n.url,d=Object.fromEntries(n.headers.entries()),s.response={headers:d,ok:o,redirected:l,status:u,statusText:A,type:c,url:h}),e.next=4,_x(i,t,r);case 4:if(i=e.sent,!t.parseTextSync||"string"!=typeof i){e.next=8;break}return r.dataType="text",e.abrupt("return",t.parseTextSync(i,r,s,t));case 8:if(!tw(t,r)){e.next=12;break}return e.next=11,iw(t,i,r,s,Bx);case 11:case 15:case 19:return e.abrupt("return",e.sent);case 12:if(!t.parseText||"string"!=typeof i){e.next=16;break}return e.next=15,t.parseText(i,r,s,t);case 16:if(!t.parse){e.next=20;break}return e.next=19,t.parse(i,r,s,t);case 20:throw Pb(!t.parseSync),new Error("".concat(t.id," loader - no parser found and worker is disabled"));case 22:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Mx,Ex,Fx="https://unpkg.com/@loaders.gl/textures@".concat("3.2.6","/dist/libs/basis_encoder.wasm"),kx="https://unpkg.com/@loaders.gl/textures@".concat("3.2.6","/dist/libs/basis_encoder.js");function Ix(e){return Dx.apply(this,arguments)}function Dx(){return(Dx=u(a().mark((function e(t){var i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=t.modules||{}).basis){e.next=3;break}return e.abrupt("return",i.basis);case 3:return Mx=Mx||Sx(t),e.next=6,Mx;case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Sx(e){return Tx.apply(this,arguments)}function Tx(){return(Tx=u(a().mark((function e(t){var i,r,s,n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null,r=null,e.t0=Promise,e.next=5,Yb("basis_transcoder.js","textures",t);case 5:return e.t1=e.sent,e.next=8,Yb("basis_transcoder.wasm","textures",t);case 8:return e.t2=e.sent,e.t3=[e.t1,e.t2],e.next=12,e.t0.all.call(e.t0,e.t3);case 12:return s=e.sent,n=c(s,2),i=n[0],r=n[1],i=i||globalThis.BASIS,e.next=19,Lx(i,r);case 19:return e.abrupt("return",e.sent);case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Lx(e,t){var i={};return t&&(i.wasmBinary=t),new Promise((function(t){e(i).then((function(e){var i=e.BasisFile;(0,e.initializeBasis)(),t({BasisFile:i})}))}))}function Rx(e){return Ux.apply(this,arguments)}function Ux(){return(Ux=u(a().mark((function e(t){var i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=t.modules||{}).basisEncoder){e.next=3;break}return e.abrupt("return",i.basisEncoder);case 3:return Ex=Ex||Ox(t),e.next=6,Ex;case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ox(e){return Nx.apply(this,arguments)}function Nx(){return(Nx=u(a().mark((function e(t){var i,r,s,n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null,r=null,e.t0=Promise,e.next=5,Yb(kx,"textures",t);case 5:return e.t1=e.sent,e.next=8,Yb(Fx,"textures",t);case 8:return e.t2=e.sent,e.t3=[e.t1,e.t2],e.next=12,e.t0.all.call(e.t0,e.t3);case 12:return s=e.sent,n=c(s,2),i=n[0],r=n[1],i=i||globalThis.BASIS,e.next=19,Qx(i,r);case 19:return e.abrupt("return",e.sent);case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qx(e,t){var i={};return t&&(i.wasmBinary=t),new Promise((function(t){e(i).then((function(e){var i=e.BasisFile,r=e.KTX2File,s=e.initializeBasis,n=e.BasisEncoder;s(),t({BasisFile:i,KTX2File:r,BasisEncoder:n})}))}))}var Vx,Hx,jx,Gx,zx,Wx,Kx,Xx,Yx,Jx=33776,Zx=33779,qx=35840,$x=35842,eP=36196,tP=37808,iP=["","WEBKIT_","MOZ_"],rP={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"},sP=null;function nP(e){if(!sP){e=e||function(){try{return document.createElement("canvas").getContext("webgl")}catch(e){return null}}()||void 0,sP=new Set;var t,i=A(iP);try{for(i.s();!(t=i.n()).done;){var r=t.value;for(var s in rP)if(e&&e.getExtension("".concat(r).concat(s))){var n=rP[s];sP.add(n)}}}catch(e){i.e(e)}finally{i.f()}}return sP}(Yx=Vx||(Vx={}))[Yx.NONE=0]="NONE",Yx[Yx.BASISLZ=1]="BASISLZ",Yx[Yx.ZSTD=2]="ZSTD",Yx[Yx.ZLIB=3]="ZLIB",function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(Hx||(Hx={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(jx||(jx={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(Gx||(Gx={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(zx||(zx={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Wx||(Wx={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(Kx||(Kx={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(Xx||(Xx={}));var oP=[171,75,84,88,32,50,48,187,13,10,26,10];function aP(e){var t=new Uint8Array(e);return!(t.byteLength1&&void 0!==r[1]?r[1]:null)&&TP||(i=null),!i){e.next=13;break}return e.prev=3,e.next=6,createImageBitmap(t,i);case 6:return e.abrupt("return",e.sent);case 9:e.prev=9,e.t0=e.catch(3),console.warn(e.t0),TP=!1;case 13:return e.next=15,createImageBitmap(t);case 15:return e.abrupt("return",e.sent);case 16:case"end":return e.stop()}}),e,null,[[3,9]])}))),OP.apply(this,arguments)}function NP(e){for(var t in e||SP)return!1;return!0}function QP(e){var t=VP(e);return function(e){var t=VP(e);if(!(t.byteLength>=24&&2303741511===t.getUint32(0,false)))return null;return{mimeType:"image/png",width:t.getUint32(16,false),height:t.getUint32(20,false)}}(t)||function(e){var t=VP(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,false)&&255===t.getUint8(2)))return null;var i=function(){for(var e=new Set([65499,65476,65484,65501,65534]),t=65504;t<65520;++t)e.add(t);var i=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:i}}(),r=i.tableMarkers,s=i.sofMarkers,n=2;for(;n+9=10&&1195984440===t.getUint32(0,false)))return null;return{mimeType:"image/gif",width:t.getUint16(6,true),height:t.getUint16(8,true)}}(t)||function(e){var t=VP(e);if(!(t.byteLength>=14&&16973===t.getUint16(0,false)&&t.getUint32(2,true)===t.byteLength))return null;return{mimeType:"image/bmp",width:t.getUint32(18,true),height:t.getUint32(22,true)}}(t)}function VP(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}function HP(e,t){return jP.apply(this,arguments)}function jP(){return jP=u(a().mark((function e(t,i){var r,s,n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=QP(t)||{},s=r.mimeType,wb(n=globalThis._parseImageNode),e.next=5,n(t,s);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)}))),jP.apply(this,arguments)}function GP(){return(GP=u(a().mark((function e(t,i,r){var s,n,o,l,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=(i=i||{}).image||{},n=s.type||"auto",o=(r||{}).url,l=zP(n),e.t0=l,e.next="imagebitmap"===e.t0?8:"image"===e.t0?12:"data"===e.t0?16:20;break;case 8:return e.next=10,LP(t,i,o);case 10:return u=e.sent,e.abrupt("break",21);case 12:return e.next=14,FP(t,i,o);case 14:return u=e.sent,e.abrupt("break",21);case 16:return e.next=18,HP(t);case 18:return u=e.sent,e.abrupt("break",21);case 20:wb(!1);case 21:return"data"===n&&(u=BP(u)),e.abrupt("return",u);case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function zP(e){switch(e){case"auto":case"data":return function(){if(_P)return"imagebitmap";if(mP)return"image";if(bP)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(e){switch(e){case"auto":return _P||mP||bP;case"imagebitmap":return _P;case"image":return mP;case"data":return bP;default:throw new Error("@loaders.gl/images: image ".concat(e," not supported in this environment"))}}(e),e}}var WP={id:"image",module:"images",name:"Images",version:"3.2.6",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:function(e,t,i){return GP.apply(this,arguments)},tests:[function(e){return Boolean(QP(new DataView(e)))}],options:{image:{type:"auto",decode:!0}}},KP=["image/png","image/jpeg","image/gif"],XP={};function YP(e){return void 0===XP[e]&&(XP[e]=function(e){switch(e){case"image/webp":return function(){if(!Bb)return!1;try{return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}catch(e){return!1}}();case"image/svg":return Bb;default:if(!Bb){var t=globalThis._parseImageNode;return Boolean(t)&&KP.includes(e)}return!0}}(e)),XP[e]}function JP(e,t){if(!e)throw new Error(t||"assert failed: gltf")}function ZP(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;var i=t.baseUri||t.uri;if(!i)throw new Error("'baseUri' must be provided to resolve relative url ".concat(e));return i.substr(0,i.lastIndexOf("/")+1)+e}function qP(e,t,i){var r=e.bufferViews[i];JP(r);var s=t[r.buffer];JP(s);var n=(r.byteOffset||0)+s.byteOffset;return new Uint8Array(s.arrayBuffer,n,r.byteLength)}var $P=["SCALAR","VEC2","VEC3","VEC4"],eC=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],tC=new Map(eC),iC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},rC={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},sC={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function nC(e){return $P[e-1]||$P[0]}function oC(e){var t=tC.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function aC(e,t){var i=sC[e.componentType],r=iC[e.type],s=rC[e.componentType],n=e.count*r,o=e.count*r*s;return JP(o>=0&&o<=t.byteLength),{ArrayType:i,length:n,byteLength:o}}var lC,uC={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]},AC=function(){function e(t){x(this,e),Db(this,"gltf",void 0),Db(this,"sourceBuffers",void 0),Db(this,"byteLength",void 0),this.gltf=t||{json:n({},uC),buffers:[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}return C(e,[{key:"json",get:function(){return this.gltf.json}},{key:"getApplicationData",value:function(e){return this.json[e]}},{key:"getExtraData",value:function(e){return(this.json.extras||{})[e]}},{key:"getExtension",value:function(e){var t=this.getUsedExtensions().find((function(t){return t===e})),i=this.json.extensions||{};return t?i[e]||!0:null}},{key:"getRequiredExtension",value:function(e){var t=this.getRequiredExtensions().find((function(t){return t===e}));return t?this.getExtension(e):null}},{key:"getRequiredExtensions",value:function(){return this.json.extensionsRequired||[]}},{key:"getUsedExtensions",value:function(){return this.json.extensionsUsed||[]}},{key:"getObjectExtension",value:function(e,t){return(e.extensions||{})[t]}},{key:"getScene",value:function(e){return this.getObject("scenes",e)}},{key:"getNode",value:function(e){return this.getObject("nodes",e)}},{key:"getSkin",value:function(e){return this.getObject("skins",e)}},{key:"getMesh",value:function(e){return this.getObject("meshes",e)}},{key:"getMaterial",value:function(e){return this.getObject("materials",e)}},{key:"getAccessor",value:function(e){return this.getObject("accessors",e)}},{key:"getTexture",value:function(e){return this.getObject("textures",e)}},{key:"getSampler",value:function(e){return this.getObject("samplers",e)}},{key:"getImage",value:function(e){return this.getObject("images",e)}},{key:"getBufferView",value:function(e){return this.getObject("bufferViews",e)}},{key:"getBuffer",value:function(e){return this.getObject("buffers",e)}},{key:"getObject",value:function(e,t){if("object"===B(t))return t;var i=this.json[e]&&this.json[e][t];if(!i)throw new Error("glTF file error: Could not find ".concat(e,"[").concat(t,"]"));return i}},{key:"getTypedArrayForBufferView",value:function(e){var t=(e=this.getBufferView(e)).buffer,i=this.gltf.buffers[t];JP(i);var r=(e.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,r,e.byteLength)}},{key:"getTypedArrayForAccessor",value:function(e){e=this.getAccessor(e);var t=this.getBufferView(e.bufferView),i=this.getBuffer(t.buffer).data,r=aC(e,t),s=r.ArrayType,n=r.length;return new s(i,t.byteOffset+e.byteOffset,n)}},{key:"getTypedArrayForImageData",value:function(e){e=this.getAccessor(e);var t=this.getBufferView(e.bufferView),i=this.getBuffer(t.buffer).data,r=t.byteOffset||0;return new Uint8Array(i,r,t.byteLength)}},{key:"addApplicationData",value:function(e,t){return this.json[e]=t,this}},{key:"addExtraData",value:function(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}},{key:"addObjectExtension",value:function(e,t,i){return e.extensions=e.extensions||{},e.extensions[t]=i,this.registerUsedExtension(t),this}},{key:"setObjectExtension",value:function(e,t,i){(e.extensions||{})[t]=i}},{key:"removeObjectExtension",value:function(e,t){var i=e.extensions||{},r=i[t];return delete i[t],r}},{key:"addExtension",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return JP(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}},{key:"addRequiredExtension",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return JP(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}},{key:"registerUsedExtension",value:function(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find((function(t){return t===e}))||this.json.extensionsUsed.push(e)}},{key:"registerRequiredExtension",value:function(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find((function(t){return t===e}))||this.json.extensionsRequired.push(e)}},{key:"removeExtension",value:function(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}},{key:"setDefaultScene",value:function(e){this.json.scene=e}},{key:"addScene",value:function(e){var t=e.nodeIndices;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}},{key:"addNode",value:function(e){var t=e.meshIndex,i=e.matrix;this.json.nodes=this.json.nodes||[];var r={mesh:t};return i&&(r.matrix=i),this.json.nodes.push(r),this.json.nodes.length-1}},{key:"addMesh",value:function(e){var t=e.attributes,i=e.indices,r=e.material,s=e.mode,n=void 0===s?4:s,o={primitives:[{attributes:this._addAttributes(t),mode:n}]};if(i){var a=this._addIndices(i);o.primitives[0].indices=a}return Number.isFinite(r)&&(o.primitives[0].material=r),this.json.meshes=this.json.meshes||[],this.json.meshes.push(o),this.json.meshes.length-1}},{key:"addPointCloud",value:function(e){var t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}},{key:"addImage",value:function(e,t){var i=QP(e),r=t||(null==i?void 0:i.mimeType),s={bufferView:this.addBufferView(e),mimeType:r};return this.json.images=this.json.images||[],this.json.images.push(s),this.json.images.length-1}},{key:"addBufferView",value:function(e){var t=e.byteLength;JP(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);var i={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=hw(t,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}},{key:"addAccessor",value:function(e,t){var i={bufferView:e,type:nC(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(i),this.json.accessors.length-1}},{key:"addBinaryBuffer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{size:3},i=this.addBufferView(e),r={min:t.min,max:t.max};r.min&&r.max||(r=this._getAccessorMinMax(e,t.size));var s={size:t.size,componentType:oC(e),count:Math.round(e.length/t.size),min:r.min,max:r.max};return this.addAccessor(i,Object.assign(s,t))}},{key:"addTexture",value:function(e){var t={source:e.imageIndex};return this.json.textures=this.json.textures||[],this.json.textures.push(t),this.json.textures.length-1}},{key:"addMaterial",value:function(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}},{key:"createBinaryChunk",value:function(){var e,t;this.gltf.buffers=[];var i,r=this.byteLength,s=new ArrayBuffer(r),n=new Uint8Array(s),o=0,a=A(this.sourceBuffers||[]);try{for(a.s();!(i=a.n()).done;){o=dw(i.value,n,o)}}catch(e){a.e(e)}finally{a.f()}null!==(e=this.json)&&void 0!==e&&null!==(t=e.buffers)&&void 0!==t&&t[0]?this.json.buffers[0].byteLength=r:this.json.buffers=[{byteLength:r}],this.gltf.binary=s,this.sourceBuffers=[s]}},{key:"_removeStringFromArray",value:function(e,t){for(var i=!0;i;){var r=e.indexOf(t);r>-1?e.splice(r,1):i=!1}}},{key:"_addAttributes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={};for(var i in e){var r=e[i],s=this._getGltfAttributeName(i),n=this.addBinaryBuffer(r.value,r);t[s]=n}return t}},{key:"_addIndices",value:function(e){return this.addBinaryBuffer(e,{size:1})}},{key:"_getGltfAttributeName",value:function(e){switch(e.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 e}}},{key:"_getAccessorMinMax",value:function(e,t){var i={min:null,max:null};if(e.length5&&void 0!==u[5]?u[5]:"NONE",e.next=3,_C();case 3:xC(l=e.sent,l.exports[vC[n]],t,i,r,s,l.exports[fC[o||"NONE"]]);case 5:case"end":return e.stop()}}),e)}))),mC.apply(this,arguments)}function _C(){return yC.apply(this,arguments)}function yC(){return(yC=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return lC||(lC=bC()),e.abrupt("return",lC);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bC(){return wC.apply(this,arguments)}function wC(){return(wC=u(a().mark((function e(){var t,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=cC,WebAssembly.validate(dC)&&(t=hC,console.log("Warning: meshopt_decoder is using experimental SIMD support")),e.next=4,WebAssembly.instantiate(BC(t),{});case 4:return i=e.sent,e.next=7,i.instance.exports.__wasm_call_ctors();case 7:return e.abrupt("return",i.instance);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function BC(e){for(var t=new Uint8Array(e.length),i=0;i96?r-71:r>64?r-65:r>47?r+4:r>46?63:62}for(var s=0,n=0;ns?A:s,n=c>n?c:n,o=h>o?h:o}return[[t,i,r],[s,n,o]]}var SC=function(){function e(t,i){x(this,e),Db(this,"fields",void 0),Db(this,"metadata",void 0),function(e,t){if(!e)throw new Error(t||"loader assertion failed.")}(Array.isArray(t)),function(e){var t,i={},r=A(e);try{for(r.s();!(t=r.n()).done;){var s=t.value;i[s.name]&&console.warn("Schema: duplicated field name",s.name,s),i[s.name]=!0}}catch(e){r.e(e)}finally{r.f()}}(t),this.fields=t,this.metadata=i||new Map}return C(e,[{key:"compareTo",value:function(e){if(this.metadata!==e.metadata)return!1;if(this.fields.length!==e.fields.length)return!1;for(var t=0;t2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Map;x(this,e),Db(this,"name",void 0),Db(this,"type",void 0),Db(this,"nullable",void 0),Db(this,"metadata",void 0),this.name=t,this.type=i,this.nullable=r,this.metadata=s}return C(e,[{key:"typeId",get:function(){return this.type&&this.type.typeId}},{key:"clone",value:function(){return new e(this.name,this.type,this.nullable,this.metadata)}},{key:"compareTo",value:function(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}},{key:"toString",value:function(){return"".concat(this.type).concat(this.nullable?", nullable":"").concat(this.metadata?", metadata: ".concat(this.metadata):"")}}]),e}();!function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(LC||(LC={}));var UC=function(){function e(){x(this,e)}return C(e,[{key:"typeId",get:function(){return LC.NONE}},{key:"compareTo",value:function(e){return this===e}}],[{key:"isNull",value:function(e){return e&&e.typeId===LC.Null}},{key:"isInt",value:function(e){return e&&e.typeId===LC.Int}},{key:"isFloat",value:function(e){return e&&e.typeId===LC.Float}},{key:"isBinary",value:function(e){return e&&e.typeId===LC.Binary}},{key:"isUtf8",value:function(e){return e&&e.typeId===LC.Utf8}},{key:"isBool",value:function(e){return e&&e.typeId===LC.Bool}},{key:"isDecimal",value:function(e){return e&&e.typeId===LC.Decimal}},{key:"isDate",value:function(e){return e&&e.typeId===LC.Date}},{key:"isTime",value:function(e){return e&&e.typeId===LC.Time}},{key:"isTimestamp",value:function(e){return e&&e.typeId===LC.Timestamp}},{key:"isInterval",value:function(e){return e&&e.typeId===LC.Interval}},{key:"isList",value:function(e){return e&&e.typeId===LC.List}},{key:"isStruct",value:function(e){return e&&e.typeId===LC.Struct}},{key:"isUnion",value:function(e){return e&&e.typeId===LC.Union}},{key:"isFixedSizeBinary",value:function(e){return e&&e.typeId===LC.FixedSizeBinary}},{key:"isFixedSizeList",value:function(e){return e&&e.typeId===LC.FixedSizeList}},{key:"isMap",value:function(e){return e&&e.typeId===LC.Map}},{key:"isDictionary",value:function(e){return e&&e.typeId===LC.Dictionary}}]),e}(),OC=function(e,t){g(r,UC);var i=_(r);function r(e,t){var s;return x(this,r),Db(b(s=i.call(this)),"isSigned",void 0),Db(b(s),"bitWidth",void 0),s.isSigned=e,s.bitWidth=t,s}return C(r,[{key:"typeId",get:function(){return LC.Int}},{key:t,get:function(){return"Int"}},{key:"toString",value:function(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}}]),r}(0,Symbol.toStringTag),NC=function(e){g(i,OC);var t=_(i);function i(){return x(this,i),t.call(this,!0,8)}return C(i)}(),QC=function(e){g(i,OC);var t=_(i);function i(){return x(this,i),t.call(this,!0,16)}return C(i)}(),VC=function(e){g(i,OC);var t=_(i);function i(){return x(this,i),t.call(this,!0,32)}return C(i)}(),HC=function(e){g(i,OC);var t=_(i);function i(){return x(this,i),t.call(this,!1,8)}return C(i)}(),jC=function(e){g(i,OC);var t=_(i);function i(){return x(this,i),t.call(this,!1,16)}return C(i)}(),GC=function(e){g(i,OC);var t=_(i);function i(){return x(this,i),t.call(this,!1,32)}return C(i)}(),zC=32,WC=64,KC=function(e,t){g(r,UC);var i=_(r);function r(e){var t;return x(this,r),Db(b(t=i.call(this)),"precision",void 0),t.precision=e,t}return C(r,[{key:"typeId",get:function(){return LC.Float}},{key:t,get:function(){return"Float"}},{key:"toString",value:function(){return"Float".concat(this.precision)}}]),r}(0,Symbol.toStringTag),XC=function(e){g(i,KC);var t=_(i);function i(){return x(this,i),t.call(this,zC)}return C(i)}(),YC=function(e){g(i,KC);var t=_(i);function i(){return x(this,i),t.call(this,WC)}return C(i)}(),JC=function(e,t){g(r,UC);var i=_(r);function r(e,t){var s;return x(this,r),Db(b(s=i.call(this)),"listSize",void 0),Db(b(s),"children",void 0),s.listSize=e,s.children=[t],s}return C(r,[{key:"typeId",get:function(){return LC.FixedSizeList}},{key:"valueType",get:function(){return this.children[0].type}},{key:"valueField",get:function(){return this.children[0]}},{key:t,get:function(){return"FixedSizeList"}},{key:"toString",value:function(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}}]),r}(0,Symbol.toStringTag);function ZC(e,t,i){var r=function(e){switch(e.constructor){case Int8Array:return new NC;case Uint8Array:return new HC;case Int16Array:return new QC;case Uint16Array:return new jC;case Int32Array:return new VC;case Uint32Array:return new GC;case Float32Array:return new XC;case Float64Array:return new YC;default:throw new Error("array type not supported")}}(t.value),s=i||function(e){var t=new Map;"byteOffset"in e&&t.set("byteOffset",e.byteOffset.toString(10));"byteStride"in e&&t.set("byteStride",e.byteStride.toString(10));"normalized"in e&&t.set("normalized",e.normalized.toString());return t}(t);return new RC(e,new JC(t.size,new RC("value",r)),!1,s)}function qC(e,t,i){var r=eM(t.metadata),s=[],n=function(e){var t={};for(var i in e){var r=e[i];t[r.name||"undefined"]=r}return t}(t.attributes);for(var o in e){var a=$C(o,e[o],n[o]);s.push(a)}if(i){var l=$C("indices",i);s.push(l)}return new SC(s,r)}function $C(e,t,i){return ZC(e,t,i?eM(i.metadata):void 0)}function eM(e){var t=new Map;for(var i in e)t.set("".concat(i,".string"),JSON.stringify(e[i]));return t}var tM={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},iM={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},rM=function(){function e(t){x(this,e),Db(this,"draco",void 0),Db(this,"decoder",void 0),Db(this,"metadataQuerier",void 0),this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}return C(e,[{key:"destroy",value:function(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}},{key:"parseSync",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=new this.draco.DecoderBuffer;i.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(t);var r=this.decoder.GetEncodedGeometryType(i),s=r===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{var o;switch(r){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(i,s);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(i,s);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!s.ptr){var a="DRACO decompression failed: ".concat(o.error_msg());throw new Error(a)}var l=this._getDracoLoaderData(s,r,t),u=this._getMeshData(s,l,t),A=DC(u.attributes),c=qC(u.attributes,l,u.indices),h=n(n({loader:"draco",loaderData:l,header:{vertexCount:s.num_points(),boundingBox:A}},u),{},{schema:c});return h}finally{this.draco.destroy(i),s&&this.draco.destroy(s)}}},{key:"_getDracoLoaderData",value:function(e,t,i){var r=this._getTopLevelMetadata(e),s=this._getDracoAttributes(e,i);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:r,attributes:s}}},{key:"_getDracoAttributes",value:function(e,t){for(var i={},r=0;r2&&void 0!==arguments[2]&&arguments[2];if(!e)return null;if(Array.isArray(e))return new t(e);if(i&&!(e instanceof t))return new t(e);return e}(t,Float32Array)),r=t.length/i);return{buffer:t,size:i,count:r}}(e),i=t.buffer,r=t.size;return{value:i,size:r,byteOffset:0,count:t.count,type:nC(r),componentType:oC(i)}}function gM(){return(gM=u(a().mark((function e(t,i,r){var s,n,o,l,u,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=i&&null!==(s=i.gltf)&&void 0!==s&&s.decompressMeshes){e.next=2;break}return e.abrupt("return");case 2:n=new AC(t),o=[],l=A(wM(n));try{for(l.s();!(u=l.n()).done;)c=u.value,n.getObjectExtension(c,"KHR_draco_mesh_compression")&&o.push(mM(n,c,i,r))}catch(e){l.e(e)}finally{l.f()}return e.next=8,Promise.all(o);case 8:n.removeExtension("KHR_draco_mesh_compression");case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mM(e,t,i,r){return _M.apply(this,arguments)}function _M(){return _M=u(a().mark((function e(t,i,r,s){var o,l,u,A,h,d,p,f,v,g,m,_,y,b;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.getObjectExtension(i,"KHR_draco_mesh_compression")){e.next=3;break}return e.abrupt("return");case 3:return l=t.getTypedArrayForBufferView(o.bufferView),u=cw(l.buffer,l.byteOffset),A=s.parse,delete(h=n({},r))["3d-tiles"],e.next=10,A(u,dM,h,s);case 10:for(d=e.sent,p=fM(d.attributes),f=0,v=Object.entries(p);f2&&void 0!==arguments[2]?arguments[2]:4,s=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;if(!s.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");var a=s.DracoWriter.encodeSync({attributes:e}),l=null==n||null===(i=n.parseSync)||void 0===i?void 0:i.call(n,{attributes:e}),u=s._addFauxAttributes(l.attributes),A=s.addBufferView(a),c={primitives:[{attributes:u,mode:r,extensions:o({},"KHR_draco_mesh_compression",{bufferView:A,attributes:u})}]};return c}function bM(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function wM(e){var t,i,s,n,o,l;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:t=A(e.json.meshes||[]),r.prev=1,t.s();case 3:if((i=t.n()).done){r.next=24;break}s=i.value,n=A(s.primitives),r.prev=6,n.s();case 8:if((o=n.n()).done){r.next=14;break}return l=o.value,r.next=12,l;case 12:r.next=8;break;case 14:r.next=19;break;case 16:r.prev=16,r.t0=r.catch(6),n.e(r.t0);case 19:return r.prev=19,n.f(),r.finish(19);case 22:r.next=3;break;case 24:r.next=29;break;case 26:r.prev=26,r.t1=r.catch(1),t.e(r.t1);case 29:return r.prev=29,t.f(),r.finish(29);case 32:case"end":return r.stop()}}),r,null,[[1,26,29,32],[6,16,19,22]])}function BM(){return(BM=u(a().mark((function e(t){var i,r,s,n,o,l,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=new AC(t),r=i.json,(s=i.getExtension("KHR_lights_punctual"))&&(i.json.lights=s.lights,i.removeExtension("KHR_lights_punctual")),n=A(r.nodes||[]);try{for(n.s();!(o=n.n()).done;)l=o.value,(u=i.getObjectExtension(l,"KHR_lights_punctual"))&&(l.light=u.light),i.removeObjectExtension(l,"KHR_lights_punctual")}catch(e){n.e(e)}finally{n.f()}case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xM(){return(xM=u(a().mark((function e(t){var i,r,s,n,o,l,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=new AC(t),(r=i.json).lights&&(JP(!(s=i.addExtension("KHR_lights_punctual")).lights),s.lights=r.lights,delete r.lights),i.json.lights){n=A(i.json.lights);try{for(n.s();!(o=n.n()).done;)l=o.value,u=l.node,i.addObjectExtension(u,"KHR_lights_punctual",l)}catch(e){n.e(e)}finally{n.f()}delete i.json.lights}case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function PM(){return(PM=u(a().mark((function e(t){var i,r,s,n,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=new AC(t),r=i.json,i.removeExtension("KHR_materials_unlit"),s=A(r.materials||[]);try{for(s.s();!(n=s.n()).done;)o=n.value,o.extensions&&o.extensions.KHR_materials_unlit&&(o.unlit=!0),i.removeObjectExtension(o,"KHR_materials_unlit")}catch(e){s.e(e)}finally{s.f()}case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function CM(){return(CM=u(a().mark((function e(t){var i,r,s,n,o,l,u,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=new AC(t),r=i.json,s=i.getExtension("KHR_techniques_webgl")){n=EM(s,i),o=A(r.materials||[]);try{for(o.s();!(l=o.n()).done;)u=l.value,(c=i.getObjectExtension(u,"KHR_techniques_webgl"))&&(u.technique=Object.assign({},c,n[c.technique]),u.technique.values=FM(u.technique,i)),i.removeObjectExtension(u,"KHR_techniques_webgl")}catch(e){o.e(e)}finally{o.f()}i.removeExtension("KHR_techniques_webgl")}case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function MM(){return(MM=u(a().mark((function e(t,i){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function EM(e,t){var i=e.programs,r=void 0===i?[]:i,s=e.shaders,n=void 0===s?[]:s,o=e.techniques,a=void 0===o?[]:o,l=new TextDecoder;return n.forEach((function(e){if(!Number.isFinite(e.bufferView))throw new Error("KHR_techniques_webgl: no shader code");e.code=l.decode(t.getTypedArrayForBufferView(e.bufferView))})),r.forEach((function(e){e.fragmentShader=n[e.fragmentShader],e.vertexShader=n[e.vertexShader]})),a.forEach((function(e){e.program=r[e.program]})),a}function FM(e,t){var i=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach((function(t){e.uniforms[t].value&&!(t in i)&&(i[t]=e.uniforms[t].value)})),Object.keys(i).forEach((function(e){"object"===B(i[e])&&void 0!==i[e].index&&(i[e].texture=t.getTexture(i[e].index))})),i}var kM=[EC,FC,kC,Object.freeze({__proto__:null,name:"KHR_draco_mesh_compression",preprocess:function(e,t,i){var r,s=new AC(e),n=A(wM(s));try{for(n.s();!(r=n.n()).done;){var o=r.value;s.getObjectExtension(o,"KHR_draco_mesh_compression")}}catch(e){n.e(e)}finally{n.f()}},decode:function(e,t,i){return gM.apply(this,arguments)},encode:function(e){var t,i=new AC(e),r=A(i.json.meshes||[]);try{for(r.s();!(t=r.n()).done;){var s=t.value;yM(s),i.addRequiredExtension("KHR_draco_mesh_compression")}}catch(e){r.e(e)}finally{r.f()}}}),Object.freeze({__proto__:null,name:"KHR_lights_punctual",decode:function(e){return BM.apply(this,arguments)},encode:function(e){return xM.apply(this,arguments)}}),Object.freeze({__proto__:null,name:"KHR_materials_unlit",decode:function(e){return PM.apply(this,arguments)},encode:function(e){var t=new AC(e),i=t.json;if(t.materials){var r,s=A(i.materials||[]);try{for(s.s();!(r=s.n()).done;){var n=r.value;n.unlit&&(delete n.unlit,t.addObjectExtension(n,"KHR_materials_unlit",{}),t.addExtension("KHR_materials_unlit"))}}catch(e){s.e(e)}finally{s.f()}}}}),Object.freeze({__proto__:null,name:"KHR_techniques_webgl",decode:function(e){return CM.apply(this,arguments)},encode:function(e,t){return MM.apply(this,arguments)}})];function IM(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,s=kM.filter((function(e){return TM(e.name,i)})),n=A(s);try{for(n.s();!(t=n.n()).done;){var o,a=t.value;null===(o=a.preprocess)||void 0===o||o.call(a,e,i,r)}}catch(e){n.e(e)}finally{n.f()}}function DM(e){return SM.apply(this,arguments)}function SM(){return SM=u(a().mark((function e(t){var i,r,s,n,o,l,u,c=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=c.length>1&&void 0!==c[1]?c[1]:{},r=c.length>2?c[2]:void 0,s=kM.filter((function(e){return TM(e.name,i)})),n=A(s),e.prev=4,n.s();case 6:if((o=n.n()).done){e.next=12;break}return l=o.value,e.next=10,null===(u=l.decode)||void 0===u?void 0:u.call(l,t,i,r);case 10:e.next=6;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(4),n.e(e.t0);case 17:return e.prev=17,n.f(),e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[4,14,17,20]])}))),SM.apply(this,arguments)}function TM(e,t){var i,r=(null==t||null===(i=t.gltf)||void 0===i?void 0:i.excludeExtensions)||{};return!(e in r&&!r[e])}var LM={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},RM={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},UM=function(){function e(){x(this,e),Db(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),Db(this,"json",void 0)}return C(e,[{key:"normalize",value:function(e,t){this.json=e.json;var i=e.json;switch(i.asset&&i.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version ".concat(i.asset.version))}if(!t.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(i),this._convertTopLevelObjectsToArrays(i),function(e){var t,i=new AC(e),r=i.json,s=A(r.images||[]);try{for(s.s();!(t=s.n()).done;){var n=t.value,o=i.getObjectExtension(n,"KHR_binary_glTF");o&&Object.assign(n,o),i.removeObjectExtension(n,"KHR_binary_glTF")}}catch(e){s.e(e)}finally{s.f()}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,i.removeExtension("KHR_binary_glTF")}(e),this._convertObjectIdsToArrayIndices(i),this._updateObjects(i),this._updateMaterial(i)}},{key:"_addAsset",value:function(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}},{key:"_convertTopLevelObjectsToArrays",value:function(e){for(var t in LM)this._convertTopLevelObjectToArray(e,t)}},{key:"_convertTopLevelObjectToArray",value:function(e,t){var i=e[t];if(i&&!Array.isArray(i))for(var r in e[t]=[],i){var s=i[r];s.id=s.id||r;var n=e[t].length;e[t].push(s),this.idToIndexMap[t][r]=n}}},{key:"_convertObjectIdsToArrayIndices",value:function(e){for(var t in LM)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));var i,r=A(e.textures);try{for(r.s();!(i=r.n()).done;){var s=i.value;this._convertTextureIds(s)}}catch(e){r.e(e)}finally{r.f()}var n,o=A(e.meshes);try{for(o.s();!(n=o.n()).done;){var a=n.value;this._convertMeshIds(a)}}catch(e){o.e(e)}finally{o.f()}var l,u=A(e.nodes);try{for(u.s();!(l=u.n()).done;){var c=l.value;this._convertNodeIds(c)}}catch(e){u.e(e)}finally{u.f()}var h,d=A(e.scenes);try{for(d.s();!(h=d.n()).done;){var p=h.value;this._convertSceneIds(p)}}catch(e){d.e(e)}finally{d.f()}}},{key:"_convertTextureIds",value:function(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}},{key:"_convertMeshIds",value:function(e){var t,i=A(e.primitives);try{for(i.s();!(t=i.n()).done;){var r=t.value,s=r.attributes,n=r.indices,o=r.material;for(var a in s)s[a]=this._convertIdToIndex(s[a],"accessor");n&&(r.indices=this._convertIdToIndex(n,"accessor")),o&&(r.material=this._convertIdToIndex(o,"material"))}}catch(e){i.e(e)}finally{i.f()}}},{key:"_convertNodeIds",value:function(e){var t=this;e.children&&(e.children=e.children.map((function(e){return t._convertIdToIndex(e,"node")}))),e.meshes&&(e.meshes=e.meshes.map((function(e){return t._convertIdToIndex(e,"mesh")})))}},{key:"_convertSceneIds",value:function(e){var t=this;e.nodes&&(e.nodes=e.nodes.map((function(e){return t._convertIdToIndex(e,"node")})))}},{key:"_convertIdsToIndices",value:function(e,t){e[t]||(console.warn("gltf v1: json doesn't contain attribute ".concat(t)),e[t]=[]);var i,r=A(e[t]);try{for(r.s();!(i=r.n()).done;){var s=i.value;for(var n in s){var o=s[n],a=this._convertIdToIndex(o,n);s[n]=a}}}catch(e){r.e(e)}finally{r.f()}}},{key:"_convertIdToIndex",value:function(e,t){var i=RM[t];if(i in this.idToIndexMap){var r=this.idToIndexMap[i][e];if(!Number.isFinite(r))throw new Error("gltf v1: failed to resolve ".concat(t," with id ").concat(e));return r}return e}},{key:"_updateObjects",value:function(e){var t,i=A(this.json.buffers);try{for(i.s();!(t=i.n()).done;){delete t.value.type}}catch(e){i.e(e)}finally{i.f()}}},{key:"_updateMaterial",value:function(e){var t,i=A(e.materials);try{var r=function(){var i=t.value;i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};var r=(null===(s=i.values)||void 0===s?void 0:s.tex)||(null===(n=i.values)||void 0===n?void 0:n.texture2d_0),o=e.textures.findIndex((function(e){return e.id===r}));-1!==o&&(i.pbrMetallicRoughness.baseColorTexture={index:o})};for(i.s();!(t=i.n()).done;){var s,n;r()}}catch(e){i.e(e)}finally{i.f()}}}]),e}();function OM(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(new UM).normalize(e,t)}var NM={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},QM={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},VM=10240,HM=10241,jM=10242,GM=10243,zM=10497,WM=9986,KM={magFilter:VM,minFilter:HM,wrapS:jM,wrapT:GM},XM=(o(e={},VM,9729),o(e,HM,WM),o(e,jM,zM),o(e,GM,zM),e);var YM=function(){function e(){x(this,e),Db(this,"baseUri",""),Db(this,"json",{}),Db(this,"buffers",[]),Db(this,"images",[])}return C(e,[{key:"postProcess",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.json,r=e.buffers,s=void 0===r?[]:r,n=e.images,o=void 0===n?[]:n,a=e.baseUri,l=void 0===a?"":a;return JP(i),this.baseUri=l,this.json=i,this.buffers=s,this.images=o,this._resolveTree(this.json,t),this.json}},{key:"_resolveTree",value:function(e){var t=this;e.bufferViews&&(e.bufferViews=e.bufferViews.map((function(e,i){return t._resolveBufferView(e,i)}))),e.images&&(e.images=e.images.map((function(e,i){return t._resolveImage(e,i)}))),e.samplers&&(e.samplers=e.samplers.map((function(e,i){return t._resolveSampler(e,i)}))),e.textures&&(e.textures=e.textures.map((function(e,i){return t._resolveTexture(e,i)}))),e.accessors&&(e.accessors=e.accessors.map((function(e,i){return t._resolveAccessor(e,i)}))),e.materials&&(e.materials=e.materials.map((function(e,i){return t._resolveMaterial(e,i)}))),e.meshes&&(e.meshes=e.meshes.map((function(e,i){return t._resolveMesh(e,i)}))),e.nodes&&(e.nodes=e.nodes.map((function(e,i){return t._resolveNode(e,i)}))),e.skins&&(e.skins=e.skins.map((function(e,i){return t._resolveSkin(e,i)}))),e.scenes&&(e.scenes=e.scenes.map((function(e,i){return t._resolveScene(e,i)}))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene])}},{key:"getScene",value:function(e){return this._get("scenes",e)}},{key:"getNode",value:function(e){return this._get("nodes",e)}},{key:"getSkin",value:function(e){return this._get("skins",e)}},{key:"getMesh",value:function(e){return this._get("meshes",e)}},{key:"getMaterial",value:function(e){return this._get("materials",e)}},{key:"getAccessor",value:function(e){return this._get("accessors",e)}},{key:"getCamera",value:function(e){return null}},{key:"getTexture",value:function(e){return this._get("textures",e)}},{key:"getSampler",value:function(e){return this._get("samplers",e)}},{key:"getImage",value:function(e){return this._get("images",e)}},{key:"getBufferView",value:function(e){return this._get("bufferViews",e)}},{key:"getBuffer",value:function(e){return this._get("buffers",e)}},{key:"_get",value:function(e,t){if("object"===B(t))return t;var i=this.json[e]&&this.json[e][t];return i||console.warn("glTF file error: Could not find ".concat(e,"[").concat(t,"]")),i}},{key:"_resolveScene",value:function(e,t){var i=this;return e.id=e.id||"scene-".concat(t),e.nodes=(e.nodes||[]).map((function(e){return i.getNode(e)})),e}},{key:"_resolveNode",value:function(e,t){var i=this;return e.id=e.id||"node-".concat(t),e.children&&(e.children=e.children.map((function(e){return i.getNode(e)}))),void 0!==e.mesh?e.mesh=this.getMesh(e.mesh):void 0!==e.meshes&&e.meshes.length&&(e.mesh=e.meshes.reduce((function(e,t){var r=i.getMesh(t);return e.id=r.id,e.primitives=e.primitives.concat(r.primitives),e}),{primitives:[]})),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}},{key:"_resolveSkin",value:function(e,t){return e.id=e.id||"skin-".concat(t),e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}},{key:"_resolveMesh",value:function(e,t){var i=this;return e.id=e.id||"mesh-".concat(t),e.primitives&&(e.primitives=e.primitives.map((function(e){var t=(e=n({},e)).attributes;for(var r in e.attributes={},t)e.attributes[r]=i.getAccessor(t[r]);return void 0!==e.indices&&(e.indices=i.getAccessor(e.indices)),void 0!==e.material&&(e.material=i.getMaterial(e.material)),e}))),e}},{key:"_resolveMaterial",value:function(e,t){if(e.id=e.id||"material-".concat(t),e.normalTexture&&(e.normalTexture=n({},e.normalTexture),e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture=n({},e.occlustionTexture),e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture=n({},e.emmisiveTexture),e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.emissiveFactor||(e.emissiveFactor=e.emmisiveTexture?[1,1,1]:[0,0,0]),e.pbrMetallicRoughness){e.pbrMetallicRoughness=n({},e.pbrMetallicRoughness);var i=e.pbrMetallicRoughness;i.baseColorTexture&&(i.baseColorTexture=n({},i.baseColorTexture),i.baseColorTexture.texture=this.getTexture(i.baseColorTexture.index)),i.metallicRoughnessTexture&&(i.metallicRoughnessTexture=n({},i.metallicRoughnessTexture),i.metallicRoughnessTexture.texture=this.getTexture(i.metallicRoughnessTexture.index))}return e}},{key:"_resolveAccessor",value:function(e,t){var i,r;if(e.id=e.id||"accessor-".concat(t),void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(i=e.componentType,QM[i]),e.components=(r=e.type,NM[r]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){var s=e.bufferView.buffer,n=aC(e,e.bufferView),o=n.ArrayType,a=n.byteLength,l=(e.bufferView.byteOffset||0)+(e.byteOffset||0)+s.byteOffset,u=s.arrayBuffer.slice(l,l+a);e.bufferView.byteStride&&(u=this._getValueFromInterleavedBuffer(s,l,e.bufferView.byteStride,e.bytesPerElement,e.count)),e.value=new o(u)}return e}},{key:"_getValueFromInterleavedBuffer",value:function(e,t,i,r,s){for(var n=new Uint8Array(s*r),o=0;o1&&void 0!==arguments[1]?arguments[1]:0;return"".concat(String.fromCharCode(e.getUint8(t+0))).concat(String.fromCharCode(e.getUint8(t+1))).concat(String.fromCharCode(e.getUint8(t+2))).concat(String.fromCharCode(e.getUint8(t+3)))}function $M(e,t,i){wb(e.header.byteLength>20);var r=t.getUint32(i+0,ZM),s=t.getUint32(i+4,ZM);return i+=8,wb(0===s),tE(e,t,i,r),i+=r,i+=iE(e,t,i,e.header.byteLength)}function eE(e,t,i,r){return wb(e.header.byteLength>20),function(e,t,i,r){for(;i+8<=e.header.byteLength;){var s=t.getUint32(i+0,ZM),n=t.getUint32(i+4,ZM);switch(i+=8,n){case 1313821514:tE(e,t,i,s);break;case 5130562:iE(e,t,i,s);break;case 0:r.strict||tE(e,t,i,s);break;case 1:r.strict||iE(e,t,i,s)}i+=hw(s,4)}}(e,t,i,r),i+e.header.byteLength}function tE(e,t,i,r){var s=new Uint8Array(t.buffer,i,r),n=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(n),hw(r,4)}function iE(e,t,i,r){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:i,byteLength:r,arrayBuffer:t.buffer}),hw(r,4)}function rE(e,t){return sE.apply(this,arguments)}function sE(){return sE=u(a().mark((function e(t,i){var r,s,n,o,l,u,A,c,h,d,p=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=p.length>2&&void 0!==p[2]?p[2]:0,s=p.length>3?p[3]:void 0,n=p.length>4?p[4]:void 0,nE(t,i,r,s),OM(t,{normalize:null==s||null===(o=s.gltf)||void 0===o?void 0:o.normalize}),IM(t,s,n),c=[],null==s||null===(l=s.gltf)||void 0===l||!l.loadBuffers||!t.json.buffers){e.next=10;break}return e.next=10,oE(t,s,n);case 10:return null!=s&&null!==(u=s.gltf)&&void 0!==u&&u.loadImages&&(h=lE(t,s,n),c.push(h)),d=DM(t,s,n),c.push(d),e.next=15,Promise.all(c);case 15:return e.abrupt("return",null!=s&&null!==(A=s.gltf)&&void 0!==A&&A.postProcess?JM(t,s):t);case 16:case"end":return e.stop()}}),e)}))),sE.apply(this,arguments)}function nE(e,t,i,r){(r.uri&&(e.baseUri=r.uri),t instanceof ArrayBuffer&&!function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new DataView(e),s=i.magic,n=void 0===s?1735152710:s,o=r.getUint32(t,!1);return o===n||1735152710===o}(t,i,r))&&(t=(new TextDecoder).decode(t));if("string"==typeof t)e.json=aw(t);else if(t instanceof ArrayBuffer){var s={};i=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=new DataView(t),s=qM(r,i+0),n=r.getUint32(i+4,ZM),o=r.getUint32(i+8,ZM);switch(Object.assign(e,{header:{byteOffset:i,byteLength:o,hasBinChunk:!1},type:s,version:n,json:{},binChunks:[]}),i+=12,e.version){case 1:return $M(e,r,i);case 2:return eE(e,r,i,{});default:throw new Error("Invalid GLB version ".concat(e.version,". Only supports v1 and v2."))}}(s,t,i,r.glb),JP("glTF"===s.type,"Invalid GLB magic string ".concat(s.type)),e._glb=s,e.json=s.json}else JP(!1,"GLTF: must be ArrayBuffer or string");var n=e.json.buffers||[];if(e.buffers=new Array(n.length).fill(null),e._glb&&e._glb.header.hasBinChunk){var o=e._glb.binChunks;e.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}var a=e.json.images||[];e.images=new Array(a.length).fill({})}function oE(e,t,i){return aE.apply(this,arguments)}function aE(){return(aE=u(a().mark((function e(t,i,r){var s,n,o,l,u,A,c,h;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=t.json.buffers||[],n=0;case 2:if(!(n1&&void 0!==u[1]?u[1]:{},r=u.length>2?u[2]:void 0,(i=n(n({},dE.options),i)).gltf=n(n({},dE.options.gltf),i.gltf),s=i.byteOffset,o=void 0===s?0:s,l={},e.next=8,rE(l,t,o,i,r);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)}))),pE.apply(this,arguments)}var fE=function(){function e(t){x(this,e)}return C(e,[{key:"load",value:function(e,t,i,r,s,n,o){!function(e,t,i,r,s,n,o){var a=e.viewer.scene.canvas.spinner;a.processes++,"glb"===t.split(".").pop()?e.dataSource.getGLB(t,(function(o){r.basePath=gE(t),mE(e,t,o,i,r,s,n),a.processes--}),(function(e){a.processes--,o(e)})):e.dataSource.getGLTF(t,(function(o){r.basePath=gE(t),mE(e,t,o,i,r,s,n),a.processes--}),(function(e){a.processes--,o(e)}))}(e,t,i,r=r||{},s,(function(){Be.scheduleTask((function(){s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1)})),n&&n()}),(function(t){e.error(t),o&&o(t),s.fire("error",t)}))}},{key:"parse",value:function(e,t,i,r,s,n,o){mE(e,"",t,i,r=r||{},s,(function(){s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1),n&&n()}))}}]),e}();function vE(e){for(var t={},i={},r=e.metaObjects||[],s={},n=0,o=r.length;n0)for(var A=0;A0){null==y&&e.log("Warning: 'name' properties not found on glTF scene nodes - will randomly-generate object IDs in XKT");var b=y;if(e.metaModelCorrections){var w=e.metaModelCorrections.eachChildRoot[b];if(w){var B=e.metaModelCorrections.eachRootStats[w.id];B.countChildren++,B.countChildren>=B.numChildren&&(n.createEntity({id:w.id,meshIds:BE,isObject:!0}),BE.length=0)}else{e.metaModelCorrections.metaObjectsMap[b]&&(n.createEntity({id:b,meshIds:BE,isObject:!0}),BE.length=0)}}else n.createEntity({id:b,meshIds:BE,isObject:!0}),BE.length=0}}}function PE(e,t){e.plugin.error(t)}var CE={DEFAULT:{}},ME=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"GLTFLoader",e,s))._sceneModelLoader=new fE(b(r),s),r.dataSource=s.dataSource,r.objectDefaults=s.objectDefaults,r}return C(i,[{key:"dataSource",get:function(){return this._dataSource},set:function(e){this._dataSource=e||new Yh}},{key:"objectDefaults",get:function(){return this._objectDefaults},set:function(e){this._objectDefaults=e||CE}},{key:"load",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.id&&this.viewer.scene.components[t.id]&&(this.error("Component with this ID already exists in viewer: "+t.id+" - will autogenerate this ID"),delete t.id);var i=new Ph(this.viewer.scene,he.apply(t,{isModel:!0,dtxEnabled:t.dtxEnabled})),r=i.id;if(!t.src&&!t.gltf)return this.error("load() param expected: src or gltf"),i;if(t.metaModelSrc||t.metaModelJSON){var s=t.objectDefaults||this._objectDefaults||CE,n=function(n){var o;if(e.viewer.metaScene.createMetaModel(r,n,{includeTypes:t.includeTypes,excludeTypes:t.excludeTypes}),e.viewer.scene.canvas.spinner.processes--,t.includeTypes){o={};for(var a=0,l=t.includeTypes.length;a2&&void 0!==arguments[2]?arguments[2]:{},r="lightgrey",s=i.hoverColor||"rgba(0,0,0,0.4)",n=i.textColor||"black",o=500,a=o+o/3,l=a/24,u=[{boundary:[6,6,6,6],color:i.frontColor||i.color||"#55FF55"},{boundary:[18,6,6,6],color:i.backColor||i.color||"#55FF55"},{boundary:[12,6,6,6],color:i.rightColor||i.color||"#FF5555"},{boundary:[0,6,6,6],color:i.leftColor||i.color||"#FF5555"},{boundary:[6,0,6,6],color:i.topColor||i.color||"#7777FF"},{boundary:[6,12,6,6],color:i.bottomColor||i.color||"#7777FF"}],A=[{label:"NavCube.front",boundaries:[[7,7,4,4]],dir:[0,1,0],up:[0,0,1]},{label:"NavCube.back",boundaries:[[19,7,4,4]],dir:[0,-1,0],up:[0,0,1]},{label:"NavCube.right",boundaries:[[13,7,4,4]],dir:[-1,0,0],up:[0,0,1]},{label:"NavCube.left",boundaries:[[1,7,4,4]],dir:[1,0,0],up:[0,0,1]},{label:"NavCube.top",boundaries:[[7,1,4,4]],dir:[0,0,-1],up:[0,1,0]},{label:"NavCube.bottom",boundaries:[[7,13,4,4]],dir:[0,0,1],up:[0,-1,0]},{boundaries:[[7,5,4,2]],dir:[0,1,-1],up:[0,1,1]},{boundaries:[[1,6,4,1],[6,1,1,4]],dir:[1,0,-1],up:[1,0,1]},{boundaries:[[7,0,4,1],[19,6,4,1]],dir:[0,-1,-1],up:[0,-1,1]},{boundaries:[[13,6,4,1],[11,1,1,4]],dir:[-1,0,-1],up:[-1,0,1]},{boundaries:[[7,11,4,2]],dir:[0,1,1],up:[0,-1,1]},{boundaries:[[1,11,4,1],[6,13,1,4]],dir:[1,0,1],up:[-1,0,1]},{boundaries:[[7,17,4,1],[19,11,4,1]],dir:[0,-1,1],up:[0,1,1]},{boundaries:[[13,11,4,1],[11,13,1,4]],dir:[-1,0,1],up:[1,0,1]},{boundaries:[[5,7,2,4]],dir:[1,1,0],up:[0,0,1]},{boundaries:[[11,7,2,4]],dir:[-1,1,0],up:[0,0,1]},{boundaries:[[17,7,2,4]],dir:[-1,-1,0],up:[0,0,1]},{boundaries:[[0,7,1,4],[23,7,1,4]],dir:[1,-1,0],up:[0,0,1]},{boundaries:[[5,11,2,2]],dir:[1,1,1],up:[-1,-1,1]},{boundaries:[[23,11,1,1],[6,17,1,1],[0,11,1,1]],dir:[1,-1,1],up:[-1,1,1]},{boundaries:[[5,5,2,2]],dir:[1,1,-1],up:[1,1,1]},{boundaries:[[11,17,1,1],[17,11,2,1]],dir:[-1,-1,1],up:[1,1,1]},{boundaries:[[17,6,2,1],[11,0,1,1]],dir:[-1,-1,-1],up:[-1,-1,1]},{boundaries:[[11,11,2,2]],dir:[-1,1,1],up:[1,-1,1]},{boundaries:[[0,6,1,1],[6,0,1,1],[23,6,1,1]],dir:[1,-1,-1],up:[1,-1,1]},{boundaries:[[11,5,2,2]],dir:[-1,1,-1],up:[-1,1,1]}];i.frontColor||i.color,i.backColor||i.color,i.rightColor||i.color,i.leftColor||i.color,i.topColor||i.color,i.bottomColor||i.color;for(var c=[{yUp:"",label:"NavCube.front",boundaries:[[7,7,4,4]],dir:[0,0,-1],up:[0,1,0]},{label:"NavCube.back",boundaries:[[19,7,4,4]],dir:[0,0,1],up:[0,1,0]},{label:"NavCube.right",boundaries:[[13,7,4,4]],dir:[-1,0,0],up:[0,1,0]},{label:"NavCube.left",boundaries:[[1,7,4,4]],dir:[1,0,0],up:[0,1,0]},{label:"NavCube.top",boundaries:[[7,1,4,4]],dir:[0,-1,0],up:[0,0,-1]},{label:"NavCube.bottom",boundaries:[[7,13,4,4]],dir:[0,1,0],up:[0,0,1]},{boundaries:[[7,5,4,2]],dir:[0,-.7071,-.7071],up:[0,.7071,-.7071]},{boundaries:[[1,6,4,1],[6,1,1,4]],dir:[1,-1,0],up:[1,1,0]},{boundaries:[[7,0,4,1],[19,6,4,1]],dir:[0,-.7071,.7071],up:[0,.7071,.7071]},{boundaries:[[13,6,4,1],[11,1,1,4]],dir:[-1,-1,0],up:[-1,1,0]},{boundaries:[[7,11,4,2]],dir:[0,1,-1],up:[0,1,1]},{boundaries:[[1,11,4,1],[6,13,1,4]],dir:[1,1,0],up:[-1,1,0]},{boundaries:[[7,17,4,1],[19,11,4,1]],dir:[0,1,1],up:[0,1,-1]},{boundaries:[[13,11,4,1],[11,13,1,4]],dir:[-1,1,0],up:[1,1,0]},{boundaries:[[5,7,2,4]],dir:[1,0,-1],up:[0,1,0]},{boundaries:[[11,7,2,4]],dir:[-1,0,-1],up:[0,1,0]},{boundaries:[[17,7,2,4]],dir:[-1,0,1],up:[0,1,0]},{boundaries:[[0,7,1,4],[23,7,1,4]],dir:[1,0,1],up:[0,1,0]},{boundaries:[[5,11,2,2]],dir:[.5,.7071,-.5],up:[-.5,.7071,.5]},{boundaries:[[23,11,1,1],[6,17,1,1],[0,11,1,1]],dir:[.5,.7071,.5],up:[-.5,.7071,-.5]},{boundaries:[[5,5,2,2]],dir:[.5,-.7071,-.5],up:[.5,.7071,-.5]},{boundaries:[[11,17,1,1],[17,11,2,1]],dir:[-.5,.7071,.5],up:[.5,.7071,-.5]},{boundaries:[[17,6,2,1],[11,0,1,1]],dir:[-.5,-.7071,.5],up:[-.5,.7071,.5]},{boundaries:[[11,11,2,2]],dir:[-.5,.7071,-.5],up:[.5,.7071,.5]},{boundaries:[[0,6,1,1],[6,0,1,1],[23,6,1,1]],dir:[.5,-.7071,.5],up:[.5,.7071,.5]},{boundaries:[[11,5,2,2]],dir:[-.5,-.7071,-.5],up:[-.5,.7071,-.5]}],h=0,d=A.length;h=c[0]*l&&t<=(c[0]+c[2])*l&&i>=c[1]*l&&i<=(c[1]+c[3])*l)return r}return-1},this.setAreaHighlighted=function(e,t){var i=v[e];if(!i)throw"Area not found: "+e;i.highlighted=!!t,y()},this.getAreaDir=function(e){var t=v[e];if(!t)throw"Unknown area: "+e;return t.dir},this.getAreaUp=function(e){var t=v[e];if(!t)throw"Unknown area: "+e;return t.up},this.getImage=function(){return this._textureCanvas},this.destroy=function(){this._textureCanvas&&(this._textureCanvas.parentNode.removeChild(this._textureCanvas),this._textureCanvas=null)}}var FE=re.vec3(),kE=re.vec3();re.mat4();var IE=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),r=t.call(this,"NavCube",e,s),e.navCube=b(r);var n=!0;try{r._navCubeScene=new cr(e,{canvasId:s.canvasId,canvasElement:s.canvasElement,transparent:!0}),r._navCubeCanvas=r._navCubeScene.canvas.canvas,r._navCubeScene.input.keyboardEnabled=!1}catch(e){return r.error(e),y(r)}var o=r._navCubeScene;o.clearLights(),new Si(o,{dir:[.4,-.4,.8],color:[.8,1,1],intensity:1,space:"view"}),new Si(o,{dir:[-.8,-.3,-.4],color:[.8,.8,.8],intensity:1,space:"view"}),new Si(o,{dir:[.8,-.6,-.8],color:[1,1,1],intensity:1,space:"view"}),r._navCubeCamera=o.camera,r._navCubeCamera.ortho.scale=7,r._navCubeCamera.ortho.near=.1,r._navCubeCamera.ortho.far=2e3,o.edgeMaterial.edgeColor=[.2,.2,.2],o.edgeMaterial.edgeAlpha=.6,r._zUp=Boolean(e.camera.zUp);var a=b(r);r.setIsProjectNorth(s.isProjectNorth),r.setProjectNorthOffsetAngle(s.projectNorthOffsetAngle);var l,u=(l=re.mat4(),function(e,t,i){return re.identityMat4(l),re.rotationMat4v(e*a._projectNorthOffsetAngle*re.DEGTORAD,[0,1,0],l),re.transformVec3(l,t,i)});r._synchCamera=function(){var t=re.rotationMat4c(-90*re.DEGTORAD,1,0,0),i=re.vec3(),r=re.vec3(),s=re.vec3();return function(){var n=e.camera.eye,o=e.camera.look,l=e.camera.up;i=re.mulVec3Scalar(re.normalizeVec3(re.subVec3(n,o,i)),5),a._isProjectNorth&&a._projectNorthOffsetAngle&&(i=u(-1,i,FE),l=u(-1,l,kE)),a._zUp?(re.transformVec3(t,i,r),re.transformVec3(t,l,s),a._navCubeCamera.look=[0,0,0],a._navCubeCamera.eye=re.transformVec3(t,i,r),a._navCubeCamera.up=re.transformPoint3(t,l,s)):(a._navCubeCamera.look=[0,0,0],a._navCubeCamera.eye=i,a._navCubeCamera.up=l)}}(),r._cubeTextureCanvas=new EE(e,o,s),r._cubeSampler=new Jn(o,{image:r._cubeTextureCanvas.getImage(),flipY:!0,wrapS:1001,wrapT:1001}),r._cubeMesh=new gn(o,{geometry:new Wi(o,{primitive:"triangles",normals:[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1],uv:[.5,.6666,.25,.6666,.25,.3333,.5,.3333,.5,.6666,.5,.3333,.75,.3333,.75,.6666,.5,.6666,.5,1,.25,1,.25,.6666,.25,.6666,0,.6666,0,.3333,.25,.3333,.25,0,.5,0,.5,.3333,.25,.3333,.75,.3333,1,.3333,1,.6666,.75,.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),material:new Zi(o,{diffuse:[.4,.4,.4],specular:[.4,.4,.4],emissive:[.6,.6,.6],diffuseMap:r._cubeSampler,emissiveMap:r._cubeSampler}),visible:!!n,edges:!0}),r._shadow=!1===s.shadowVisible?null:new gn(o,{geometry:new Wi(o,_n({center:[0,0,0],radiusTop:.001,radiusBottom:1.4,height:.01,radialSegments:20,heightSegments:1,openEnded:!0})),material:new Zi(o,{diffuse:[0,0,0],specular:[0,0,0],emissive:[0,0,0],alpha:.5}),position:[0,-1.5,0],visible:!!n,pickable:!1,backfaces:!1}),r._onCameraMatrix=e.camera.on("matrix",r._synchCamera),r._onCameraWorldAxis=e.camera.on("worldAxis",(function(){e.camera.zUp?(r._zUp=!0,r._cubeTextureCanvas.setZUp(),r._repaint(),r._synchCamera()):e.camera.yUp&&(r._zUp=!1,r._cubeTextureCanvas.setYUp(),r._repaint(),r._synchCamera())})),r._onCameraFOV=e.camera.perspective.on("fov",(function(e){r._synchProjection&&(r._navCubeCamera.perspective.fov=e)})),r._onCameraProjection=e.camera.on("projection",(function(e){r._synchProjection&&(r._navCubeCamera.projection="ortho"===e||"perspective"===e?e:"perspective")}));var A=-1;function c(t,i){var r=(t-d)*-_,s=(i-p)*-_;e.camera.orbitYaw(r),e.camera.orbitPitch(-s),d=t,p=i}function h(e){var t=[0,0];if(e){for(var i=e.target,r=0,s=0;i.offsetParent;)r+=i.offsetLeft,s+=i.offsetTop,i=i.offsetParent;t[0]=e.pageX-r,t[1]=e.pageY-s}else e=window.event,t[0]=e.x,t[1]=e.y;return t}var d,p,f=null,v=null,g=!1,m=!1,_=.5;a._navCubeCanvas.addEventListener("mouseenter",a._onMouseEnter=function(e){m=!0}),a._navCubeCanvas.addEventListener("mouseleave",a._onMouseLeave=function(e){m=!1}),a._navCubeCanvas.addEventListener("mousedown",a._onMouseDown=function(e){if(1===e.which){f=e.x,v=e.y,d=e.clientX,p=e.clientY;var t=h(e),i=o.pick({canvasPos:t});g=!!i}}),document.addEventListener("mouseup",a._onMouseUp=function(e){if(1===e.which&&(g=!1,null!==f)){var t=h(e),i=o.pick({canvasPos:t,pickSurface:!0});if(i&&i.uv){var r=a._cubeTextureCanvas.getArea(i.uv);if(r>=0&&(document.body.style.cursor="pointer",A>=0&&(a._cubeTextureCanvas.setAreaHighlighted(A,!1),a._repaint(),A=-1),r>=0)){if(a._cubeTextureCanvas.setAreaHighlighted(r,!0),A=r,a._repaint(),e.xf+3||e.yv+3)return;var s=a._cubeTextureCanvas.getAreaDir(r);if(s){var n=a._cubeTextureCanvas.getAreaUp(r);a._isProjectNorth&&a._projectNorthOffsetAngle&&(s=u(1,s,FE),n=u(1,n,kE)),w(s,n,(function(){A>=0&&(a._cubeTextureCanvas.setAreaHighlighted(A,!1),a._repaint(),A=-1),document.body.style.cursor="pointer",A>=0&&(a._cubeTextureCanvas.setAreaHighlighted(A,!1),a._repaint(),A=-1),r>=0&&(a._cubeTextureCanvas.setAreaHighlighted(r,!1),A=-1,a._repaint())}))}}}}}),document.addEventListener("mousemove",a._onMouseMove=function(e){if(A>=0&&(a._cubeTextureCanvas.setAreaHighlighted(A,!1),a._repaint(),A=-1),1!==e.buttons||g){if(g){var t=e.clientX,i=e.clientY;return document.body.style.cursor="move",void c(t,i)}if(m){var r=h(e),s=o.pick({canvasPos:r,pickSurface:!0});if(s){if(s.uv){document.body.style.cursor="pointer";var n=a._cubeTextureCanvas.getArea(s.uv);if(n===A)return;A>=0&&a._cubeTextureCanvas.setAreaHighlighted(A,!1),n>=0&&(a._cubeTextureCanvas.setAreaHighlighted(n,!0),a._repaint(),A=n)}}else document.body.style.cursor="default",A>=0&&(a._cubeTextureCanvas.setAreaHighlighted(A,!1),a._repaint(),A=-1)}}});var w=function(){var t=re.vec3();return function(i,r,s){var n=a._fitVisible?e.scene.getAABB(e.scene.visibleObjectIds):e.scene.aabb,o=re.getAABB3Diag(n);re.getAABB3Center(n,t);var l=Math.abs(o/Math.tan(a._cameraFitFOV*re.DEGTORAD));e.cameraControl.pivotPos=t,a._cameraFly?e.cameraFlight.flyTo({look:t,eye:[t[0]-l*i[0],t[1]-l*i[1],t[2]-l*i[2]],up:r||[0,1,0],orthoScale:1.1*o,fitFOV:a._cameraFitFOV,duration:a._cameraFlyDuration},s):e.cameraFlight.jumpTo({look:t,eye:[t[0]-l*i[0],t[1]-l*i[1],t[2]-l*i[2]],up:r||[0,1,0],orthoScale:1.1*o,fitFOV:a._cameraFitFOV},s)}}();return r._onUpdated=e.localeService.on("updated",(function(){r._cubeTextureCanvas.clear(),r._repaint()})),r.setVisible(s.visible),r.setCameraFitFOV(s.cameraFitFOV),r.setCameraFly(s.cameraFly),r.setCameraFlyDuration(s.cameraFlyDuration),r.setFitVisible(s.fitVisible),r.setSynchProjection(s.synchProjection),r}return C(i,[{key:"send",value:function(e,t){if("language"===e)this._cubeTextureCanvas.clear(),this._repaint()}},{key:"_repaint",value:function(){var e=this._cubeTextureCanvas.getImage();this._cubeMesh.material.diffuseMap.image=e,this._cubeMesh.material.emissiveMap.image=e}},{key:"setVisible",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._navCubeCanvas&&(this._cubeMesh.visible=e,this._shadow&&(this._shadow.visible=e),this._navCubeCanvas.style.visibility=e?"visible":"hidden")}},{key:"getVisible",value:function(){return!!this._navCubeCanvas&&this._cubeMesh.visible}},{key:"setFitVisible",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._fitVisible=e}},{key:"getFitVisible",value:function(){return this._fitVisible}},{key:"setCameraFly",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._cameraFly=e}},{key:"getCameraFly",value:function(){return this._cameraFly}},{key:"setCameraFitFOV",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:45;this._cameraFitFOV=e}},{key:"getCameraFitFOV",value:function(){return this._cameraFitFOV}},{key:"setCameraFlyDuration",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5;this._cameraFlyDuration=e}},{key:"getCameraFlyDuration",value:function(){return this._cameraFlyDuration}},{key:"setSynchProjection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._synchProjection=e}},{key:"getSynchProjection",value:function(){return this._synchProjection}},{key:"setIsProjectNorth",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._isProjectNorth=e}},{key:"getIsProjectNorth",value:function(){return this._isProjectNorth}},{key:"setProjectNorthOffsetAngle",value:function(e){this._projectNorthOffsetAngle=e}},{key:"getProjectNorthOffsetAngle",value:function(){return this._projectNorthOffsetAngle}},{key:"destroy",value:function(){this._navCubeCanvas&&(this.viewer.localeService.off(this._onUpdated),this.viewer.camera.off(this._onCameraMatrix),this.viewer.camera.off(this._onCameraWorldAxis),this.viewer.camera.perspective.off(this._onCameraFOV),this.viewer.camera.off(this._onCameraProjection),this._navCubeCanvas.removeEventListener("mouseenter",this._onMouseEnter),this._navCubeCanvas.removeEventListener("mouseleave",this._onMouseLeave),this._navCubeCanvas.removeEventListener("mousedown",this._onMouseDown),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._navCubeCanvas=null,this._cubeTextureCanvas.destroy(),this._cubeTextureCanvas=null,this._onMouseEnter=null,this._onMouseLeave=null,this._onMouseDown=null,this._onMouseMove=null,this._onMouseUp=null),this._navCubeScene.destroy(),this._navCubeScene=null,this._cubeMesh=null,this._shadow=null,f(w(i.prototype),"destroy",this).call(this)}}]),i}(),DE=re.vec3(),SE=function(){function e(){x(this,e)}return C(e,[{key:"load",value:function(e,t){var i=e.scene.canvas.spinner;i.processes++,TE(e,t,(function(t){RE(e,t,(function(){NE(e,t),i.processes--,Be.scheduleTask((function(){e.fire("loaded",!0,!1)}))}))}))}},{key:"parse",value:function(e,t,i,r){if(t){var s=LE(e,t,null);i&&OE(e,i,r),NE(e,s),e.src=null,e.fire("loaded",!0,!1)}else this.warn("load() param expected: objText")}}]),e}(),TE=function(e,t,i){QE(t,(function(r){var s=LE(e,r,t);i(s)}),(function(t){e.error(t)}))},LE=function(){var e={vertex_pattern:/^v\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,normal_pattern:/^vn\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,uv_pattern:/^vt\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,face_vertex:/^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/,face_vertex_uv:/^f\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+))?/,face_vertex_uv_normal:/^f\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+)\/(-?\d+))?/,face_vertex_normal:/^f\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)(?:\s+(-?\d+)\/\/(-?\d+))?/,object_pattern:/^[og]\s*(.+)?/,smoothing_pattern:/^s\s+(\d+|on|off)/,material_library_pattern:/^mtllib /,material_use_pattern:/^usemtl /};return function(r,s,n){var o={src:n=n||"",basePath:t(n),objects:[],object:{},positions:[],normals:[],uv:[],materialLibraries:{}};i(o,"",!1),-1!==s.indexOf("\r\n")&&(s=s.replace("\r\n","\n"));for(var a=s.split("\n"),l="",u="",A="",d=[],p="function"==typeof"".trimLeft,f=0,v=a.length;f=0?i-1:i+t/3)}function s(e,t){var i=parseInt(e,10);return 3*(i>=0?i-1:i+t/3)}function n(e,t){var i=parseInt(e,10);return 2*(i>=0?i-1:i+t/2)}function o(e,t,i,r){var s=e.positions,n=e.object.geometry.positions;n.push(s[t+0]),n.push(s[t+1]),n.push(s[t+2]),n.push(s[i+0]),n.push(s[i+1]),n.push(s[i+2]),n.push(s[r+0]),n.push(s[r+1]),n.push(s[r+2])}function a(e,t){var i=e.positions,r=e.object.geometry.positions;r.push(i[t+0]),r.push(i[t+1]),r.push(i[t+2])}function l(e,t,i,r){var s=e.normals,n=e.object.geometry.normals;n.push(s[t+0]),n.push(s[t+1]),n.push(s[t+2]),n.push(s[i+0]),n.push(s[i+1]),n.push(s[i+2]),n.push(s[r+0]),n.push(s[r+1]),n.push(s[r+2])}function u(e,t,i,r){var s=e.uv,n=e.object.geometry.uv;n.push(s[t+0]),n.push(s[t+1]),n.push(s[i+0]),n.push(s[i+1]),n.push(s[r+0]),n.push(s[r+1])}function A(e,t){var i=e.uv,r=e.object.geometry.uv;r.push(i[t+0]),r.push(i[t+1])}function c(e,t,i,a,A,c,h,d,p,f,v,g,m){var _,y=e.positions.length,b=r(t,y),w=r(i,y),B=r(a,y);if(void 0===A?o(e,b,w,B):(o(e,b,w,_=r(A,y)),o(e,w,B,_)),void 0!==c){var x=e.uv.length;b=n(c,x),w=n(h,x),B=n(d,x),void 0===A?u(e,b,w,B):(u(e,b,w,_=n(p,x)),u(e,w,B,_))}if(void 0!==f){var P=e.normals.length;b=s(f,P),w=f===v?b:s(v,P),B=f===g?b:s(g,P),void 0===A?l(e,b,w,B):(l(e,b,w,_=s(m,P)),l(e,w,B,_))}}function h(e,t,i){e.object.geometry.type="Line";for(var s=e.positions.length,o=e.uv.length,l=0,u=t.length;l=0?o.substring(0,a):o).toLowerCase(),u=(u=a>=0?o.substring(a+1):"").trim(),l.toLowerCase()){case"newmtl":i(e,h),h={id:u},d=!0;break;case"ka":h.ambient=r(u);break;case"kd":h.diffuse=r(u);break;case"ks":h.specular=r(u);break;case"map_kd":h.diffuseMap||(h.diffuseMap=t(e,n,u,"sRGB"));break;case"map_ks":h.specularMap||(h.specularMap=t(e,n,u,"linear"));break;case"map_bump":case"bump":h.normalMap||(h.normalMap=t(e,n,u));break;case"ns":h.shininess=parseFloat(u);break;case"d":(A=parseFloat(u))<1&&(h.alpha=A,h.alphaMode="blend");break;case"tr":(A=parseFloat(u))>0&&(h.alpha=1-A,h.alphaMode="blend")}d&&i(e,h)};function t(e,t,i,r){var s={},n=i.split(/\s+/),o=n.indexOf("-bm");return o>=0&&n.splice(o,2),(o=n.indexOf("-s"))>=0&&(s.scale=[parseFloat(n[o+1]),parseFloat(n[o+2])],n.splice(o,4)),(o=n.indexOf("-o"))>=0&&(s.translate=[parseFloat(n[o+1]),parseFloat(n[o+2])],n.splice(o,4)),s.src=t+n.join(" ").trim(),s.flipY=!0,s.encoding=r||"linear",new Jn(e,s).id}function i(e,t){new Zi(e,t)}function r(t){var i=t.split(e,3);return[parseFloat(i[0]),parseFloat(i[1]),parseFloat(i[2])]}}();function NE(e,t){for(var i=0,r=t.objects.length;i0&&(o.normals=n.normals),n.uv.length>0&&(o.uv=n.uv);for(var a=new Array(o.positions.length/3),l=0;l0&&void 0!==arguments[0]?arguments[0]:{};t.id&&this.viewer.scene.components[t.id]&&(this.error("Component with this ID already exists in viewer: "+t.id+" - will autogenerate this ID"),delete t.id);var i=new Tn(this.viewer.scene,he.apply(t,{isModel:!0})),r=i.id,s=t.src;if(!s)return this.error("load() param expected: src"),i;if(t.metaModelSrc){var n=t.metaModelSrc;he.loadJSON(n,(function(n){e.viewer.metaScene.createMetaModel(r,n),e._sceneGraphLoader.load(i,s,t)}),(function(t){e.error("load(): Failed to load model modelMetadata for model '".concat(r," from '").concat(n,"' - ").concat(t))}))}else this._sceneGraphLoader.load(i,s,t);return i.once("destroyed",(function(){e.viewer.metaScene.destroyMetaModel(r)})),i}},{key:"destroy",value:function(){f(w(i.prototype),"destroy",this).call(this)}}]),i}(),HE=new Float64Array([0,0,1]),jE=new Float64Array(4),GE=function(){function e(t){x(this,e),this.id=null,this._viewer=t.viewer,this._visible=!1,this._pos=re.vec3(),this._origin=re.vec3(),this._rtcPos=re.vec3(),this._baseDir=re.vec3(),this._rootNode=null,this._displayMeshes=null,this._affordanceMeshes=null,this._ignoreNextSectionPlaneDirUpdate=!1,this._createNodes(),this._bindEvents()}return C(e,[{key:"_setSectionPlane",value:function(e){var t=this;this._sectionPlane&&(this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._onSectionPlanePos=null,this._onSectionPlaneDir=null,this._sectionPlane=null),e&&(this.id=e.id,this._setPos(e.pos),this._setDir(e.dir),this._sectionPlane=e,this._onSectionPlanePos=e.on("pos",(function(){t._setPos(t._sectionPlane.pos)})),this._onSectionPlaneDir=e.on("dir",(function(){t._ignoreNextSectionPlaneDirUpdate?t._ignoreNextSectionPlaneDirUpdate=!1:t._setDir(t._sectionPlane.dir)})))}},{key:"sectionPlane",get:function(){return this._sectionPlane}},{key:"_setPos",value:function(e){this._pos.set(e),He(this._pos,this._origin,this._rtcPos),this._rootNode.origin=this._origin,this._rootNode.position=this._rtcPos}},{key:"_setDir",value:function(e){this._baseDir.set(e),this._rootNode.quaternion=re.vec3PairToQuaternion(HE,e,jE)}},{key:"_setSectionPlaneDir",value:function(e){this._sectionPlane&&(this._ignoreNextSectionPlaneDirUpdate=!0,this._sectionPlane.dir=e)}},{key:"setVisible",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this._visible!==e){var t;for(t in this._visible=e,this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].visible=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].visible=e)}}},{key:"getVisible",value:function(){return this._visible}},{key:"setCulled",value:function(e){var t;for(t in this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].culled=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].culled=e)}},{key:"_createNodes",value:function(){var e=!1,t=this._viewer.scene,i=.01;this._rootNode=new Tn(t,{position:[0,0,0],scale:[5,5,5],isObject:!1});var r,s,n=this._rootNode,o={arrowHead:new Wi(n,_n({radiusTop:.001,radiusBottom:.07,radialSegments:32,heightSegments:1,height:.2,openEnded:!1})),arrowHeadBig:new Wi(n,_n({radiusTop:.001,radiusBottom:.09,radialSegments:32,heightSegments:1,height:.25,openEnded:!1})),arrowHeadHandle:new Wi(n,_n({radiusTop:.09,radiusBottom:.09,radialSegments:8,heightSegments:1,height:.37,openEnded:!1})),curve:new Wi(n,lo({radius:.8,tube:i,radialSegments:64,tubeSegments:14,arc:2*Math.PI/4})),curveHandle:new Wi(n,lo({radius:.8,tube:.06,radialSegments:64,tubeSegments:14,arc:2*Math.PI/4})),hoop:new Wi(n,lo({radius:.8,tube:i,radialSegments:64,tubeSegments:8,arc:2*Math.PI})),axis:new Wi(n,_n({radiusTop:i,radiusBottom:i,radialSegments:20,heightSegments:1,height:1,openEnded:!1})),axisHandle:new Wi(n,_n({radiusTop:.08,radiusBottom:.08,radialSegments:20,heightSegments:1,height:1,openEnded:!1}))},a={pickable:new Zi(n,{diffuse:[1,1,0],alpha:0,alphaMode:"blend"}),red:new Zi(n,{diffuse:[1,0,0],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightRed:new $i(n,{edges:!1,fill:!0,fillColor:[1,0,0],fillAlpha:.6}),green:new Zi(n,{diffuse:[0,1,0],emissive:[0,1,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightGreen:new $i(n,{edges:!1,fill:!0,fillColor:[0,1,0],fillAlpha:.6}),blue:new Zi(n,{diffuse:[0,0,1],emissive:[0,0,1],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightBlue:new $i(n,{edges:!1,fill:!0,fillColor:[0,0,1],fillAlpha:.2}),center:new Zi(n,{diffuse:[0,0,0],emissive:[0,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80}),highlightBall:new $i(n,{edges:!1,fill:!0,fillColor:[.5,.5,.5],fillAlpha:.5,vertices:!1}),highlightPlane:new $i(n,{edges:!0,edgeWidth:3,fill:!1,fillColor:[.5,.5,.5],fillAlpha:.5,vertices:!1})};this._displayMeshes={plane:n.addChild(new gn(n,{geometry:new Wi(n,{primitive:"triangles",positions:[.5,.5,0,.5,-.5,0,-.5,-.5,0,-.5,.5,0,.5,.5,-0,.5,-.5,-0,-.5,-.5,-0,-.5,.5,-0],indices:[0,1,2,2,3,0]}),material:new Zi(n,{emissive:[0,0,0],diffuse:[0,0,0],backfaces:!0}),opacity:.6,ghosted:!0,ghostMaterial:new $i(n,{edges:!1,filled:!0,fillColor:[1,1,0],edgeColor:[0,0,0],fillAlpha:.1,backfaces:!0}),pickable:!1,collidable:!0,clippable:!1,visible:!1,scale:[2.4,2.4,1],isObject:!1}),e),planeFrame:n.addChild(new gn(n,{geometry:new Wi(n,lo({center:[0,0,0],radius:1.7,tube:.02,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Zi(n,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),highlightMaterial:new $i(n,{edges:!1,edgeColor:[0,0,0],filled:!0,fillColor:[.8,.8,.8],fillAlpha:1}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,.1],rotation:[0,0,45],isObject:!1}),e),xCurve:n.addChild(new gn(n,{geometry:o.curve,material:a.red,matrix:(r=re.rotationMat4v(90*re.DEGTORAD,[0,1,0],re.identityMat4()),s=re.rotationMat4v(270*re.DEGTORAD,[1,0,0],re.identityMat4()),re.mulMat4(s,r,re.identityMat4())),pickable:!1,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),xCurveHandle:n.addChild(new gn(n,{geometry:o.curveHandle,material:a.pickable,matrix:function(){var e=re.rotationMat4v(90*re.DEGTORAD,[0,1,0],re.identityMat4()),t=re.rotationMat4v(270*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),xCurveArrow1:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.red,matrix:function(){var e=re.translateMat4c(0,-.07,-.8,re.identityMat4()),t=re.scaleMat4v([.6,.6,.6],re.identityMat4()),i=re.rotationMat4v(0*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(re.mulMat4(e,t,re.identityMat4()),i,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xCurveArrow2:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.red,matrix:function(){var e=re.translateMat4c(0,-.8,-.07,re.identityMat4()),t=re.scaleMat4v([.6,.6,.6],re.identityMat4()),i=re.rotationMat4v(90*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(re.mulMat4(e,t,re.identityMat4()),i,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yCurve:n.addChild(new gn(n,{geometry:o.curve,material:a.green,rotation:[-90,0,0],pickable:!1,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),yCurveHandle:n.addChild(new gn(n,{geometry:o.curveHandle,material:a.pickable,rotation:[-90,0,0],pickable:!0,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),yCurveArrow1:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.green,matrix:function(){var e=re.translateMat4c(.07,0,-.8,re.identityMat4()),t=re.scaleMat4v([.6,.6,.6],re.identityMat4()),i=re.rotationMat4v(90*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(re.mulMat4(e,t,re.identityMat4()),i,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yCurveArrow2:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.green,matrix:function(){var e=re.translateMat4c(.8,0,-.07,re.identityMat4()),t=re.scaleMat4v([.6,.6,.6],re.identityMat4()),i=re.rotationMat4v(90*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(re.mulMat4(e,t,re.identityMat4()),i,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurve:n.addChild(new gn(n,{geometry:o.curve,material:a.blue,matrix:re.rotationMat4v(180*re.DEGTORAD,[1,0,0],re.identityMat4()),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurveHandle:n.addChild(new gn(n,{geometry:o.curveHandle,material:a.pickable,matrix:re.rotationMat4v(180*re.DEGTORAD,[1,0,0],re.identityMat4()),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurveCurveArrow1:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.blue,matrix:function(){var e=re.translateMat4c(.8,-.07,0,re.identityMat4()),t=re.scaleMat4v([.6,.6,.6],re.identityMat4());return re.mulMat4(e,t,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurveArrow2:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.blue,matrix:function(){var e=re.translateMat4c(.05,-.8,0,re.identityMat4()),t=re.scaleMat4v([.6,.6,.6],re.identityMat4()),i=re.rotationMat4v(90*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(re.mulMat4(e,t,re.identityMat4()),i,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),center:n.addChild(new gn(n,{geometry:new Wi(n,yn({radius:.05})),material:a.center,pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxisArrow:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.red,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxisArrowHandle:n.addChild(new gn(n,{geometry:o.arrowHeadHandle,material:a.pickable,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxis:n.addChild(new gn(n,{geometry:o.axis,material:a.red,matrix:function(){var e=re.translateMat4c(0,.5,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxisHandle:n.addChild(new gn(n,{geometry:o.axisHandle,material:a.pickable,matrix:function(){var e=re.translateMat4c(0,.5,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yAxisArrow:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.green,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(180*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yAxisArrowHandle:n.addChild(new gn(n,{geometry:o.arrowHeadHandle,material:a.pickable,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(180*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,opacity:.2,isObject:!1}),e),yShaft:n.addChild(new gn(n,{geometry:o.axis,material:a.green,position:[0,-.5,0],pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yShaftHandle:n.addChild(new gn(n,{geometry:o.axisHandle,material:a.pickable,position:[0,-.5,0],pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zAxisArrow:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.blue,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[.8,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zAxisArrowHandle:n.addChild(new gn(n,{geometry:o.arrowHeadHandle,material:a.pickable,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[.8,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zShaft:n.addChild(new gn(n,{geometry:o.axis,material:a.blue,matrix:function(){var e=re.translateMat4c(0,.5,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),clippable:!1,pickable:!1,collidable:!0,visible:!1,isObject:!1}),e),zAxisHandle:n.addChild(new gn(n,{geometry:o.axisHandle,material:a.pickable,matrix:function(){var e=re.translateMat4c(0,.5,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),clippable:!1,pickable:!0,collidable:!0,visible:!1,isObject:!1}),e)},this._affordanceMeshes={planeFrame:n.addChild(new gn(n,{geometry:new Wi(n,lo({center:[0,0,0],radius:2,tube:i,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Zi(n,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:!0,highlightMaterial:new $i(n,{edges:!1,filled:!0,fillColor:[1,1,0],fillAlpha:1}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,1],rotation:[0,0,45],isObject:!1}),e),xHoop:n.addChild(new gn(n,{geometry:o.hoop,material:a.red,highlighted:!0,highlightMaterial:a.highlightRed,matrix:function(){var e=re.rotationMat4v(90*re.DEGTORAD,[0,1,0],re.identityMat4()),t=re.rotationMat4v(270*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yHoop:n.addChild(new gn(n,{geometry:o.hoop,material:a.green,highlighted:!0,highlightMaterial:a.highlightGreen,rotation:[-90,0,0],pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zHoop:n.addChild(new gn(n,{geometry:o.hoop,material:a.blue,highlighted:!0,highlightMaterial:a.highlightBlue,matrix:re.rotationMat4v(180*re.DEGTORAD,[1,0,0],re.identityMat4()),pickable:!1,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),xAxisArrow:n.addChild(new gn(n,{geometry:o.arrowHeadBig,material:a.red,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yAxisArrow:n.addChild(new gn(n,{geometry:o.arrowHeadBig,material:a.green,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(180*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zAxisArrow:n.addChild(new gn(n,{geometry:o.arrowHeadBig,material:a.blue,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[.8,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e)}}},{key:"_bindEvents",value:function(){var e=this,t=this,i=!1,r=-1,s=0,n=1,o=2,a=3,l=4,u=5,A=this._rootNode,c=null,h=null,d=re.vec2(),p=re.vec3([1,0,0]),f=re.vec3([0,1,0]),v=re.vec3([0,0,1]),g=this._viewer.scene.canvas.canvas,m=this._viewer.camera,_=this._viewer.scene,y=re.vec3([0,0,0]),b=-1;this._onCameraViewMatrix=_.camera.on("viewMatrix",(function(){})),this._onCameraProjMatrix=_.camera.on("projMatrix",(function(){})),this._onSceneTick=_.on("tick",(function(){var t=Math.abs(re.lenVec3(re.subVec3(_.camera.eye,e._pos,y)));if(t!==b&&"perspective"===m.projection){var i=.07*(Math.tan(m.perspective.fov*re.DEGTORAD)*t);A.scale=[i,i,i],b=t}if("ortho"===m.projection){var r=m.ortho.scale/10;A.scale=[r,r,r],b=t}}));var w,B,x,P,C,M=function(){var e=new Float64Array(2);return function(t){if(t){for(var i=t.target,r=0,s=0;i.offsetParent;)r+=i.offsetLeft,s+=i.offsetTop,i=i.offsetParent;e[0]=t.pageX-r,e[1]=t.pageY-s}else t=window.event,e[0]=t.x,e[1]=t.y;return e}}(),E=function(){var e=re.mat4();return function(i,r){return re.quaternionToMat4(t._rootNode.quaternion,e),re.transformVec3(e,i,r),re.normalizeVec3(r),r}}(),F=(w=re.vec3(),function(e){var t=Math.abs(e[0]);return t>Math.abs(e[1])&&t>Math.abs(e[2])?re.cross3Vec3(e,[0,1,0],w):re.cross3Vec3(e,[1,0,0],w),re.cross3Vec3(w,e,w),re.normalizeVec3(w),w}),k=(B=re.vec3(),x=re.vec3(),P=re.vec4(),function(e,i,r){E(e,P);var s=F(P,i,r);D(i,s,B),D(r,s,x),re.subVec3(x,B);var n=re.dotVec3(x,P);t._pos[0]+=P[0]*n,t._pos[1]+=P[1]*n,t._pos[2]+=P[2]*n,t._rootNode.position=t._pos,t._sectionPlane&&(t._sectionPlane.pos=t._pos)}),I=function(){var e=re.vec4(),i=re.vec4(),r=re.vec4(),s=re.vec4();return function(n,o,a){if(E(n,s),!(D(o,s,e)&&D(a,s,i))){var l=F(s,o,a);D(o,l,e,1),D(a,l,i,1);var u=re.dotVec3(e,s);e[0]-=u*s[0],e[1]-=u*s[1],e[2]-=u*s[2],u=re.dotVec3(i,s),i[0]-=u*s[0],i[1]-=u*s[1],i[2]-=u*s[2]}re.normalizeVec3(e),re.normalizeVec3(i),u=re.dotVec3(e,i),u=re.clamp(u,-1,1);var A=Math.acos(u)*re.RADTODEG;re.cross3Vec3(e,i,r),re.dotVec3(r,s)<0&&(A=-A),t._rootNode.rotate(n,A),S()}}(),D=function(){var e=re.vec4([0,0,0,1]),i=re.mat4();return function(r,s,n,o){o=o||0,e[0]=r[0]/g.width*2-1,e[1]=-(r[1]/g.height*2-1),e[2]=0,e[3]=1,re.mulMat4(m.projMatrix,m.viewMatrix,i),re.inverseMat4(i),re.transformVec4(i,e,e),re.mulVec4Scalar(e,1/e[3]);var a=m.eye;re.subVec4(e,a,e);var l=t._sectionPlane.pos,u=-re.dotVec3(l,s)-o,A=re.dotVec3(s,e);if(Math.abs(A)>.005){var c=-(re.dotVec3(s,a)+u)/A;return re.mulVec3Scalar(e,c,n),re.addVec3(n,a),re.subVec3(n,l,n),!0}return!1}}(),S=function(){var e=re.vec3(),i=re.mat4();return function(){t.sectionPlane&&(re.quaternionToMat4(A.quaternion,i),re.transformVec3(i,[0,0,1],e),t._setSectionPlaneDir(e))}}(),T=!1;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",(function(t){if(e._visible&&!T){var A;switch(i=!1,C&&(C.visible=!1),t.entity.id){case e._displayMeshes.xAxisArrowHandle.id:case e._displayMeshes.xAxisHandle.id:A=e._affordanceMeshes.xAxisArrow,c=s;break;case e._displayMeshes.yAxisArrowHandle.id:case e._displayMeshes.yShaftHandle.id:A=e._affordanceMeshes.yAxisArrow,c=n;break;case e._displayMeshes.zAxisArrowHandle.id:case e._displayMeshes.zAxisHandle.id:A=e._affordanceMeshes.zAxisArrow,c=o;break;case e._displayMeshes.xCurveHandle.id:A=e._affordanceMeshes.xHoop,c=a;break;case e._displayMeshes.yCurveHandle.id:A=e._affordanceMeshes.yHoop,c=l;break;case e._displayMeshes.zCurveHandle.id:A=e._affordanceMeshes.zHoop,c=u;break;default:return void(c=r)}A&&(A.visible=!0),C=A,i=!0}})),this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOutEntity",(function(t){e._visible&&(C&&(C.visible=!1),C=null,c=r)})),g.addEventListener("mousedown",this._canvasMouseDownListener=function(t){if(t.preventDefault(),e._visible&&i&&(e._viewer.cameraControl.pointerEnabled=!1,1===t.which)){T=!0;var r=M(t);h=c,d[0]=r[0],d[1]=r[1]}}),g.addEventListener("mousemove",this._canvasMouseMoveListener=function(t){if(e._visible&&T){var i=M(t),r=i[0],A=i[1];switch(h){case s:k(p,d,i);break;case n:k(f,d,i);break;case o:k(v,d,i);break;case a:I(p,d,i);break;case l:I(f,d,i);break;case u:I(v,d,i)}d[0]=r,d[1]=A}}),g.addEventListener("mouseup",this._canvasMouseUpListener=function(t){e._visible&&(e._viewer.cameraControl.pointerEnabled=!0,T&&(t.which,T=!1,i=!1))}),g.addEventListener("wheel",this._canvasWheelListener=function(t){if(e._visible)Math.max(-1,Math.min(1,40*-t.deltaY))})}},{key:"_destroy",value:function(){this._unbindEvents(),this._destroyNodes()}},{key:"_unbindEvents",value:function(){var e=this._viewer,t=e.scene,i=t.canvas.canvas,r=e.camera,s=e.cameraControl;t.off(this._onSceneTick),i.removeEventListener("mousedown",this._canvasMouseDownListener),i.removeEventListener("mousemove",this._canvasMouseMoveListener),i.removeEventListener("mouseup",this._canvasMouseUpListener),i.removeEventListener("wheel",this._canvasWheelListener),r.off(this._onCameraViewMatrix),r.off(this._onCameraProjMatrix),s.off(this._onCameraControlHover),s.off(this._onCameraControlHoverLeave)}},{key:"_destroyNodes",value:function(){this._setSectionPlane(null),this._rootNode.destroy(),this._displayMeshes={},this._affordanceMeshes={}}}]),e}(),zE=function(){function e(t,i,r){var s=this;x(this,e),this.id=r.id,this._sectionPlane=r,this._mesh=new gn(i,{id:r.id,geometry:new Wi(i,Ki({xSize:.5,ySize:.5,zSize:.001})),material:new Zi(i,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:!1}),edgeMaterial:new tr(i,{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),highlightMaterial:new $i(i,{fill:!0,fillColor:[.5,1,.5],fillAlpha:.7,edges:!0,edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),selectedMaterial:new $i(i,{fill:!0,fillColor:[0,0,1],fillAlpha:.7,edges:!0,edgeColor:[1,0,0],edgeAlpha:1,edgeWidth:1}),highlighted:!0,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:.3,edges:!0});var n=re.vec3([0,0,0]),o=re.vec3(),a=re.vec3([0,0,1]),l=re.vec4(4),u=re.vec3(),A=function(){var e=s._sectionPlane.scene.center,t=[-s._sectionPlane.dir[0],-s._sectionPlane.dir[1],-s._sectionPlane.dir[2]];re.subVec3(e,s._sectionPlane.pos,n);var i=-re.dotVec3(t,n);re.normalizeVec3(t),re.mulVec3Scalar(t,i,o);var r=re.vec3PairToQuaternion(a,s._sectionPlane.dir,l);u[0]=.1*o[0],u[1]=.1*o[1],u[2]=.1*o[2],s._mesh.quaternion=r,s._mesh.position=u};this._onSectionPlanePos=this._sectionPlane.on("pos",A),this._onSectionPlaneDir=this._sectionPlane.on("dir",A),this._highlighted=!1,this._selected=!1}return C(e,[{key:"setHighlighted",value:function(e){this._highlighted=!!e,this._mesh.highlighted=this._highlighted,this._mesh.highlightMaterial.fillColor=e?[0,.7,0]:[0,0,0]}},{key:"getHighlighted",value:function(){return this._highlighted}},{key:"setSelected",value:function(e){this._selected=!!e,this._mesh.edgeMaterial.edgeWidth=e?3:1,this._mesh.highlightMaterial.edgeWidth=e?3:1}},{key:"getSelected",value:function(){return this._selected}},{key:"destroy",value:function(){this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._mesh.destroy()}}]),e}(),WE=function(){function e(t,i){var r=this;if(x(this,e),!(i.onHoverEnterPlane&&i.onHoverLeavePlane&&i.onClickedNothing&&i.onClickedPlane))throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";this.plugin=t,this._viewer=t.viewer,this._onHoverEnterPlane=i.onHoverEnterPlane,this._onHoverLeavePlane=i.onHoverLeavePlane,this._onClickedNothing=i.onClickedNothing,this._onClickedPlane=i.onClickedPlane,this._visible=!0,this._planes={},this._canvas=i.overviewCanvas,this._scene=new cr(this._viewer,{canvasId:this._canvas.id,transparent:!0}),this._scene.clearLights(),new Si(this._scene,{dir:[.4,-.4,.8],color:[.8,1,1],intensity:1,space:"view"}),new Si(this._scene,{dir:[-.8,-.3,-.4],color:[.8,.8,.8],intensity:1,space:"view"}),new Si(this._scene,{dir:[.8,-.6,-.8],color:[1,1,1],intensity:1,space:"view"}),this._scene.camera,this._scene.camera.perspective.fov=70,this._zUp=!1;var s=this._scene.camera,n=re.rotationMat4c(-90*re.DEGTORAD,1,0,0),o=re.vec3(),a=re.vec3(),l=re.vec3();this._synchCamera=function(){var e=r._viewer.camera.eye,t=r._viewer.camera.look,i=r._viewer.camera.up;re.mulVec3Scalar(re.normalizeVec3(re.subVec3(e,t,o)),7),r._zUp?(re.transformVec3(n,o,a),re.transformVec3(n,i,l),s.look=[0,0,0],s.eye=re.transformVec3(n,o,a),s.up=re.transformPoint3(n,i,l)):(s.look=[0,0,0],s.eye=o,s.up=i)},this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera),this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera),this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",(function(e){r._scene.camera.perspective.fov=e}));var u=null;this._onInputMouseMove=this._scene.input.on("mousemove",(function(e){var t=r._scene.pick({canvasPos:e});if(t){if(!u||t.entity.id!==u.id){if(u)r._planes[u.id]&&r._onHoverLeavePlane(u.id);u=t.entity,r._planes[u.id]&&r._onHoverEnterPlane(u.id)}}else u&&(r._onHoverLeavePlane(u.id),u=null)})),this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=function(){u?r._planes[u.id]&&r._onClickedPlane(u.id):r._onClickedNothing()}),this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=function(){u&&(r._onHoverLeavePlane(u.id),u=null)}),this.setVisible(i.overviewVisible)}return C(e,[{key:"addSectionPlane",value:function(e){this._planes[e.id]=new zE(this,this._scene,e)}},{key:"setPlaneHighlighted",value:function(e,t){var i=this._planes[e];i&&i.setHighlighted(t)}},{key:"setPlaneSelected",value:function(e,t){var i=this._planes[e];i&&i.setSelected(t)}},{key:"removeSectionPlane",value:function(e){var t=this._planes[e.id];t&&(t.destroy(),delete this._planes[e.id])}},{key:"setVisible",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._visible=e,this._canvas.style.visibility=e?"visible":"hidden"}},{key:"getVisible",value:function(){return this._visible}},{key:"destroy",value:function(){this._viewer.camera.off(this._onViewerCameraMatrix),this._viewer.camera.off(this._onViewerCameraWorldAxis),this._viewer.camera.perspective.off(this._onViewerCameraFOV),this._scene.input.off(this._onInputMouseMove),this._scene.canvas.canvas.removeEventListener("mouseup",this._onCanvasMouseUp),this._scene.canvas.canvas.removeEventListener("mouseout",this._onCanvasMouseOut),this._scene.destroy()}}]),e}(),KE=re.AABB3(),XE=re.vec3(),YE=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(r=t.call(this,"SectionPlanes",e))._freeControls=[],r._sectionPlanes=e.scene.sectionPlanes,r._controls={},r._shownControlId=null,null!==s.overviewCanvasId&&void 0!==s.overviewCanvasId){var n=document.getElementById(s.overviewCanvasId);n?r._overview=new WE(b(r),{overviewCanvas:n,visible:s.overviewVisible,onHoverEnterPlane:function(e){r._overview.setPlaneHighlighted(e,!0)},onHoverLeavePlane:function(e){r._overview.setPlaneHighlighted(e,!1)},onClickedPlane:function(e){if(r.getShownControl()!==e){r.showControl(e);var t=r.sectionPlanes[e].pos;KE.set(r.viewer.scene.aabb),re.getAABB3Center(KE,XE),KE[0]+=t[0]-XE[0],KE[1]+=t[1]-XE[1],KE[2]+=t[2]-XE[2],KE[3]+=t[0]-XE[0],KE[4]+=t[1]-XE[1],KE[5]+=t[2]-XE[2],r.viewer.cameraFlight.flyTo({aabb:KE,fitFOV:65})}else r.hideControl()},onClickedNothing:function(){r.hideControl()}}):r.warn("Can't find overview canvas: '"+s.overviewCanvasId+"' - will create plugin without overview")}return r._onSceneSectionPlaneCreated=e.scene.on("sectionPlaneCreated",(function(e){r._sectionPlaneCreated(e)})),r}return C(i,[{key:"setOverviewVisible",value:function(e){this._overview&&this._overview.setVisible(e)}},{key:"getOverviewVisible",value:function(){if(this._overview)return this._overview.getVisible()}},{key:"sectionPlanes",get:function(){return this._sectionPlanes}},{key:"createSectionPlane",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};void 0!==e.id&&null!==e.id&&this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);var t=new xn(this.viewer.scene,{id:e.id,pos:e.pos,dir:e.dir,active:!0});return t}},{key:"_sectionPlaneCreated",value:function(e){var t=this,i=this._freeControls.length>0?this._freeControls.pop():new GE(this);i._setSectionPlane(e),i.setVisible(!1),this._controls[e.id]=i,this._overview&&this._overview.addSectionPlane(e),e.once("destroyed",(function(){t._sectionPlaneDestroyed(e)}))}},{key:"flipSectionPlanes",value:function(){var e=this.viewer.scene.sectionPlanes;for(var t in e){e[t].flipDir()}}},{key:"showControl",value:function(e){var t=this._controls[e];t?(this.hideControl(),t.setVisible(!0),this._overview&&this._overview.setPlaneSelected(e,!0),this._shownControlId=e):this.error("Control not found: "+e)}},{key:"getShownControl",value:function(){return this._shownControlId}},{key:"hideControl",value:function(){for(var e in this._controls)this._controls.hasOwnProperty(e)&&(this._controls[e].setVisible(!1),this._overview&&this._overview.setPlaneSelected(e,!1));this._shownControlId=null}},{key:"destroySectionPlane",value:function(e){var t=this.viewer.scene.sectionPlanes[e];t?(this._sectionPlaneDestroyed(t),t.destroy(),e===this._shownControlId&&(this._shownControlId=null)):this.error("SectionPlane not found: "+e)}},{key:"_sectionPlaneDestroyed",value:function(e){this._overview&&this._overview.removeSectionPlane(e);var t=this._controls[e.id];t&&(t.setVisible(!1),t._setSectionPlane(null),delete this._controls[e.id],this._freeControls.push(t))}},{key:"clear",value:function(){for(var e=Object.keys(this._sectionPlanes),t=0,i=e.length;t1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"StoreyViews",e))._objectsMemento=new Cd,r._cameraMemento=new wd,r.storeys={},r.modelStoreys={},r._fitStoreyMaps=!!s.fitStoreyMaps,r._onModelLoaded=r.viewer.scene.on("modelLoaded",(function(e){r._registerModelStoreys(e),r.fire("storeys",r.storeys)})),r}return C(i,[{key:"_registerModelStoreys",value:function(e){var t=this,i=this.viewer,r=i.scene,s=i.metaScene,n=s.metaModels[e],o=r.models[e];if(n&&n.rootMetaObjects)for(var a=n.rootMetaObjects,l=0,u=a.length;l.5?p.length:0,g=new JE(this,o.aabb,f,e,d,v);g._onModelDestroyed=o.once("destroyed",(function(){t._deregisterModelStoreys(e),t.fire("storeys",t.storeys)})),this.storeys[d]=g,this.modelStoreys[e]||(this.modelStoreys[e]={}),this.modelStoreys[e][d]=g}}},{key:"_deregisterModelStoreys",value:function(e){var t=this.modelStoreys[e];if(t){var i=this.viewer.scene;for(var r in t)if(t.hasOwnProperty(r)){var s=t[r],n=i.models[s.modelId];n&&n.off(s._onModelDestroyed),delete this.storeys[r]}delete this.modelStoreys[e]}}},{key:"fitStoreyMaps",get:function(){return this._fitStoreyMaps}},{key:"gotoStoreyCamera",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=this.storeys[e];if(!i)return this.error("IfcBuildingStorey not found with this ID: "+e),void(t.done&&t.done());var r=this.viewer,s=r.scene,n=s.camera,o=i.storeyAABB;if(o[3]1&&void 0!==arguments[1]?arguments[1]:{},i=this.storeys[e];if(i){var r=this.viewer,s=r.scene,n=r.metaScene,o=n.metaObjects[e];o&&(t.hideOthers&&s.setObjectsVisible(r.scene.visibleObjectIds,!1),this.withStoreyObjects(e,(function(e,t){e&&(e.visible=!0)})))}else this.error("IfcBuildingStorey not found with this ID: "+e)}},{key:"withStoreyObjects",value:function(e,t){var i=this.viewer,r=i.scene,s=i.metaScene,n=s.metaObjects[e];if(n)for(var o=n.getObjectIDsInSubtree(),a=0,l=o.length;a1&&void 0!==arguments[1]?arguments[1]:{},i=this.storeys[e];if(!i)return this.error("IfcBuildingStorey not found with this ID: "+e),eF;var r,s,n=this.viewer,o=n.scene,a=t.format||"png",l=this._fitStoreyMaps?i.storeyAABB:i.modelAABB,u=Math.abs((l[5]-l[2])/(l[3]-l[0])),A=t.padding||0;t.width&&t.height?(r=t.width,s=t.height):t.height?(s=t.height,r=Math.round(s/u)):t.width?(r=t.width,s=Math.round(r*u)):(r=300,s=Math.round(r*u)),this._objectsMemento.saveObjects(o),this._cameraMemento.saveCamera(o),this.showStoreyObjects(e,he.apply(t,{hideOthers:!0})),this._arrangeStoreyMapCamera(i);var c=n.getSnapshot({width:r,height:s,format:a});return this._objectsMemento.restoreObjects(o),this._cameraMemento.restoreCamera(o),new ZE(e,c,a,r,s,A)}},{key:"_arrangeStoreyMapCamera",value:function(e){var t=this.viewer,i=t.scene.camera,r=this._fitStoreyMaps?e.storeyAABB:e.modelAABB,s=re.getAABB3Center(r),n=qE;n[0]=s[0]+.5*i.worldUp[0],n[1]=s[1]+.5*i.worldUp[1],n[2]=s[2]+.5*i.worldUp[2];var o=i.worldForward;t.cameraFlight.jumpTo({eye:n,look:s,up:o});var a=(r[3]-r[0])/2,l=(r[4]-r[1])/2,u=(r[5]-r[2])/2,A=-a,c=+a,h=-l,d=+l,p=-u,f=+u;t.camera.customProjection.matrix=re.orthoMat4c(A,c,p,f,h,d,$E),t.camera.projection="customProjection"}},{key:"pickStoreyMap",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=e.storeyId,s=this.storeys[r];if(!s)return this.error("IfcBuildingStorey not found with this ID: "+r),null;var n=1-t[0]/e.width,o=1-t[1]/e.height,a=this._fitStoreyMaps?s.storeyAABB:s.modelAABB,l=a[0],u=a[1],A=a[2],c=a[3],h=a[4],d=a[5],p=c-l,f=h-u,v=d-A,g=re.vec3([l+p*n,u+.5*f,A+v*o]),m=re.vec3([0,-1,0]),_=re.addVec3(g,m,qE),y=this.viewer.camera.worldForward,b=re.lookAtMat4v(g,_,y,$E),w=this.viewer.scene.pick({pickSurface:i.pickSurface,pickInvisible:!0,matrix:b});return w}},{key:"storeyMapToWorldPos",value:function(e,t){var i=e.storeyId,r=this.storeys[i];if(!r)return this.error("IfcBuildingStorey not found with this ID: "+i),null;var s=1-t[0]/e.width,n=1-t[1]/e.height,o=this._fitStoreyMaps?r.storeyAABB:r.modelAABB,a=o[0],l=o[1],u=o[2],A=o[3],c=o[4],h=o[5],d=A-a,p=c-l,f=h-u,v=re.vec3([a+d*s,l+.5*p,u+f*n]);return v}},{key:"getStoreyContainingWorldPos",value:function(e){for(var t in this.storeys){var i=this.storeys[t];if(re.point3AABB3Intersect(i.storeyAABB,e))return t}return null}},{key:"worldPosToStoreyMap",value:function(e,t,i){var r=e.storeyId,s=this.storeys[r];if(!s)return this.error("IfcBuildingStorey not found with this ID: "+r),!1;var n=this._fitStoreyMaps?s.storeyAABB:s.modelAABB,o=n[0],a=n[1],l=n[2],u=n[3]-o,A=n[4]-a,c=n[5]-l,h=this.viewer.camera.worldUp,d=h[0]>h[1]&&h[0]>h[2],p=!d&&h[1]>h[0]&&h[1]>h[2];!d&&!p&&h[2]>h[0]&&(h[2],h[1]);var f=e.width/u,v=p?e.height/c:e.height/A;return i[0]=Math.floor(e.width-(t[0]-o)*f),i[1]=Math.floor(e.height-(t[2]-l)*v),i[0]>=0&&i[0]=0&&i[1]<=e.height}},{key:"worldDirToStoreyMap",value:function(e,t,i){var r=this.viewer.camera,s=r.eye,n=r.look,o=re.subVec3(n,s,qE),a=r.worldUp,l=a[0]>a[1]&&a[0]>a[2],u=!l&&a[1]>a[0]&&a[1]>a[2];!l&&!u&&a[2]>a[0]&&(a[2],a[1]),l?(i[0]=o[1],i[1]=o[2]):u?(i[0]=o[0],i[1]=o[2]):(i[0]=o[0],i[1]=o[1]),re.normalizeVec2(i)}},{key:"destroy",value:function(){this.viewer.scene.off(this._onModelLoaded),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),iF=new Float64Array([0,0,1]),rF=new Float64Array(4),sF=function(){function e(t){x(this,e),this.id=null,this._viewer=t.viewer,this._plugin=t,this._visible=!1,this._pos=re.vec3(),this._origin=re.vec3(),this._rtcPos=re.vec3(),this._baseDir=re.vec3(),this._rootNode=null,this._displayMeshes=null,this._affordanceMeshes=null,this._ignoreNextSectionPlaneDirUpdate=!1,this._createNodes(),this._bindEvents()}return C(e,[{key:"_setSectionPlane",value:function(e){var t=this;this._sectionPlane&&(this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._onSectionPlanePos=null,this._onSectionPlaneDir=null,this._sectionPlane=null),e&&(this.id=e.id,this._setPos(e.pos),this._setDir(e.dir),this._sectionPlane=e,this._onSectionPlanePos=e.on("pos",(function(){t._setPos(t._sectionPlane.pos)})),this._onSectionPlaneDir=e.on("dir",(function(){t._ignoreNextSectionPlaneDirUpdate?t._ignoreNextSectionPlaneDirUpdate=!1:t._setDir(t._sectionPlane.dir)})))}},{key:"sectionPlane",get:function(){return this._sectionPlane}},{key:"_setPos",value:function(e){this._pos.set(e),He(this._pos,this._origin,this._rtcPos),this._rootNode.origin=this._origin,this._rootNode.position=this._rtcPos}},{key:"_setDir",value:function(e){this._baseDir.set(e),this._rootNode.quaternion=re.vec3PairToQuaternion(iF,e,rF)}},{key:"_setSectionPlaneDir",value:function(e){this._sectionPlane&&(this._ignoreNextSectionPlaneDirUpdate=!0,this._sectionPlane.dir=e)}},{key:"setVisible",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this._visible!==e){var t;for(t in this._visible=e,this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].visible=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].visible=e)}}},{key:"getVisible",value:function(){return this._visible}},{key:"setCulled",value:function(e){var t;for(t in this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].culled=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].culled=e)}},{key:"_createNodes",value:function(){var e=!1,t=this._viewer.scene,i=.01;this._rootNode=new Tn(t,{position:[0,0,0],scale:[5,5,5]});var r=this._rootNode,s={arrowHead:new Wi(r,_n({radiusTop:.001,radiusBottom:.07,radialSegments:32,heightSegments:1,height:.2,openEnded:!1})),arrowHeadBig:new Wi(r,_n({radiusTop:.001,radiusBottom:.09,radialSegments:32,heightSegments:1,height:.25,openEnded:!1})),axis:new Wi(r,_n({radiusTop:i,radiusBottom:i,radialSegments:20,heightSegments:1,height:1,openEnded:!1}))},n={red:new Zi(r,{diffuse:[1,0,0],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),green:new Zi(r,{diffuse:[0,1,0],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),blue:new Zi(r,{diffuse:[0,0,1],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightRed:new $i(r,{edges:!1,fill:!0,fillColor:[1,0,0],fillAlpha:.6})};this._displayMeshes={plane:r.addChild(new gn(r,{geometry:new Wi(r,{primitive:"triangles",positions:[.5,.5,0,.5,-.5,0,-.5,-.5,0,-.5,.5,0,.5,.5,-0,.5,-.5,-0,-.5,-.5,-0,-.5,.5,-0],indices:[0,1,2,2,3,0]}),material:new Zi(r,{emissive:[0,0,0],diffuse:[0,0,0],backfaces:!0}),opacity:.6,ghosted:!0,pickable:!1,collidable:!0,clippable:!1,visible:!1,scale:[2.4,2.4,1]}),e),planeFrame:r.addChild(new gn(r,{geometry:new Wi(r,lo({center:[0,0,0],radius:1.7,tube:.02,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Zi(r,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,.1],rotation:[0,0,45]}),e),center:r.addChild(new gn(r,{geometry:new Wi(r,yn({radius:.05})),material:n.center,pickable:!1,collidable:!0,clippable:!1,visible:!1}),e),zAxisArrow:r.addChild(new gn(r,{geometry:s.arrowHead,material:n.blue,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[.8,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1}),e),zShaft:r.addChild(new gn(r,{geometry:s.axis,material:n.blue,matrix:function(){var e=re.translateMat4c(0,.5,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),clippable:!1,pickable:!1,collidable:!0,visible:!1}),e)},this._affordanceMeshes={planeFrame:r.addChild(new gn(r,{geometry:new Wi(r,lo({center:[0,0,0],radius:2,tube:i,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Zi(r,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:!0,highlightMaterial:new $i(r,{edges:!1,filled:!0,fillColor:[1,1,0],fillAlpha:1}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,1],rotation:[0,0,45]}),e),zAxisArrow:r.addChild(new gn(r,{geometry:s.arrowHeadBig,material:n.blue,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[.8,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1}),e)}}},{key:"_bindEvents",value:function(){var e=this,t=this._rootNode,i=re.vec2(),r=this._viewer.camera,s=this._viewer.scene,n=0,o=!1,a=re.vec3([0,0,0]),l=-1;this._onCameraViewMatrix=s.camera.on("viewMatrix",(function(){})),this._onCameraProjMatrix=s.camera.on("projMatrix",(function(){})),this._onSceneTick=s.on("tick",(function(){o=!1;var i=Math.abs(re.lenVec3(re.subVec3(s.camera.eye,e._pos,a)));if(i!==l&&"perspective"===r.projection){var u=.07*(Math.tan(r.perspective.fov*re.DEGTORAD)*i);t.scale=[u,u,u],l=i}if("ortho"===r.projection){var c=r.ortho.scale/10;t.scale=[c,c,c],l=i}0!==n&&(A(n),n=0)}));var u=function(){var e=new Float64Array(2);return function(t){if(t){for(var i=t.target,r=0,s=0;i.offsetParent;)r+=i.offsetLeft,s+=i.offsetTop,i=i.offsetParent;e[0]=t.pageX-r,e[1]=t.pageY-s}else t=window.event,e[0]=t.x,e[1]=t.y;return e}}(),A=function(t){var i=e._sectionPlane.pos,r=e._sectionPlane.dir;re.addVec3(i,re.mulVec3Scalar(r,.1*t*e._plugin.getDragSensitivity(),re.vec3())),e._sectionPlane.pos=i},c=!1;this._plugin._controlElement.addEventListener("mousedown",this._canvasMouseDownListener=function(t){if(t.preventDefault(),e._visible&&(e._viewer.cameraControl.pointerEnabled=!1,1===t.which)){c=!0;var r=u(t);i[0]=r[0],i[1]=r[1]}}),this._plugin._controlElement.addEventListener("mousemove",this._canvasMouseMoveListener=function(t){if(e._visible&&c&&!o){var r=u(t),s=r[0],n=r[1];A(n-i[1]),i[0]=s,i[1]=n}}),this._plugin._controlElement.addEventListener("mouseup",this._canvasMouseUpListener=function(t){e._visible&&(e._viewer.cameraControl.pointerEnabled=!0,c&&(t.which,c=!1))}),this._plugin._controlElement.addEventListener("wheel",this._canvasWheelListener=function(t){e._visible&&(n+=Math.max(-1,Math.min(1,40*-t.deltaY)))});var h,d,p=null;this._plugin._controlElement.addEventListener("touchstart",this._handleTouchStart=function(t){t.stopPropagation(),t.preventDefault(),e._visible&&(h=t.touches[0].clientY,p=h,n=0)}),this._plugin._controlElement.addEventListener("touchmove",this._handleTouchMove=function(t){t.stopPropagation(),t.preventDefault(),e._visible&&(o||(o=!0,d=t.touches[0].clientY,null!==p&&(n+=d-p),p=d))}),this._plugin._controlElement.addEventListener("touchend",this._handleTouchEnd=function(t){t.stopPropagation(),t.preventDefault(),e._visible&&(h=null,d=null,n=0)})}},{key:"_destroy",value:function(){this._unbindEvents(),this._destroyNodes()}},{key:"_unbindEvents",value:function(){var e=this._viewer,t=e.scene,i=t.canvas.canvas,r=e.camera,s=this._plugin._controlElement;t.off(this._onSceneTick),i.removeEventListener("mousedown",this._canvasMouseDownListener),i.removeEventListener("mousemove",this._canvasMouseMoveListener),i.removeEventListener("mouseup",this._canvasMouseUpListener),i.removeEventListener("wheel",this._canvasWheelListener),s.removeEventListener("touchstart",this._handleTouchStart),s.removeEventListener("touchmove",this._handleTouchMove),s.removeEventListener("touchend",this._handleTouchEnd),r.off(this._onCameraViewMatrix),r.off(this._onCameraProjMatrix)}},{key:"_destroyNodes",value:function(){this._setSectionPlane(null),this._rootNode.destroy(),this._displayMeshes={},this._affordanceMeshes={}}}]),e}(),nF=function(){function e(t,i,r){var s=this;x(this,e),this.id=r.id,this._sectionPlane=r,this._mesh=new gn(i,{id:r.id,geometry:new Wi(i,Ki({xSize:.5,ySize:.5,zSize:.001})),material:new Zi(i,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:!1}),edgeMaterial:new tr(i,{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),highlightMaterial:new $i(i,{fill:!0,fillColor:[.5,1,.5],fillAlpha:.7,edges:!0,edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),selectedMaterial:new $i(i,{fill:!0,fillColor:[0,0,1],fillAlpha:.7,edges:!0,edgeColor:[1,0,0],edgeAlpha:1,edgeWidth:1}),highlighted:!0,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:.3,edges:!0});var n=re.vec3([0,0,0]),o=re.vec3(),a=re.vec3([0,0,1]),l=re.vec4(4),u=re.vec3(),A=function(){var e=s._sectionPlane.scene.center,t=[-s._sectionPlane.dir[0],-s._sectionPlane.dir[1],-s._sectionPlane.dir[2]];re.subVec3(e,s._sectionPlane.pos,n);var i=-re.dotVec3(t,n);re.normalizeVec3(t),re.mulVec3Scalar(t,i,o);var r=re.vec3PairToQuaternion(a,s._sectionPlane.dir,l);u[0]=.1*o[0],u[1]=.1*o[1],u[2]=.1*o[2],s._mesh.quaternion=r,s._mesh.position=u};this._onSectionPlanePos=this._sectionPlane.on("pos",A),this._onSectionPlaneDir=this._sectionPlane.on("dir",A),this._highlighted=!1,this._selected=!1}return C(e,[{key:"setHighlighted",value:function(e){this._highlighted=!!e,this._mesh.highlighted=this._highlighted,this._mesh.highlightMaterial.fillColor=e?[0,.7,0]:[0,0,0]}},{key:"getHighlighted",value:function(){return this._highlighted}},{key:"setSelected",value:function(e){this._selected=!!e,this._mesh.edgeMaterial.edgeWidth=e?3:1,this._mesh.highlightMaterial.edgeWidth=e?3:1}},{key:"getSelected",value:function(){return this._selected}},{key:"destroy",value:function(){this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._mesh.destroy()}}]),e}(),oF=function(){function e(t,i){var r=this;if(x(this,e),!(i.onHoverEnterPlane&&i.onHoverLeavePlane&&i.onClickedNothing&&i.onClickedPlane))throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";this.plugin=t,this._viewer=t.viewer,this._onHoverEnterPlane=i.onHoverEnterPlane,this._onHoverLeavePlane=i.onHoverLeavePlane,this._onClickedNothing=i.onClickedNothing,this._onClickedPlane=i.onClickedPlane,this._visible=!0,this._planes={},this._canvas=i.overviewCanvas,this._scene=new cr(this._viewer,{canvasId:this._canvas.id,transparent:!0}),this._scene.clearLights(),new Si(this._scene,{dir:[.4,-.4,.8],color:[.8,1,1],intensity:1,space:"view"}),new Si(this._scene,{dir:[-.8,-.3,-.4],color:[.8,.8,.8],intensity:1,space:"view"}),new Si(this._scene,{dir:[.8,-.6,-.8],color:[1,1,1],intensity:1,space:"view"}),this._scene.camera,this._scene.camera.perspective.fov=70,this._zUp=!1;var s=this._scene.camera,n=re.rotationMat4c(-90*re.DEGTORAD,1,0,0),o=re.vec3(),a=re.vec3(),l=re.vec3();this._synchCamera=function(){var e=r._viewer.camera.eye,t=r._viewer.camera.look,i=r._viewer.camera.up;re.mulVec3Scalar(re.normalizeVec3(re.subVec3(e,t,o)),7),r._zUp?(re.transformVec3(n,o,a),re.transformVec3(n,i,l),s.look=[0,0,0],s.eye=re.transformVec3(n,o,a),s.up=re.transformPoint3(n,i,l)):(s.look=[0,0,0],s.eye=o,s.up=i)},this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera),this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera),this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",(function(e){r._scene.camera.perspective.fov=e}));var u=null;this._onInputMouseMove=this._scene.input.on("mousemove",(function(e){var t=r._scene.pick({canvasPos:e});if(t){if(!u||t.entity.id!==u.id){if(u)r._planes[u.id]&&r._onHoverLeavePlane(u.id);u=t.entity,r._planes[u.id]&&r._onHoverEnterPlane(u.id)}}else u&&(r._onHoverLeavePlane(u.id),u=null)})),this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=function(){u?r._planes[u.id]&&r._onClickedPlane(u.id):r._onClickedNothing()}),this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=function(){u&&(r._onHoverLeavePlane(u.id),u=null)}),this.setVisible(i.overviewVisible)}return C(e,[{key:"addSectionPlane",value:function(e){this._planes[e.id]=new nF(this,this._scene,e)}},{key:"setPlaneHighlighted",value:function(e,t){var i=this._planes[e];i&&i.setHighlighted(t)}},{key:"setPlaneSelected",value:function(e,t){var i=this._planes[e];i&&i.setSelected(t)}},{key:"removeSectionPlane",value:function(e){var t=this._planes[e.id];t&&(t.destroy(),delete this._planes[e.id])}},{key:"setVisible",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._visible=e,this._canvas.style.visibility=e?"visible":"hidden"}},{key:"getVisible",value:function(){return this._visible}},{key:"destroy",value:function(){this._viewer.camera.off(this._onViewerCameraMatrix),this._viewer.camera.off(this._onViewerCameraWorldAxis),this._viewer.camera.perspective.off(this._onViewerCameraFOV),this._scene.input.off(this._onInputMouseMove),this._scene.canvas.canvas.removeEventListener("mouseup",this._onCanvasMouseUp),this._scene.canvas.canvas.removeEventListener("mouseout",this._onCanvasMouseOut),this._scene.destroy()}}]),e}(),aF=re.AABB3(),lF=re.vec3(),uF=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(r=t.call(this,"FaceAlignedSectionPlanesPlugin",e))._freeControls=[],r._sectionPlanes=e.scene.sectionPlanes,r._controls={},r._shownControlId=null,r._dragSensitivity=s.dragSensitivity||1,null!==s.overviewCanvasId&&void 0!==s.overviewCanvasId){var n=document.getElementById(s.overviewCanvasId);n?r._overview=new oF(b(r),{overviewCanvas:n,visible:s.overviewVisible,onHoverEnterPlane:function(e){r._overview.setPlaneHighlighted(e,!0)},onHoverLeavePlane:function(e){r._overview.setPlaneHighlighted(e,!1)},onClickedPlane:function(e){if(r.getShownControl()!==e){r.showControl(e);var t=r.sectionPlanes[e].pos;aF.set(r.viewer.scene.aabb),re.getAABB3Center(aF,lF),aF[0]+=t[0]-lF[0],aF[1]+=t[1]-lF[1],aF[2]+=t[2]-lF[2],aF[3]+=t[0]-lF[0],aF[4]+=t[1]-lF[1],aF[5]+=t[2]-lF[2],r.viewer.cameraFlight.flyTo({aabb:aF,fitFOV:65})}else r.hideControl()},onClickedNothing:function(){r.hideControl()}}):r.warn("Can't find overview canvas: '"+s.overviewCanvasId+"' - will create plugin without overview")}return null===s.controlElementId||void 0===s.controlElementId?r.error("Parameter expected: controlElementId"):(r._controlElement=document.getElementById(s.controlElementId),r._controlElement||r.warn("Can't find control element: '"+s.controlElementId+"' - will create plugin without control element")),r._onSceneSectionPlaneCreated=e.scene.on("sectionPlaneCreated",(function(e){r._sectionPlaneCreated(e)})),r}return C(i,[{key:"setDragSensitivity",value:function(e){this._dragSensitivity=e||1}},{key:"getDragSensitivity",value:function(){return this._dragSensitivity}},{key:"setOverviewVisible",value:function(e){this._overview&&this._overview.setVisible(e)}},{key:"getOverviewVisible",value:function(){if(this._overview)return this._overview.getVisible()}},{key:"sectionPlanes",get:function(){return this._sectionPlanes}},{key:"createSectionPlane",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};void 0!==e.id&&null!==e.id&&this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);var t=new xn(this.viewer.scene,{id:e.id,pos:e.pos,dir:e.dir,active:!0});return t}},{key:"_sectionPlaneCreated",value:function(e){var t=this,i=this._freeControls.length>0?this._freeControls.pop():new sF(this);i._setSectionPlane(e),i.setVisible(!1),this._controls[e.id]=i,this._overview&&this._overview.addSectionPlane(e),e.once("destroyed",(function(){t._sectionPlaneDestroyed(e)}))}},{key:"flipSectionPlanes",value:function(){var e=this.viewer.scene.sectionPlanes;for(var t in e){e[t].flipDir()}}},{key:"showControl",value:function(e){var t=this._controls[e];t?(this.hideControl(),t.setVisible(!0),this._overview&&this._overview.setPlaneSelected(e,!0),this._shownControlId=e):this.error("Control not found: "+e)}},{key:"getShownControl",value:function(){return this._shownControlId}},{key:"hideControl",value:function(){for(var e in this._controls)this._controls.hasOwnProperty(e)&&(this._controls[e].setVisible(!1),this._overview&&this._overview.setPlaneSelected(e,!1));this._shownControlId=null}},{key:"destroySectionPlane",value:function(e){var t=this.viewer.scene.sectionPlanes[e];t?(this._sectionPlaneDestroyed(t),t.destroy(),e===this._shownControlId&&(this._shownControlId=null)):this.error("SectionPlane not found: "+e)}},{key:"_sectionPlaneDestroyed",value:function(e){this._overview&&this._overview.removeSectionPlane(e);var t=this._controls[e.id];t&&(t.setVisible(!1),t._setSectionPlane(null),delete this._controls[e.id],this._freeControls.push(t))}},{key:"clear",value:function(){for(var e=Object.keys(this._sectionPlanes),t=0,i=e.length;t0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this.cacheBuster=!1!==t.cacheBuster}return C(e,[{key:"_cacheBusterURL",value:function(e){if(!this.cacheBuster)return e;var t=(new Date).getTime();return e.indexOf("?")>-1?e+"&_="+t:e+"?_="+t}},{key:"getSTL",value:function(e,t,i){e=this._cacheBusterURL(e);var r=new XMLHttpRequest;r.overrideMimeType("application/json"),r.open("GET",e,!0),r.responseType="arraybuffer",r.onreadystatechange=function(){4===r.readyState&&(200===r.status?t(r.response):i(r.statusText))},r.send(null)}}]),e}(),hF=re.vec3(),dF=function(){function e(){x(this,e)}return C(e,[{key:"load",value:function(e,t,i,r,s,n){r=r||{};var o=e.viewer.scene.canvas.spinner;o.processes++,e.dataSource.getSTL(i,(function(i){!function(e,t,i,r){try{var s=_F(i);pF(s)?fF(e,s,t,r):vF(e,mF(i),t,r)}catch(e){t.fire("error",e)}}(e,t,i,r);try{var a=_F(i);pF(a)?fF(e,a,t,r):vF(e,mF(i),t,r),o.processes--,Be.scheduleTask((function(){t.fire("loaded",!0,!1)})),s&&s()}catch(i){o.processes--,e.error(i),n&&n(i),t.fire("error",i)}}),(function(i){o.processes--,e.error(i),n&&n(i),t.fire("error",i)}))}},{key:"parse",value:function(e,t,i,r){var s=e.viewer.scene.canvas.spinner;s.processes++;try{var n=_F(i);pF(n)?fF(e,n,t,r):vF(e,mF(i),t,r),s.processes--,Be.scheduleTask((function(){t.fire("loaded",!0,!1)}))}catch(e){s.processes--,t.fire("error",e)}}}]),e}();function pF(e){var t=new DataView(e);if(84+50*t.getUint32(80,!0)===t.byteLength)return!0;for(var i=[115,111,108,105,100],r=0;r<5;r++)if(i[r]!==t.getUint8(r,!1))return!0;return!1}function fF(e,t,i,r){for(var s,n,o,a,l,u,A,c=new DataView(t),h=c.getUint32(80,!0),d=!1,p=null,f=null,v=null,g=!1,m=0;m<70;m++)1129270351===c.getUint32(m,!1)&&82===c.getUint8(m+4)&&61===c.getUint8(m+5)&&(d=!0,a=[],l=c.getUint8(m+6)/255,u=c.getUint8(m+7)/255,A=c.getUint8(m+8)/255,c.getUint8(m+9));for(var _=new On(i,{roughness:.5}),y=[],b=[],w=r.splitMeshes,B=0;B>5&31)/31,o=(E>>10&31)/31):(s=l,n=u,o=A),(w&&s!==p||n!==f||o!==v)&&(null!==p&&(g=!0),p=s,f=n,v=o)}for(var F=1;F<=3;F++){var k=x+12*F;y.push(c.getFloat32(k,!0)),y.push(c.getFloat32(k+4,!0)),y.push(c.getFloat32(k+8,!0)),b.push(P,C,M),d&&a.push(s,n,o,1)}w&&g&&(gF(i,y,b,a,_,r),y=[],b=[],a=a?[]:null,g=!1)}y.length>0&&gF(i,y,b,a,_,r)}function vF(e,t,i,r){for(var s,n,o,a,l,u,A,c=/facet([\s\S]*?)endfacet/g,h=0,d=/[\s]+([+-]?(?:\d+.\d+|\d+.|\d+|.\d+)(?:[eE][+-]?\d+)?)/.source,p=new RegExp("vertex"+d+d+d,"g"),f=new RegExp("normal"+d+d+d,"g"),v=[],g=[];null!==(a=c.exec(t));){for(l=0,u=0,A=a[0];null!==(a=f.exec(A));)s=parseFloat(a[1]),n=parseFloat(a[2]),o=parseFloat(a[3]),u++;for(;null!==(a=p.exec(A));)v.push(parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3])),g.push(s,n,o),l++;1!==u&&e.error("Error in normal of face "+h),3!==l&&e.error("Error in positions of face "+h),h++}gF(i,v,g,null,new On(i,{roughness:.5}),r)}function gF(e,t,i,r,s,n){for(var o=new Int32Array(t.length/3),a=0,l=o.length;a0?i:null,r=r&&r.length>0?r:null,n.smoothNormals&&re.faceToVertexNormals(t,i,n);var u=hF;je(t,t,u);var A=new Wi(e,{primitive:"triangles",positions:t,normals:i,colors:r,indices:o}),c=new gn(e,{origin:0!==u[0]||0!==u[1]||0!==u[2]?u:null,geometry:A,material:s,edges:n.edges});e.addChild(c)}function mF(e){return"string"!=typeof e?function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",i=0,r=e.length;i1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"STLLoader",e,s))._sceneGraphLoader=new dF,r.dataSource=s.dataSource,r}return C(i,[{key:"dataSource",get:function(){return this._dataSource},set:function(e){this._dataSource=e||new cF}},{key:"load",value:function(e){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);var t=new Tn(this.viewer.scene,he.apply(e,{isModel:!0})),i=e.src,r=e.stl;return i||r?(i?this._sceneGraphLoader.load(this,t,i,e):this._sceneGraphLoader.parse(this,t,r,e),t):(this.error("load() param expected: either 'src' or 'stl'"),t)}}]),i}(),bF=function(){function e(){x(this,e)}return C(e,[{key:"createRootNode",value:function(){return document.createElement("ul")}},{key:"createNodeElement",value:function(e,t,i,r,s){var n=document.createElement("li");if(n.id=e.nodeId,e.xrayed&&n.classList.add("xrayed-node"),e.children.length>0){var o=document.createElement("a");o.href="#",o.id="switch-".concat(e.nodeId),o.textContent="+",o.classList.add("plus"),t&&o.addEventListener("click",t),n.appendChild(o)}var a=document.createElement("input");a.id="checkbox-".concat(e.nodeId),a.type="checkbox",a.checked=e.checked,a.style["pointer-events"]="all",i&&a.addEventListener("change",i),n.appendChild(a);var l=document.createElement("span");return l.textContent=e.title,n.appendChild(l),r&&(l.oncontextmenu=r),s&&(l.onclick=s),n}},{key:"createDisabledNodeElement",value:function(e){var t=document.createElement("li"),i=document.createElement("a");i.href="#",i.textContent="!",i.classList.add("warn"),i.classList.add("warning"),t.appendChild(i);var r=document.createElement("span");return r.textContent=e,t.appendChild(r),t}},{key:"addChildren",value:function(e,t){var i=document.createElement("ul");t.forEach((function(e){i.appendChild(e)})),e.parentElement.appendChild(i)}},{key:"expand",value:function(e,t,i){e.classList.remove("plus"),e.classList.add("minus"),e.textContent="-",e.removeEventListener("click",t),e.addEventListener("click",i)}},{key:"collapse",value:function(e,t,i){if(e){var r=e.parentElement;if(r){var s=r.querySelector("ul");s&&(r.removeChild(s),e.classList.remove("minus"),e.classList.add("plus"),e.textContent="+",e.removeEventListener("click",i),e.addEventListener("click",t))}}}},{key:"isExpanded",value:function(e){return void 0!==e.parentElement.getElementsByTagName("li")[0]}},{key:"getId",value:function(e){return e.parentElement.id}},{key:"getIdFromCheckbox",value:function(e){return e.id.replace("checkbox-","")}},{key:"getSwitchElement",value:function(e){return document.getElementById("switch-".concat(e))}},{key:"isChecked",value:function(e){return e.checked}},{key:"setCheckbox",value:function(e,t){var i=document.getElementById("checkbox-".concat(e));i&&t!==i.checked&&(i.checked=t)}},{key:"setXRayed",value:function(e,t){var i=document.getElementById(e);i&&(t?i.classList.add("xrayed-node"):i.classList.remove("xrayed-node"))}},{key:"setHighlighted",value:function(e,t){var i=document.getElementById(e);i&&(t?(i.scrollIntoView({block:"center"}),i.classList.add("highlighted-node")):i.classList.remove("highlighted-node"))}}]),e}(),wF=[],BF=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(r=t.call(this,"TreeViewPlugin",e)).errors=[],r.valid=!0;var n=s.containerElement||document.getElementById(s.containerElementId);if(!(n instanceof HTMLElement))return r.error("Mandatory config expected: valid containerElementId or containerElement"),y(r);for(var o=0;;o++)if(!wF[o]){wF[o]=b(r),r._index=o,r._id="tree-".concat(o);break}if(r._containerElement=n,r._metaModels={},r._autoAddModels=!1!==s.autoAddModels,r._autoExpandDepth=s.autoExpandDepth||0,r._sortNodes=!1!==s.sortNodes,r._viewer=e,r._rootElement=null,r._muteSceneEvents=!1,r._muteTreeEvents=!1,r._rootNodes=[],r._objectNodes={},r._nodeNodes={},r._rootNames={},r._sortNodes=s.sortNodes,r._pruneEmptyNodes=s.pruneEmptyNodes,r._showListItemElementId=null,r._renderService=s.renderService||new bF,!r._renderService)throw new Error("TreeViewPlugin: no render service set");if(r._containerElement.oncontextmenu=function(e){e.preventDefault()},r._onObjectVisibility=r._viewer.scene.on("objectVisibility",(function(e){if(!r._muteSceneEvents){var t=e.id,i=r._objectNodes[t];if(i){var s=e.visible;if(s!==i.checked){r._muteTreeEvents=!0,i.checked=s,s?i.numVisibleEntities++:i.numVisibleEntities--,r._renderService.setCheckbox(i.nodeId,s);for(var n=i.parent;n;)n.checked=s,s?n.numVisibleEntities++:n.numVisibleEntities--,r._renderService.setCheckbox(n.nodeId,n.numVisibleEntities>0),n=n.parent;r._muteTreeEvents=!1}}}})),r._onObjectXrayed=r._viewer.scene.on("objectXRayed",(function(e){if(!r._muteSceneEvents){var t=e.id,i=r._objectNodes[t];if(i){r._muteTreeEvents=!0;var s=e.xrayed;s!==i.xrayed&&(i.xrayed=s,r._renderService.setXRayed(i.nodeId,s),r._muteTreeEvents=!1)}}})),r._switchExpandHandler=function(e){e.preventDefault(),e.stopPropagation();var t=e.target;r._expandSwitchElement(t)},r._switchCollapseHandler=function(e){e.preventDefault(),e.stopPropagation();var t=e.target;r._collapseSwitchElement(t)},r._checkboxChangeHandler=function(e){if(!r._muteTreeEvents){r._muteSceneEvents=!0;var t=e.target,i=r._renderService.isChecked(t),s=r._renderService.getIdFromCheckbox(t),n=r._nodeNodes[s],o=r._viewer.scene.objects,a=0;r._withNodeTree(n,(function(e){var t=e.objectId,s=o[t],n=0===e.children.length;e.numVisibleEntities=i?e.numEntities:0,n&&i!==e.checked&&a++,e.checked=i,r._renderService.setCheckbox(e.nodeId,i),s&&(s.visible=i)}));for(var l=n.parent;l;)l.checked=i,i?l.numVisibleEntities+=a:l.numVisibleEntities-=a,r._renderService.setCheckbox(l.nodeId,l.numVisibleEntities>0),l=l.parent;r._muteSceneEvents=!1}},r._hierarchy=s.hierarchy||"containment",r._autoExpandDepth=s.autoExpandDepth||0,r._autoAddModels){for(var a=Object.keys(r.viewer.metaScene.metaModels),l=0,u=a.length;l1&&void 0!==arguments[1]?arguments[1]:{};if(this._containerElement){var r=this.viewer.scene.models[e];if(!r)throw"Model not found: "+e;var s=this.viewer.metaScene.metaModels[e];s?this._metaModels[e]?this.warn("Model already added: "+e):(this._metaModels[e]=s,i&&i.rootName&&(this._rootNames[e]=i.rootName),r.on("destroyed",(function(){t.removeModel(r.id)})),this._createNodes()):this.error("MetaModel not found: "+e)}}},{key:"removeModel",value:function(e){this._containerElement&&(this._metaModels[e]&&(this._rootNames[e]&&delete this._rootNames[e],delete this._metaModels[e],this._createNodes()))}},{key:"showNode",value:function(e){this.unShowNode();var t=this._objectNodes[e];if(t){var i=t.nodeId,r=this._renderService.getSwitchElement(i);if(r)return this._expandSwitchElement(r),r.scrollIntoView(),!0;var s=[];s.unshift(t);for(var n=t.parent;n;)s.unshift(n),n=n.parent;for(var o=0,a=s.length;o0;return this.valid}},{key:"_validateMetaModelForStoreysHierarchy",value:function(){return!0}},{key:"_createEnabledNodes",value:function(){switch(this._pruneEmptyNodes&&this._findEmptyNodes(),this._hierarchy){case"storeys":this._createStoreysNodes(),0===this._rootNodes.length&&this.error("Failed to build storeys hierarchy");break;case"types":this._createTypesNodes();break;default:this._createContainmentNodes()}this._sortNodes&&this._doSortNodes(),this._synchNodesToEntities(),this._createTrees(),this.expandToDepth(this._autoExpandDepth)}},{key:"_createDisabledNodes",value:function(){var e=this._renderService.createRootNode();this._rootElement=e,this._containerElement.appendChild(e);var t=this._viewer.metaScene.rootMetaObjects;for(var i in t){var r=t[i],s=r.type,n=r.name,o=n&&""!==n&&"Undefined"!==n&&"Default"!==n?n:s,a=this._renderService.createDisabledNodeElement(o);e.appendChild(a)}}},{key:"_findEmptyNodes",value:function(){var e=this._viewer.metaScene.rootMetaObjects;for(var t in e)this._findEmptyNodes2(e[t])}},{key:"_findEmptyNodes2",value:function(e){var t=this.viewer,i=t.scene,r=e.children,s=e.id,n=i.objects[s];if(e._countEntities=0,n&&e._countEntities++,r)for(var o=0,a=r.length;os.aabb[n]?-1:e.aabb[n]r?1:0}},{key:"_synchNodesToEntities",value:function(){for(var e=Object.keys(this.viewer.metaScene.metaObjects),t=this._viewer.metaScene.metaObjects,i=this._viewer.scene.objects,r=0,s=e.length;r0){for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"ViewCull",e))._objectCullStates=CF(e.scene),r._maxTreeDepth=s.maxTreeDepth||8,r._modelInfos={},r._frustum=new Ie,r._kdRoot=null,r._frustumDirty=!1,r._kdTreeDirty=!1,r._onViewMatrix=e.scene.camera.on("viewMatrix",(function(){r._frustumDirty=!0})),r._onProjMatrix=e.scene.camera.on("projMatMatrix",(function(){r._frustumDirty=!0})),r._onModelLoaded=e.scene.on("modelLoaded",(function(e){var t=r.viewer.scene.models[e];t&&r._addModel(t)})),r._onSceneTick=e.scene.on("tick",(function(){r._doCull()})),r}return C(i,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}},{key:"_addModel",value:function(e){var t=this,i={model:e,onDestroyed:e.on("destroyed",(function(){t._removeModel(e)}))};this._modelInfos[e.id]=i,this._kdTreeDirty=!0}},{key:"_removeModel",value:function(e){var t=this._modelInfos[e.id];t&&(t.model.off(t.onDestroyed),delete this._modelInfos[e.id],this._kdTreeDirty=!0)}},{key:"_doCull",value:function(){var e=this._frustumDirty||this._kdTreeDirty;if(this._frustumDirty&&this._buildFrustum(),this._kdTreeDirty&&this._buildKDTree(),e){var t=this._kdRoot;t&&this._visitKDNode(t)}}},{key:"_buildFrustum",value:function(){var e=this.viewer.scene.camera;De(this._frustum,e.viewMatrix,e.projMatrix),this._frustumDirty=!1}},{key:"_buildKDTree",value:function(){var e=this.viewer.scene;this._kdRoot,this._kdRoot={aabb:e.getAABB(),intersection:Ie.INTERSECT};for(var t=0,i=this._objectCullStates.numObjects;t=this._maxTreeDepth)return e.objects=e.objects||[],e.objects.push(i),void re.expandAABB3(e.aabb,s);if(e.left&&re.containsAABB3(e.left.aabb,s))this._insertEntityIntoKDTree(e.left,t,i,r+1);else if(e.right&&re.containsAABB3(e.right.aabb,s))this._insertEntityIntoKDTree(e.right,t,i,r+1);else{var n=e.aabb;MF[0]=n[3]-n[0],MF[1]=n[4]-n[1],MF[2]=n[5]-n[2];var o=0;if(MF[1]>MF[o]&&(o=1),MF[2]>MF[o]&&(o=2),!e.left){var a=n.slice();if(a[o+3]=(n[o]+n[o+3])/2,e.left={aabb:a,intersection:Ie.INTERSECT},re.containsAABB3(a,s))return void this._insertEntityIntoKDTree(e.left,t,i,r+1)}if(!e.right){var l=n.slice();if(l[o]=(n[o]+n[o+3])/2,e.right={aabb:l,intersection:Ie.INTERSECT},re.containsAABB3(l,s))return void this._insertEntityIntoKDTree(e.right,t,i,r+1)}e.objects=e.objects||[],e.objects.push(i),re.expandAABB3(e.aabb,s)}}},{key:"_visitKDNode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ie.INTERSECT;if(t===Ie.INTERSECT||e.intersects!==t){t===Ie.INTERSECT&&(t=Se(this._frustum,e.aabb),e.intersects=t);var i=t===Ie.OUTSIDE,r=e.objects;if(r&&r.length>0)for(var s=0,n=r.length;s0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this.cacheBuster=!1!==t.cacheBuster}return C(e,[{key:"_cacheBusterURL",value:function(e){if(!this.cacheBuster)return e;var t=(new Date).getTime();return e.indexOf("?")>-1?e+"&_="+t:e+"?_="+t}},{key:"getManifest",value:function(e,t,i){he.loadJSON(this._cacheBusterURL(e),(function(e){t(e)}),(function(e){i(e)}))}},{key:"getMetaModel",value:function(e,t,i){he.loadJSON(this._cacheBusterURL(e),(function(e){t(e)}),(function(e){i(e)}))}},{key:"getXKT",value:function(e,t,i){var r=function(){};t=t||r,i=i||r;var s=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(s){var n=!!s[2],o=s[3];o=window.decodeURIComponent(o),n&&(o=window.atob(o));try{for(var a=new ArrayBuffer(o.length),l=new Uint8Array(a),u=0;u=0;)e[t]=0}var i=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]),r=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]),s=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),n=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=new Array(576);t(o);var a=new Array(60);t(a);var l=new Array(512);t(l);var u=new Array(256);t(u);var A=new Array(29);t(A);var c,h,d,p=new Array(30);function f(e,t,i,r,s){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=s,this.has_stree=e&&e.length}function v(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}t(p);var g=function(e){return e<256?l[e]:l[256+(e>>>7)]},m=function(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},_=function(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<>>=1,i<<=1}while(--t>0);return i>>>1},w=function(e,t,i){var r,s,n=new Array(16),o=0;for(r=1;r<=15;r++)o=o+i[r-1]<<1,n[r]=o;for(s=0;s<=t;s++){var a=e[2*s+1];0!==a&&(e[2*s]=b(n[a]++,a))}},x=function(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},P=function(e){e.bi_valid>8?m(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},C=function(e,t,i,r){var s=2*t,n=2*i;return e[s]>1;i>=1;i--)M(e,n,i);s=l;do{i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],M(e,n,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,n[2*s]=n[2*i]+n[2*r],e.depth[s]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,n[2*i+1]=n[2*r+1]=s,e.heap[1]=s++,M(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,r,s,n,o,a,l=t.dyn_tree,u=t.max_code,A=t.stat_desc.static_tree,c=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,f=0;for(n=0;n<=15;n++)e.bl_count[n]=0;for(l[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)(n=l[2*l[2*(r=e.heap[i])+1]+1]+1)>p&&(n=p,f++),l[2*r+1]=n,r>u||(e.bl_count[n]++,o=0,r>=d&&(o=h[r-d]),a=l[2*r],e.opt_len+=a*(n+o),c&&(e.static_len+=a*(A[2*r+1]+o)));if(0!==f){do{for(n=p-1;0===e.bl_count[n];)n--;e.bl_count[n]--,e.bl_count[n+1]+=2,e.bl_count[p]--,f-=2}while(f>0);for(n=p;0!==n;n--)for(r=e.bl_count[n];0!==r;)(s=e.heap[--i])>u||(l[2*s+1]!==n&&(e.opt_len+=(n-l[2*s+1])*l[2*s],l[2*s+1]=n),r--)}}(e,t),w(n,u,e.bl_count)},k=function(e,t,i){var r,s,n=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)s=o,o=t[2*(r+1)+1],++a>=7;v<30;v++)for(p[v]=g<<7,e=0;e<1<0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),F(e,e.l_desc),F(e,e.d_desc),u=function(e){var t;for(k(e,e.dyn_ltree,e.l_desc.max_code),k(e,e.dyn_dtree,e.d_desc.max_code),F(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*n[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),s=e.opt_len+3+7>>>3,(l=e.static_len+3+7>>>3)<=s&&(s=l)):s=l=i+5,i+4<=s&&-1!==t?S(e,t,i,r):4===e.strategy||l===s?(_(e,2+(r?1:0),3),E(e,o,a)):(_(e,4+(r?1:0),3),function(e,t,i,r){var s;for(_(e,t-257,5),_(e,i-1,5),_(e,r-4,4),s=0;s>8,e.pending_buf[e.sym_buf+e.sym_next++]=i,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(u[i]+256+1)]++,e.dyn_dtree[2*g(t)]++),e.sym_next===e.sym_end},O=function(e){_(e,2,3),y(e,256,o),function(e){16===e.bi_valid?(m(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)},N=function(e,t,i,r){for(var s=65535&e|0,n=e>>>16&65535|0,o=0;0!==i;){i-=o=i>2e3?2e3:i;do{n=n+(s=s+t[r++]|0)|0}while(--o);s%=65521,n%=65521}return s|n<<16|0},Q=new Uint32Array(function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}()),V=function(e,t,i,r){var s=Q,n=r+i;e^=-1;for(var o=r;o>>8^s[255&(e^t[o])];return-1^e},H={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"},j={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},G=T,z=L,W=R,K=U,X=O,Y=j.Z_NO_FLUSH,J=j.Z_PARTIAL_FLUSH,Z=j.Z_FULL_FLUSH,q=j.Z_FINISH,$=j.Z_BLOCK,ee=j.Z_OK,te=j.Z_STREAM_END,ie=j.Z_STREAM_ERROR,re=j.Z_DATA_ERROR,se=j.Z_BUF_ERROR,ne=j.Z_DEFAULT_COMPRESSION,oe=j.Z_FILTERED,ae=j.Z_HUFFMAN_ONLY,le=j.Z_RLE,ue=j.Z_FIXED,Ae=j.Z_UNKNOWN,ce=j.Z_DEFLATED,he=258,de=262,pe=42,fe=113,ve=666,ge=function(e,t){return e.msg=H[t],t},me=function(e){return 2*e-(e>4?9:0)},_e=function(e){for(var t=e.length;--t>=0;)e[t]=0},ye=function(e){var t,i,r,s=e.w_size;r=t=e.hash_size;do{i=e.head[--r],e.head[r]=i>=s?i-s:0}while(--t);r=t=s;do{i=e.prev[--r],e.prev[r]=i>=s?i-s:0}while(--t)},be=function(e,t,i){return(t<e.avail_out&&(i=e.avail_out),0!==i&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+i),e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))},Be=function(e,t){W(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,we(e.strm)},xe=function(e,t){e.pending_buf[e.pending++]=t},Pe=function(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Ce=function(e,t,i,r){var s=e.avail_in;return s>r&&(s=r),0===s?0:(e.avail_in-=s,t.set(e.input.subarray(e.next_in,e.next_in+s),i),1===e.state.wrap?e.adler=N(e.adler,t,s,i):2===e.state.wrap&&(e.adler=V(e.adler,t,s,i)),e.next_in+=s,e.total_in+=s,s)},Me=function(e,t){var i,r,s=e.max_chain_length,n=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-de?e.strstart-(e.w_size-de):0,u=e.window,A=e.w_mask,c=e.prev,h=e.strstart+he,d=u[n+o-1],p=u[n+o];e.prev_length>=e.good_match&&(s>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(i=t)+o]===p&&u[i+o-1]===d&&u[i]===u[n]&&u[++i]===u[n+1]){n+=2,i++;do{}while(u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&no){if(e.match_start=t,o=r,r>=a)break;d=u[n+o-1],p=u[n+o]}}}while((t=c[t&A])>l&&0!=--s);return o<=e.lookahead?o:e.lookahead},Ee=function(e){var t,i,r,s=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=s+(s-de)&&(e.window.set(e.window.subarray(s,s+s-i),0),e.match_start-=s,e.strstart-=s,e.block_start-=s,e.insert>e.strstart&&(e.insert=e.strstart),ye(e),i+=s),0===e.strm.avail_in)break;if(t=Ce(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=t,e.lookahead+e.insert>=3)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=be(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=be(e,e.ins_h,e.window[r+3-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookaheade.w_size?e.w_size:e.pending_buf_size-5,o=0,a=e.strm.avail_in;do{if(i=65535,s=e.bi_valid+42>>3,e.strm.avail_out(r=e.strstart-e.block_start)+e.strm.avail_in&&(i=r+e.strm.avail_in),i>s&&(i=s),i>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,we(e.strm),r&&(r>i&&(r=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,i-=r),i&&(Ce(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(0===o);return(a-=e.strm.avail_in)&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_waters&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,s+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),s>e.strm.avail_in&&(s=e.strm.avail_in),s&&(Ce(e.strm,e.window,e.strstart,s),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.high_water>3,n=(s=e.pending_buf_size-s>65535?65535:e.pending_buf_size-s)>e.w_size?e.w_size:s,((r=e.strstart-e.block_start)>=n||(r||t===q)&&t!==Y&&0===e.strm.avail_in&&r<=s)&&(i=r>s?s:r,o=t===q&&0===e.strm.avail_in&&i===r?1:0,z(e,e.block_start,i,o),e.block_start+=i,we(e.strm)),o?3:1)},ke=function(e,t){for(var i,r;;){if(e.lookahead=3&&(e.ins_h=be(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-de&&(e.match_length=Me(e,i)),e.match_length>=3)if(r=K(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=be(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=be(e,e.ins_h,e.window[e.strstart+1]);else r=K(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Be(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===q?(Be(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Be(e,!1),0===e.strm.avail_out)?1:2},Ie=function(e,t){for(var i,r,s;;){if(e.lookahead=3&&(e.ins_h=be(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){s=e.strstart+e.lookahead-3,r=K(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=s&&(e.ins_h=be(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(Be(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=K(e,0,e.window[e.strstart-1]))&&Be(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=K(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===q?(Be(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Be(e,!1),0===e.strm.avail_out)?1:2};function De(e,t,i,r,s){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=s}var Se=[new De(0,0,0,0,Fe),new De(4,4,8,4,ke),new De(4,5,16,8,ke),new De(4,6,32,32,ke),new De(4,4,16,16,Ie),new De(8,16,32,32,Ie),new De(8,16,128,128,Ie),new De(8,32,128,256,Ie),new De(32,128,258,1024,Ie),new De(32,258,258,4096,Ie)];function Te(){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=ce,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),_e(this.dyn_ltree),_e(this.dyn_dtree),_e(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),_e(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),_e(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 Le=function(e){if(!e)return 1;var t=e.state;return!t||t.strm!==e||t.status!==pe&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==fe&&t.status!==ve?1:0},Re=function(e){if(Le(e))return ge(e,ie);e.total_in=e.total_out=0,e.data_type=Ae;var t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?pe:fe,e.adler=2===t.wrap?0:1,t.last_flush=-2,G(t),ee},Ue=function(e){var t,i=Re(e);return i===ee&&((t=e.state).window_size=2*t.w_size,_e(t.head),t.max_lazy_match=Se[t.level].max_lazy,t.good_match=Se[t.level].good_length,t.nice_match=Se[t.level].nice_length,t.max_chain_length=Se[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),i},Oe=function(e,t,i,r,s,n){if(!e)return ie;var o=1;if(t===ne&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),s<1||s>9||i!==ce||r<8||r>15||t<0||t>9||n<0||n>ue||8===r&&1!==o)return ge(e,ie);8===r&&(r=9);var a=new Te;return e.state=a,a.strm=e,a.status=pe,a.wrap=o,a.gzhead=null,a.w_bits=r,a.w_size=1<$||t<0)return e?ge(e,ie):ie;var i=e.state;if(!e.output||0!==e.avail_in&&!e.input||i.status===ve&&t!==q)return ge(e,0===e.avail_out?se:ie);var r=i.last_flush;if(i.last_flush=t,0!==i.pending){if(we(e),0===e.avail_out)return i.last_flush=-1,ee}else if(0===e.avail_in&&me(t)<=me(r)&&t!==q)return ge(e,se);if(i.status===ve&&0!==e.avail_in)return ge(e,se);if(i.status===pe&&0===i.wrap&&(i.status=fe),i.status===pe){var s=ce+(i.w_bits-8<<4)<<8;if(s|=(i.strategy>=ae||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(s|=32),Pe(i,s+=31-s%31),0!==i.strstart&&(Pe(i,e.adler>>>16),Pe(i,65535&e.adler)),e.adler=1,i.status=fe,we(e),0!==i.pending)return i.last_flush=-1,ee}if(57===i.status)if(e.adler=0,xe(i,31),xe(i,139),xe(i,8),i.gzhead)xe(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),xe(i,255&i.gzhead.time),xe(i,i.gzhead.time>>8&255),xe(i,i.gzhead.time>>16&255),xe(i,i.gzhead.time>>24&255),xe(i,9===i.level?2:i.strategy>=ae||i.level<2?4:0),xe(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(xe(i,255&i.gzhead.extra.length),xe(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=V(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(xe(i,0),xe(i,0),xe(i,0),xe(i,0),xe(i,0),xe(i,9===i.level?2:i.strategy>=ae||i.level<2?4:0),xe(i,3),i.status=fe,we(e),0!==i.pending)return i.last_flush=-1,ee;if(69===i.status){if(i.gzhead.extra){for(var n=i.pending,o=(65535&i.gzhead.extra.length)-i.gzindex;i.pending+o>i.pending_buf_size;){var a=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+a),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>n&&(e.adler=V(e.adler,i.pending_buf,i.pending-n,n)),i.gzindex+=a,we(e),0!==i.pending)return i.last_flush=-1,ee;n=0,o-=a}var l=new Uint8Array(i.gzhead.extra);i.pending_buf.set(l.subarray(i.gzindex,i.gzindex+o),i.pending),i.pending+=o,i.gzhead.hcrc&&i.pending>n&&(e.adler=V(e.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){var u,A=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>A&&(e.adler=V(e.adler,i.pending_buf,i.pending-A,A)),we(e),0!==i.pending)return i.last_flush=-1,ee;A=0}u=i.gzindexA&&(e.adler=V(e.adler,i.pending_buf,i.pending-A,A)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){var c,h=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>h&&(e.adler=V(e.adler,i.pending_buf,i.pending-h,h)),we(e),0!==i.pending)return i.last_flush=-1,ee;h=0}c=i.gzindexh&&(e.adler=V(e.adler,i.pending_buf,i.pending-h,h))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(we(e),0!==i.pending))return i.last_flush=-1,ee;xe(i,255&e.adler),xe(i,e.adler>>8&255),e.adler=0}if(i.status=fe,we(e),0!==i.pending)return i.last_flush=-1,ee}if(0!==e.avail_in||0!==i.lookahead||t!==Y&&i.status!==ve){var d=0===i.level?Fe(i,t):i.strategy===ae?function(e,t){for(var i;;){if(0===e.lookahead&&(Ee(e),0===e.lookahead)){if(t===Y)return 1;break}if(e.match_length=0,i=K(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(Be(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===q?(Be(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Be(e,!1),0===e.strm.avail_out)?1:2}(i,t):i.strategy===le?function(e,t){for(var i,r,s,n,o=e.window;;){if(e.lookahead<=he){if(Ee(e),e.lookahead<=he&&t===Y)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&((r=o[s=e.strstart-1])===o[++s]&&r===o[++s]&&r===o[++s])){n=e.strstart+he;do{}while(r===o[++s]&&r===o[++s]&&r===o[++s]&&r===o[++s]&&r===o[++s]&&r===o[++s]&&r===o[++s]&&r===o[++s]&&se.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=K(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=K(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(Be(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===q?(Be(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Be(e,!1),0===e.strm.avail_out)?1:2}(i,t):Se[i.level].func(i,t);if(3!==d&&4!==d||(i.status=ve),1===d||3===d)return 0===e.avail_out&&(i.last_flush=-1),ee;if(2===d&&(t===J?X(i):t!==$&&(z(i,0,0,!1),t===Z&&(_e(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),we(e),0===e.avail_out))return i.last_flush=-1,ee}return t!==q?ee:i.wrap<=0?te:(2===i.wrap?(xe(i,255&e.adler),xe(i,e.adler>>8&255),xe(i,e.adler>>16&255),xe(i,e.adler>>24&255),xe(i,255&e.total_in),xe(i,e.total_in>>8&255),xe(i,e.total_in>>16&255),xe(i,e.total_in>>24&255)):(Pe(i,e.adler>>>16),Pe(i,65535&e.adler)),we(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?ee:te)},He=function(e){if(Le(e))return ie;var t=e.state.status;return e.state=null,t===fe?ge(e,re):ee},je=function(e,t){var i=t.length;if(Le(e))return ie;var r=e.state,s=r.wrap;if(2===s||1===s&&r.status!==pe||r.lookahead)return ie;if(1===s&&(e.adler=N(e.adler,t,i,0)),r.wrap=0,i>=r.w_size){0===s&&(_e(r.head),r.strstart=0,r.block_start=0,r.insert=0);var n=new Uint8Array(r.w_size);n.set(t.subarray(i-r.w_size,i),0),t=n,i=r.w_size}var o=e.avail_in,a=e.next_in,l=e.input;for(e.avail_in=i,e.next_in=0,e.input=t,Ee(r);r.lookahead>=3;){var u=r.strstart,A=r.lookahead-2;do{r.ins_h=be(r,r.ins_h,r.window[u+3-1]),r.prev[u&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=u,u++}while(--A);r.strstart=u,r.lookahead=2,Ee(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=a,e.input=l,e.avail_in=o,r.wrap=s,ee},Ge=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},ze=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=B(i))throw new TypeError(i+"must be non-object");for(var r in i)Ge(i,r)&&(e[r]=i[r])}}return e},We=function(e){for(var t=0,i=0,r=e.length;i=252?6:Ye>=248?5:Ye>=240?4:Ye>=224?3:Ye>=192?2:1;Xe[254]=Xe[254]=1;var Je=function(e){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);var t,i,r,s,n,o=e.length,a=0;for(s=0;s>>6,t[n++]=128|63&i):i<65536?(t[n++]=224|i>>>12,t[n++]=128|i>>>6&63,t[n++]=128|63&i):(t[n++]=240|i>>>18,t[n++]=128|i>>>12&63,t[n++]=128|i>>>6&63,t[n++]=128|63&i);return t},Ze=function(e,t){var i,r,s=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));var n=new Array(2*s);for(r=0,i=0;i4)n[r++]=65533,i+=a-1;else{for(o&=2===a?31:3===a?15:7;a>1&&i1?n[r++]=65533:o<65536?n[r++]=o:(o-=65536,n[r++]=55296|o>>10&1023,n[r++]=56320|1023&o)}}}return function(e,t){if(t<65534&&e.subarray&&Ke)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));for(var i="",r=0;re.length&&(t=e.length);for(var i=t-1;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+Xe[e[i]]>t?i:t},$e=function(){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},et=Object.prototype.toString,tt=j.Z_NO_FLUSH,it=j.Z_SYNC_FLUSH,rt=j.Z_FULL_FLUSH,st=j.Z_FINISH,nt=j.Z_OK,ot=j.Z_STREAM_END,at=j.Z_DEFAULT_COMPRESSION,lt=j.Z_DEFAULT_STRATEGY,ut=j.Z_DEFLATED;function At(e){this.options=ze({level:at,method:ut,chunkSize:16384,windowBits:15,memLevel:8,strategy:lt},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $e,this.strm.avail_out=0;var i=Ne(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==nt)throw new Error(H[i]);if(t.header&&Qe(this.strm,t.header),t.dictionary){var r;if(r="string"==typeof t.dictionary?Je(t.dictionary):"[object ArrayBuffer]"===et.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(i=je(this.strm,r))!==nt)throw new Error(H[i]);this._dict_set=!0}}function ct(e,t){var i=new At(t);if(i.push(e,!0),i.err)throw i.msg||H[i.err];return i.result}At.prototype.push=function(e,t){var i,r,s=this.strm,n=this.options.chunkSize;if(this.ended)return!1;for(r=t===~~t?t:!0===t?st:tt,"string"==typeof e?s.input=Je(e):"[object ArrayBuffer]"===et.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;;)if(0===s.avail_out&&(s.output=new Uint8Array(n),s.next_out=0,s.avail_out=n),(r===it||r===rt)&&s.avail_out<=6)this.onData(s.output.subarray(0,s.next_out)),s.avail_out=0;else{if((i=Ve(s,r))===ot)return s.next_out>0&&this.onData(s.output.subarray(0,s.next_out)),i=He(this.strm),this.onEnd(i),this.ended=!0,i===nt;if(0!==s.avail_out){if(r>0&&s.next_out>0)this.onData(s.output.subarray(0,s.next_out)),s.avail_out=0;else if(0===s.avail_in)break}else this.onData(s.output)}return!0},At.prototype.onData=function(e){this.chunks.push(e)},At.prototype.onEnd=function(e){e===nt&&(this.result=We(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ht=At,dt=ct,pt=function(e,t){return(t=t||{}).raw=!0,ct(e,t)},ft=function(e,t){return(t=t||{}).gzip=!0,ct(e,t)},vt=16209,gt=function(e,t){var i,r,s,n,o,a,l,u,A,c,h,d,p,f,v,g,m,_,y,b,w,B,x,P,C=e.state;i=e.next_in,x=e.input,r=i+(e.avail_in-5),s=e.next_out,P=e.output,n=s-(t-e.avail_out),o=s+(e.avail_out-257),a=C.dmax,l=C.wsize,u=C.whave,A=C.wnext,c=C.window,h=C.hold,d=C.bits,p=C.lencode,f=C.distcode,v=(1<>>=_=m>>>24,d-=_,0===(_=m>>>16&255))P[s++]=65535&m;else{if(!(16&_)){if(0==(64&_)){m=p[(65535&m)+(h&(1<<_)-1)];continue t}if(32&_){C.mode=16191;break e}e.msg="invalid literal/length code",C.mode=vt;break e}y=65535&m,(_&=15)&&(d<_&&(h+=x[i++]<>>=_,d-=_),d<15&&(h+=x[i++]<>>=_=m>>>24,d-=_,!(16&(_=m>>>16&255))){if(0==(64&_)){m=f[(65535&m)+(h&(1<<_)-1)];continue i}e.msg="invalid distance code",C.mode=vt;break e}if(b=65535&m,d<(_&=15)&&(h+=x[i++]<a){e.msg="invalid distance too far back",C.mode=vt;break e}if(h>>>=_,d-=_,b>(_=s-n)){if((_=b-_)>u&&C.sane){e.msg="invalid distance too far back",C.mode=vt;break e}if(w=0,B=c,0===A){if(w+=l-_,_2;)P[s++]=B[w++],P[s++]=B[w++],P[s++]=B[w++],y-=3;y&&(P[s++]=B[w++],y>1&&(P[s++]=B[w++]))}else{w=s-b;do{P[s++]=P[w++],P[s++]=P[w++],P[s++]=P[w++],y-=3}while(y>2);y&&(P[s++]=P[w++],y>1&&(P[s++]=P[w++]))}break}}break}}while(i>3,h&=(1<<(d-=y<<3))-1,e.next_in=i,e.next_out=s,e.avail_in=i=1&&0===F[b];b--);if(w>b&&(w=b),0===b)return s[n++]=20971520,s[n++]=20971520,a.bits=1,0;for(y=1;y0&&(0===e||1!==b))return-1;for(k[1]=0,m=1;m<15;m++)k[m+1]=k[m]+F[m];for(_=0;_852||2===e&&C>592)return 1;for(;;){p=m-x,o[_]+1=d?(f=I[o[_]-d],v=E[o[_]-d]):(f=96,v=0),l=1<>x)+(u-=l)]=p<<24|f<<16|v|0}while(0!==u);for(l=1<>=1;if(0!==l?(M&=l-1,M+=l):M=0,_++,0==--F[m]){if(m===b)break;m=t[i+o[_]]}if(m>w&&(M&c)!==A){for(0===x&&(x=w),h+=y,P=1<<(B=m-x);B+x852||2===e&&C>592)return 1;s[A=M&c]=w<<24|B<<16|h-n|0}}return 0!==M&&(s[h+M]=m-x<<24|64<<16|0),a.bits=w,0},Bt=j.Z_FINISH,xt=j.Z_BLOCK,Pt=j.Z_TREES,Ct=j.Z_OK,Mt=j.Z_STREAM_END,Et=j.Z_NEED_DICT,Ft=j.Z_STREAM_ERROR,kt=j.Z_DATA_ERROR,It=j.Z_MEM_ERROR,Dt=j.Z_BUF_ERROR,St=j.Z_DEFLATED,Tt=16180,Lt=16190,Rt=16191,Ut=16192,Ot=16194,Nt=16199,Qt=16200,Vt=16206,Ht=16209,jt=function(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)};function Gt(){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 zt,Wt,Kt=function(e){if(!e)return 1;var t=e.state;return!t||t.strm!==e||t.mode16211?1:0},Xt=function(e){if(Kt(e))return Ft;var t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Tt,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Ct},Yt=function(e){if(Kt(e))return Ft;var t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Xt(e)},Jt=function(e,t){var i;if(Kt(e))return Ft;var r=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Ft:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,Yt(e))},Zt=function(e,t){if(!e)return Ft;var i=new Gt;e.state=i,i.strm=e,i.window=null,i.mode=Tt;var r=Jt(e,t);return r!==Ct&&(e.state=null),r},qt=!0,$t=function(e){if(qt){zt=new Int32Array(512),Wt=new Int32Array(32);for(var t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(wt(1,e.lens,0,288,zt,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;wt(2,e.lens,0,32,Wt,0,e.work,{bits:5}),qt=!1}e.lencode=zt,e.lenbits=9,e.distcode=Wt,e.distbits=5},ei=function(e,t,i,r){var s,n=e.state;return null===n.window&&(n.wsize=1<=n.wsize?(n.window.set(t.subarray(i-n.wsize,i),0),n.wnext=0,n.whave=n.wsize):((s=n.wsize-n.wnext)>r&&(s=r),n.window.set(t.subarray(i-r,i-r+s),n.wnext),(r-=s)?(n.window.set(t.subarray(i-r,i),0),n.wnext=r,n.whave=n.wsize):(n.wnext+=s,n.wnext===n.wsize&&(n.wnext=0),n.whave>>8&255,i.check=V(i.check,M,2,0),u=0,A=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",i.mode=Ht;break}if((15&u)!==St){e.msg="unknown compression method",i.mode=Ht;break}if(A-=4,w=8+(15&(u>>>=4)),0===i.wbits&&(i.wbits=w),w>15||w>i.wbits){e.msg="invalid window size",i.mode=Ht;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(M[0]=255&u,M[1]=u>>>8&255,i.check=V(i.check,M,2,0)),u=0,A=0,i.mode=16182;case 16182:for(;A<32;){if(0===a)break e;a--,u+=r[n++]<>>8&255,M[2]=u>>>16&255,M[3]=u>>>24&255,i.check=V(i.check,M,4,0)),u=0,A=0,i.mode=16183;case 16183:for(;A<16;){if(0===a)break e;a--,u+=r[n++]<>8),512&i.flags&&4&i.wrap&&(M[0]=255&u,M[1]=u>>>8&255,i.check=V(i.check,M,2,0)),u=0,A=0,i.mode=16184;case 16184:if(1024&i.flags){for(;A<16;){if(0===a)break e;a--,u+=r[n++]<>>8&255,i.check=V(i.check,M,2,0)),u=0,A=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&((d=i.length)>a&&(d=a),d&&(i.head&&(w=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(r.subarray(n,n+d),w)),512&i.flags&&4&i.wrap&&(i.check=V(i.check,r,d,n)),a-=d,n+=d,i.length-=d),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break e;d=0;do{w=r[n+d++],i.head&&w&&i.length<65536&&(i.head.name+=String.fromCharCode(w))}while(w&&d>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Rt;break;case 16189:for(;A<32;){if(0===a)break e;a--,u+=r[n++]<>>=7&A,A-=7&A,i.mode=Vt;break}for(;A<3;){if(0===a)break e;a--,u+=r[n++]<>>=1)){case 0:i.mode=16193;break;case 1:if($t(i),i.mode=Nt,t===Pt){u>>>=2,A-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=Ht}u>>>=2,A-=2;break;case 16193:for(u>>>=7&A,A-=7&A;A<32;){if(0===a)break e;a--,u+=r[n++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=Ht;break}if(i.length=65535&u,u=0,A=0,i.mode=Ot,t===Pt)break e;case Ot:i.mode=16195;case 16195:if(d=i.length){if(d>a&&(d=a),d>l&&(d=l),0===d)break e;s.set(r.subarray(n,n+d),o),a-=d,n+=d,l-=d,o+=d,i.length-=d;break}i.mode=Rt;break;case 16196:for(;A<14;){if(0===a)break e;a--,u+=r[n++]<>>=5,A-=5,i.ndist=1+(31&u),u>>>=5,A-=5,i.ncode=4+(15&u),u>>>=4,A-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=Ht;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,A-=3}for(;i.have<19;)i.lens[E[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,x={bits:i.lenbits},B=wt(0,i.lens,0,19,i.lencode,0,i.work,x),i.lenbits=x.bits,B){e.msg="invalid code lengths set",i.mode=Ht;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>16&255,m=65535&C,!((v=C>>>24)<=A);){if(0===a)break e;a--,u+=r[n++]<>>=v,A-=v,i.lens[i.have++]=m;else{if(16===m){for(P=v+2;A>>=v,A-=v,0===i.have){e.msg="invalid bit length repeat",i.mode=Ht;break}w=i.lens[i.have-1],d=3+(3&u),u>>>=2,A-=2}else if(17===m){for(P=v+3;A>>=v)),u>>>=3,A-=3}else{for(P=v+7;A>>=v)),u>>>=7,A-=7}if(i.have+d>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=Ht;break}for(;d--;)i.lens[i.have++]=w}}if(i.mode===Ht)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=Ht;break}if(i.lenbits=9,x={bits:i.lenbits},B=wt(1,i.lens,0,i.nlen,i.lencode,0,i.work,x),i.lenbits=x.bits,B){e.msg="invalid literal/lengths set",i.mode=Ht;break}if(i.distbits=6,i.distcode=i.distdyn,x={bits:i.distbits},B=wt(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,x),i.distbits=x.bits,B){e.msg="invalid distances set",i.mode=Ht;break}if(i.mode=Nt,t===Pt)break e;case Nt:i.mode=Qt;case Qt:if(a>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=n,e.avail_in=a,i.hold=u,i.bits=A,gt(e,h),o=e.next_out,s=e.output,l=e.avail_out,n=e.next_in,r=e.input,a=e.avail_in,u=i.hold,A=i.bits,i.mode===Rt&&(i.back=-1);break}for(i.back=0;g=(C=i.lencode[u&(1<>>16&255,m=65535&C,!((v=C>>>24)<=A);){if(0===a)break e;a--,u+=r[n++]<>_)])>>>16&255,m=65535&C,!(_+(v=C>>>24)<=A);){if(0===a)break e;a--,u+=r[n++]<>>=_,A-=_,i.back+=_}if(u>>>=v,A-=v,i.back+=v,i.length=m,0===g){i.mode=16205;break}if(32&g){i.back=-1,i.mode=Rt;break}if(64&g){e.msg="invalid literal/length code",i.mode=Ht;break}i.extra=15&g,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;A>>=i.extra,A-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;g=(C=i.distcode[u&(1<>>16&255,m=65535&C,!((v=C>>>24)<=A);){if(0===a)break e;a--,u+=r[n++]<>_)])>>>16&255,m=65535&C,!(_+(v=C>>>24)<=A);){if(0===a)break e;a--,u+=r[n++]<>>=_,A-=_,i.back+=_}if(u>>>=v,A-=v,i.back+=v,64&g){e.msg="invalid distance code",i.mode=Ht;break}i.offset=m,i.extra=15&g,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;A>>=i.extra,A-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=Ht;break}i.mode=16204;case 16204:if(0===l)break e;if(d=h-l,i.offset>d){if((d=i.offset-d)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=Ht;break}d>i.wnext?(d-=i.wnext,p=i.wsize-d):p=i.wnext-d,d>i.length&&(d=i.length),f=i.window}else f=s,p=o-i.offset,d=i.length;d>l&&(d=l),l-=d,i.length-=d;do{s[o++]=f[p++]}while(--d);0===i.length&&(i.mode=Qt);break;case 16205:if(0===l)break e;s[o++]=i.length,l--,i.mode=Qt;break;case Vt:if(i.wrap){for(;A<32;){if(0===a)break e;a--,u|=r[n++]<=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $e,this.strm.avail_out=0;var i=ii(this.strm,t.windowBits);if(i!==ci)throw new Error(H[i]);if(this.header=new ai,ni(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Je(t.dictionary):"[object ArrayBuffer]"===li.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=oi(this.strm,t.dictionary))!==ci))throw new Error(H[i])}function mi(e,t){var i=new gi(t);if(i.push(e),i.err)throw i.msg||H[i.err];return i.result}gi.prototype.push=function(e,t){var i,r,s,n=this.strm,o=this.options.chunkSize,a=this.options.dictionary;if(this.ended)return!1;for(r=t===~~t?t:!0===t?Ai:ui,"[object ArrayBuffer]"===li.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(o),n.next_out=0,n.avail_out=o),(i=ri(n,r))===di&&a&&((i=oi(n,a))===ci?i=ri(n,r):i===fi&&(i=di));n.avail_in>0&&i===hi&&n.state.wrap>0&&0!==e[n.next_in];)ti(n),i=ri(n,r);switch(i){case pi:case fi:case di:case vi:return this.onEnd(i),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(0===n.avail_out||i===hi))if("string"===this.options.to){var l=qe(n.output,n.next_out),u=n.next_out-l,A=Ze(n.output,l);n.next_out=u,n.avail_out=o-u,u&&n.output.set(n.output.subarray(l,l+u),0),this.onData(A)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(i!==ci||0!==s){if(i===hi)return i=si(this.strm),this.onEnd(i),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},gi.prototype.onData=function(e){this.chunks.push(e)},gi.prototype.onEnd=function(e){e===ci&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=We(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var _i=function(e,t){return(t=t||{}).raw=!0,mi(e,t)},yi=ht,bi=dt,wi=pt,Bi=ft,xi=gi,Pi=mi,Ci=_i,Mi=mi,Ei=j,Fi={Deflate:yi,deflate:bi,deflateRaw:wi,gzip:Bi,Inflate:xi,inflate:Pi,inflateRaw:Ci,ungzip:Mi,constants:Ei};e.Deflate=yi,e.Inflate=xi,e.constants=Ei,e.default=Fi,e.deflate=bi,e.deflateRaw=wi,e.gzip=Bi,e.inflate=Pi,e.inflateRaw=Ci,e.ungzip=Mi,Object.defineProperty(e,"__esModule",{value:!0})}));var kF=Object.freeze({__proto__:null}),IF=window.pako||kF;IF.inflate||(IF=IF.default);var DF,SF=(DF=new Float32Array(3),function(e){return DF[0]=e[0]/255,DF[1]=e[1]/255,DF[2]=e[2]/255,DF});var TF={version:1,parse:function(e,t,i,r,s,n){var o=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],meshPositions:e[4],meshIndices:e[5],meshEdgesIndices:e[6],meshColors:e[7],entityIDs:e[8],entityMeshes:e[9],entityIsObjects:e[10],positionsDecodeMatrix:e[11]}}(i),a=function(e){return{positions:new Uint16Array(IF.inflate(e.positions).buffer),normals:new Int8Array(IF.inflate(e.normals).buffer),indices:new Uint32Array(IF.inflate(e.indices).buffer),edgeIndices:new Uint32Array(IF.inflate(e.edgeIndices).buffer),meshPositions:new Uint32Array(IF.inflate(e.meshPositions).buffer),meshIndices:new Uint32Array(IF.inflate(e.meshIndices).buffer),meshEdgesIndices:new Uint32Array(IF.inflate(e.meshEdgesIndices).buffer),meshColors:new Uint8Array(IF.inflate(e.meshColors).buffer),entityIDs:IF.inflate(e.entityIDs,{to:"string"}),entityMeshes:new Uint32Array(IF.inflate(e.entityMeshes).buffer),entityIsObjects:new Uint8Array(IF.inflate(e.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(IF.inflate(e.positionsDecodeMatrix).buffer)}}(o);!function(e,t,i,r,s,n){n.getNextId(),r.positionsCompression="precompressed",r.normalsCompression="precompressed";for(var o=i.positions,a=i.normals,l=i.indices,u=i.edgeIndices,A=i.meshPositions,c=i.meshIndices,h=i.meshEdgesIndices,d=i.meshColors,p=JSON.parse(i.entityIDs),f=i.entityMeshes,v=i.entityIsObjects,g=A.length,m=f.length,_=0;_v[t]?1:0}));for(var E=0;E1||(F[R]=k)}for(var U=0;U1,V=HF(g.subarray(4*O,4*O+3)),H=g[4*O+3]/255,j=a.subarray(d[O],N?a.length:d[O+1]),G=l.subarray(d[O],N?l.length:d[O+1]),z=u.subarray(p[O],N?u.length:p[O+1]),W=A.subarray(f[O],N?A.length:f[O+1]),K=c.subarray(v[O],v[O]+16);if(Q){var X="".concat(o,"-geometry.").concat(O);r.createGeometry({id:X,primitive:"triangles",positionsCompressed:j,normalsCompressed:G,indices:z,edgeIndices:W,positionsDecodeMatrix:K})}else{var Y="".concat(o,"-").concat(O);_[F[O]],r.createMesh(he.apply({},{id:Y,primitive:"triangles",positionsCompressed:j,normalsCompressed:G,indices:z,edgeIndices:W,positionsDecodeMatrix:K,color:V,opacity:H}))}}for(var J=0,Z=0;Z1){var oe="".concat(o,"-instance.").concat(J++),ae="".concat(o,"-geometry.").concat(ne),le=16*b[Z],ue=h.subarray(le,le+16);r.createMesh(he.apply({},{id:oe,geometryId:ae,matrix:ue})),re.push(oe)}else re.push(ne)}re.length>0&&r.createEntity(he.apply({},{id:ee,isObject:!0,meshIds:re}))}}(0,0,a,r,0,n)}},GF=window.pako||kF;GF.inflate||(GF=GF.default);var zF=function(){var e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();var WF={version:5,parse:function(e,t,i,r,s,n){var o=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],eachPrimitivePositionsAndNormalsPortion:e[5],eachPrimitiveIndicesPortion:e[6],eachPrimitiveEdgeIndicesPortion:e[7],eachPrimitiveColor:e[8],primitiveInstances:e[9],eachEntityId:e[10],eachEntityPrimitiveInstancesPortion:e[11],eachEntityMatricesPortion:e[12]}}(i),a=function(e){return{positions:new Float32Array(GF.inflate(e.positions).buffer),normals:new Int8Array(GF.inflate(e.normals).buffer),indices:new Uint32Array(GF.inflate(e.indices).buffer),edgeIndices:new Uint32Array(GF.inflate(e.edgeIndices).buffer),matrices:new Float32Array(GF.inflate(e.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(GF.inflate(e.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(GF.inflate(e.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(GF.inflate(e.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveColor:new Uint8Array(GF.inflate(e.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(GF.inflate(e.primitiveInstances).buffer),eachEntityId:GF.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(GF.inflate(e.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(GF.inflate(e.eachEntityMatricesPortion).buffer)}}(o);!function(e,t,i,r,s,n){var o=n.getNextId();r.positionsCompression="disabled",r.normalsCompression="precompressed";for(var a=i.positions,l=i.normals,u=i.indices,A=i.edgeIndices,c=i.matrices,h=i.eachPrimitivePositionsAndNormalsPortion,d=i.eachPrimitiveIndicesPortion,p=i.eachPrimitiveEdgeIndicesPortion,f=i.eachPrimitiveColor,v=i.primitiveInstances,g=JSON.parse(i.eachEntityId),m=i.eachEntityPrimitiveInstancesPortion,_=i.eachEntityMatricesPortion,y=h.length,b=v.length,w=new Uint8Array(y),B=g.length,x=0;x1||(P[D]=C)}for(var S=0;S1,R=zF(f.subarray(4*S,4*S+3)),U=f[4*S+3]/255,O=a.subarray(h[S],T?a.length:h[S+1]),N=l.subarray(h[S],T?l.length:h[S+1]),Q=u.subarray(d[S],T?u.length:d[S+1]),V=A.subarray(p[S],T?A.length:p[S+1]);if(L){var H="".concat(o,"-geometry.").concat(S);r.createGeometry({id:H,primitive:"triangles",positionsCompressed:O,normalsCompressed:N,indices:Q,edgeIndices:V})}else{var j=S;g[P[S]],r.createMesh(he.apply({},{id:j,primitive:"triangles",positionsCompressed:O,normalsCompressed:N,indices:Q,edgeIndices:V,color:R,opacity:U}))}}for(var G=0,z=0;z1){var ee="instance."+G++,te="geometry"+$,ie=16*_[z],re=c.subarray(ie,ie+16);r.createMesh(he.apply({},{id:ee,geometryId:te,matrix:re})),Z.push(ee)}else Z.push($)}Z.length>0&&r.createEntity(he.apply({},{id:X,isObject:!0,meshIds:Z}))}}(0,0,a,r,0,n)}},KF=window.pako||kF;KF.inflate||(KF=KF.default);var XF,YF=(XF=new Float32Array(3),function(e){return XF[0]=e[0]/255,XF[1]=e[1]/255,XF[2]=e[2]/255,XF});var JF={version:6,parse:function(e,t,i,r,s,n){var o=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],reusedPrimitivesDecodeMatrix:e[5],eachPrimitivePositionsAndNormalsPortion:e[6],eachPrimitiveIndicesPortion:e[7],eachPrimitiveEdgeIndicesPortion:e[8],eachPrimitiveColorAndOpacity:e[9],primitiveInstances:e[10],eachEntityId:e[11],eachEntityPrimitiveInstancesPortion:e[12],eachEntityMatricesPortion:e[13],eachTileAABB:e[14],eachTileEntitiesPortion:e[15]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:KF.inflate(e,t).buffer}return{positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedPrimitivesDecodeMatrix:new Float32Array(t(e.reusedPrimitivesDecodeMatrix)),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(t(e.eachPrimitivePositionsAndNormalsPortion)),eachPrimitiveIndicesPortion:new Uint32Array(t(e.eachPrimitiveIndicesPortion)),eachPrimitiveEdgeIndicesPortion:new Uint32Array(t(e.eachPrimitiveEdgeIndicesPortion)),eachPrimitiveColorAndOpacity:new Uint8Array(t(e.eachPrimitiveColorAndOpacity)),primitiveInstances:new Uint32Array(t(e.primitiveInstances)),eachEntityId:KF.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(t(e.eachEntityPrimitiveInstancesPortion)),eachEntityMatricesPortion:new Uint32Array(t(e.eachEntityMatricesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(o);!function(e,t,i,r,s,n){for(var o=n.getNextId(),a=i.positions,l=i.normals,u=i.indices,A=i.edgeIndices,c=i.matrices,h=i.reusedPrimitivesDecodeMatrix,d=i.eachPrimitivePositionsAndNormalsPortion,p=i.eachPrimitiveIndicesPortion,f=i.eachPrimitiveEdgeIndicesPortion,v=i.eachPrimitiveColorAndOpacity,g=i.primitiveInstances,m=JSON.parse(i.eachEntityId),_=i.eachEntityPrimitiveInstancesPortion,y=i.eachEntityMatricesPortion,b=i.eachTileAABB,w=i.eachTileEntitiesPortion,B=d.length,x=g.length,P=m.length,C=w.length,M=new Uint32Array(B),E=0;E1,ie=ee===B-1,se=a.subarray(d[ee],ie?a.length:d[ee+1]),ne=l.subarray(d[ee],ie?l.length:d[ee+1]),oe=u.subarray(p[ee],ie?u.length:p[ee+1]),ae=A.subarray(f[ee],ie?A.length:f[ee+1]),le=YF(v.subarray(4*ee,4*ee+3)),ue=v[4*ee+3]/255,Ae=n.getNextId();if(te){var ce="".concat(o,"-geometry.").concat(D,".").concat(ee);N[ce]||(r.createGeometry({id:ce,primitive:"triangles",positionsCompressed:se,indices:oe,edgeIndices:ae,positionsDecodeMatrix:h}),N[ce]=!0),r.createMesh(he.apply(Z,{id:Ae,geometryId:ce,origin:k,matrix:G,color:le,opacity:ue})),X.push(Ae)}else r.createMesh(he.apply(Z,{id:Ae,origin:k,primitive:"triangles",positionsCompressed:se,normalsCompressed:ne,indices:oe,edgeIndices:ae,positionsDecodeMatrix:O,color:le,opacity:ue})),X.push(Ae)}X.length>0&&r.createEntity(he.apply(J,{id:H,isObject:!0,meshIds:X}))}}}(e,t,a,r,0,n)}},ZF=window.pako||kF;ZF.inflate||(ZF=ZF.default);var qF=function(){var e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function $F(e){for(var t=[],i=0,r=e.length;i1,ne=ie===M-1,oe=qF(w.subarray(6*te,6*te+3)),ae=w[6*te+3]/255,le=w[6*te+4]/255,ue=w[6*te+5]/255,Ae=n.getNextId();if(se){var ce=b[te],de=h.slice(ce,ce+16),pe="".concat(o,"-geometry.").concat(R,".").concat(ie);if(!j[pe]){var fe=void 0,ve=void 0,ge=void 0,me=void 0,_e=void 0,ye=void 0;switch(p[ie]){case 0:fe="solid",ve=a.subarray(f[ie],ne?a.length:f[ie+1]),ge=l.subarray(v[ie],ne?l.length:v[ie+1]),_e=A.subarray(m[ie],ne?A.length:m[ie+1]),ye=c.subarray(_[ie],ne?c.length:_[ie+1]);break;case 1:fe="surface",ve=a.subarray(f[ie],ne?a.length:f[ie+1]),ge=l.subarray(v[ie],ne?l.length:v[ie+1]),_e=A.subarray(m[ie],ne?A.length:m[ie+1]),ye=c.subarray(_[ie],ne?c.length:_[ie+1]);break;case 2:fe="points",ve=a.subarray(f[ie],ne?a.length:f[ie+1]),me=$F(u.subarray(g[ie],ne?u.length:g[ie+1]));break;case 3:fe="lines",ve=a.subarray(f[ie],ne?a.length:f[ie+1]),_e=A.subarray(m[ie],ne?A.length:m[ie+1]);break;default:continue}r.createGeometry({id:pe,primitive:fe,positionsCompressed:ve,normalsCompressed:ge,colors:me,indices:_e,edgeIndices:ye,positionsDecodeMatrix:d}),j[pe]=!0}r.createMesh(he.apply($,{id:Ae,geometryId:pe,origin:T,matrix:de,color:oe,metallic:le,roughness:ue,opacity:ae})),J.push(Ae)}else{var be=void 0,we=void 0,Be=void 0,xe=void 0,Pe=void 0,Ce=void 0;switch(p[ie]){case 0:be="solid",we=a.subarray(f[ie],ne?a.length:f[ie+1]),Be=l.subarray(v[ie],ne?l.length:v[ie+1]),Pe=A.subarray(m[ie],ne?A.length:m[ie+1]),Ce=c.subarray(_[ie],ne?c.length:_[ie+1]);break;case 1:be="surface",we=a.subarray(f[ie],ne?a.length:f[ie+1]),Be=l.subarray(v[ie],ne?l.length:v[ie+1]),Pe=A.subarray(m[ie],ne?A.length:m[ie+1]),Ce=c.subarray(_[ie],ne?c.length:_[ie+1]);break;case 2:be="points",we=a.subarray(f[ie],ne?a.length:f[ie+1]),xe=$F(u.subarray(g[ie],ne?u.length:g[ie+1]));break;case 3:be="lines",we=a.subarray(f[ie],ne?a.length:f[ie+1]),Pe=A.subarray(m[ie],ne?A.length:m[ie+1]);break;default:continue}r.createMesh(he.apply($,{id:Ae,origin:T,primitive:be,positionsCompressed:we,normalsCompressed:Be,colors:xe,indices:Pe,edgeIndices:Ce,positionsDecodeMatrix:H,color:oe,metallic:le,roughness:ue,opacity:ae})),J.push(Ae)}}J.length>0&&r.createEntity(he.apply(q,{id:W,isObject:!0,meshIds:J}))}}}(e,t,a,r,0,n)}},tk=window.pako||kF;tk.inflate||(tk=tk.default);var ik=re.vec4(),rk=re.vec4();var sk=function(){var e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function nk(e){for(var t=[],i=0,r=e.length;i1,ye=me===S-1,be=sk(M.subarray(6*ge,6*ge+3)),we=M[6*ge+3]/255,Be=M[6*ge+4]/255,xe=M[6*ge+5]/255,Pe=n.getNextId();if(_e){var Ce=C[ge],Me=g.slice(Ce,Ce+16),Ee="".concat(o,"-geometry.").concat(J,".").concat(me),Fe=Y[Ee];if(!Fe){Fe={batchThisMesh:!t.reuseGeometries};var ke=!1;switch(_[me]){case 0:Fe.primitiveName="solid",Fe.geometryPositions=h.subarray(y[me],ye?h.length:y[me+1]),Fe.geometryNormals=d.subarray(b[me],ye?d.length:b[me+1]),Fe.geometryIndices=f.subarray(B[me],ye?f.length:B[me+1]),Fe.geometryEdgeIndices=v.subarray(x[me],ye?v.length:x[me+1]),ke=Fe.geometryPositions.length>0&&Fe.geometryIndices.length>0;break;case 1:Fe.primitiveName="surface",Fe.geometryPositions=h.subarray(y[me],ye?h.length:y[me+1]),Fe.geometryNormals=d.subarray(b[me],ye?d.length:b[me+1]),Fe.geometryIndices=f.subarray(B[me],ye?f.length:B[me+1]),Fe.geometryEdgeIndices=v.subarray(x[me],ye?v.length:x[me+1]),ke=Fe.geometryPositions.length>0&&Fe.geometryIndices.length>0;break;case 2:Fe.primitiveName="points",Fe.geometryPositions=h.subarray(y[me],ye?h.length:y[me+1]),Fe.geometryColors=nk(p.subarray(w[me],ye?p.length:w[me+1])),ke=Fe.geometryPositions.length>0;break;case 3:Fe.primitiveName="lines",Fe.geometryPositions=h.subarray(y[me],ye?h.length:y[me+1]),Fe.geometryIndices=f.subarray(B[me],ye?f.length:B[me+1]),ke=Fe.geometryPositions.length>0&&Fe.geometryIndices.length>0;break;default:continue}if(ke||(Fe=null),Fe&&(Fe.geometryPositions.length,Fe.batchThisMesh)){Fe.decompressedPositions=new Float32Array(Fe.geometryPositions.length);for(var Ie=Fe.geometryPositions,De=Fe.decompressedPositions,Se=0,Te=Ie.length;Se0&&je.length>0;break;case 1:Ne="surface",Qe=h.subarray(y[me],ye?h.length:y[me+1]),Ve=d.subarray(b[me],ye?d.length:b[me+1]),je=f.subarray(B[me],ye?f.length:B[me+1]),Ge=v.subarray(x[me],ye?v.length:x[me+1]),ze=Qe.length>0&&je.length>0;break;case 2:Ne="points",Qe=h.subarray(y[me],ye?h.length:y[me+1]),He=nk(p.subarray(w[me],ye?p.length:w[me+1])),ze=Qe.length>0;break;case 3:Ne="lines",Qe=h.subarray(y[me],ye?h.length:y[me+1]),je=f.subarray(B[me],ye?f.length:B[me+1]),ze=Qe.length>0&&je.length>0;break;default:continue}ze&&(r.createMesh(he.apply(fe,{id:Pe,origin:K,primitive:Ne,positionsCompressed:Qe,normalsCompressed:Ve,colorsCompressed:He,indices:je,edgeIndices:Ge,positionsDecodeMatrix:ie,color:be,metallic:Be,roughness:xe,opacity:we})),ce.push(Pe))}}ce.length>0&&r.createEntity(he.apply(pe,{id:ae,isObject:!0,meshIds:ce}))}}}(e,t,a,r,s,n)}},ak=window.pako||kF;ak.inflate||(ak=ak.default);var lk=re.vec4(),uk=re.vec4();var Ak=function(){var e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();var ck={version:9,parse:function(e,t,i,r,s,n){var o=function(e){return{metadata:e[0],positions:e[1],normals:e[2],colors:e[3],indices:e[4],edgeIndices:e[5],matrices:e[6],reusedGeometriesDecodeMatrix:e[7],eachGeometryPrimitiveType:e[8],eachGeometryPositionsPortion:e[9],eachGeometryNormalsPortion:e[10],eachGeometryColorsPortion:e[11],eachGeometryIndicesPortion:e[12],eachGeometryEdgeIndicesPortion:e[13],eachMeshGeometriesPortion:e[14],eachMeshMatricesPortion:e[15],eachMeshMaterial:e[16],eachEntityId:e[17],eachEntityMeshesPortion:e[18],eachTileAABB:e[19],eachTileEntitiesPortion:e[20]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:ak.inflate(e,t).buffer}return{metadata:JSON.parse(ak.inflate(e.metadata,{to:"string"})),positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),colors:new Uint8Array(t(e.colors)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(t(e.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(t(e.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(t(e.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(t(e.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(t(e.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(t(e.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(t(e.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(t(e.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(t(e.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(t(e.eachMeshMaterial)),eachEntityId:JSON.parse(ak.inflate(e.eachEntityId,{to:"string"})),eachEntityMeshesPortion:new Uint32Array(t(e.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(o);!function(e,t,i,r,s,n){var o=n.getNextId(),a=i.metadata,l=i.positions,u=i.normals,A=i.colors,c=i.indices,h=i.edgeIndices,d=i.matrices,p=i.reusedGeometriesDecodeMatrix,f=i.eachGeometryPrimitiveType,v=i.eachGeometryPositionsPortion,g=i.eachGeometryNormalsPortion,m=i.eachGeometryColorsPortion,_=i.eachGeometryIndicesPortion,y=i.eachGeometryEdgeIndicesPortion,b=i.eachMeshGeometriesPortion,w=i.eachMeshMatricesPortion,B=i.eachMeshMaterial,x=i.eachEntityId,P=i.eachEntityMeshesPortion,C=i.eachTileAABB,M=i.eachTileEntitiesPortion,E=v.length,F=b.length,k=P.length,I=M.length;s&&s.loadData(a,{includeTypes:t.includeTypes,excludeTypes:t.excludeTypes,globalizeObjectIds:t.globalizeObjectIds});for(var D=new Uint32Array(E),S=0;S1,ae=ne===E-1,le=Ak(B.subarray(6*se,6*se+3)),ue=B[6*se+3]/255,Ae=B[6*se+4]/255,ce=B[6*se+5]/255,de=n.getNextId();if(oe){var pe=w[se],fe=d.slice(pe,pe+16),ve="".concat(o,"-geometry.").concat(O,".").concat(ne),ge=U[ve];if(!ge){ge={batchThisMesh:!t.reuseGeometries};var me=!1;switch(f[ne]){case 0:ge.primitiveName="solid",ge.geometryPositions=l.subarray(v[ne],ae?l.length:v[ne+1]),ge.geometryNormals=u.subarray(g[ne],ae?u.length:g[ne+1]),ge.geometryIndices=c.subarray(_[ne],ae?c.length:_[ne+1]),ge.geometryEdgeIndices=h.subarray(y[ne],ae?h.length:y[ne+1]),me=ge.geometryPositions.length>0&&ge.geometryIndices.length>0;break;case 1:ge.primitiveName="surface",ge.geometryPositions=l.subarray(v[ne],ae?l.length:v[ne+1]),ge.geometryNormals=u.subarray(g[ne],ae?u.length:g[ne+1]),ge.geometryIndices=c.subarray(_[ne],ae?c.length:_[ne+1]),ge.geometryEdgeIndices=h.subarray(y[ne],ae?h.length:y[ne+1]),me=ge.geometryPositions.length>0&&ge.geometryIndices.length>0;break;case 2:ge.primitiveName="points",ge.geometryPositions=l.subarray(v[ne],ae?l.length:v[ne+1]),ge.geometryColors=A.subarray(m[ne],ae?A.length:m[ne+1]),me=ge.geometryPositions.length>0;break;case 3:ge.primitiveName="lines",ge.geometryPositions=l.subarray(v[ne],ae?l.length:v[ne+1]),ge.geometryIndices=c.subarray(_[ne],ae?c.length:_[ne+1]),me=ge.geometryPositions.length>0&&ge.geometryIndices.length>0;break;default:continue}if(me||(ge=null),ge&&(ge.geometryPositions.length,ge.batchThisMesh)){ge.decompressedPositions=new Float32Array(ge.geometryPositions.length),ge.transformedAndRecompressedPositions=new Uint16Array(ge.geometryPositions.length);for(var _e=ge.geometryPositions,ye=ge.decompressedPositions,be=0,we=_e.length;be0&&Ie.length>0;break;case 1:Me="surface",Ee=l.subarray(v[ne],ae?l.length:v[ne+1]),Fe=u.subarray(g[ne],ae?u.length:g[ne+1]),Ie=c.subarray(_[ne],ae?c.length:_[ne+1]),De=h.subarray(y[ne],ae?h.length:y[ne+1]),Se=Ee.length>0&&Ie.length>0;break;case 2:Me="points",Ee=l.subarray(v[ne],ae?l.length:v[ne+1]),ke=A.subarray(m[ne],ae?A.length:m[ne+1]),Se=Ee.length>0;break;case 3:Me="lines",Ee=l.subarray(v[ne],ae?l.length:v[ne+1]),Ie=c.subarray(_[ne],ae?c.length:_[ne+1]),Se=Ee.length>0&&Ie.length>0;break;default:continue}Se&&(r.createMesh(he.apply(te,{id:de,origin:L,primitive:Me,positionsCompressed:Ee,normalsCompressed:Fe,colorsCompressed:ke,indices:Ie,edgeIndices:De,positionsDecodeMatrix:G,color:le,metallic:Ae,roughness:ce,opacity:ue})),q.push(de))}}q.length>0&&r.createEntity(he.apply(ee,{id:X,isObject:!0,meshIds:q}))}}}(e,t,a,r,s,n)}},hk=window.pako||kF;hk.inflate||(hk=hk.default);var dk=re.vec4(),pk=re.vec4();var fk=function(){var e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function vk(e,t){var i=[];if(t.length>1)for(var r=0,s=t.length-1;r1)for(var n=0,o=e.length/3-1;n0,W=9*V,K=1===A[W+0],X=A[W+1];A[W+2],A[W+3];var Y=A[W+4],J=A[W+5],Z=A[W+6],q=A[W+7],$=A[W+8];if(z){var ee=new Uint8Array(l.subarray(j,G)).buffer,te="".concat(o,"-texture-").concat(V);if(K)r.createTexture({id:te,buffers:[ee],minFilter:Y,magFilter:J,wrapS:Z,wrapT:q,wrapR:$});else{var ie=new Blob([ee],{type:10001===X?"image/jpeg":10002===X?"image/png":"image/gif"}),se=(window.URL||window.webkitURL).createObjectURL(ie),ne=document.createElement("img");ne.src=se,r.createTexture({id:te,image:ne,minFilter:Y,magFilter:J,wrapS:Z,wrapT:q,wrapR:$})}}}for(var oe=0;oe=0?"".concat(o,"-texture-").concat(ue):null,normalsTextureId:ce>=0?"".concat(o,"-texture-").concat(ce):null,metallicRoughnessTextureId:Ae>=0?"".concat(o,"-texture-").concat(Ae):null,emissiveTextureId:de>=0?"".concat(o,"-texture-").concat(de):null,occlusionTextureId:pe>=0?"".concat(o,"-texture-").concat(pe):null})}for(var fe=new Uint32Array(U),ve=0;ve1,je=Ve===U-1,Ge=F[Qe],ze=Ge>=0?"".concat(o,"-textureSet-").concat(Ge):null,We=fk(k.subarray(6*Qe,6*Qe+3)),Ke=k[6*Qe+3]/255,Xe=k[6*Qe+4]/255,Ye=k[6*Qe+5]/255,Je=n.getNextId();if(He){var Ze=E[Qe],qe=m.slice(Ze,Ze+16),$e="".concat(o,"-geometry.").concat(be,".").concat(Ve),et=ye[$e];if(!et){et={batchThisMesh:!t.reuseGeometries};var tt=!1;switch(y[Ve]){case 0:et.primitiveName="solid",et.geometryPositions=c.subarray(b[Ve],je?c.length:b[Ve+1]),et.geometryNormals=h.subarray(w[Ve],je?h.length:w[Ve+1]),et.geometryUVs=p.subarray(x[Ve],je?p.length:x[Ve+1]),et.geometryIndices=f.subarray(P[Ve],je?f.length:P[Ve+1]),et.geometryEdgeIndices=v.subarray(C[Ve],je?v.length:C[Ve+1]),tt=et.geometryPositions.length>0&&et.geometryIndices.length>0;break;case 1:et.primitiveName="surface",et.geometryPositions=c.subarray(b[Ve],je?c.length:b[Ve+1]),et.geometryNormals=h.subarray(w[Ve],je?h.length:w[Ve+1]),et.geometryUVs=p.subarray(x[Ve],je?p.length:x[Ve+1]),et.geometryIndices=f.subarray(P[Ve],je?f.length:P[Ve+1]),et.geometryEdgeIndices=v.subarray(C[Ve],je?v.length:C[Ve+1]),tt=et.geometryPositions.length>0&&et.geometryIndices.length>0;break;case 2:et.primitiveName="points",et.geometryPositions=c.subarray(b[Ve],je?c.length:b[Ve+1]),et.geometryColors=d.subarray(B[Ve],je?d.length:B[Ve+1]),tt=et.geometryPositions.length>0;break;case 3:et.primitiveName="lines",et.geometryPositions=c.subarray(b[Ve],je?c.length:b[Ve+1]),et.geometryIndices=f.subarray(P[Ve],je?f.length:P[Ve+1]),tt=et.geometryPositions.length>0&&et.geometryIndices.length>0;break;case 4:et.primitiveName="lines",et.geometryPositions=c.subarray(b[Ve],je?c.length:b[Ve+1]),et.geometryIndices=vk(et.geometryPositions,f.subarray(P[Ve],je?f.length:P[Ve+1])),tt=et.geometryPositions.length>0&&et.geometryIndices.length>0;break;default:continue}if(tt||(et=null),et&&(et.geometryPositions.length,et.batchThisMesh)){et.decompressedPositions=new Float32Array(et.geometryPositions.length),et.transformedAndRecompressedPositions=new Uint16Array(et.geometryPositions.length);for(var it=et.geometryPositions,rt=et.decompressedPositions,st=0,nt=it.length;st0&&ft.length>0;break;case 1:At="surface",ct=c.subarray(b[Ve],je?c.length:b[Ve+1]),ht=h.subarray(w[Ve],je?h.length:w[Ve+1]),dt=p.subarray(x[Ve],je?p.length:x[Ve+1]),ft=f.subarray(P[Ve],je?f.length:P[Ve+1]),vt=v.subarray(C[Ve],je?v.length:C[Ve+1]),gt=ct.length>0&&ft.length>0;break;case 2:At="points",ct=c.subarray(b[Ve],je?c.length:b[Ve+1]),pt=d.subarray(B[Ve],je?d.length:B[Ve+1]),gt=ct.length>0;break;case 3:At="lines",ct=c.subarray(b[Ve],je?c.length:b[Ve+1]),ft=f.subarray(P[Ve],je?f.length:P[Ve+1]),gt=ct.length>0&&ft.length>0;break;case 4:At="lines",ft=vk(ct=c.subarray(b[Ve],je?c.length:b[Ve+1]),f.subarray(P[Ve],je?f.length:P[Ve+1])),gt=ct.length>0&&ft.length>0;break;default:continue}gt&&(r.createMesh(he.apply(Oe,{id:Je,textureSetId:ze,origin:me,primitive:At,positionsCompressed:ct,normalsCompressed:ht,uv:dt&&dt.length>0?dt:null,colorsCompressed:pt,indices:ft,edgeIndices:vt,positionsDecodeMatrix:Me,color:We,metallic:Xe,roughness:Ye,opacity:Ke})),Le.push(Je))}}Le.length>0&&r.createEntity(he.apply(Ue,{id:Ie,isObject:!0,meshIds:Le}))}}}(e,t,a,r,s,n)}},mk={};mk[TF.version]=TF,mk[UF.version]=UF,mk[QF.version]=QF,mk[jF.version]=jF,mk[WF.version]=WF,mk[JF.version]=JF,mk[ek.version]=ek,mk[ok.version]=ok,mk[ck.version]=ck,mk[gk.version]=gk;var _k=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"XKTLoader",e,s))._maxGeometryBatchSize=s.maxGeometryBatchSize,r.textureTranscoder=s.textureTranscoder,r.dataSource=s.dataSource,r.objectDefaults=s.objectDefaults,r.includeTypes=s.includeTypes,r.excludeTypes=s.excludeTypes,r.excludeUnclassifiedObjects=s.excludeUnclassifiedObjects,r.reuseGeometries=s.reuseGeometries,r}return C(i,[{key:"supportedVersions",get:function(){return Object.keys(mk)}},{key:"textureTranscoder",get:function(){return this._textureTranscoder},set:function(e){this._textureTranscoder=e}},{key:"dataSource",get:function(){return this._dataSource},set:function(e){this._dataSource=e||new FF}},{key:"objectDefaults",get:function(){return this._objectDefaults},set:function(e){this._objectDefaults=e||CE}},{key:"includeTypes",get:function(){return this._includeTypes},set:function(e){this._includeTypes=e}},{key:"excludeTypes",get:function(){return this._excludeTypes},set:function(e){this._excludeTypes=e}},{key:"excludeUnclassifiedObjects",get:function(){return this._excludeUnclassifiedObjects},set:function(e){this._excludeUnclassifiedObjects=!!e}},{key:"globalizeObjectIds",get:function(){return this._globalizeObjectIds},set:function(e){this._globalizeObjectIds=!!e}},{key:"reuseGeometries",get:function(){return this._reuseGeometries},set:function(e){this._reuseGeometries=!1!==e}},{key:"load",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.id&&this.viewer.scene.components[t.id]&&(this.error("Component with this ID already exists in viewer: "+t.id+" - will autogenerate this ID"),delete t.id),!(t.src||t.xkt||t.manifestSrc||t.manifest))return this.error("load() param expected: src, xkt, manifestSrc or manifestData"),A;var i={},r=t.includeTypes||this._includeTypes,s=t.excludeTypes||this._excludeTypes,n=t.objectDefaults||this._objectDefaults;if(i.reuseGeometries=null!==t.reuseGeometries&&void 0!==t.reuseGeometries?t.reuseGeometries:!1!==this._reuseGeometries,r){i.includeTypesMap={};for(var o=0,a=r.length;o=t.length?n():e._dataSource.getMetaModel("".concat(m).concat(t[a]),(function(t){h.loadData(t,{includeTypes:r,excludeTypes:s,globalizeObjectIds:i.globalizeObjectIds}),a++,e.scheduleTask(l,100)}),o)}()},y=function(r,s,n){var o=0;!function a(){o>=r.length?s():e._dataSource.getXKT("".concat(m).concat(r[o]),(function(r){e._parseModel(r,t,i,A,null,v),o++,e.scheduleTask(a,100)}),n)}()},b=function(r,s,n){var o=0;!function a(){o>=r.length?s():e._dataSource.getXKT("".concat(m).concat(r[o]),(function(r){e._parseModel(r,t,i,A,h,v),o++,e.scheduleTask(a,100)}),n)}()};if(t.manifest){var w=t.manifest,B=w.xktFiles;if(!B||0===B.length)return void p("load(): Failed to load model manifest - manifest not valid");var x=w.metaModelFiles;x?_(x,(function(){y(B,d,p)}),p):b(B,d,p)}else this._dataSource.getManifest(t.manifestSrc,(function(e){if(!A.destroyed){var t=e.xktFiles;if(t&&0!==t.length){var i=e.metaModelFiles;i?_(i,(function(){y(t,d,p)}),p):b(t,d,p)}else p("load(): Failed to load model manifest - manifest not valid")}}),p)}return A}},{key:"_loadModel",value:function(e,t,i,r,s,n,o,a){var l=this;this._dataSource.getXKT(t.src,(function(e){l._parseModel(e,t,i,r,s,n),o()}),a)}},{key:"_parseModel",value:function(e,t,i,r,s,n){if(!r.destroyed){var o=new DataView(e),a=new Uint8Array(e),l=o.getUint32(0,!0),u=mk[l];if(u){this.log("Loading .xkt V"+l);for(var A=o.getUint32(4,!0),c=[],h=4*(A+2),d=0;de.size)throw new RangeError("offset:"+t+", length:"+i+", size:"+e.size);return e.slice?e.slice(t,t+i):e.webkitSlice?e.webkitSlice(t,t+i):e.mozSlice?e.mozSlice(t,t+i):e.msSlice?e.msSlice(t,t+i):void 0}(e,t,i))}catch(e){s(e)}}}function p(){}function f(e){var i,r=this;r.init=function(e){i=new Blob([],{type:o}),e()},r.writeUint8Array=function(e,r){i=new Blob([i,t?e:e.buffer],{type:o}),r()},r.getData=function(t,r){var s=new FileReader;s.onload=function(e){t(e.target.result)},s.onerror=r,s.readAsText(i,e)}}function v(t){var i=this,r="",s="";i.init=function(e){r+="data:"+(t||"")+";base64,",e()},i.writeUint8Array=function(t,i){var n,o=s.length,a=s;for(s="",n=0;n<3*Math.floor((o+t.length)/3)-o;n++)a+=String.fromCharCode(t[n]);for(;n2?r+=e.btoa(a):s=a,i()},i.getData=function(t){t(r+e.btoa(s))}}function g(e){var i,r=this;r.init=function(t){i=new Blob([],{type:e}),t()},r.writeUint8Array=function(r,s){i=new Blob([i,t?r:r.buffer],{type:e}),s()},r.getData=function(e){e(i)}}function m(e,t,i,r,s,o,a,l,u,A){var c,h,d,p=0,f=t.sn;function v(){e.removeEventListener("message",g,!1),l(h,d)}function g(t){var i=t.data,s=i.data,n=i.error;if(n)return n.toString=function(){return"Error: "+this.message},void u(n);if(i.sn===f)switch("number"==typeof i.codecTime&&(e.codecTime+=i.codecTime),"number"==typeof i.crcTime&&(e.crcTime+=i.crcTime),i.type){case"append":s?(h+=s.length,r.writeUint8Array(s,(function(){m()}),A)):m();break;case"flush":d=i.crc,s?(h+=s.length,r.writeUint8Array(s,(function(){v()}),A)):v();break;case"progress":a&&a(c+i.loaded,o);break;case"importScripts":case"newTask":case"echo":break;default:console.warn("zip.js:launchWorkerProcess: unknown message: ",i)}}function m(){(c=p*n)<=o?i.readUint8Array(s+c,Math.min(n,o-c),(function(i){a&&a(c,o);var r=0===c?t:{sn:f};r.type="append",r.data=i;try{e.postMessage(r,[i.buffer])}catch(t){e.postMessage(r)}p++}),u):e.postMessage({sn:f,type:"flush"})}h=0,e.addEventListener("message",g,!1),m()}function _(e,t,i,r,s,o,l,u,A,c){var h,d=0,p=0,f="input"===o,v="output"===o,g=new a;!function o(){var a;if((h=d*n)127?s[i-128]:String.fromCharCode(i);return r}function w(e){return decodeURIComponent(escape(e))}function B(e){var t,i="";for(t=0;t>16,i=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&i)>>11,(2016&i)>>5,2*(31&i),0)}catch(e){}}(e.lastModDateRaw),1!=(1&e.bitFlag)?((r||8!=(8&e.bitFlag))&&(e.crc32=t.view.getUint32(i+10,!0),e.compressedSize=t.view.getUint32(i+14,!0),e.uncompressedSize=t.view.getUint32(i+18,!0)),4294967295!==e.compressedSize&&4294967295!==e.uncompressedSize?(e.filenameLength=t.view.getUint16(i+22,!0),e.extraFieldLength=t.view.getUint16(i+24,!0)):s("File is using Zip64 (4gb+ file size).")):s("File contains encrypted entry.")}function P(t,n,o){var a=0;function l(){}l.prototype.getData=function(r,n,l,A){var c=this;function h(e,t){A&&!function(e){var t=u(4);return t.view.setUint32(0,e),c.crc32==t.view.getUint32(0)}(t)?o("CRC failed."):r.getData((function(e){n(e)}))}function d(e){o(e||s)}function p(e){o(e||"Error while writing file data.")}t.readUint8Array(c.offset,30,(function(s){var n,f=u(s.length,s);1347093252==f.view.getUint32(0)?(x(c,f,4,!1,o),n=c.offset+30+c.filenameLength+c.extraFieldLength,r.init((function(){0===c.compressionMethod?y(c._worker,a++,t,r,n,c.compressedSize,A,h,l,d,p):function(t,i,r,s,n,o,a,l,u,A,c){var h=a?"output":"none";e.zip.useWebWorkers?m(t,{sn:i,codecClass:"Inflater",crcType:h},r,s,n,o,u,l,A,c):_(new e.zip.Inflater,r,s,n,o,h,u,l,A,c)}(c._worker,a++,t,r,n,c.compressedSize,A,h,l,d,p)}),p)):o(i)}),d)};var A={getEntries:function(e){var s=this._worker;!function(e){t.size<22?o(i):s(22,(function(){s(Math.min(65558,t.size),(function(){o(i)}))}));function s(i,s){t.readUint8Array(t.size-i,i,(function(t){for(var i=t.length-22;i>=0;i--)if(80===t[i]&&75===t[i+1]&&5===t[i+2]&&6===t[i+3])return void e(new DataView(t.buffer,i,22));s()}),(function(){o(r)}))}}((function(n){var a,A;a=n.getUint32(16,!0),A=n.getUint16(8,!0),a<0||a>=t.size?o(i):t.readUint8Array(a,t.size-a,(function(t){var r,n,a,c,h=0,d=[],p=u(t.length,t);for(r=0;r>>8^i[255&(t^e[r])];this.crc=t},a.prototype.get=function(){return~this.crc},a.prototype.table=function(){var e,t,i,r=[];for(e=0;e<256;e++){for(i=e,t=0;t<8;t++)1&i?i=i>>>1^3988292384:i>>>=1;r[e]=i}return r}(),l.prototype.append=function(e,t){return e},l.prototype.flush=function(){},c.prototype=new A,c.prototype.constructor=c,h.prototype=new A,h.prototype.constructor=h,d.prototype=new A,d.prototype.constructor=d,p.prototype.getData=function(e){e(this.data)},f.prototype=new p,f.prototype.constructor=f,v.prototype=new p,v.prototype.constructor=v,g.prototype=new p,g.prototype.constructor=g;var F={deflater:["z-worker.js","deflate.js"],inflater:["z-worker.js","inflate.js"]};function k(t,i,r){if(null===e.zip.workerScripts||null===e.zip.workerScriptsPath){var s;if(e.zip.workerScripts){if(s=e.zip.workerScripts[t],!Array.isArray(s))return void r(new Error("zip.workerScripts."+t+" is not an array!"));s=function(e){var t=document.createElement("a");return e.map((function(e){return t.href=e,t.href}))}(s)}else(s=F[t].slice(0))[0]=(e.zip.workerScriptsPath||"")+s[0];var n=new Worker(s[0]);n.codecTime=n.crcTime=0,n.postMessage({type:"importScripts",scripts:s.slice(1)}),n.addEventListener("message",(function e(t){var s=t.data;if(s.error)return n.terminate(),void r(s.error);"importScripts"===s.type&&(n.removeEventListener("message",e),n.removeEventListener("error",o),i(n))})),n.addEventListener("error",o)}else r(new Error("Either zip.workerScripts or zip.workerScriptsPath may be set, not both."));function o(e){n.terminate(),r(e)}}function I(e){console.error(e)}e.zip={Reader:A,Writer:p,BlobReader:d,Data64URIReader:h,TextReader:c,BlobWriter:g,Data64URIWriter:v,TextWriter:f,createReader:function(e,t,i){i=i||I,e.init((function(){P(e,t,i)}),i)},createWriter:function(e,t,i,r){i=i||I,r=!!r,e.init((function(){E(e,t,i,r)}),i)},useWebWorkers:!0,workerScriptsPath:null,workerScripts:null}}(bk);var wk=bk.zip;!function(e){var t,i,r=e.Reader,s=e.Writer;try{i=0===new Blob([new DataView(new ArrayBuffer(0))]).size}catch(e){}function n(e){var t=this;function i(i,r){var s;t.data?i():((s=new XMLHttpRequest).addEventListener("load",(function(){t.size||(t.size=Number(s.getResponseHeader("Content-Length"))||Number(s.response.byteLength)),t.data=new Uint8Array(s.response),i()}),!1),s.addEventListener("error",r,!1),s.open("GET",e),s.responseType="arraybuffer",s.send())}t.size=0,t.init=function(r,s){if(function(e){var t=document.createElement("a");return t.href=e,"http:"===t.protocol||"https:"===t.protocol}(e)){var n=new XMLHttpRequest;n.addEventListener("load",(function(){t.size=Number(n.getResponseHeader("Content-Length")),t.size?r():i(r,s)}),!1),n.addEventListener("error",s,!1),n.open("HEAD",e),n.send()}else i(r,s)},t.readUint8Array=function(e,r,s,n){i((function(){s(new Uint8Array(t.data.subarray(e,e+r)))}),n)}}function o(e){var t=this;t.size=0,t.init=function(i,r){var s=new XMLHttpRequest;s.addEventListener("load",(function(){t.size=Number(s.getResponseHeader("Content-Length")),"bytes"==s.getResponseHeader("Accept-Ranges")?i():r("HTTP Range not supported.")}),!1),s.addEventListener("error",r,!1),s.open("HEAD",e),s.send()},t.readUint8Array=function(t,i,r,s){!function(t,i,r,s){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="arraybuffer",n.setRequestHeader("Range","bytes="+t+"-"+(t+i-1)),n.addEventListener("load",(function(){r(n.response)}),!1),n.addEventListener("error",s,!1),n.send()}(t,i,(function(e){r(new Uint8Array(e))}),s)}}function a(e){var t=this;t.size=0,t.init=function(i,r){t.size=e.byteLength,i()},t.readUint8Array=function(t,i,r,s){r(new Uint8Array(e.slice(t,t+i)))}}function l(){var e,t=this;t.init=function(t,i){e=new Uint8Array,t()},t.writeUint8Array=function(t,i,r){var s=new Uint8Array(e.length+t.length);s.set(e),s.set(t,e.length),e=s,i()},t.getData=function(t){t(e.buffer)}}function u(e,t){var r,s=this;s.init=function(t,i){e.createWriter((function(e){r=e,t()}),i)},s.writeUint8Array=function(e,s,n){var o=new Blob([i?e:e.buffer],{type:t});r.onwrite=function(){r.onwrite=null,s()},r.onerror=n,r.write(o)},s.getData=function(t){e.file(t)}}n.prototype=new r,n.prototype.constructor=n,o.prototype=new r,o.prototype.constructor=o,a.prototype=new r,a.prototype.constructor=a,l.prototype=new s,l.prototype.constructor=l,u.prototype=new s,u.prototype.constructor=u,e.FileWriter=u,e.HttpReader=n,e.HttpRangeReader=o,e.ArrayBufferReader=a,e.ArrayBufferWriter=l,e.fs&&((t=e.fs.ZipDirectoryEntry).prototype.addHttpContent=function(i,r,s){return function(i,r,s,n){if(i.directory)return n?new t(i.fs,r,s,i):new e.fs.ZipFileEntry(i.fs,r,s,i);throw"Parent entry is not a directory."}(this,i,{data:r,Reader:s?o:n})},t.prototype.importHttpContent=function(e,t,i,r){this.importZip(t?new o(e):new n(e),i,r)},e.fs.FS.prototype.importHttpContent=function(e,i,r,s){this.entries=[],this.root=new t(this),this.root.importHttpContent(e,i,r,s)})}(wk);var Bk=["4.2"],xk=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,e),this.supportedSchemas=Bk,this._xrayOpacity=.7,this._src=null,this._options=i,this.viewpoint=null,i.workerScriptsPath?(wk.workerScriptsPath=i.workerScriptsPath,this.src=i.src,this.xrayOpacity=.7,this.displayEffect=i.displayEffect,this.createMetaModel=i.createMetaModel):t.error("Config expected: workerScriptsPath")}return C(e,[{key:"load",value:function(e,t,i,r,s,n){switch(r.materialType){case"MetallicMaterial":t._defaultMaterial=new On(t,{baseColor:[1,1,1],metallic:.6,roughness:.6});break;case"SpecularMaterial":t._defaultMaterial=new Vn(t,{diffuse:[1,1,1],specular:re.vec3([1,1,1]),glossiness:.5});break;default:t._defaultMaterial=new Zi(t,{reflectivity:.75,shiness:100,diffuse:[1,1,1]})}t._wireframeMaterial=new Ln(t,{color:[0,0,0],lineWidth:2});var o=t.scene.canvas.spinner;o.processes++,Pk(e,t,i,r,(function(){o.processes--,s&&s(),t.fire("loaded",!0,!1)}),(function(e){o.processes--,t.error(e),n&&n(e),t.fire("error",e)}),(function(e){console.log("Error, Will Robinson: "+e)}))}}]),e}(),Pk=function(e,t,i,r,s,n){!function(e,t,i){var r=new Sk;r.load(e,(function(){t(r)}),(function(e){i("Error loading ZIP archive: "+e)}))}(i,(function(i){Ck(e,i,r,t,s,n)}),n)},Ck=function(){return function(t,i,r,s,n){var o={plugin:t,zip:i,edgeThreshold:30,materialType:r.materialType,scene:s.scene,modelNode:s,info:{references:{}},materials:{}};r.createMetaModel&&(o.metaModelData={modelId:s.id,metaObjects:[{name:s.id,type:"Default",id:s.id}]}),s.scene.loading++,function(t,i){t.zip.getFile("Manifest.xml",(function(r,s){for(var n=s.children,o=0,a=n.length;o0){for(var o=n.trim().split(" "),a=new Int16Array(o.length),l=0,u=0,A=o.length;u0){i.primitive="triangles";for(var n=[],o=0,a=s.length;o=t.length)i();else{var a=t[n].id,l=a.lastIndexOf(":");l>0&&(a=a.substring(l+1));var u=a.lastIndexOf("#");u>0&&(a=a.substring(0,u)),r[a]?s(n+1):function(e,t,i){e.zip.getFile(t,(function(t,r){!function(e,t,i){for(var r,s=t.children,n=0,o=s.length;n0)for(var r=0,s=t.length;r1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),r=t.call(this,"XML3DLoader",e,s),s.workerScriptsPath?(r._workerScriptsPath=s.workerScriptsPath,r._loader=new xk(b(r),s),r.supportedSchemas=r._loader.supportedSchemas,r):(r.error("Config expected: workerScriptsPath"),y(r))}return C(i,[{key:"load",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.workerScriptsPath=this._workerScriptsPath,e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);var t=new Tn(this.viewer.scene,he.apply(e,{isModel:!0})),i=e.src;return i?(this._loader.load(this,t,i,e),t):(this.error("load() param expected: src"),t)}}]),i}(),Rk=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this.cacheBuster=!1!==t.cacheBuster}return C(e,[{key:"_cacheBusterURL",value:function(e){if(!this.cacheBuster)return e;var t=(new Date).getTime();return e.indexOf("?")>-1?e+"&_="+t:e+"?_="+t}},{key:"getIFC",value:function(e,t,i){e=this._cacheBusterURL(e);var r=function(){};t=t||r,i=i||r;var s=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(s){var n=!!s[2],o=s[3];o=window.decodeURIComponent(o),n&&(o=window.atob(o));try{for(var a=new ArrayBuffer(o.length),l=new Uint8Array(a),u=0;u1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(r=t.call(this,"ifcLoader",e,s)).dataSource=s.dataSource,r.objectDefaults=s.objectDefaults,r.includeTypes=s.includeTypes,r.excludeTypes=s.excludeTypes,r.excludeUnclassifiedObjects=s.excludeUnclassifiedObjects,!s.WebIFC)throw"Parameter expected: WebIFC";if(!s.IfcAPI)throw"Parameter expected: IfcAPI";return r._webIFC=s.WebIFC,r._ifcAPI=s.IfcAPI,r}return C(i,[{key:"supportedVersions",get:function(){return["2x3","4"]}},{key:"dataSource",get:function(){return this._dataSource},set:function(e){this._dataSource=e||new Rk}},{key:"objectDefaults",get:function(){return this._objectDefaults},set:function(e){this._objectDefaults=e||CE}},{key:"includeTypes",get:function(){return this._includeTypes},set:function(e){this._includeTypes=e}},{key:"excludeTypes",get:function(){return this._excludeTypes},set:function(e){this._excludeTypes=e}},{key:"excludeUnclassifiedObjects",get:function(){return this._excludeUnclassifiedObjects},set:function(e){this._excludeUnclassifiedObjects=!!e}},{key:"globalizeObjectIds",get:function(){return this._globalizeObjectIds},set:function(e){this._globalizeObjectIds=!!e}},{key:"load",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);var t=new Ph(this.viewer.scene,he.apply(e,{isModel:!0}));if(!e.src&&!e.ifc)return this.error("load() param expected: src or IFC"),t;var i={autoNormals:!0};if(!1!==e.loadMetadata){var r=e.includeTypes||this._includeTypes,s=e.excludeTypes||this._excludeTypes,n=e.objectDefaults||this._objectDefaults;if(r){i.includeTypesMap={};for(var o=0,a=r.length;o0){for(var l=n.Name.value,u=[],A=0,c=a.length;A0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this.cacheBuster=!1!==t.cacheBuster}return C(e,[{key:"_cacheBusterURL",value:function(e){if(!this.cacheBuster)return e;var t=(new Date).getTime();return e.indexOf("?")>-1?e+"&_="+t:e+"?_="+t}},{key:"getLAS",value:function(e,t,i){e=this._cacheBusterURL(e);var r=function(){};t=t||r,i=i||r;var s=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(s){var n=!!s[2],o=s[3];o=window.decodeURIComponent(o),n&&(o=window.atob(o));try{for(var a=new ArrayBuffer(o.length),l=new Uint8Array(a),u=0;u1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"lasLoader",e,s)).dataSource=s.dataSource,r.skip=s.skip,r.fp64=s.fp64,r.colorDepth=s.colorDepth,r}return C(i,[{key:"dataSource",get:function(){return this._dataSource},set:function(e){this._dataSource=e||new Ok}},{key:"skip",get:function(){return this._skip},set:function(e){this._skip=e||1}},{key:"fp64",get:function(){return this._fp64},set:function(e){this._fp64=!!e}},{key:"colorDepth",get:function(){return this._colorDepth},set:function(e){this._colorDepth=e||"auto"}},{key:"load",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.id&&this.viewer.scene.components[t.id]&&(this.error("Component with this ID already exists in viewer: "+t.id+" - will autogenerate this ID"),delete t.id);var i=new Ph(this.viewer.scene,he.apply(t,{isModel:!0}));if(!t.src&&!t.las)return this.error("load() param expected: src or las"),i;var r={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(t.src)this._loadModel(t.src,t,r,i);else{var s=this.viewer.scene.canvas.spinner;s.processes++,this._parseModel(t.las,t,r,i).then((function(){s.processes--}),(function(t){s.processes--,e.error(t),i.fire("error",t)}))}return i}},{key:"_loadModel",value:function(e,t,i,r){var s=this,n=this.viewer.scene.canvas.spinner;n.processes++,this._dataSource.getLAS(t.src,(function(e){s._parseModel(e,t,i,r).then((function(){n.processes--}),(function(e){n.processes--,s.error(e),r.fire("error",e)}))}),(function(e){n.processes--,s.error(e),r.fire("error",e)}))}},{key:"_parseModel",value:function(e,t,i,r){var s=this;function n(e){var i=e.value;if(t.rotateX&&i)for(var r=0,s=i.length;r=e.length)return[e];for(var i=[],r=0;r0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this.cacheBuster=!1!==t.cacheBuster}return C(e,[{key:"_cacheBusterURL",value:function(e){if(!this.cacheBuster)return e;var t=(new Date).getTime();return e.indexOf("?")>-1?e+"&_="+t:e+"?_="+t}},{key:"getCityJSON",value:function(e,t,i){he.loadJSON(this._cacheBusterURL(e),(function(e){t(e)}),(function(e){i(e)}))}}]),e}();function Xk(e,t,i){i=i||2;var r,s,n,o,a,l,u,A=t&&t.length,c=A?t[0]*i:e.length,h=Yk(e,0,c,i,!0),d=[];if(!h||h.next===h.prev)return d;if(A&&(h=function(e,t,i,r){var s,n,o,a=[];for(s=0,n=t.length;s80*i){r=n=e[0],s=o=e[1];for(var p=i;pn&&(n=a),l>o&&(o=l);u=0!==(u=Math.max(n-r,o-s))?1/u:0}return Zk(h,d,i,r,s,u),d}function Yk(e,t,i,r,s){var n,o;if(s===_I(e,t,i,r)>0)for(n=t;n=t;n-=r)o=vI(n,e[n],e[n+1],o);return o&&AI(o,o.next)&&(gI(o),o=o.next),o}function Jk(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=!1,r.steiner||!AI(r,r.next)&&0!==uI(r.prev,r,r.next))r=r.next;else{if(gI(r),(r=t=r.prev)===r.next)break;i=!0}}while(i||r!==t);return t}function Zk(e,t,i,r,s,n,o){if(e){!o&&n&&function(e,t,i,r){var s=e;do{null===s.z&&(s.z=nI(s.x,s.y,t,i,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,function(e){var t,i,r,s,n,o,a,l,u=1;do{for(i=e,e=null,n=null,o=0;i;){for(o++,r=i,a=0,t=0;t0||l>0&&r;)0!==a&&(0===l||!r||i.z<=r.z)?(s=i,i=i.nextZ,a--):(s=r,r=r.nextZ,l--),n?n.nextZ=s:e=s,s.prevZ=n,n=s;i=r}n.nextZ=null,u*=2}while(o>1)}(s)}(e,r,s,n);for(var a,l,u=e;e.prev!==e.next;)if(a=e.prev,l=e.next,n?$k(e,r,s,n):qk(e))t.push(a.i/i),t.push(e.i/i),t.push(l.i/i),gI(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?Zk(e=eI(Jk(e),t,i),t,i,r,s,n,2):2===o&&tI(e,t,i,r,s,n):Zk(Jk(e),t,i,r,s,n,1);break}}}function qk(e){var t=e.prev,i=e,r=e.next;if(uI(t,i,r)>=0)return!1;for(var s=e.next.next;s!==e.prev;){if(aI(t.x,t.y,i.x,i.y,r.x,r.y,s.x,s.y)&&uI(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function $k(e,t,i,r){var s=e.prev,n=e,o=e.next;if(uI(s,n,o)>=0)return!1;for(var a=s.xn.x?s.x>o.x?s.x:o.x:n.x>o.x?n.x:o.x,A=s.y>n.y?s.y>o.y?s.y:o.y:n.y>o.y?n.y:o.y,c=nI(a,l,t,i,r),h=nI(u,A,t,i,r),d=e.prevZ,p=e.nextZ;d&&d.z>=c&&p&&p.z<=h;){if(d!==e.prev&&d!==e.next&&aI(s.x,s.y,n.x,n.y,o.x,o.y,d.x,d.y)&&uI(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==e.prev&&p!==e.next&&aI(s.x,s.y,n.x,n.y,o.x,o.y,p.x,p.y)&&uI(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==e.prev&&d!==e.next&&aI(s.x,s.y,n.x,n.y,o.x,o.y,d.x,d.y)&&uI(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=h;){if(p!==e.prev&&p!==e.next&&aI(s.x,s.y,n.x,n.y,o.x,o.y,p.x,p.y)&&uI(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function eI(e,t,i){var r=e;do{var s=r.prev,n=r.next.next;!AI(s,n)&&cI(s,r,r.next,n)&&pI(s,n)&&pI(n,s)&&(t.push(s.i/i),t.push(r.i/i),t.push(n.i/i),gI(r),gI(r.next),r=e=n),r=r.next}while(r!==e);return Jk(r)}function tI(e,t,i,r,s,n){var o=e;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&lI(o,a)){var l=fI(o,a);return o=Jk(o,o.next),l=Jk(l,l.next),Zk(o,t,i,r,s,n),void Zk(l,t,i,r,s,n)}a=a.next}o=o.next}while(o!==e)}function iI(e,t){return e.x-t.x}function rI(e,t){if(t=function(e,t){var i,r=t,s=e.x,n=e.y,o=-1/0;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){var a=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=s&&a>o){if(o=a,a===s){if(n===r.y)return r;if(n===r.next.y)return r.next}i=r.x=r.x&&r.x>=A&&s!==r.x&&aI(ni.x||r.x===i.x&&sI(i,r)))&&(i=r,h=l)),r=r.next}while(r!==u);return i}(e,t),t){var i=fI(t,e);Jk(t,t.next),Jk(i,i.next)}}function sI(e,t){return uI(e.prev,e,t.prev)<0&&uI(t.next,e,e.next)<0}function nI(e,t,i,r,s){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*s)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*s)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function oI(e){var t=e,i=e;do{(t.x=0&&(e-o)*(r-a)-(i-o)*(t-a)>=0&&(i-o)*(n-a)-(s-o)*(r-a)>=0}function lI(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&cI(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(pI(e,t)&&pI(t,e)&&function(e,t){var i=e,r=!1,s=(e.x+t.x)/2,n=(e.y+t.y)/2;do{i.y>n!=i.next.y>n&&i.next.y!==i.y&&s<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(uI(e.prev,e,t.prev)||uI(e,t.prev,t))||AI(e,t)&&uI(e.prev,e,e.next)>0&&uI(t.prev,t,t.next)>0)}function uI(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function AI(e,t){return e.x===t.x&&e.y===t.y}function cI(e,t,i,r){var s=dI(uI(e,t,i)),n=dI(uI(e,t,r)),o=dI(uI(i,r,e)),a=dI(uI(i,r,t));return s!==n&&o!==a||(!(0!==s||!hI(e,i,t))||(!(0!==n||!hI(e,r,t))||(!(0!==o||!hI(i,e,r))||!(0!==a||!hI(i,t,r)))))}function hI(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function dI(e){return e>0?1:e<0?-1:0}function pI(e,t){return uI(e.prev,e,e.next)<0?uI(e,t,e.next)>=0&&uI(e,e.prev,t)>=0:uI(e,t,e.prev)<0||uI(e,e.next,t)<0}function fI(e,t){var i=new mI(e.i,e.x,e.y),r=new mI(t.i,t.x,t.y),s=e.next,n=t.prev;return e.next=t,t.prev=e,i.next=s,s.prev=i,r.next=i,i.prev=r,n.next=r,r.prev=n,r}function vI(e,t,i,r){var s=new mI(e,t,i);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function gI(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function mI(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function _I(e,t,i,r){for(var s=0,n=t,o=i-r;n0&&(r+=e[s-1].length,i.holes.push(r))}return i};var yI=re.vec2(),bI=re.vec3(),wI=re.vec3(),BI=re.vec3(),xI=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"cityJSONLoader",e,s)).dataSource=s.dataSource,r}return C(i,[{key:"dataSource",get:function(){return this._dataSource},set:function(e){this._dataSource=e||new Kk}},{key:"load",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);var t=new Ph(this.viewer.scene,he.apply(e,{isModel:!0,edges:!0}));if(!e.src&&!e.cityJSON)return this.error("load() param expected: src or cityJSON"),t;var i={};if(e.src)this._loadModel(e.src,e,i,t);else{var r=this.viewer.scene.canvas.spinner;r.processes++,this._parseModel(e.cityJSON,e,i,t),r.processes--}return t}},{key:"_loadModel",value:function(e,t,i,r){var s=this,n=this.viewer.scene.canvas.spinner;n.processes++,this._dataSource.getCityJSON(t.src,(function(e){s._parseModel(e,t,i,r),n.processes--}),(function(e){n.processes--,s.error(e),r.fire("error",e)}))}},{key:"_parseModel",value:function(e,t,i,r){if(!r.destroyed){var s=e.transform?this._transformVertices(e.vertices,e.transform,i.rotateX):e.vertices,n=t.stats||{};n.sourceFormat=e.type||"CityJSON",n.schemaVersion=e.version||"",n.title="",n.author="",n.created="",n.numMetaObjects=0,n.numPropertySets=0,n.numObjects=0,n.numGeometries=0,n.numTriangles=0,n.numVertices=0;var o=!1!==t.loadMetadata,a=o?{id:re.createUUID(),name:"Model",type:"Model"}:null,l=o?{id:"",projectId:"",author:"",createdAt:"",schema:e.version||"",creatingApplication:"",metaObjects:[a],propertySets:[]}:null,u={data:e,vertices:s,sceneModel:r,loadMetadata:o,metadata:l,rootMetaObject:a,nextId:0,stats:n};if(this._parseCityJSON(u),r.finalize(),o){var A=r.id;this.viewer.metaScene.createMetaModel(A,u.metadata,i)}r.scene.once("tick",(function(){r.destroyed||(r.scene.fire("modelLoaded",r.id),r.fire("loaded",!0,!1))}))}}},{key:"_transformVertices",value:function(e,t,i){for(var r=[],s=t.scale||re.vec3([1,1,1]),n=t.translate||re.vec3([0,0,0]),o=0,a=0;o0){for(var u=[],A=0,c=t.geometry.length;A0){var _=g[m[0]];if(void 0!==_.value)d=v[_.value];else{var y=_.values;if(y){p=[];for(var b=0,w=y.length;b0&&(r.createEntity({id:i,meshIds:u,isObject:!0}),e.stats.numObjects++)}}},{key:"_parseGeometrySurfacesWithOwnMaterials",value:function(e,t,i,r){switch(t.type){case"MultiPoint":case"MultiLineString":break;case"MultiSurface":case"CompositeSurface":var s=t.boundaries;this._parseSurfacesWithOwnMaterials(e,i,s,r);break;case"Solid":for(var n=t.boundaries,o=0;o0&&A.push(u.length);var f=this._extractLocalIndices(e,a[p],c,d);u.push.apply(u,h(f))}if(3===u.length)d.indices.push(u[0]),d.indices.push(u[1]),d.indices.push(u[2]);else if(u.length>3){for(var v=[],g=0;g0&&o.indices.length>0){var f=""+e.nextId++;s.createMesh({id:f,primitive:"triangles",positions:o.positions,indices:o.indices,color:i&&i.diffuseColor?i.diffuseColor:[.8,.8,.8],opacity:1}),r.push(f),e.stats.numGeometries++,e.stats.numVertices+=o.positions.length/3,e.stats.numTriangles+=o.indices.length/3}}},{key:"_parseSurfacesWithSharedMaterial",value:function(e,t,i,r){for(var s=e.vertices,n=0;n0&&a.push(o.length);var u=this._extractLocalIndices(e,t[n][l],i,r);o.push.apply(o,h(u))}if(3===o.length)r.indices.push(o[0]),r.indices.push(o[1]),r.indices.push(o[2]);else if(o.length>3){for(var A=[],c=0;c0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this.cacheBuster=!1!==t.cacheBuster}return C(e,[{key:"_cacheBusterURL",value:function(e){if(!this.cacheBuster)return e;var t=(new Date).getTime();return e.indexOf("?")>-1?e+"&_="+t:e+"?_="+t}},{key:"getDotBIM",value:function(e,t,i){he.loadJSON(this._cacheBusterURL(e),(function(e){t(e)}),(function(e){i(e)}))}}]),e}(),CI=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"DotBIMLoader",e,s)).dataSource=s.dataSource,r.objectDefaults=s.objectDefaults,r}return C(i,[{key:"dataSource",get:function(){return this._dataSource},set:function(e){this._dataSource=e||new PI}},{key:"objectDefaults",get:function(){return this._objectDefaults},set:function(e){this._objectDefaults=e||CE}},{key:"load",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.id&&this.viewer.scene.components[t.id]&&(this.error("Component with this ID already exists in viewer: "+t.id+" - will autogenerate this ID"),delete t.id);var i=new Ph(this.viewer.scene,he.apply(t,{isModel:!0,backfaces:t.backfaces,dtxEnabled:t.dtxEnabled,rotation:t.rotation,origin:t.origin})),r=i.id;if(!t.src&&!t.dotBIM)return this.error("load() param expected: src or dotBIM"),i;var s,n,o=t.objectDefaults||this._objectDefaults||CE;if(t.includeTypes){s={};for(var a=0,l=t.includeTypes.length;a=0?A:2*Math.PI-A}return s0||o>0||a>0))}}(),n=[],o=(r?t:t.slice(0).reverse()).map((function(e){return{idx:e}}));o.forEach((function(e,t){e.prev=o[(t-1+o.length)%o.length],e.next=o[(t+1)%o.length]}));for(var a=re.vec2(),l=re.vec2();o.length>2;){for(var u=0,A=function(){if(u>=o.length)throw"isCCW = ".concat(r,"; earIdx = ").concat(u,"; len = ").concat(o.length);var t=o[u],i=e[t.prev.idx],n=e[t.idx],A=e[t.next.idx];if(re.subVec2(i,n,a),re.subVec2(A,n,l),a[0]*l[1]-a[1]*l[0]>=0&&o.every((function(r){return r===t||r===t.prev||r===t.next||!s(e[r.idx],i,n,A)})))return"break";++u};;){if("break"===A())break}var c=o[u];o.splice(u,1),n.push([c.idx,c.next.idx,c.prev.idx]),c.prev.next=c.next,c.next.prev=c.prev}return[e,n]},FI=function(e,t){var i=e.canvas.canvas,r=i.parentNode,s=document.createElement("div");r.insertBefore(s,i);var n=5;s.style.background=t,s.style.border="2px solid white",s.style.margin="0 0",s.style.zIndex="100",s.style.position="absolute",s.style.pointerEvents="none",s.style.display="none";var o=new ot(e,{}),a=function(e){return e+"px"},l=function(){var e=o.canvasPos.slice();lt(i,r,e),s.style.left=a(e[0]-3-n/2),s.style.top=a(e[1]-3-n/2),s.style.borderRadius=a(2*n),s.style.width=a(n),s.style.height=a(n)},u=e.camera.on("viewMatrix",l),A=e.camera.on("projMatrix",l);return{update:function(e){e&&(o.worldPos=e,l()),s.style.display=e?"":"none"},setHighlighted:function(e){n=e?10:5,l()},getCanvasPos:function(){return o.canvasPos},getWorldPos:function(){return o.worldPos},destroy:function(){s.parentNode.removeChild(s),e.camera.off(u),e.camera.off(A),o.destroy()}}},kI=function(e,t,i){var r=null,s=function(s){if(s){r&&r.destroy();try{var n,o,a=EI(s.map((function(e){return[e[0],e[2]]}))),l=c(a,2),u=l[0],A=l[1],d=(n=[]).concat.apply(n,h(u.map((function(e){return[e[0],s[0][1],e[1]]})))),p=(o=[]).concat.apply(o,h(A));r=new gn(e,{pickable:!1,geometry:new Wi(e,{positions:d,indices:p,normals:re.buildNormals(d,p)}),material:new Zi(e,{alpha:void 0!==i?i:.5,backfaces:!0,diffuse:MI(t)})})}catch(e){r=null}}r&&(r.visible=!!s)};return s(null),{updateBase:s,destroy:function(){return r&&r.destroy()}}},II=function(e,t,i,r,s,n,o,a,l){var u=FI(e,r),A=FI(e,r),c=kI(e,r,s),h=n?function(e){n.visible=!!e,e&&(n.canvasPos=e)}:function(){},d=a((function(){h(null),u.update(null)}),(function(e,t){h(e),u.update(t)}),(function(e,n){u.update(n),d=a((function(){h(null),A.update(null),c.updateBase(null)}),(function(e,t){if(h(e),A.update(t),re.distVec3(n,t)>.01){var i=function(e){return Math.min(n[e],t[e])},r=function(e){return Math.max(n[e],t[e])},s=i(0),o=i(1),a=i(2),l=r(0);r(1);var u=r(2);c.updateBase([[s,o,u],[l,o,u],[l,o,a],[s,o,a]])}else c.updateBase(null)}),(function(e,a){A.update(a),u.destroy(),A.destroy(),c.destroy(),h(null);var d=function(e){return Math.min(n[e],a[e])},p=function(e){return Math.max(n[e],a[e])},f=d(0),v=d(2),g=p(0),m=p(2),_=o.createZone({id:re.createUUID(),geometry:{planeCoordinates:[[f,m],[g,m],[g,v],[f,v]],altitude:t,height:i},alpha:s,color:r});l(_)}))}));return{deactivate:function(){d(),u.destroy(),A.destroy(),c.destroy(),h(null)}}},DI=function(e,t){return function(i,r,s){var n=e.scene,o=n.canvas.canvas,a=function(e,t){return t[0]=e.clientX,t[1]=e.clientY,lt(o.ownerDocument.body,o,t),t},l=function(e){var i=re.vec3(),r=re.vec3();return re.canvasPosToWorldRay(o,n.camera.viewMatrix,n.camera.projMatrix,n.camera.projection,e,i,r),t(i,r)},u=!1,A=function(){u=!1},c=function(){A(),o.removeEventListener("mousedown",d),o.removeEventListener("mousemove",p),e.cameraControl.off(f),o.removeEventListener("mouseup",v)},h=re.vec2(),d=function(e){1===e.which&&(a(e,h),u=!0)};o.addEventListener("mousedown",d);var p=function(e){var t=a(e,re.vec2());u&&re.distVec2(h,t)>20&&(A(),i())};o.addEventListener("mousemove",p);var f=e.cameraControl.on("rayMove",(function(e){var t=e.canvasPos;r(t,l(t))})),v=function(e){if(1===e.which&&u){c();var t=a(e,re.vec2());s(t,l(t))}};return o.addEventListener("mouseup",v),c}},SI=function(e,t,i){return function(r,s,n){var o,a=e.scene,l=a.canvas.canvas,u=function(e,t){return t[0]=e.clientX,t[1]=e.clientY,lt(l.ownerDocument.body,l,t),t},A=function(e){var t=re.vec3(),r=re.vec3();return re.canvasPosToWorldRay(l,a.camera.viewMatrix,a.camera.projMatrix,a.camera.projection,e,t,r),i(t,r)},c=null,d=function(){},p=d,f=function(){t.stop(),clearTimeout(c),e.cameraControl.active=!0,p=d,o=null},v=function(){f(),l.removeEventListener("touchstart",g),l.removeEventListener("touchmove",m),l.removeEventListener("touchend",_)},g=function(i){var n=i.touches;if(1!==n.length)f(),r();else{var a=n[0],l=u(a,re.vec2());A(l)&&(o=a.identifier,p=function(e){re.distVec2(l,e)>20&&f()},c=setTimeout((function(){t.start(l),c=setTimeout((function(){t.stop(),e.cameraControl.active=!1,p=function(e){s(e,A(e))},p(l)}),300)}),250))}};l.addEventListener("touchstart",g,{passive:!0});var m=function(e){var t=h(e.changedTouches).find((function(e){return e.identifier===o}));t&&p(u(t,re.vec2()))};l.addEventListener("touchmove",m,{passive:!0});var _=function(e){var t=h(e.changedTouches).find((function(e){return e.identifier===o}));if(t){v();var i=u(t,re.vec2());n(i,A(i))}};return l.addEventListener("touchend",_,{passive:!0}),v}},TI=function(e,t,i,r){var s=-(re.dotVec3(i,t)-e)/re.dotVec3(r,t),n=re.vec3();return re.mulVec3Scalar(r,s,n),re.addVec3(i,n,n),n},LI=function(e){g(i,Ce);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(r=t.call(this,e.viewer.scene,s)).plugin=e,r._container=s.container,!r._container)throw"config missing: container";return r._eventSubs={},r.plugin.viewer.scene,r._geometry=s.geometry,s.onMouseOver,s.onMouseLeave,s.onContextMenu,r._alpha="alpha"in s&&void 0!==s.alpha?s.alpha:.5,r.color=s.color,r._visible=!0,r._rebuildMesh(),r}return C(i,[{key:"_rebuildMesh",value:function(){var e,t=this.plugin.viewer.scene,i=this._geometry.planeCoordinates.slice(),r=this._geometry.height<0,s=this._geometry.altitude+(r?this._geometry.height:0),n=this._geometry.height*(r?-1:1),o=c(EI(i),2),a=o[0],l=o[1],u=[],d=[],p=function(e){var t,i=u.length,r=A(a);try{for(r.s();!(t=r.n()).done;){var o=t.value;u.push([o[0],s+(e?n:0),o[1]])}}catch(e){r.e(e)}finally{r.f()}var c,p=A(l);try{for(p.s();!(c=p.n()).done;){var f=c.value;d.push.apply(d,h((e?f:f.slice(0).reverse()).map((function(e){return e+i}))))}}catch(e){p.e(e)}finally{p.f()}};p(!1),p(!0);for(var f=function(e){var t=a[e],i=a[(e+1)%a.length],r=s,o=s+n,l=u.length;u.push([t[0],r,t[1]],[i[0],r,i[1]],[i[0],o,i[1]],[t[0],o,t[1]]),d.push.apply(d,h([0,1,2,0,2,3].map((function(e){return e+l}))))},v=0;vb?1:0;w|=C,B.push(C)}switch(w){case 0:case 1:m.push(y);break;case 2:break;case 3:for(var M=[],E=0;E=3&&m.push(M)}}}catch(e){_.e(e)}finally{_.f()}i=m}}catch(e){d.e(e)}finally{d.f()}if(0===i.length)return null;var U,O=re.vec3([0,0,0]),N=new Set,Q=A(i);try{for(Q.s();!(U=Q.n()).done;){var V,H=A(U.value);try{for(H.s();!(V=H.n()).done;){var j=V.value,G=j.map((function(e){return e.toFixed(3)})).join(":");N.has(G)||(N.add(G),re.addVec3(O,j,O))}}catch(e){H.e(e)}finally{H.f()}}}catch(e){Q.e(e)}finally{Q.f()}return re.mulVec3Scalar(O,1/N.size,O),O}},{key:"center",get:function(){return this._center}},{key:"altitude",get:function(){return this._geometry.altitude},set:function(e){this._geometry.altitude=e,this._rebuildMesh()}},{key:"height",get:function(){return this._geometry.height},set:function(e){this._geometry.height=e,this._rebuildMesh()}},{key:"highlighted",get:function(){return this._highlighted},set:function(e){this._highlighted=e,this._zoneMesh&&(this._zoneMesh.highlighted=e)}},{key:"color",get:function(){return this._color},set:function(e){this._color=e,this._zoneMesh&&(this._zoneMesh.material.diffuse=MI(this._color))}},{key:"alpha",get:function(){return this._alpha},set:function(e){this._alpha=e,this._zoneMesh&&(this._zoneMesh.material.alpha=this._alpha)}},{key:"edges",get:function(){return this._edges},set:function(e){this._edges=e,this._zoneMesh&&(this._zoneMesh.edges=this._edges)}},{key:"visible",get:function(){return this._visible},set:function(e){this._visible=!!e,this._zoneMesh.visible=this._visible,this._needUpdate()}},{key:"getJSON",value:function(){return{id:this.id,geometry:this._geometry,alpha:this._alpha,color:this._color}}},{key:"duplicate",value:function(){return this.plugin.createZone({id:re.createUUID(),geometry:{planeCoordinates:this._geometry.planeCoordinates.map((function(e){return e.slice()})),altitude:this._geometry.altitude,height:this._geometry.height},alpha:this._alpha,color:this._color})}},{key:"destroy",value:function(){this._zoneMesh.destroy(),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),RI=function(e){g(i,Ce);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,e.viewer.scene)).zonesPlugin=e,r.pointerLens=s.pointerLens,r._deactivate=null,r}return C(i,[{key:"active",get:function(){return!!this._deactivate}},{key:"activate",value:function(e,t,i,r){if(!this._deactivate){if("object"===B(e)&&null!==e){var s=e,n=function(e,t){if(e in s)return s[e];if(void 0!==t)return t;throw"config missing: "+e};e=n("altitude"),t=n("height"),i=n("color","#008000"),r=n("alpha",.5)}var o=this.zonesPlugin,a=o.viewer,l=a.scene,u=this,A=DI(a,(function(t,i){return TI(e,re.vec3([0,1,0]),t,i)}));!function s(){u._deactivate=II(l,e,t,i,r,u.pointerLens,o,A,(function(e){var t=!0;u._deactivate=function(){t=!1},u.fire("zoneEnd",e),t&&s()})).deactivate}()}}},{key:"deactivate",value:function(){this._deactivate&&(this._deactivate(),this._deactivate=null)}},{key:"destroy",value:function(){this.deactivate(),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),UI=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"Zones",e))._pointerLens=s.pointerLens,r._container=s.container||document.body,r._zones=[],r.defaultColor=void 0!==s.defaultColor?s.defaultColor:"#00BBFF",r.zIndex=s.zIndex||1e4,r._onMouseOver=function(e,t){r.fire("mouseOver",{plugin:b(r),zone:t,event:e})},r._onMouseLeave=function(e,t){r.fire("mouseLeave",{plugin:b(r),zone:t,event:e})},r._onContextMenu=function(e,t){r.fire("contextMenu",{plugin:b(r),zone:t,event:e})},r}return C(i,[{key:"createZone",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.viewer.scene.components[t.id]&&(this.error("Viewer scene component with this ID already exists: "+t.id),delete t.id);var i=new LI(this,{id:t.id,plugin:this,container:this._container,geometry:t.geometry,alpha:t.alpha,color:t.color,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._zones.push(i),i.on("destroyed",(function(){var t=e._zones.indexOf(i);t>=0&&e._zones.splice(t,1)})),this.fire("zoneCreated",i),i}},{key:"zones",get:function(){return this._zones}},{key:"destroy",value:function(){f(w(i.prototype),"destroy",this).call(this)}}]),i}(),OI=function(e){g(i,Ce);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,e.viewer.scene)).zonesPlugin=e,r.pointerLens=s.pointerLens,r.pointerCircle=new Re(e.viewer),r._deactivate=null,r}return C(i,[{key:"active",get:function(){return!!this._deactivate}},{key:"activate",value:function(e,t,i,r){if("object"===B(e)&&null!==e){var s=e,n=function(e,t){if(e in s)return s[e];if(void 0!==t)return t;throw"config missing: "+e};e=n("altitude"),t=n("height"),i=n("color","#008000"),r=n("alpha",.5)}if(!this._deactivate){var o=this.zonesPlugin,a=o.viewer,l=a.scene,u=this,A=SI(a,this.pointerCircle,(function(t,i){return TI(e,re.vec3([0,1,0]),t,i)}));!function s(){u._deactivate=II(l,e,t,i,r,u.pointerLens,o,A,(function(e){var t=!0;u._deactivate=function(){t=!1},u.fire("zoneEnd",e),t&&s()})).deactivate}()}}},{key:"deactivate",value:function(){this._deactivate&&(this._deactivate(),this._deactivate=null)}},{key:"destroy",value:function(){this.deactivate(),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),NI=function(e,t,i,r,s,n,o,a,l){var u,A=n?function(e){n.visible=!!e,e&&(n.canvasPos=e)}:function(){},c=[function(){return A(null)}],h=kI(e,r,s);return c.push((function(){return h.destroy()})),function n(d){var p=FI(e,r),f=d.length>0&&function(e,t,i){var r=e.canvas.canvas,s=new ot(e,{});s.worldPos=i;var n=new ot(e,{}),o=r.ownerDocument.body,a=new ht(o,{color:t,thickness:1,thicknessClickable:6});a.setVisible(!1);var l=function(){var e=s.canvasPos.slice(),t=n.canvasPos.slice();lt(r,o,e),lt(r,o,t),a.setStartAndEnd(e[0],e[1],t[0],t[1])},u=e.camera.on("viewMatrix",l),A=e.camera.on("projMatrix",l);return{update:function(e){e&&(n.worldPos=e,l()),a.setVisible(!!e)},destroy:function(){e.camera.off(u),e.camera.off(A),s.destroy(),n.destroy(),a.destroy()}}}(e,r,d[d.length-1].getWorldPos());c.push((function(){p.destroy(),f&&f.destroy()}));var v=d.length>0&&d[0],g=function(e){var t=v&&v.getCanvasPos();return t&&re.distVec2(t,e)<10&&{canvasPos:t,worldPos:v.getWorldPos()}},m=function(){var e=function(e,t,i){return t[0]<=Math.max(e[0],i[0])&&t[0]>=Math.min(e[0],i[0])&&t[1]<=Math.max(e[1],i[1])&&t[1]>=Math.min(e[1],i[1])},t=function(e,t,i){var r=(t[1]-e[1])*(i[0]-t[0])-(t[0]-e[0])*(i[1]-t[1]);return 0===r?0:r>0?1:2};return function(i,r){for(var s=i[i.length-2],n=i[i.length-1],o=r?1:0;o2?d.map((function(e){return e.getWorldPos()})):null)}),(function(e,t){var i=d.length>2&&g(e);if(v&&v.setHighlighted(!!i),A(i?i.canvasPos:e),p.update(!i&&t),f&&f.update(i?i.worldPos:t),d.length>=2){var r=d.map((function(e){return e.getWorldPos()})).concat(i?[]:[t]),s=m(r.map((function(e){return[e[0],e[2]]})),i);h.updateBase(s?null:r)}else h.updateBase(null)}),(function(e,a){var u=d.length>2&&g(e),A=d.map((function(e){return e.getWorldPos()})).concat(u?[]:[a]);h.updateBase(A);var v=A.map((function(e){return[e[0],e[2]]}));d.length>2&&m(v,u)?(c.pop()(),n(d)):u?(p.update(a),c.forEach((function(e){return e()})),l(o.createZone({id:re.createUUID(),geometry:{planeCoordinates:v,altitude:t,height:i},alpha:s,color:r}))):(p.update(a),f&&f.update(a),n(d.concat(p)))}))}([]),{closeSurface:function(){throw"TODO"},deactivate:function(){u(),c.forEach((function(e){return e()}))}}},QI=function(e){g(i,Ce);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,e.viewer.scene)).zonesPlugin=e,r.pointerLens=s.pointerLens,r._action=null,r}return C(i,[{key:"active",get:function(){return!!this._action}},{key:"activate",value:function(e,t,i,r){if("object"===B(e)&&null!==e){var s=e,n=function(e,t){if(e in s)return s[e];if(void 0!==t)return t;throw"config missing: "+e};e=n("altitude"),t=n("height"),i=n("color","#008000"),r=n("alpha",.5)}if(!this._action){var o=this.zonesPlugin,a=o.viewer,l=a.scene,u=this,A=DI(a,(function(t,i){return TI(e,re.vec3([0,1,0]),t,i)}));!function s(){u._action=NI(l,e,t,i,r,u.pointerLens,o,A,(function(e){var t=!0;u._action={deactivate:function(){t=!1}},u.fire("zoneEnd",e),t&&s()}))}()}}},{key:"deactivate",value:function(){this._action&&(this._action.deactivate(),this._action=null)}},{key:"destroy",value:function(){this.deactivate(),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),VI=function(e){g(i,Ce);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,e.viewer.scene)).zonesPlugin=e,r.pointerLens=s.pointerLens,r.pointerCircle=new Re(e.viewer),r._action=null,r}return C(i,[{key:"active",get:function(){return!!this._action}},{key:"activate",value:function(e,t,i,r){if("object"===B(e)&&null!==e){var s=e,n=function(e,t){if(e in s)return s[e];if(void 0!==t)return t;throw"config missing: "+e};e=n("altitude"),t=n("height"),i=n("color","#008000"),r=n("alpha",.5)}if(!this._action){var o=this.zonesPlugin,a=o.viewer,l=a.scene,u=this,A=SI(a,this.pointerCircle,(function(t,i){return TI(e,re.vec3([0,1,0]),t,i)}));!function s(){u._action=NI(l,e,t,i,r,u.pointerLens,o,A,(function(e){var t=!0;u._action={deactivate:function(){t=!1}},u.fire("zoneEnd",e),t&&s()}))}()}}},{key:"deactivate",value:function(){this._action&&(this._action.deactivate(),this._action=null)}},{key:"destroy",value:function(){this.deactivate(),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),HI=function(e){g(i,Ce);var t=_(i);function i(e,r,s,n){var o;x(this,i);var a=e.plugin.viewer,l=a.scene;o=t.call(this,l);var u=e._geometry.altitude,A=e._geometry.planeCoordinates.map((function(t){var i=l.canvas.canvas.ownerDocument.body,r=new ut(l,{},i,{fillColor:e._color});return r.worldPos=re.vec3([t[0],u,t[1]]),r.on("worldPos",(function(){t[0]=r.worldPos[0],t[1]=r.worldPos[2];try{e._rebuildMesh()}catch(t){e._zoneMesh&&(e._zoneMesh.destroy(),e._zoneMesh=null)}})),r})),c=ct({viewer:a,handleMouseEvents:s,handleTouchEvents:n,pointerLens:r&&r.pointerLens,dots:A,ray2WorldPos:function(e,t){return TI(u,re.vec3([0,1,0]),e,t)},onEnd:function(t,i){return e._zoneMesh&&o.fire("edited"),!!e._zoneMesh}}),h=function(){c(),A.forEach((function(e){return e.destroy()}))},d=e.on("destroyed",h);return o._deactivate=function(){e.off("destroyed",d),h()},o}return C(i,[{key:"deactivate",value:function(){this._deactivate(),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),jI=function(e){g(i,HI);var t=_(i);function i(e,r){return x(this,i),t.call(this,e,r,!0,!1)}return C(i)}(),GI=function(e){g(i,HI);var t=_(i);function i(e,r){return x(this,i),t.call(this,e,r,!1,!0)}return C(i)}(),zI=function(e){g(i,Ce);var t=_(i);function i(e,r,s,n){var o;x(this,i);var a=e.plugin.viewer,l=a.scene,u=l.canvas.canvas,A=b(o=t.call(this,l)),c=e._geometry.altitude,d=r&&r.pointerLens,p=d?function(e){d.visible=!!e,e&&(d.canvasPos=e)}:function(){},f=function(e){var t,i,r=re.vec3(),s=re.vec3();return re.canvasPosToWorldRay(u,l.camera.viewMatrix,l.camera.projMatrix,l.camera.projection,e,r,s),t=r,i=s,TI(c,re.vec3([0,1,0]),t,i)},v=function(e,t){return t[0]=e.clientX,t[1]=e.clientY,lt(u.ownerDocument.body,u,t),t},g=function(e,t){var i=function(e){e.preventDefault(),t(e)};return u.addEventListener(e,i),function(){return u.removeEventListener(e,i)}},m=function(){},_=function(t,i,r,s){var n,o,l,c,h=s(t),d=v(h,re.vec2()),_=a.scene.pick({canvasPos:d,includeEntities:[e._zoneMesh.id]});if((_&&_.entity&&_.entity.zone)===e){m(),u.style.cursor="move",a.cameraControl.active=!1;var y=(n=e._geometry.planeCoordinates.map((function(e){return e.slice()})),o=f(d),l=re.vec2([o[0],o[2]]),c=re.vec2(),function(t){var i=f(t);c[0]=i[0],c[1]=i[2],re.subVec2(l,c,c),e._geometry.planeCoordinates.forEach((function(e,t){re.subVec2(n[t],c,e)}));try{e._rebuildMesh()}catch(t){e._zoneMesh&&(e._zoneMesh.destroy(),e._zoneMesh=null)}}),b=g(i,(function(e){var t=s(e);if(t){var i=v(t,re.vec2());y(i),p(i)}})),w=g(r,(function(e){var t=s(e);if(t){var i=v(t,re.vec2());y(i),p(null),m(),A.fire("translated")}}));m=function(){m=function(){},u.style.cursor="default",a.cameraControl.active=!0,b(),w()}}},y=[];s&&y.push(g("mousedown",(function(e){1===e.which&&_(e,"mousemove","mouseup",(function(e){return 1===e.which&&e}))}))),n&&y.push(g("touchstart",(function(e){if(1===e.touches.length){var t=e.touches[0].identifier;_(e,"touchmove","touchend",(function(e){return h(e.changedTouches).find((function(e){return e.identifier===t}))}))}})));var w=function(){m(),y.forEach((function(e){return e()})),p(null)},B=e.on("destroyed",w);return o._deactivate=function(){e.off("destroyed",B),w()},o}return C(i,[{key:"deactivate",value:function(){this._deactivate(),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),WI=function(e){g(i,zI);var t=_(i);function i(e,r){return x(this,i),t.call(this,e,r,!0,!1)}return C(i)}(),KI=function(e){g(i,zI);var t=_(i);function i(e,r){return x(this,i),t.call(this,e,r,!1,!0)}return C(i)}();export{Rr as AlphaFormat,Ti as AmbientLight,wt as AngleMeasurementEditMouseControl,Bt as AngleMeasurementEditTouchControl,gt as AngleMeasurementsControl,mt as AngleMeasurementsMouseControl,_t as AngleMeasurementsPlugin,yt as AngleMeasurementsTouchControl,Et as AnnotationsPlugin,Bn as AxisGizmoPlugin,Dh as BCFViewpointsPlugin,ho as Bitmap,Cr as ByteType,wd as CameraMemento,id as CameraPath,ud as CameraPathAnimation,xI as CityJSONLoaderPlugin,dr as ClampToEdgeWrapping,Ce as Component,Ps as CompressedMediaType,la as Configs,Y as ContextMenu,Md as CubicBezierCurve,$h as Curve,jc as DefaultLoadingManager,Vr as DepthFormat,Hr as DepthStencilFormat,Si as DirLight,Wh as DistanceMeasurementEditMouseControl,Kh as DistanceMeasurementEditTouchControl,Vh as DistanceMeasurementsControl,Hh as DistanceMeasurementsMouseControl,jh as DistanceMeasurementsPlugin,Gh as DistanceMeasurementsTouchControl,PI as DotBIMDefaultDataSource,CI as DotBIMLoaderPlugin,tr as EdgeMaterial,$i as EmphasisMaterial,uF as FaceAlignedSectionPlanesPlugin,Xh as FastNavPlugin,Ir as FloatType,Zn as Fresnel,Ie as Frustum,ke as FrustumPlane,ws as GIFMediaType,Yh as GLTFDefaultDataSource,ME as GLTFLoaderPlugin,Dr as HalfFloatType,pd as ImagePlane,Fr as IntType,Bs as JPEGMediaType,Yc as KTX2TextureTranscoder,zk as LASLoaderPlugin,Ln as LambertMaterial,yd as LightMap,Mh as LineSet,ys as LinearEncoding,yr as LinearFilter,xr as LinearMipMapLinearFilter,wr as LinearMipMapNearestFilter,Br as LinearMipmapLinearFilter,br as LinearMipmapNearestFilter,Gc as Loader,Hc as LoadingManager,Jh as LocaleService,Qr as LuminanceAlphaFormat,Nr as LuminanceFormat,G as Map,ot as Marker,Te as MarqueePicker,Le as MarqueePickerMouseControl,gn as Mesh,On as MetallicMaterial,pr as MirroredRepeatWrapping,xd as ModelMemento,IE as NavCubePlugin,fr as NearestFilter,_r as NearestMipMapLinearFilter,vr as NearestMipMapNearestFilter,mr as NearestMipmapLinearFilter,gr as NearestMipmapNearestFilter,Tn as Node,VE as OBJLoaderPlugin,ne as ObjectsKdTree3,Cd as ObjectsMemento,xs as PNGMediaType,Ed as Path,kd as PerformanceModel,Zi as PhongMaterial,Rt as PickResult,Ue as Plugin,fd as PointLight,Re as PointerCircle,J as PointerLens,Fd as QuadraticBezierCurve,oe as Queue,Or as RGBAFormat,Kr as RGBAIntegerFormat,vs as RGBA_ASTC_10x10_Format,ds as RGBA_ASTC_10x5_Format,ps as RGBA_ASTC_10x6_Format,fs as RGBA_ASTC_10x8_Format,gs as RGBA_ASTC_12x10_Format,ms as RGBA_ASTC_12x12_Format,ns as RGBA_ASTC_4x4_Format,os as RGBA_ASTC_5x4_Format,as as RGBA_ASTC_5x5_Format,ls as RGBA_ASTC_6x5_Format,us as RGBA_ASTC_6x6_Format,As as RGBA_ASTC_8x5_Format,cs as RGBA_ASTC_8x6_Format,hs as RGBA_ASTC_8x8_Format,_s as RGBA_BPTC_Format,ss as RGBA_ETC2_EAC_Format,ts as RGBA_PVRTC_2BPPV1_Format,es as RGBA_PVRTC_4BPPV1_Format,Yr as RGBA_S3TC_DXT1_Format,Jr as RGBA_S3TC_DXT3_Format,Zr as RGBA_S3TC_DXT5_Format,Ur as RGBFormat,is as RGB_ETC1_Format,rs as RGB_ETC2_Format,$r as RGB_PVRTC_2BPPV1_Format,qr as RGB_PVRTC_4BPPV1_Format,Xr as RGB_S3TC_DXT1_Format,zr as RGFormat,Wr as RGIntegerFormat,Wi as ReadableGeometry,jr as RedFormat,Gr as RedIntegerFormat,_d as ReflectionMap,hr as RepeatWrapping,cF as STLDefaultDataSource,yF as STLLoaderPlugin,Ph as SceneModel,go as SceneModelMesh,vh as SceneModelTransform,xn as SectionPlane,YE as SectionPlanesPlugin,Mr as ShortType,Id as Skybox,AF as SkyboxesPlugin,Vn as SpecularMaterial,ed as SplineCurve,bd as SpriteMarker,tF as StoreyViewsPlugin,Jn as Texture,Dd as TextureTranscoder,BF as TreeViewPlugin,Pr as UnsignedByteType,Lr as UnsignedInt248Type,kr as UnsignedIntType,Sr as UnsignedShort4444Type,Tr as UnsignedShort5551Type,Er as UnsignedShortType,eo as VBOGeometry,EF as ViewCullPlugin,bb as Viewer,Uk as WebIFCLoaderPlugin,Kc as WorkerPool,FF as XKTDefaultDataSource,_k as XKTLoaderPlugin,Lk as XML3DLoaderPlugin,HI as ZoneEditControl,jI as ZoneEditMouseControl,GI as ZoneEditTouchControl,zI as ZoneTranslateControl,WI as ZoneTranslateMouseControl,KI as ZoneTranslateTouchControl,RI as ZonesMouseControl,UI as ZonesPlugin,QI as ZonesPolysurfaceMouseControl,VI as ZonesPolysurfaceTouchControl,OI as ZonesTouchControl,Ki as buildBoxGeometry,so as buildBoxLinesGeometry,no as buildBoxLinesGeometryFromAABB,_n as buildCylinderGeometry,oo as buildGridGeometry,co as buildLineGeometry,ao as buildPlaneGeometry,uo as buildPolylineGeometry,Ao as buildPolylineGeometryFromCurve,yn as buildSphereGeometry,lo as buildTorusGeometry,wn as buildVectorTextGeometry,Ve as createRTCViewMat,Se as frustumIntersectsAABB3,Zc as getKTX2TextureTranscoder,ze as getPlaneRTCPos,io as load3DSGeometry,ro as loadOBJGeometry,re as math,Ge as rtcToWorldPos,bs as sRGBEncoding,De as setFrustum,ae as stats,he as utils,He as worldToRTCPos,je as worldToRTCPositions}; +***************************************************************************** */var wp=function(e,t){return wp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},wp(e,t)};function Bp(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}wp(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var xp=function(){return xp=Object.assign||function(e){for(var t,i=1,r=arguments.length;i0&&s[s.length-1])||6!==n[0]&&2!==n[0])){o=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]=55296&&s<=56319&&i>10),o%1024+56320)),(s+1===i||r.length>16384)&&(n+=String.fromCharCode.apply(String,r),r.length=0)}return n},Dp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Sp="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Tp=0;Tp=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>5])<<2)+(31&e),this.data[t];if(e<=65535)return t=((t=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[t];if(e>11),t=this.index[t],t+=e>>5&63,t=((t=this.index[t])<<2)+(31&e),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Qp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vp="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Hp=0;Hp>4,A[l++]=(15&r)<<4|s>>2,A[l++]=(3&s)<<6|63&n;return u}(e),o=Array.isArray(n)?function(e){for(var t=e.length,i=[],r=0;r0;){var o=r[--n];if(Array.isArray(e)?-1!==e.indexOf(o):e===o)for(var a=i;a<=r.length;){var l;if((l=r[++a])===t)return!0;if(l!==jp)break}if(o!==jp)break}return!1},xf=function(e,t){for(var i=e;i>=0;){var r=t[i];if(r!==jp)return r;i--}return 0},Pf=function(e,t,i,r,s){if(0===i[r])return"×";var n=r-1;if(Array.isArray(s)&&!0===s[n])return"×";var o=n-1,a=n+1,l=t[n],u=o>=0?t[o]:0,A=t[a];if(2===l&&3===A)return"×";if(-1!==gf.indexOf(l))return"!";if(-1!==gf.indexOf(A))return"×";if(-1!==mf.indexOf(A))return"×";if(8===xf(n,t))return"÷";if(11===ff.get(e[n]))return"×";if((l===nf||l===of)&&11===ff.get(e[a]))return"×";if(7===l||7===A)return"×";if(9===l)return"×";if(-1===[jp,Gp,zp].indexOf(l)&&9===A)return"×";if(-1!==[Wp,Kp,Xp,qp,rf].indexOf(A))return"×";if(xf(n,t)===Zp)return"×";if(Bf(23,Zp,n,t))return"×";if(Bf([Wp,Kp],Jp,n,t))return"×";if(Bf(12,12,n,t))return"×";if(l===jp)return"÷";if(23===l||23===A)return"×";if(16===A||16===l)return"÷";if(-1!==[Gp,zp,Jp].indexOf(A)||14===l)return"×";if(36===u&&-1!==wf.indexOf(l))return"×";if(l===rf&&36===A)return"×";if(A===Yp)return"×";if(-1!==vf.indexOf(A)&&l===$p||-1!==vf.indexOf(l)&&A===$p)return"×";if(l===tf&&-1!==[uf,nf,of].indexOf(A)||-1!==[uf,nf,of].indexOf(l)&&A===ef)return"×";if(-1!==vf.indexOf(l)&&-1!==_f.indexOf(A)||-1!==_f.indexOf(l)&&-1!==vf.indexOf(A))return"×";if(-1!==[tf,ef].indexOf(l)&&(A===$p||-1!==[Zp,zp].indexOf(A)&&t[a+1]===$p)||-1!==[Zp,zp].indexOf(l)&&A===$p||l===$p&&-1!==[$p,rf,qp].indexOf(A))return"×";if(-1!==[$p,rf,qp,Wp,Kp].indexOf(A))for(var c=n;c>=0;){if((h=t[c])===$p)return"×";if(-1===[rf,qp].indexOf(h))break;c--}if(-1!==[tf,ef].indexOf(A))for(c=-1!==[Wp,Kp].indexOf(l)?o:n;c>=0;){var h;if((h=t[c])===$p)return"×";if(-1===[rf,qp].indexOf(h))break;c--}if(Af===l&&-1!==[Af,cf,af,lf].indexOf(A)||-1!==[cf,af].indexOf(l)&&-1!==[cf,hf].indexOf(A)||-1!==[hf,lf].indexOf(l)&&A===hf)return"×";if(-1!==bf.indexOf(l)&&-1!==[Yp,ef].indexOf(A)||-1!==bf.indexOf(A)&&l===tf)return"×";if(-1!==vf.indexOf(l)&&-1!==vf.indexOf(A))return"×";if(l===qp&&-1!==vf.indexOf(A))return"×";if(-1!==vf.concat($p).indexOf(l)&&A===Zp&&-1===pf.indexOf(e[a])||-1!==vf.concat($p).indexOf(A)&&l===Kp)return"×";if(41===l&&41===A){for(var d=i[n],p=1;d>0&&41===t[--d];)p++;if(p%2!=0)return"×"}return l===nf&&A===of?"×":"÷"},Cf=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var i=function(e,t){void 0===t&&(t="strict");var i=[],r=[],s=[];return e.forEach((function(e,n){var o=ff.get(e);if(o>50?(s.push(!0),o-=50):s.push(!1),-1!==["normal","auto","loose"].indexOf(t)&&-1!==[8208,8211,12316,12448].indexOf(e))return r.push(n),i.push(16);if(4===o||11===o){if(0===n)return r.push(n),i.push(sf);var a=i[n-1];return-1===yf.indexOf(a)?(r.push(r[n-1]),i.push(a)):(r.push(n),i.push(sf))}return r.push(n),31===o?i.push("strict"===t?Jp:uf):o===df||29===o?i.push(sf):43===o?e>=131072&&e<=196605||e>=196608&&e<=262141?i.push(uf):i.push(sf):void i.push(o)})),[r,i,s]}(e,t.lineBreak),r=i[0],s=i[1],n=i[2];"break-all"!==t.wordBreak&&"break-word"!==t.wordBreak||(s=s.map((function(e){return-1!==[$p,sf,df].indexOf(e)?uf:e})));var o="keep-all"===t.wordBreak?n.map((function(t,i){return t&&e[i]>=19968&&e[i]<=40959})):void 0;return[r,s,o]},Mf=function(){function e(e,t,i,r){this.codePoints=e,this.required="!"===t,this.start=i,this.end=r}return e.prototype.slice=function(){return Ip.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),Ef=function(e){return e>=48&&e<=57},Ff=function(e){return Ef(e)||e>=65&&e<=70||e>=97&&e<=102},kf=function(e){return 10===e||9===e||32===e},If=function(e){return function(e){return function(e){return e>=97&&e<=122}(e)||function(e){return e>=65&&e<=90}(e)}(e)||function(e){return e>=128}(e)||95===e},Df=function(e){return If(e)||Ef(e)||45===e},Sf=function(e){return e>=0&&e<=8||11===e||e>=14&&e<=31||127===e},Tf=function(e,t){return 92===e&&10!==t},Lf=function(e,t,i){return 45===e?If(t)||Tf(t,i):!!If(e)||!(92!==e||!Tf(e,t))},Rf=function(e,t,i){return 43===e||45===e?!!Ef(t)||46===t&&Ef(i):Ef(46===e?t:e)},Uf=function(e){var t=0,i=1;43!==e[t]&&45!==e[t]||(45===e[t]&&(i=-1),t++);for(var r=[];Ef(e[t]);)r.push(e[t++]);var s=r.length?parseInt(Ip.apply(void 0,r),10):0;46===e[t]&&t++;for(var n=[];Ef(e[t]);)n.push(e[t++]);var o=n.length,a=o?parseInt(Ip.apply(void 0,n),10):0;69!==e[t]&&101!==e[t]||t++;var l=1;43!==e[t]&&45!==e[t]||(45===e[t]&&(l=-1),t++);for(var u=[];Ef(e[t]);)u.push(e[t++]);var A=u.length?parseInt(Ip.apply(void 0,u),10):0;return i*(s+a*Math.pow(10,-o))*Math.pow(10,l*A)},Of={type:2},Nf={type:3},Qf={type:4},Vf={type:13},Hf={type:8},jf={type:21},Gf={type:9},zf={type:10},Wf={type:11},Kf={type:12},Xf={type:14},Yf={type:23},Jf={type:1},Zf={type:25},qf={type:24},$f={type:26},ev={type:27},tv={type:28},iv={type:29},rv={type:31},sv={type:32},nv=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(kp(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==sv;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case 34:return this.consumeStringToken(34);case 35:var t=this.peekCodePoint(0),i=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Df(t)||Tf(i,r)){var s=Lf(t,i,r)?2:1;return{type:5,value:this.consumeName(),flags:s}}break;case 36:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Vf;break;case 39:return this.consumeStringToken(39);case 40:return Of;case 41:return Nf;case 42:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Xf;break;case 43:if(Rf(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case 44:return Qf;case 45:var n=e,o=this.peekCodePoint(0),a=this.peekCodePoint(1);if(Rf(n,o,a))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(Lf(n,o,a))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(45===o&&62===a)return this.consumeCodePoint(),this.consumeCodePoint(),qf;break;case 46:if(Rf(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case 47:if(42===this.peekCodePoint(0))for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(42===l&&47===(l=this.consumeCodePoint()))return this.consumeToken();if(-1===l)return this.consumeToken()}break;case 58:return $f;case 59:return ev;case 60:if(33===this.peekCodePoint(0)&&45===this.peekCodePoint(1)&&45===this.peekCodePoint(2))return this.consumeCodePoint(),this.consumeCodePoint(),Zf;break;case 64:var u=this.peekCodePoint(0),A=this.peekCodePoint(1),c=this.peekCodePoint(2);if(Lf(u,A,c))return{type:7,value:this.consumeName()};break;case 91:return tv;case 92:if(Tf(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case 93:return iv;case 61:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Hf;break;case 123:return Wf;case 125:return Kf;case 117:case 85:var h=this.peekCodePoint(0),d=this.peekCodePoint(1);return 43!==h||!Ff(d)&&63!==d||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case 124:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Gf;if(124===this.peekCodePoint(0))return this.consumeCodePoint(),jf;break;case 126:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),zf;break;case-1:return sv}return kf(e)?(this.consumeWhiteSpace(),rv):Ef(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):If(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Ip(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return void 0===e?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();Ff(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var i=!1;63===t&&e.length<6;)e.push(t),t=this.consumeCodePoint(),i=!0;if(i)return{type:30,start:parseInt(Ip.apply(void 0,e.map((function(e){return 63===e?48:e}))),16),end:parseInt(Ip.apply(void 0,e.map((function(e){return 63===e?70:e}))),16)};var r=parseInt(Ip.apply(void 0,e),16);if(45===this.peekCodePoint(0)&&Ff(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var s=[];Ff(t)&&s.length<6;)s.push(t),t=this.consumeCodePoint();return{type:30,start:r,end:parseInt(Ip.apply(void 0,s),16)}}return{type:30,start:r,end:r}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return"url"===e.toLowerCase()&&40===this.peekCodePoint(0)?(this.consumeCodePoint(),this.consumeUrlToken()):40===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),-1===this.peekCodePoint(0))return{type:22,value:""};var t=this.peekCodePoint(0);if(39===t||34===t){var i=this.consumeStringToken(this.consumeCodePoint());return 0===i.type&&(this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0))?(this.consumeCodePoint(),{type:22,value:i.value}):(this.consumeBadUrlRemnants(),Yf)}for(;;){var r=this.consumeCodePoint();if(-1===r||41===r)return{type:22,value:Ip.apply(void 0,e)};if(kf(r))return this.consumeWhiteSpace(),-1===this.peekCodePoint(0)||41===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:22,value:Ip.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Yf);if(34===r||39===r||40===r||Sf(r))return this.consumeBadUrlRemnants(),Yf;if(92===r){if(!Tf(r,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),Yf;e.push(this.consumeEscapedCodePoint())}else e.push(r)}},e.prototype.consumeWhiteSpace=function(){for(;kf(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(41===e||-1===e)return;Tf(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t="";e>0;){var i=Math.min(5e4,e);t+=Ip.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),t},e.prototype.consumeStringToken=function(e){for(var t="",i=0;;){var r=this._value[i];if(-1===r||void 0===r||r===e)return{type:0,value:t+=this.consumeStringSlice(i)};if(10===r)return this._value.splice(0,i),Jf;if(92===r){var s=this._value[i+1];-1!==s&&void 0!==s&&(10===s?(t+=this.consumeStringSlice(i),i=-1,this._value.shift()):Tf(r,s)&&(t+=this.consumeStringSlice(i),t+=Ip(this.consumeEscapedCodePoint()),i=-1))}i++}},e.prototype.consumeNumber=function(){var e=[],t=4,i=this.peekCodePoint(0);for(43!==i&&45!==i||e.push(this.consumeCodePoint());Ef(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(46===i&&Ef(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;Ef(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0),r=this.peekCodePoint(1);var s=this.peekCodePoint(2);if((69===i||101===i)&&((43===r||45===r)&&Ef(s)||Ef(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;Ef(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[Uf(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],i=e[1],r=this.peekCodePoint(0),s=this.peekCodePoint(1),n=this.peekCodePoint(2);return Lf(r,s,n)?{type:15,number:t,flags:i,unit:this.consumeName()}:37===r?(this.consumeCodePoint(),{type:16,number:t,flags:i}):{type:17,number:t,flags:i}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Ff(e)){for(var t=Ip(e);Ff(this.peekCodePoint(0))&&t.length<6;)t+=Ip(this.consumeCodePoint());kf(this.peekCodePoint(0))&&this.consumeCodePoint();var i=parseInt(t,16);return 0===i||function(e){return e>=55296&&e<=57343}(i)||i>1114111?65533:i}return-1===e?65533:e},e.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Df(t))e+=Ip(t);else{if(!Tf(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),e;e+=Ip(this.consumeEscapedCodePoint())}}},e}(),ov=function(){function e(e){this._tokens=e}return e.create=function(t){var i=new nv;return i.write(t),new e(i.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();31===e.type;)e=this.consumeToken();if(32===e.type)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do{e=this.consumeToken()}while(31===e.type);if(32===e.type)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(32===t.type)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},i=this.consumeToken();;){if(32===i.type||fv(i,e))return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue()),i=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var i=this.consumeToken();if(32===i.type||3===i.type)return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return void 0===e?sv:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),av=function(e){return 15===e.type},lv=function(e){return 17===e.type},uv=function(e){return 20===e.type},Av=function(e){return 0===e.type},cv=function(e,t){return uv(e)&&e.value===t},hv=function(e){return 31!==e.type},dv=function(e){return 31!==e.type&&4!==e.type},pv=function(e){var t=[],i=[];return e.forEach((function(e){if(4===e.type){if(0===i.length)throw new Error("Error parsing function args, zero tokens for arg");return t.push(i),void(i=[])}31!==e.type&&i.push(e)})),i.length&&t.push(i),t},fv=function(e,t){return 11===t&&12===e.type||(28===t&&29===e.type||2===t&&3===e.type)},vv=function(e){return 17===e.type||15===e.type},gv=function(e){return 16===e.type||vv(e)},mv=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},_v={type:17,number:0,flags:4},yv={type:16,number:50,flags:4},bv={type:16,number:100,flags:4},wv=function(e,t,i){var r=e[0],s=e[1];return[Bv(r,t),Bv(void 0!==s?s:r,i)]},Bv=function(e,t){if(16===e.type)return e.number/100*t;if(av(e))switch(e.unit){case"rem":case"em":return 16*e.number;default:return e.number}return e.number},xv=function(e,t){if(15===t.type)switch(t.unit){case"deg":return Math.PI*t.number/180;case"grad":return Math.PI/200*t.number;case"rad":return t.number;case"turn":return 2*Math.PI*t.number}throw new Error("Unsupported angle type")},Pv=function(e){return 15===e.type&&("deg"===e.unit||"grad"===e.unit||"rad"===e.unit||"turn"===e.unit)},Cv=function(e){switch(e.filter(uv).map((function(e){return e.value})).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[_v,_v];case"to top":case"bottom":return Mv(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[_v,bv];case"to right":case"left":return Mv(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[bv,bv];case"to bottom":case"top":return Mv(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[bv,_v];case"to left":case"right":return Mv(270)}return 0},Mv=function(e){return Math.PI*e/180},Ev=function(e,t){if(18===t.type){var i=Rv[t.name];if(void 0===i)throw new Error('Attempting to parse an unsupported color function "'+t.name+'"');return i(e,t.values)}if(5===t.type){if(3===t.value.length){var r=t.value.substring(0,1),s=t.value.substring(1,2),n=t.value.substring(2,3);return Iv(parseInt(r+r,16),parseInt(s+s,16),parseInt(n+n,16),1)}if(4===t.value.length){r=t.value.substring(0,1),s=t.value.substring(1,2),n=t.value.substring(2,3);var o=t.value.substring(3,4);return Iv(parseInt(r+r,16),parseInt(s+s,16),parseInt(n+n,16),parseInt(o+o,16)/255)}if(6===t.value.length){r=t.value.substring(0,2),s=t.value.substring(2,4),n=t.value.substring(4,6);return Iv(parseInt(r,16),parseInt(s,16),parseInt(n,16),1)}if(8===t.value.length){r=t.value.substring(0,2),s=t.value.substring(2,4),n=t.value.substring(4,6),o=t.value.substring(6,8);return Iv(parseInt(r,16),parseInt(s,16),parseInt(n,16),parseInt(o,16)/255)}}if(20===t.type){var a=Ov[t.value.toUpperCase()];if(void 0!==a)return a}return Ov.TRANSPARENT},Fv=function(e){return 0==(255&e)},kv=function(e){var t=255&e,i=255&e>>8,r=255&e>>16,s=255&e>>24;return t<255?"rgba("+s+","+r+","+i+","+t/255+")":"rgb("+s+","+r+","+i+")"},Iv=function(e,t,i,r){return(e<<24|t<<16|i<<8|Math.round(255*r)<<0)>>>0},Dv=function(e,t){if(17===e.type)return e.number;if(16===e.type){var i=3===t?1:255;return 3===t?e.number/100*i:Math.round(e.number/100*i)}return 0},Sv=function(e,t){var i=t.filter(dv);if(3===i.length){var r=i.map(Dv),s=r[0],n=r[1],o=r[2];return Iv(s,n,o,1)}if(4===i.length){var a=i.map(Dv),l=(s=a[0],n=a[1],o=a[2],a[3]);return Iv(s,n,o,l)}return 0};function Tv(e,t,i){return i<0&&(i+=1),i>=1&&(i-=1),i<1/6?(t-e)*i*6+e:i<.5?t:i<2/3?6*(t-e)*(2/3-i)+e:e}var Lv=function(e,t){var i=t.filter(dv),r=i[0],s=i[1],n=i[2],o=i[3],a=(17===r.type?Mv(r.number):xv(e,r))/(2*Math.PI),l=gv(s)?s.number/100:0,u=gv(n)?n.number/100:0,A=void 0!==o&&gv(o)?Bv(o,1):1;if(0===l)return Iv(255*u,255*u,255*u,1);var c=u<=.5?u*(l+1):u+l-u*l,h=2*u-c,d=Tv(h,c,a+1/3),p=Tv(h,c,a),f=Tv(h,c,a-1/3);return Iv(255*d,255*p,255*f,A)},Rv={hsl:Lv,hsla:Lv,rgb:Sv,rgba:Sv},Uv=function(e,t){return Ev(e,ov.create(t).parseComponentValue())},Ov={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Nv={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(uv(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},Qv={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Vv=function(e,t){var i=Ev(e,t[0]),r=t[1];return r&&gv(r)?{color:i,stop:r}:{color:i,stop:null}},Hv=function(e,t){var i=e[0],r=e[e.length-1];null===i.stop&&(i.stop=_v),null===r.stop&&(r.stop=bv);for(var s=[],n=0,o=0;on?s.push(l):s.push(n),n=l}else s.push(null)}var u=null;for(o=0;oe.optimumDistance)?{optimumCorner:t,optimumDistance:a}:e}),{optimumDistance:s?1/0:-1/0,optimumCorner:null}).optimumCorner},Wv=function(e,t){var i=Mv(180),r=[];return pv(t).forEach((function(t,s){if(0===s){var n=t[0];if(20===n.type&&-1!==["top","left","right","bottom"].indexOf(n.value))return void(i=Cv(t));if(Pv(n))return void(i=(xv(e,n)+Mv(270))%Mv(360))}var o=Vv(e,t);r.push(o)})),{angle:i,stops:r,type:1}},Kv=function(e,t){var i=0,r=3,s=[],n=[];return pv(t).forEach((function(t,o){var a=!0;if(0===o?a=t.reduce((function(e,t){if(uv(t))switch(t.value){case"center":return n.push(yv),!1;case"top":case"left":return n.push(_v),!1;case"right":case"bottom":return n.push(bv),!1}else if(gv(t)||vv(t))return n.push(t),!1;return e}),a):1===o&&(a=t.reduce((function(e,t){if(uv(t))switch(t.value){case"circle":return i=0,!1;case"ellipse":return i=1,!1;case"contain":case"closest-side":return r=0,!1;case"farthest-side":return r=1,!1;case"closest-corner":return r=2,!1;case"cover":case"farthest-corner":return r=3,!1}else if(vv(t)||gv(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e}),a)),a){var l=Vv(e,t);s.push(l)}})),{size:r,shape:i,stops:s,position:n,type:2}},Xv=function(e,t){if(22===t.type){var i={url:t.value,type:0};return e.cache.addImage(t.value),i}if(18===t.type){var r=Jv[t.name];if(void 0===r)throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return r(e,t.values)}throw new Error("Unsupported image type "+t.type)};var Yv,Jv={"linear-gradient":function(e,t){var i=Mv(180),r=[];return pv(t).forEach((function(t,s){if(0===s){var n=t[0];if(20===n.type&&"to"===n.value)return void(i=Cv(t));if(Pv(n))return void(i=xv(e,n))}var o=Vv(e,t);r.push(o)})),{angle:i,stops:r,type:1}},"-moz-linear-gradient":Wv,"-ms-linear-gradient":Wv,"-o-linear-gradient":Wv,"-webkit-linear-gradient":Wv,"radial-gradient":function(e,t){var i=0,r=3,s=[],n=[];return pv(t).forEach((function(t,o){var a=!0;if(0===o){var l=!1;a=t.reduce((function(e,t){if(l)if(uv(t))switch(t.value){case"center":return n.push(yv),e;case"top":case"left":return n.push(_v),e;case"right":case"bottom":return n.push(bv),e}else(gv(t)||vv(t))&&n.push(t);else if(uv(t))switch(t.value){case"circle":return i=0,!1;case"ellipse":return i=1,!1;case"at":return l=!0,!1;case"closest-side":return r=0,!1;case"cover":case"farthest-side":return r=1,!1;case"contain":case"closest-corner":return r=2,!1;case"farthest-corner":return r=3,!1}else if(vv(t)||gv(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e}),a)}if(a){var u=Vv(e,t);s.push(u)}})),{size:r,shape:i,stops:s,position:n,type:2}},"-moz-radial-gradient":Kv,"-ms-radial-gradient":Kv,"-o-radial-gradient":Kv,"-webkit-radial-gradient":Kv,"-webkit-gradient":function(e,t){var i=Mv(180),r=[],s=1;return pv(t).forEach((function(t,i){var n=t[0];if(0===i){if(uv(n)&&"linear"===n.value)return void(s=1);if(uv(n)&&"radial"===n.value)return void(s=2)}if(18===n.type)if("from"===n.name){var o=Ev(e,n.values[0]);r.push({stop:_v,color:o})}else if("to"===n.name){o=Ev(e,n.values[0]);r.push({stop:bv,color:o})}else if("color-stop"===n.name){var a=n.values.filter(dv);if(2===a.length){o=Ev(e,a[1]);var l=a[0];lv(l)&&r.push({stop:{type:16,number:100*l.number,flags:l.flags},color:o})}}})),1===s?{angle:(i+Mv(180))%Mv(360),stops:r,type:s}:{size:3,shape:0,stops:r,position:[],type:s}}},Zv={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(0===t.length)return[];var i=t[0];return 20===i.type&&"none"===i.value?[]:t.filter((function(e){return dv(e)&&function(e){return!(20===e.type&&"none"===e.value||18===e.type&&!Jv[e.name])}(e)})).map((function(t){return Xv(e,t)}))}},qv={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map((function(e){if(uv(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0}))}},$v={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return pv(t).map((function(e){return e.filter(gv)})).map(mv)}},eg={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return pv(t).map((function(e){return e.filter(uv).map((function(e){return e.value})).join(" ")})).map(tg)}},tg=function(e){switch(e){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}};!function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"}(Yv||(Yv={}));var ig,rg={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return pv(t).map((function(e){return e.filter(sg)}))}},sg=function(e){return uv(e)||gv(e)},ng=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},og=ng("top"),ag=ng("right"),lg=ng("bottom"),ug=ng("left"),Ag=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return mv(t.filter(gv))}}},cg=Ag("top-left"),hg=Ag("top-right"),dg=Ag("bottom-right"),pg=Ag("bottom-left"),fg=function(e){return{name:"border-"+e+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},vg=fg("top"),gg=fg("right"),mg=fg("bottom"),_g=fg("left"),yg=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return av(t)?t.number:0}}},bg=yg("top"),wg=yg("right"),Bg=yg("bottom"),xg=yg("left"),Pg={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Cg={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){return"rtl"===t?1:0}},Mg={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(uv).reduce((function(e,t){return e|Eg(t.value)}),0)}},Eg=function(e){switch(e){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},Fg={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},kg={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(e,t){return 20===t.type&&"normal"===t.value?0:17===t.type||15===t.type?t.number:0}};!function(e){e.NORMAL="normal",e.STRICT="strict"}(ig||(ig={}));var Ig,Dg={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"strict"===t?ig.STRICT:ig.NORMAL}},Sg={name:"line-height",initialValue:"normal",prefix:!1,type:4},Tg=function(e,t){return uv(e)&&"normal"===e.value?1.2*t:17===e.type?t*e.number:gv(e)?Bv(e,t):t},Lg={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return 20===t.type&&"none"===t.value?null:Xv(e,t)}},Rg={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(e,t){return"inside"===t?0:1}},Ug={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Og=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},Ng=Og("top"),Qg=Og("right"),Vg=Og("bottom"),Hg=Og("left"),jg={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(uv).map((function(e){switch(e.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}}))}},Gg={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"break-word"===t?"break-word":"normal"}},zg=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Wg=zg("top"),Kg=zg("right"),Xg=zg("bottom"),Yg=zg("left"),Jg={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(e,t){switch(t){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},Zg={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(e,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},qg={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return 1===t.length&&cv(t[0],"none")?[]:pv(t).map((function(t){for(var i={color:Ov.TRANSPARENT,offsetX:_v,offsetY:_v,blur:_v},r=0,s=0;s1?1:0],this.overflowWrap=Im(e,Gg,t.overflowWrap),this.paddingTop=Im(e,Wg,t.paddingTop),this.paddingRight=Im(e,Kg,t.paddingRight),this.paddingBottom=Im(e,Xg,t.paddingBottom),this.paddingLeft=Im(e,Yg,t.paddingLeft),this.paintOrder=Im(e,Pm,t.paintOrder),this.position=Im(e,Zg,t.position),this.textAlign=Im(e,Jg,t.textAlign),this.textDecorationColor=Im(e,Am,null!==(i=t.textDecorationColor)&&void 0!==i?i:t.color),this.textDecorationLine=Im(e,cm,null!==(r=t.textDecorationLine)&&void 0!==r?r:t.textDecoration),this.textShadow=Im(e,qg,t.textShadow),this.textTransform=Im(e,$g,t.textTransform),this.transform=Im(e,em,t.transform),this.transformOrigin=Im(e,sm,t.transformOrigin),this.visibility=Im(e,nm,t.visibility),this.webkitTextStrokeColor=Im(e,Cm,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Im(e,Mm,t.webkitTextStrokeWidth),this.wordBreak=Im(e,om,t.wordBreak),this.zIndex=Im(e,am,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&0===this.visibility},e.prototype.isTransparent=function(){return Fv(this.backgroundColor)},e.prototype.isTransformed=function(){return null!==this.transform},e.prototype.isPositioned=function(){return 0!==this.position},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return 0!==this.float},e.prototype.isInlineLevel=function(){return gm(this.display,4)||gm(this.display,33554432)||gm(this.display,268435456)||gm(this.display,536870912)||gm(this.display,67108864)||gm(this.display,134217728)},e}(),Fm=function(e,t){this.content=Im(e,mm,t.content),this.quotes=Im(e,wm,t.quotes)},km=function(e,t){this.counterIncrement=Im(e,_m,t.counterIncrement),this.counterReset=Im(e,ym,t.counterReset)},Im=function(e,t,i){var r=new nv,s=null!=i?i.toString():t.initialValue;r.write(s);var n=new ov(r.read());switch(t.type){case 2:var o=n.parseComponentValue();return t.parse(e,uv(o)?o.value:t.initialValue);case 0:return t.parse(e,n.parseComponentValue());case 1:return t.parse(e,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(t.format){case"angle":return xv(e,n.parseComponentValue());case"color":return Ev(e,n.parseComponentValue());case"image":return Xv(e,n.parseComponentValue());case"length":var a=n.parseComponentValue();return vv(a)?a:_v;case"length-percentage":var l=n.parseComponentValue();return gv(l)?l:_v;case"time":return lm(e,n.parseComponentValue())}}},Dm=function(e,t){var i=function(e){switch(e.getAttribute("data-html2canvas-debug")){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}}(e);return 1===i||t===i},Sm=function(e,t){this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Dm(t,3),this.styles=new Em(e,window.getComputedStyle(t,null)),S_(t)&&(this.styles.animationDuration.some((function(e){return e>0}))&&(t.style.animationDuration="0s"),null!==this.styles.transform&&(t.style.transform="none")),this.bounds=Fp(this.context,t),Dm(t,4)&&(this.flags|=16)},Tm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lm="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Rm=0;Rm=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>5])<<2)+(31&e),this.data[t];if(e<=65535)return t=((t=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[t];if(e>11),t=this.index[t],t+=e>>5&63,t=((t=this.index[t])<<2)+(31&e),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Nm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qm="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Vm=0;Vm>10),o%1024+56320)),(s+1===i||r.length>16384)&&(n+=String.fromCharCode.apply(String,r),r.length=0)}return n},Xm=function(e,t){var i,r,s,n=function(e){var t,i,r,s,n,o=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var u="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(o):new Array(o),A=Array.isArray(u)?u:new Uint8Array(u);for(t=0;t>4,A[l++]=(15&r)<<4|s>>2,A[l++]=(3&s)<<6|63&n;return u}(e),o=Array.isArray(n)?function(e){for(var t=e.length,i=[],r=0;r=55296&&s<=56319&&i=i)return{done:!0,value:null};for(var e="×";ro.x||s.y>o.y;return o=s,0===t||a}));return e.body.removeChild(t),a}(document);return Object.defineProperty(t_,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=function(e){var t=new Image,i=e.createElement("canvas"),r=i.getContext("2d");if(!r)return!1;t.src="data:image/svg+xml,";try{r.drawImage(t,0,0),i.toDataURL()}catch(e){return!1}return!0}(document);return Object.defineProperty(t_,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e="function"==typeof Array.from&&"function"==typeof window.fetch?function(e){var t=e.createElement("canvas"),i=100;t.width=i,t.height=i;var r=t.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,i,i);var s=new Image,n=t.toDataURL();s.src=n;var o=$m(i,i,0,0,s);return r.fillStyle="red",r.fillRect(0,0,i,i),e_(o).then((function(t){r.drawImage(t,0,0);var s=r.getImageData(0,0,i,i).data;r.fillStyle="red",r.fillRect(0,0,i,i);var o=e.createElement("div");return o.style.backgroundImage="url("+n+")",o.style.height="100px",qm(s)?e_($m(i,i,0,0,o)):Promise.reject(!1)})).then((function(e){return r.drawImage(e,0,0),qm(r.getImageData(0,0,i,i).data)})).catch((function(){return!1}))}(document):Promise.resolve(!1);return Object.defineProperty(t_,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=void 0!==(new Image).crossOrigin;return Object.defineProperty(t_,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e="string"==typeof(new XMLHttpRequest).responseType;return Object.defineProperty(t_,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(t_,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!("undefined"==typeof Intl||!Intl.Segmenter);return Object.defineProperty(t_,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},i_=function(e,t){this.text=e,this.bounds=t},r_=function(e,t){var i=t.ownerDocument;if(i){var r=i.createElement("html2canvaswrapper");r.appendChild(t.cloneNode(!0));var s=t.parentNode;if(s){s.replaceChild(r,t);var n=Fp(e,r);return r.firstChild&&s.replaceChild(r.firstChild,r),n}}return Ep.EMPTY},s_=function(e,t,i){var r=e.ownerDocument;if(!r)throw new Error("Node has no owner document");var s=r.createRange();return s.setStart(e,t),s.setEnd(e,t+i),s},n_=function(e){if(t_.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(e)).map((function(e){return e.segment}))}return function(e){for(var t,i=Zm(e),r=[];!(t=i.next()).done;)t.value&&r.push(t.value.slice());return r}(e)},o_=function(e,t){return 0!==t.letterSpacing?n_(e):function(e,t){if(t_.SUPPORT_NATIVE_TEXT_SEGMENTATION){var i=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(i.segment(e)).map((function(e){return e.segment}))}return l_(e,t)}(e,t)},a_=[32,160,4961,65792,65793,4153,4241],l_=function(e,t){for(var i,r=function(e,t){var i=kp(e),r=Cf(i,t),s=r[0],n=r[1],o=r[2],a=i.length,l=0,u=0;return{next:function(){if(u>=a)return{done:!0,value:null};for(var e="×";u0)if(t_.SUPPORT_RANGE_BOUNDS){var s=s_(r,o,t.length).getClientRects();if(s.length>1){var a=n_(t),l=0;a.forEach((function(t){n.push(new i_(t,Ep.fromDOMRectList(e,s_(r,l+o,t.length).getClientRects()))),l+=t.length}))}else n.push(new i_(t,Ep.fromDOMRectList(e,s)))}else{var u=r.splitText(t.length);n.push(new i_(t,r_(e,r))),r=u}else t_.SUPPORT_RANGE_BOUNDS||(r=r.splitText(t.length));o+=t.length})),n}(e,this.text,i,t)},A_=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(c_,h_);case 2:return e.toUpperCase();default:return e}},c_=/(^|\s|:|-|\(|\))([a-z])/g,h_=function(e,t,i){return e.length>0?t+i.toUpperCase():e},d_=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.src=i.currentSrc||i.src,r.intrinsicWidth=i.naturalWidth,r.intrinsicHeight=i.naturalHeight,r.context.cache.addImage(r.src),r}return Bp(t,e),t}(Sm),p_=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.canvas=i,r.intrinsicWidth=i.width,r.intrinsicHeight=i.height,r}return Bp(t,e),t}(Sm),f_=function(e){function t(t,i){var r=e.call(this,t,i)||this,s=new XMLSerializer,n=Fp(t,i);return i.setAttribute("width",n.width+"px"),i.setAttribute("height",n.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(s.serializeToString(i)),r.intrinsicWidth=i.width.baseVal.value,r.intrinsicHeight=i.height.baseVal.value,r.context.cache.addImage(r.svg),r}return Bp(t,e),t}(Sm),v_=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.value=i.value,r}return Bp(t,e),t}(Sm),g_=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.start=i.start,r.reversed="boolean"==typeof i.reversed&&!0===i.reversed,r}return Bp(t,e),t}(Sm),m_=[{type:15,flags:0,unit:"px",number:3}],__=[{type:16,flags:0,number:50}],y_="password",b_=function(e){function t(t,i){var r,s=e.call(this,t,i)||this;switch(s.type=i.type.toLowerCase(),s.checked=i.checked,s.value=function(e){var t=e.type===y_?new Array(e.value.length+1).join("•"):e.value;return 0===t.length?e.placeholder||"":t}(i),"checkbox"!==s.type&&"radio"!==s.type||(s.styles.backgroundColor=3739148031,s.styles.borderTopColor=s.styles.borderRightColor=s.styles.borderBottomColor=s.styles.borderLeftColor=2779096575,s.styles.borderTopWidth=s.styles.borderRightWidth=s.styles.borderBottomWidth=s.styles.borderLeftWidth=1,s.styles.borderTopStyle=s.styles.borderRightStyle=s.styles.borderBottomStyle=s.styles.borderLeftStyle=1,s.styles.backgroundClip=[0],s.styles.backgroundOrigin=[0],s.bounds=(r=s.bounds).width>r.height?new Ep(r.left+(r.width-r.height)/2,r.top,r.height,r.height):r.width0)r.textNodes.push(new u_(t,n,r.styles));else if(D_(n))if(K_(n)&&n.assignedNodes)n.assignedNodes().forEach((function(i){return e(t,i,r,s)}));else{var a=M_(t,n);a.styles.isVisible()&&(F_(n,a,s)?a.flags|=4:k_(a.styles)&&(a.flags|=2),-1!==P_.indexOf(n.tagName)&&(a.flags|=8),r.elements.push(a),n.slot,n.shadowRoot?e(t,n.shadowRoot,a,s):z_(n)||O_(n)||W_(n)||e(t,n,a,s))}},M_=function(e,t){return H_(t)?new d_(e,t):Q_(t)?new p_(e,t):O_(t)?new f_(e,t):L_(t)?new v_(e,t):R_(t)?new g_(e,t):U_(t)?new b_(e,t):W_(t)?new w_(e,t):z_(t)?new B_(e,t):j_(t)?new x_(e,t):new Sm(e,t)},E_=function(e,t){var i=M_(e,t);return i.flags|=4,C_(e,t,i,i),i},F_=function(e,t,i){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||N_(e)&&i.styles.isTransparent()},k_=function(e){return e.isPositioned()||e.isFloating()},I_=function(e){return e.nodeType===Node.TEXT_NODE},D_=function(e){return e.nodeType===Node.ELEMENT_NODE},S_=function(e){return D_(e)&&void 0!==e.style&&!T_(e)},T_=function(e){return"object"===B(e.className)},L_=function(e){return"LI"===e.tagName},R_=function(e){return"OL"===e.tagName},U_=function(e){return"INPUT"===e.tagName},O_=function(e){return"svg"===e.tagName},N_=function(e){return"BODY"===e.tagName},Q_=function(e){return"CANVAS"===e.tagName},V_=function(e){return"VIDEO"===e.tagName},H_=function(e){return"IMG"===e.tagName},j_=function(e){return"IFRAME"===e.tagName},G_=function(e){return"STYLE"===e.tagName},z_=function(e){return"TEXTAREA"===e.tagName},W_=function(e){return"SELECT"===e.tagName},K_=function(e){return"SLOT"===e.tagName},X_=function(e){return e.tagName.indexOf("-")>0},Y_=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},e.prototype.pop=function(e){var t=this;e.forEach((function(e){return t.counters[e].pop()}))},e.prototype.parse=function(e){var t=this,i=e.counterIncrement,r=e.counterReset,s=!0;null!==i&&i.forEach((function(e){var i=t.counters[e.counter];i&&0!==e.increment&&(s=!1,i.length||i.push(1),i[Math.max(0,i.length-1)]+=e.increment)}));var n=[];return s&&r.forEach((function(e){var i=t.counters[e.counter];n.push(e.counter),i||(i=t.counters[e.counter]=[]),i.push(e.reset)})),n},e}(),J_={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Z_={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},q_={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},$_={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},ey=function(e,t,i,r,s,n){return ei?ny(e,s,n.length>0):r.integers.reduce((function(t,i,s){for(;e>=i;)e-=i,t+=r.values[s];return t}),"")+n},ty=function(e,t,i,r){var s="";do{i||e--,s=r(e)+s,e/=t}while(e*t>=t);return s},iy=function(e,t,i,r,s){var n=i-t+1;return(e<0?"-":"")+(ty(Math.abs(e),n,r,(function(e){return Ip(Math.floor(e%n)+t)}))+s)},ry=function(e,t,i){void 0===i&&(i=". ");var r=t.length;return ty(Math.abs(e),r,!1,(function(e){return t[Math.floor(e%r)]}))+i},sy=function(e,t,i,r,s,n){if(e<-9999||e>9999)return ny(e,4,s.length>0);var o=Math.abs(e),a=s;if(0===o)return t[0]+a;for(var l=0;o>0&&l<=4;l++){var u=o%10;0===u&&gm(n,1)&&""!==a?a=t[u]+a:u>1||1===u&&0===l||1===u&&1===l&&gm(n,2)||1===u&&1===l&&gm(n,4)&&e>100||1===u&&l>1&&gm(n,8)?a=t[u]+(l>0?i[l-1]:"")+a:1===u&&l>0&&(a=i[l-1]+a),o=Math.floor(o/10)}return(e<0?r:"")+a},ny=function(e,t,i){var r=i?". ":"",s=i?"、":"",n=i?", ":"",o=i?" ":"";switch(t){case 0:return"•"+o;case 1:return"◦"+o;case 2:return"◾"+o;case 5:var a=iy(e,48,57,!0,r);return a.length<4?"0"+a:a;case 4:return ry(e,"〇一二三四五六七八九",s);case 6:return ey(e,1,3999,J_,3,r).toLowerCase();case 7:return ey(e,1,3999,J_,3,r);case 8:return iy(e,945,969,!1,r);case 9:return iy(e,97,122,!1,r);case 10:return iy(e,65,90,!1,r);case 11:return iy(e,1632,1641,!0,r);case 12:case 49:return ey(e,1,9999,Z_,3,r);case 35:return ey(e,1,9999,Z_,3,r).toLowerCase();case 13:return iy(e,2534,2543,!0,r);case 14:case 30:return iy(e,6112,6121,!0,r);case 15:return ry(e,"子丑寅卯辰巳午未申酉戌亥",s);case 16:return ry(e,"甲乙丙丁戊己庚辛壬癸",s);case 17:case 48:return sy(e,"零一二三四五六七八九","十百千萬","負",s,14);case 47:return sy(e,"零壹貳參肆伍陸柒捌玖","拾佰仟萬","負",s,15);case 42:return sy(e,"零一二三四五六七八九","十百千萬","负",s,14);case 41:return sy(e,"零壹贰叁肆伍陆柒捌玖","拾佰仟萬","负",s,15);case 26:return sy(e,"〇一二三四五六七八九","十百千万","マイナス",s,0);case 25:return sy(e,"零壱弐参四伍六七八九","拾百千万","マイナス",s,7);case 31:return sy(e,"영일이삼사오육칠팔구","십백천만","마이너스",n,7);case 33:return sy(e,"零一二三四五六七八九","十百千萬","마이너스",n,0);case 32:return sy(e,"零壹貳參四五六七八九","拾百千","마이너스",n,7);case 18:return iy(e,2406,2415,!0,r);case 20:return ey(e,1,19999,$_,3,r);case 21:return iy(e,2790,2799,!0,r);case 22:return iy(e,2662,2671,!0,r);case 22:return ey(e,1,10999,q_,3,r);case 23:return ry(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return ry(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return iy(e,3302,3311,!0,r);case 28:return ry(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",s);case 29:return ry(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",s);case 34:return iy(e,3792,3801,!0,r);case 37:return iy(e,6160,6169,!0,r);case 38:return iy(e,4160,4169,!0,r);case 39:return iy(e,2918,2927,!0,r);case 40:return iy(e,1776,1785,!0,r);case 43:return iy(e,3046,3055,!0,r);case 44:return iy(e,3174,3183,!0,r);case 45:return iy(e,3664,3673,!0,r);case 46:return iy(e,3872,3881,!0,r);default:return iy(e,48,57,!0,r)}},oy=function(){function e(e,t,i){if(this.context=e,this.options=i,this.scrolledElements=[],this.referenceElement=t,this.counters=new Y_,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var i=this,r=ly(e,t);if(!r.contentWindow)return Promise.reject("Unable to find iframe window");var s=e.defaultView.pageXOffset,n=e.defaultView.pageYOffset,o=r.contentWindow,a=o.document,l=cy(r).then((function(){return Pp(i,void 0,void 0,(function(){var e,i;return Cp(this,(function(s){switch(s.label){case 0:return this.scrolledElements.forEach(vy),o&&(o.scrollTo(t.left,t.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||o.scrollY===t.top&&o.scrollX===t.left||(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),e=this.options.onclone,void 0===(i=this.clonedReferenceElement)?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:a.fonts&&a.fonts.ready?[4,a.fonts.ready]:[3,2];case 1:s.sent(),s.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,Ay(a)]:[3,4];case 3:s.sent(),s.label=4;case 4:return"function"==typeof e?[2,Promise.resolve().then((function(){return e(a,i)})).then((function(){return r}))]:[2,r]}}))}))}));return a.open(),a.write(py(document.doctype)+""),fy(this.referenceElement.ownerDocument,s,n),a.replaceChild(a.adoptNode(this.documentElement),a.documentElement),a.close(),l},e.prototype.createElementClone=function(e){if(Dm(e,2),Q_(e))return this.createCanvasClone(e);if(V_(e))return this.createVideoClone(e);if(G_(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return H_(t)&&(H_(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),"lazy"===t.loading&&(t.loading="eager")),X_(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return dy(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var i=[].slice.call(t.cssRules,0).reduce((function(e,t){return t&&"string"==typeof t.cssText?e+t.cssText:e}),""),r=e.cloneNode(!1);return r.textContent=i,r}}catch(e){if(this.context.logger.error("Unable to access cssRules property",e),"SecurityError"!==e.name)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var i=e.ownerDocument.createElement("img");try{return i.src=e.toDataURL(),i}catch(t){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var s=e.getContext("2d"),n=r.getContext("2d");if(n)if(!this.options.allowTaint&&s)n.putImageData(s.getImageData(0,0,e.width,e.height),0,0);else{var o=null!==(t=e.getContext("webgl2"))&&void 0!==t?t:e.getContext("webgl");if(o){var a=o.getContextAttributes();!1===(null==a?void 0:a.preserveDrawingBuffer)&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}n.drawImage(e,0,0)}return r}catch(t){this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var i=t.getContext("2d");try{return i&&(i.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||i.getImageData(0,0,t.width,t.height)),t}catch(t){this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},e.prototype.appendChildNode=function(e,t,i){D_(t)&&(function(e){return"SCRIPT"===e.tagName}(t)||t.hasAttribute("data-html2canvas-ignore")||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(t))||this.options.copyStyles&&D_(t)&&G_(t)||e.appendChild(this.cloneNode(t,i))},e.prototype.cloneChildNodes=function(e,t,i){for(var r=this,s=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;s;s=s.nextSibling)if(D_(s)&&K_(s)&&"function"==typeof s.assignedNodes){var n=s.assignedNodes();n.length&&n.forEach((function(e){return r.appendChildNode(t,e,i)}))}else this.appendChildNode(t,s,i)},e.prototype.cloneNode=function(e,t){if(I_(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var i=e.ownerDocument.defaultView;if(i&&D_(e)&&(S_(e)||T_(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var s=i.getComputedStyle(e),n=i.getComputedStyle(e,":before"),o=i.getComputedStyle(e,":after");this.referenceElement===e&&S_(r)&&(this.clonedReferenceElement=r),N_(r)&&_y(r);var a=this.counters.parse(new km(this.context,s)),l=this.resolvePseudoContent(e,r,n,Hm.BEFORE);X_(e)&&(t=!0),V_(e)||this.cloneChildNodes(e,r,t),l&&r.insertBefore(l,r.firstChild);var u=this.resolvePseudoContent(e,r,o,Hm.AFTER);return u&&r.appendChild(u),this.counters.pop(a),(s&&(this.options.copyStyles||T_(e))&&!j_(e)||t)&&dy(s,r),0===e.scrollTop&&0===e.scrollLeft||this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(z_(e)||W_(e))&&(z_(r)||W_(r))&&(r.value=e.value),r}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,i,r){var s=this;if(i){var n=i.content,o=t.ownerDocument;if(o&&n&&"none"!==n&&"-moz-alt-content"!==n&&"none"!==i.display){this.counters.parse(new km(this.context,i));var a=new Fm(this.context,i),l=o.createElement("html2canvaspseudoelement");dy(i,l),a.content.forEach((function(t){if(0===t.type)l.appendChild(o.createTextNode(t.value));else if(22===t.type){var i=o.createElement("img");i.src=t.value,i.style.opacity="1",l.appendChild(i)}else if(18===t.type){if("attr"===t.name){var r=t.values.filter(uv);r.length&&l.appendChild(o.createTextNode(e.getAttribute(r[0].value)||""))}else if("counter"===t.name){var n=t.values.filter(dv),u=n[0],A=n[1];if(u&&uv(u)){var c=s.counters.getCounterValue(u.value),h=A&&uv(A)?Ug.parse(s.context,A.value):3;l.appendChild(o.createTextNode(ny(c,h,!1)))}}else if("counters"===t.name){var d=t.values.filter(dv),p=(u=d[0],d[1]);A=d[2];if(u&&uv(u)){var f=s.counters.getCounterValues(u.value),v=A&&uv(A)?Ug.parse(s.context,A.value):3,g=p&&0===p.type?p.value:"",m=f.map((function(e){return ny(e,v,!1)})).join(g);l.appendChild(o.createTextNode(m))}}}else if(20===t.type)switch(t.value){case"open-quote":l.appendChild(o.createTextNode(Bm(a.quotes,s.quoteDepth++,!0)));break;case"close-quote":l.appendChild(o.createTextNode(Bm(a.quotes,--s.quoteDepth,!1)));break;default:l.appendChild(o.createTextNode(t.value))}})),l.className=gy+" "+my;var u=r===Hm.BEFORE?" "+gy:" "+my;return T_(t)?t.className.baseValue+=u:t.className+=u,l}}},e.destroy=function(e){return!!e.parentNode&&(e.parentNode.removeChild(e),!0)},e}();!function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"}(Hm||(Hm={}));var ay,ly=function(e,t){var i=e.createElement("iframe");return i.className="html2canvas-container",i.style.visibility="hidden",i.style.position="fixed",i.style.left="-10000px",i.style.top="0px",i.style.border="0",i.width=t.width.toString(),i.height=t.height.toString(),i.scrolling="no",i.setAttribute("data-html2canvas-ignore","true"),e.body.appendChild(i),i},uy=function(e){return new Promise((function(t){e.complete?t():e.src?(e.onload=t,e.onerror=t):t()}))},Ay=function(e){return Promise.all([].slice.call(e.images,0).map(uy))},cy=function(e){return new Promise((function(t,i){var r=e.contentWindow;if(!r)return i("No window assigned for iframe");var s=r.document;r.onload=e.onload=function(){r.onload=e.onload=null;var i=setInterval((function(){s.body.childNodes.length>0&&"complete"===s.readyState&&(clearInterval(i),t(e))}),50)}}))},hy=["all","d","content"],dy=function(e,t){for(var i=e.length-1;i>=0;i--){var r=e.item(i);-1===hy.indexOf(r)&&t.style.setProperty(r,e.getPropertyValue(r))}return t},py=function(e){var t="";return e&&(t+=""),t},fy=function(e,t,i){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||i!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,i)},vy=function(e){var t=e[0],i=e[1],r=e[2];t.scrollLeft=i,t.scrollTop=r},gy="___html2canvas___pseudoelement_before",my="___html2canvas___pseudoelement_after",_y=function(e){yy(e,"."+gy+':before{\n content: "" !important;\n display: none !important;\n}\n .'+my+':after{\n content: "" !important;\n display: none !important;\n}')},yy=function(e,t){var i=e.ownerDocument;if(i){var r=i.createElement("style");r.textContent=t,e.appendChild(r)}},by=function(){function e(){}return e.getOrigin=function(t){var i=e._link;return i?(i.href=t,i.href=i.href,i.protocol+i.hostname+i.port):"about:blank"},e.isSameOrigin=function(t){return e.getOrigin(t)===e._origin},e.setContext=function(t){e._link=t.document.createElement("a"),e._origin=e.getOrigin(t.location.href)},e._origin="about:blank",e}(),wy=function(){function e(e,t){this.context=e,this._options=t,this._cache={}}return e.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)?t:Fy(e)||Cy(e)?((this._cache[e]=this.loadImage(e)).catch((function(){})),t):t},e.prototype.match=function(e){return this._cache[e]},e.prototype.loadImage=function(e){return Pp(this,void 0,void 0,(function(){var t,i,r,s,n=this;return Cp(this,(function(o){switch(o.label){case 0:return t=by.isSameOrigin(e),i=!My(e)&&!0===this._options.useCORS&&t_.SUPPORT_CORS_IMAGES&&!t,r=!My(e)&&!t&&!Fy(e)&&"string"==typeof this._options.proxy&&t_.SUPPORT_CORS_XHR&&!i,t||!1!==this._options.allowTaint||My(e)||Fy(e)||r||i?(s=e,r?[4,this.proxy(s)]:[3,2]):[2];case 1:s=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise((function(e,t){var r=new Image;r.onload=function(){return e(r)},r.onerror=t,(Ey(s)||i)&&(r.crossOrigin="anonymous"),r.src=s,!0===r.complete&&setTimeout((function(){return e(r)}),500),n._options.imageTimeout>0&&setTimeout((function(){return t("Timed out ("+n._options.imageTimeout+"ms) loading image")}),n._options.imageTimeout)}))];case 3:return[2,o.sent()]}}))}))},e.prototype.has=function(e){return void 0!==this._cache[e]},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(e){var t=this,i=this._options.proxy;if(!i)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise((function(s,n){var o=t_.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(200===a.status)if("text"===o)s(a.response);else{var e=new FileReader;e.addEventListener("load",(function(){return s(e.result)}),!1),e.addEventListener("error",(function(e){return n(e)}),!1),e.readAsDataURL(a.response)}else n("Failed to proxy resource "+r+" with status code "+a.status)},a.onerror=n;var l=i.indexOf("?")>-1?"&":"?";if(a.open("GET",""+i+l+"url="+encodeURIComponent(e)+"&responseType="+o),"text"!==o&&a instanceof XMLHttpRequest&&(a.responseType=o),t._options.imageTimeout){var u=t._options.imageTimeout;a.timeout=u,a.ontimeout=function(){return n("Timed out ("+u+"ms) proxying "+r)}}a.send()}))},e}(),By=/^data:image\/svg\+xml/i,xy=/^data:image\/.*;base64,/i,Py=/^data:image\/.*/i,Cy=function(e){return t_.SUPPORT_SVG_DRAWING||!ky(e)},My=function(e){return Py.test(e)},Ey=function(e){return xy.test(e)},Fy=function(e){return"blob"===e.substr(0,4)},ky=function(e){return"svg"===e.substr(-3).toLowerCase()||By.test(e)},Iy=function(){function e(e,t){this.type=0,this.x=e,this.y=t}return e.prototype.add=function(t,i){return new e(this.x+t,this.y+i)},e}(),Dy=function(e,t,i){return new Iy(e.x+(t.x-e.x)*i,e.y+(t.y-e.y)*i)},Sy=function(){function e(e,t,i,r){this.type=1,this.start=e,this.startControl=t,this.endControl=i,this.end=r}return e.prototype.subdivide=function(t,i){var r=Dy(this.start,this.startControl,t),s=Dy(this.startControl,this.endControl,t),n=Dy(this.endControl,this.end,t),o=Dy(r,s,t),a=Dy(s,n,t),l=Dy(o,a,t);return i?new e(this.start,r,o,l):new e(l,a,n,this.end)},e.prototype.add=function(t,i){return new e(this.start.add(t,i),this.startControl.add(t,i),this.endControl.add(t,i),this.end.add(t,i))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),Ty=function(e){return 1===e.type},Ly=function(e){var t=e.styles,i=e.bounds,r=wv(t.borderTopLeftRadius,i.width,i.height),s=r[0],n=r[1],o=wv(t.borderTopRightRadius,i.width,i.height),a=o[0],l=o[1],u=wv(t.borderBottomRightRadius,i.width,i.height),A=u[0],c=u[1],h=wv(t.borderBottomLeftRadius,i.width,i.height),d=h[0],p=h[1],f=[];f.push((s+a)/i.width),f.push((d+A)/i.width),f.push((n+p)/i.height),f.push((l+c)/i.height);var v=Math.max.apply(Math,f);v>1&&(s/=v,n/=v,a/=v,l/=v,A/=v,c/=v,d/=v,p/=v);var g=i.width-a,m=i.height-c,_=i.width-A,y=i.height-p,b=t.borderTopWidth,w=t.borderRightWidth,B=t.borderBottomWidth,x=t.borderLeftWidth,P=Bv(t.paddingTop,e.bounds.width),C=Bv(t.paddingRight,e.bounds.width),M=Bv(t.paddingBottom,e.bounds.width),E=Bv(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||n>0?Ry(i.left+x/3,i.top+b/3,s-x/3,n-b/3,ay.TOP_LEFT):new Iy(i.left+x/3,i.top+b/3),this.topRightBorderDoubleOuterBox=s>0||n>0?Ry(i.left+g,i.top+b/3,a-w/3,l-b/3,ay.TOP_RIGHT):new Iy(i.left+i.width-w/3,i.top+b/3),this.bottomRightBorderDoubleOuterBox=A>0||c>0?Ry(i.left+_,i.top+m,A-w/3,c-B/3,ay.BOTTOM_RIGHT):new Iy(i.left+i.width-w/3,i.top+i.height-B/3),this.bottomLeftBorderDoubleOuterBox=d>0||p>0?Ry(i.left+x/3,i.top+y,d-x/3,p-B/3,ay.BOTTOM_LEFT):new Iy(i.left+x/3,i.top+i.height-B/3),this.topLeftBorderDoubleInnerBox=s>0||n>0?Ry(i.left+2*x/3,i.top+2*b/3,s-2*x/3,n-2*b/3,ay.TOP_LEFT):new Iy(i.left+2*x/3,i.top+2*b/3),this.topRightBorderDoubleInnerBox=s>0||n>0?Ry(i.left+g,i.top+2*b/3,a-2*w/3,l-2*b/3,ay.TOP_RIGHT):new Iy(i.left+i.width-2*w/3,i.top+2*b/3),this.bottomRightBorderDoubleInnerBox=A>0||c>0?Ry(i.left+_,i.top+m,A-2*w/3,c-2*B/3,ay.BOTTOM_RIGHT):new Iy(i.left+i.width-2*w/3,i.top+i.height-2*B/3),this.bottomLeftBorderDoubleInnerBox=d>0||p>0?Ry(i.left+2*x/3,i.top+y,d-2*x/3,p-2*B/3,ay.BOTTOM_LEFT):new Iy(i.left+2*x/3,i.top+i.height-2*B/3),this.topLeftBorderStroke=s>0||n>0?Ry(i.left+x/2,i.top+b/2,s-x/2,n-b/2,ay.TOP_LEFT):new Iy(i.left+x/2,i.top+b/2),this.topRightBorderStroke=s>0||n>0?Ry(i.left+g,i.top+b/2,a-w/2,l-b/2,ay.TOP_RIGHT):new Iy(i.left+i.width-w/2,i.top+b/2),this.bottomRightBorderStroke=A>0||c>0?Ry(i.left+_,i.top+m,A-w/2,c-B/2,ay.BOTTOM_RIGHT):new Iy(i.left+i.width-w/2,i.top+i.height-B/2),this.bottomLeftBorderStroke=d>0||p>0?Ry(i.left+x/2,i.top+y,d-x/2,p-B/2,ay.BOTTOM_LEFT):new Iy(i.left+x/2,i.top+i.height-B/2),this.topLeftBorderBox=s>0||n>0?Ry(i.left,i.top,s,n,ay.TOP_LEFT):new Iy(i.left,i.top),this.topRightBorderBox=a>0||l>0?Ry(i.left+g,i.top,a,l,ay.TOP_RIGHT):new Iy(i.left+i.width,i.top),this.bottomRightBorderBox=A>0||c>0?Ry(i.left+_,i.top+m,A,c,ay.BOTTOM_RIGHT):new Iy(i.left+i.width,i.top+i.height),this.bottomLeftBorderBox=d>0||p>0?Ry(i.left,i.top+y,d,p,ay.BOTTOM_LEFT):new Iy(i.left,i.top+i.height),this.topLeftPaddingBox=s>0||n>0?Ry(i.left+x,i.top+b,Math.max(0,s-x),Math.max(0,n-b),ay.TOP_LEFT):new Iy(i.left+x,i.top+b),this.topRightPaddingBox=a>0||l>0?Ry(i.left+Math.min(g,i.width-w),i.top+b,g>i.width+w?0:Math.max(0,a-w),Math.max(0,l-b),ay.TOP_RIGHT):new Iy(i.left+i.width-w,i.top+b),this.bottomRightPaddingBox=A>0||c>0?Ry(i.left+Math.min(_,i.width-x),i.top+Math.min(m,i.height-B),Math.max(0,A-w),Math.max(0,c-B),ay.BOTTOM_RIGHT):new Iy(i.left+i.width-w,i.top+i.height-B),this.bottomLeftPaddingBox=d>0||p>0?Ry(i.left+x,i.top+Math.min(y,i.height-B),Math.max(0,d-x),Math.max(0,p-B),ay.BOTTOM_LEFT):new Iy(i.left+x,i.top+i.height-B),this.topLeftContentBox=s>0||n>0?Ry(i.left+x+E,i.top+b+P,Math.max(0,s-(x+E)),Math.max(0,n-(b+P)),ay.TOP_LEFT):new Iy(i.left+x+E,i.top+b+P),this.topRightContentBox=a>0||l>0?Ry(i.left+Math.min(g,i.width+x+E),i.top+b+P,g>i.width+x+E?0:a-x+E,l-(b+P),ay.TOP_RIGHT):new Iy(i.left+i.width-(w+C),i.top+b+P),this.bottomRightContentBox=A>0||c>0?Ry(i.left+Math.min(_,i.width-(x+E)),i.top+Math.min(m,i.height+b+P),Math.max(0,A-(w+C)),c-(B+M),ay.BOTTOM_RIGHT):new Iy(i.left+i.width-(w+C),i.top+i.height-(B+M)),this.bottomLeftContentBox=d>0||p>0?Ry(i.left+x+E,i.top+y,Math.max(0,d-(x+E)),p-(B+M),ay.BOTTOM_LEFT):new Iy(i.left+x+E,i.top+i.height-(B+M))};!function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"}(ay||(ay={}));var Ry=function(e,t,i,r,s){var n=(Math.sqrt(2)-1)/3*4,o=i*n,a=r*n,l=e+i,u=t+r;switch(s){case ay.TOP_LEFT:return new Sy(new Iy(e,u),new Iy(e,u-a),new Iy(l-o,t),new Iy(l,t));case ay.TOP_RIGHT:return new Sy(new Iy(e,t),new Iy(e+o,t),new Iy(l,u-a),new Iy(l,u));case ay.BOTTOM_RIGHT:return new Sy(new Iy(l,t),new Iy(l,t+a),new Iy(e+o,u),new Iy(e,u));case ay.BOTTOM_LEFT:default:return new Sy(new Iy(l,u),new Iy(l-o,u),new Iy(e,t+a),new Iy(e,t))}},Uy=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Oy=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Ny=function(e,t,i){this.offsetX=e,this.offsetY=t,this.matrix=i,this.type=0,this.target=6},Qy=function(e,t){this.path=e,this.target=t,this.type=1},Vy=function(e){this.opacity=e,this.type=2,this.target=6},Hy=function(e){return 1===e.type},jy=function(e,t){return e.length===t.length&&e.some((function(e,i){return e===t[i]}))},Gy=function(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]},zy=function(){function e(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new Ly(this.container),this.container.styles.opacity<1&&this.effects.push(new Vy(this.container.styles.opacity)),null!==this.container.styles.transform){var i=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new Ny(i,r,s))}if(0!==this.container.styles.overflowX){var n=Uy(this.curves),o=Oy(this.curves);jy(n,o)?this.effects.push(new Qy(n,6)):(this.effects.push(new Qy(n,2)),this.effects.push(new Qy(o,4)))}}return e.prototype.getEffects=function(e){for(var t=-1===[2,3].indexOf(this.container.styles.position),i=this.parent,r=this.effects.slice(0);i;){var s=i.effects.filter((function(e){return!Hy(e)}));if(t||0!==i.container.styles.position||!i.parent){if(r.unshift.apply(r,s),t=-1===[2,3].indexOf(i.container.styles.position),0!==i.container.styles.overflowX){var n=Uy(i.curves),o=Oy(i.curves);jy(n,o)||r.unshift(new Qy(o,6))}}else r.unshift.apply(r,s);i=i.parent}return r.filter((function(t){return gm(t.target,e)}))},e}(),Wy=function e(t,i,r,s){t.container.elements.forEach((function(n){var o=gm(n.flags,4),a=gm(n.flags,2),l=new zy(n,t);gm(n.styles.display,2048)&&s.push(l);var u=gm(n.flags,8)?[]:s;if(o||a){var A=o||n.styles.isPositioned()?r:i,c=new Gy(l);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var h=n.styles.zIndex.order;if(h<0){var d=0;A.negativeZIndex.some((function(e,t){return h>e.element.container.styles.zIndex.order?(d=t,!1):d>0})),A.negativeZIndex.splice(d,0,c)}else if(h>0){var p=0;A.positiveZIndex.some((function(e,t){return h>=e.element.container.styles.zIndex.order?(p=t+1,!1):p>0})),A.positiveZIndex.splice(p,0,c)}else A.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else n.styles.isFloating()?A.nonPositionedFloats.push(c):A.nonPositionedInlineLevel.push(c);e(l,c,o?c:r,u)}else n.styles.isInlineLevel()?i.inlineLevel.push(l):i.nonInlineLevel.push(l),e(l,i,r,u);gm(n.flags,8)&&Ky(n,u)}))},Ky=function(e,t){for(var i=e instanceof g_?e.start:1,r=e instanceof g_&&e.reversed,s=0;s0&&e.intrinsicHeight>0){var r=$y(e),s=Oy(t);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,e.intrinsicWidth,e.intrinsicHeight,r.left,r.top,r.width,r.height),this.ctx.restore()}},t.prototype.renderNodeContent=function(e){return Pp(this,void 0,void 0,(function(){var i,r,s,n,o,a,l,u,A,c,h,d,p,f,v,g,m,_;return Cp(this,(function(y){switch(y.label){case 0:this.applyEffects(e.getEffects(4)),i=e.container,r=e.curves,s=i.styles,n=0,o=i.textNodes,y.label=1;case 1:return n0&&B>0&&(g=r.ctx.createPattern(p,"repeat"),r.renderRepeat(_,g,P,C))):function(e){return 2===e.type}(i)&&(m=eb(e,t,[null,null,null]),_=m[0],y=m[1],b=m[2],w=m[3],B=m[4],x=0===i.position.length?[yv]:i.position,P=Bv(x[0],w),C=Bv(x[x.length-1],B),M=function(e,t,i,r,s){var n=0,o=0;switch(e.size){case 0:0===e.shape?n=o=Math.min(Math.abs(t),Math.abs(t-r),Math.abs(i),Math.abs(i-s)):1===e.shape&&(n=Math.min(Math.abs(t),Math.abs(t-r)),o=Math.min(Math.abs(i),Math.abs(i-s)));break;case 2:if(0===e.shape)n=o=Math.min(Gv(t,i),Gv(t,i-s),Gv(t-r,i),Gv(t-r,i-s));else if(1===e.shape){var a=Math.min(Math.abs(i),Math.abs(i-s))/Math.min(Math.abs(t),Math.abs(t-r)),l=zv(r,s,t,i,!0),u=l[0],A=l[1];o=a*(n=Gv(u-t,(A-i)/a))}break;case 1:0===e.shape?n=o=Math.max(Math.abs(t),Math.abs(t-r),Math.abs(i),Math.abs(i-s)):1===e.shape&&(n=Math.max(Math.abs(t),Math.abs(t-r)),o=Math.max(Math.abs(i),Math.abs(i-s)));break;case 3:if(0===e.shape)n=o=Math.max(Gv(t,i),Gv(t,i-s),Gv(t-r,i),Gv(t-r,i-s));else if(1===e.shape){a=Math.max(Math.abs(i),Math.abs(i-s))/Math.max(Math.abs(t),Math.abs(t-r));var c=zv(r,s,t,i,!1);u=c[0],A=c[1],o=a*(n=Gv(u-t,(A-i)/a))}}return Array.isArray(e.size)&&(n=Bv(e.size[0],r),o=2===e.size.length?Bv(e.size[1],s):n),[n,o]}(i,P,C,w,B),E=M[0],F=M[1],E>0&&F>0&&(k=r.ctx.createRadialGradient(y+P,b+C,0,y+P,b+C,E),Hv(i.stops,2*E).forEach((function(e){return k.addColorStop(e.stop,kv(e.color))})),r.path(_),r.ctx.fillStyle=k,E!==F?(I=e.bounds.left+.5*e.bounds.width,D=e.bounds.top+.5*e.bounds.height,T=1/(S=F/E),r.ctx.save(),r.ctx.translate(I,D),r.ctx.transform(1,0,0,S,0,0),r.ctx.translate(-I,-D),r.ctx.fillRect(y,T*(b-D)+D,w,B*T),r.ctx.restore()):r.ctx.fill())),L.label=6;case 6:return t--,[2]}}))},r=this,s=0,n=e.styles.backgroundImage.slice(0).reverse(),a.label=1;case 1:return s0?2!==l.style?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,n,e.curves,2)]:[3,11]:[3,13];case 4:return A.sent(),[3,11];case 5:return 3!==l.style?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,n,e.curves,3)];case 6:return A.sent(),[3,11];case 7:return 4!==l.style?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,n,e.curves)];case 8:return A.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,n,e.curves)];case 10:A.sent(),A.label=11;case 11:n++,A.label=12;case 12:return o++,[3,3];case 13:return[2]}}))}))},t.prototype.renderDashedDottedBorder=function(e,t,i,r,s){return Pp(this,void 0,void 0,(function(){var n,o,a,l,u,A,c,h,d,p,f,v,g,m,_,y;return Cp(this,(function(b){return this.ctx.save(),n=function(e,t){switch(t){case 0:return Jy(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return Jy(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return Jy(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);default:return Jy(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}}(r,i),o=Yy(r,i),2===s&&(this.path(o),this.ctx.clip()),Ty(o[0])?(a=o[0].start.x,l=o[0].start.y):(a=o[0].x,l=o[0].y),Ty(o[1])?(u=o[1].end.x,A=o[1].end.y):(u=o[1].x,A=o[1].y),c=0===i||2===i?Math.abs(a-u):Math.abs(l-A),this.ctx.beginPath(),3===s?this.formatPath(n):this.formatPath(o.slice(0,2)),h=t<3?3*t:2*t,d=t<3?2*t:t,3===s&&(h=t,d=t),p=!0,c<=2*h?p=!1:c<=2*h+d?(h*=f=c/(2*h+d),d*=f):(v=Math.floor((c+d)/(h+d)),g=(c-v*h)/(v-1),d=(m=(c-(v+1)*h)/v)<=0||Math.abs(d-g)0&&void 0!==arguments[0]?arguments[0]:{},t=!this._snapshotBegun,i=void 0!==e.width&&void 0!==e.height,r=this.scene.canvas.canvas,s=r.clientWidth,n=r.clientHeight,o=e.width?Math.floor(e.width):r.width,a=e.height?Math.floor(e.height):r.height;i&&(r.width=o,r.height=a),this._snapshotBegun||this.beginSnapshot({width:o,height:a}),e.includeGizmos||this.sendToPlugins("snapshotStarting");for(var l={},u=0,A=this._plugins.length;u0&&void 0!==b[0]?b[0]:{},i=!this._snapshotBegun,r=void 0!==t.width&&void 0!==t.height,s=this.scene.canvas.canvas,n=s.clientWidth,o=s.clientHeight,l=t.width?Math.floor(t.width):s.width,u=t.height?Math.floor(t.height):s.height,r&&(s.width=l,s.height=u),this._snapshotBegun||this.beginSnapshot(),t.includeGizmos||this.sendToPlugins("snapshotStarting"),this.scene._renderer.renderSnapshot(),A=this.scene._renderer.readSnapshotAsCanvas(),r&&(s.width=n,s.height=o,this.scene.glRedraw()),c={},h=[],d=0,p=this._plugins.length;d1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0,r=i||new Set;if(e){if(Nb(e))r.add(e);else if(Nb(e.buffer))r.add(e.buffer);else if(ArrayBuffer.isView(e));else if(t&&"object"===B(e))for(var s in e)Ob(e[s],t,r)}else;return void 0===i?Array.from(r):[]}function Nb(e){return!!e&&(e instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&e instanceof MessagePort||("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)))}var Qb=function(){},Vb=function(){function e(t){x(this,e),Db(this,"name",void 0),Db(this,"source",void 0),Db(this,"url",void 0),Db(this,"terminated",!1),Db(this,"worker",void 0),Db(this,"onMessage",void 0),Db(this,"onError",void 0),Db(this,"_loadableURL","");var i=t.name,r=t.source,s=t.url;Pb(r||s),this.name=i,this.source=r,this.url=s,this.onMessage=Qb,this.onError=function(e){return console.log(e)},this.worker=Eb?this._createBrowserWorker():this._createNodeWorker()}return C(e,[{key:"destroy",value:function(){this.onMessage=Qb,this.onError=Qb,this.worker.terminate(),this.terminated=!0}},{key:"isRunning",get:function(){return Boolean(this.onMessage)}},{key:"postMessage",value:function(e,t){t=t||Ob(e),this.worker.postMessage(e,t)}},{key:"_getErrorFromErrorEvent",value:function(e){var t="Failed to load ";return t+="worker ".concat(this.name," from ").concat(this.url,". "),e.message&&(t+="".concat(e.message," in ")),e.lineno&&(t+=":".concat(e.lineno,":").concat(e.colno)),new Error(t)}},{key:"_createBrowserWorker",value:function(){var e=this;this._loadableURL=Rb({source:this.source,url:this.url});var t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=function(t){t.data?e.onMessage(t.data):e.onError(new Error("No data received"))},t.onerror=function(t){e.onError(e._getErrorFromErrorEvent(t)),e.terminated=!0},t.onmessageerror=function(e){return console.error(e)},t}},{key:"_createNodeWorker",value:function(){var e,t=this;if(this.url){var i=this.url.includes(":/")||this.url.startsWith("/")?this.url:"./".concat(this.url);e=new Tb(i,{eval:!1})}else{if(!this.source)throw new Error("no worker");e=new Tb(this.source,{eval:!0})}return e.on("message",(function(e){t.onMessage(e)})),e.on("error",(function(e){t.onError(e)})),e.on("exit",(function(e){})),e}}],[{key:"isSupported",value:function(){return"undefined"!=typeof Worker&&Eb||void 0!==B(Tb)}}]),e}(),Hb=function(){function e(t){x(this,e),Db(this,"name","unnamed"),Db(this,"source",void 0),Db(this,"url",void 0),Db(this,"maxConcurrency",1),Db(this,"maxMobileConcurrency",1),Db(this,"onDebug",(function(){})),Db(this,"reuseWorkers",!0),Db(this,"props",{}),Db(this,"jobQueue",[]),Db(this,"idleQueue",[]),Db(this,"count",0),Db(this,"isDestroyed",!1),this.source=t.source,this.url=t.url,this.setProps(t)}var t,i;return C(e,[{key:"destroy",value:function(){this.idleQueue.forEach((function(e){return e.destroy()})),this.isDestroyed=!0}},{key:"setProps",value:function(e){this.props=n(n({},this.props),e),void 0!==e.name&&(this.name=e.name),void 0!==e.maxConcurrency&&(this.maxConcurrency=e.maxConcurrency),void 0!==e.maxMobileConcurrency&&(this.maxMobileConcurrency=e.maxMobileConcurrency),void 0!==e.reuseWorkers&&(this.reuseWorkers=e.reuseWorkers),void 0!==e.onDebug&&(this.onDebug=e.onDebug)}},{key:"startJob",value:(i=u(a().mark((function e(t){var i,r,s,n=this,o=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=o.length>1&&void 0!==o[1]?o[1]:function(e,t,i){return e.done(i)},r=o.length>2&&void 0!==o[2]?o[2]:function(e,t){return e.error(t)},s=new Promise((function(e){return n.jobQueue.push({name:t,onMessage:i,onError:r,onStart:e}),n})),this._startQueuedJob(),e.next=6,s;case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_startQueuedJob",value:(t=u(a().mark((function e(){var t,i,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.jobQueue.length){e.next=2;break}return e.abrupt("return");case 2:if(t=this._getAvailableWorker()){e.next=5;break}return e.abrupt("return");case 5:if(!(i=this.jobQueue.shift())){e.next=18;break}return this.onDebug({message:"Starting job",name:i.name,workerThread:t,backlog:this.jobQueue.length}),r=new Sb(i.name,t),t.onMessage=function(e){return i.onMessage(r,e.type,e.payload)},t.onError=function(e){return i.onError(r,e)},i.onStart(r),e.prev=12,e.next=15,r.result;case 15:return e.prev=15,this.returnWorkerToQueue(t),e.finish(15);case 18:case"end":return e.stop()}}),e,this,[[12,,15,18]])}))),function(){return t.apply(this,arguments)})},{key:"returnWorkerToQueue",value:function(e){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}},{key:"_getAvailableWorker",value:function(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count0&&void 0!==arguments[0]?arguments[0]:{};return e._workerFarm=e._workerFarm||new e({}),e._workerFarm.setProps(t),e._workerFarm}}]),e}();Db(Gb,"_workerFarm",void 0);function zb(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t[e.id]||{},r="".concat(e.id,"-worker.js"),s=i.workerUrl;if(s||"compression"!==e.id||(s=t.workerUrl),"test"===t._workerType&&(s="modules/".concat(e.module,"/dist/").concat(r)),!s){var n=e.version;"latest"===n&&(n="latest");var o=n?"@".concat(n):"";s="https://unpkg.com/@loaders.gl/".concat(e.module).concat(o,"/dist/").concat(r)}return Pb(s),s}function Wb(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"3.2.6";Pb(e,"no worker provided");var i=e.version;return!(!t||!i)}var Kb=Object.freeze({__proto__:null,default:{}}),Xb={};function Yb(e){return Jb.apply(this,arguments)}function Jb(){return Jb=u(a().mark((function e(t){var i,r,s=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=s.length>1&&void 0!==s[1]?s[1]:null,r=s.length>2&&void 0!==s[2]?s[2]:{},i&&(t=Zb(t,i,r)),Xb[t]=Xb[t]||qb(t),e.next=6,Xb[t];case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)}))),Jb.apply(this,arguments)}function Zb(e,t,i){if(e.startsWith("http"))return e;var r=i.modules||{};return r[e]?r[e]:Eb?i.CDN?(Pb(i.CDN.startsWith("http")),"".concat(i.CDN,"/").concat(t,"@").concat("3.2.6","/dist/libs/").concat(e)):Fb?"../src/libs/".concat(e):"modules/".concat(t,"/src/libs/").concat(e):"modules/".concat(t,"/dist/libs/").concat(e)}function qb(e){return $b.apply(this,arguments)}function $b(){return($b=u(a().mark((function e(t){var i,r,s;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.endsWith("wasm")){e.next=7;break}return e.next=3,fetch(t);case 3:return i=e.sent,e.next=6,i.arrayBuffer();case 6:return e.abrupt("return",e.sent);case 7:if(Eb){e.next=20;break}if(e.prev=8,e.t0=Kb&&void 0,!e.t0){e.next=14;break}return e.next=13,(void 0)(t);case 13:e.t0=e.sent;case 14:return e.abrupt("return",e.t0);case 17:return e.prev=17,e.t1=e.catch(8),e.abrupt("return",null);case 20:if(!Fb){e.next=22;break}return e.abrupt("return",importScripts(t));case 22:return e.next=24,fetch(t);case 24:return r=e.sent,e.next=27,r.text();case 27:return s=e.sent,e.abrupt("return",ew(s,t));case 29:case"end":return e.stop()}}),e,null,[[8,17]])})))).apply(this,arguments)}function ew(e,t){if(Eb){if(Fb)return eval.call(Mb,e),null;var i=document.createElement("script");i.id=t;try{i.appendChild(document.createTextNode(e))}catch(t){i.text=e}return document.body.appendChild(i),null}}function tw(e,t){return!!Gb.isSupported()&&(!!(Eb||null!=t&&t._nodeWorkers)&&(e.worker&&(null==t?void 0:t.worker)))}function iw(e,t,i,r,s){return rw.apply(this,arguments)}function rw(){return rw=u(a().mark((function e(t,i,r,s,n){var o,l,u,A,c,h;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.id,l=zb(t,r),u=Gb.getWorkerFarm(r),A=u.getWorkerPool({name:o,url:l}),r=JSON.parse(JSON.stringify(r)),s=JSON.parse(JSON.stringify(s||{})),e.next=8,A.startJob("process-on-worker",sw.bind(null,n));case 8:return(c=e.sent).postMessage("process",{input:i,options:r,context:s}),e.next=12,c.result;case 12:return h=e.sent,e.next=15,h.result;case 15:return e.abrupt("return",e.sent);case 16:case"end":return e.stop()}}),e)}))),rw.apply(this,arguments)}function sw(e,t,i,r){return nw.apply(this,arguments)}function nw(){return(nw=u(a().mark((function e(t,i,r,s){var n,o,l,u,A;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=r,e.next="done"===e.t0?3:"error"===e.t0?5:"process"===e.t0?7:20;break;case 3:return i.done(s),e.abrupt("break",21);case 5:return i.error(new Error(s.error)),e.abrupt("break",21);case 7:return n=s.id,o=s.input,l=s.options,e.prev=8,e.next=11,t(o,l);case 11:u=e.sent,i.postMessage("done",{id:n,result:u}),e.next=19;break;case 15:e.prev=15,e.t1=e.catch(8),A=e.t1 instanceof Error?e.t1.message:"unknown error",i.postMessage("error",{id:n,error:A});case 19:return e.abrupt("break",21);case 20:console.warn("parse-with-worker unknown message ".concat(r));case 21:case"end":return e.stop()}}),e,null,[[8,15]])})))).apply(this,arguments)}function ow(e,t,i){if(e.byteLength<=t+i)return"";for(var r=new DataView(e),s="",n=0;n1&&void 0!==arguments[1]?arguments[1]:5;if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return ow(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return ow(e,0,t)}return""}(e),'"'))}}function lw(e){return e&&"object"===B(e)&&e.isBuffer}function uw(e){if(lw(e))return lw(t=e)?new Uint8Array(t.buffer,t.byteOffset,t.length).slice().buffer:t;var t;if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return 0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if("string"==typeof e){var i=e;return(new TextEncoder).encode(i).buffer}if(e&&"object"===B(e)&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}function Aw(){for(var e=arguments.length,t=new Array(e),i=0;i=0),wb(t>0),e+(t-1)&~(t-1)}function dw(e,t,i){var r;if(e instanceof ArrayBuffer)r=new Uint8Array(e);else{var s=e.byteOffset,n=e.byteLength;r=new Uint8Array(e.buffer||e.arrayBuffer,s,n)}return t.set(r,i),i+hw(r.byteLength,4)}function pw(e){return fw.apply(this,arguments)}function fw(){return(fw=u(a().mark((function e(t){var i,r,s,n,o,l,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=[],r=!1,s=!1,e.prev=3,o=I(t);case 5:return e.next=7,o.next();case 7:if(!(r=!(l=e.sent).done)){e.next=13;break}u=l.value,i.push(u);case 10:r=!1,e.next=5;break;case 13:e.next=19;break;case 15:e.prev=15,e.t0=e.catch(3),s=!0,n=e.t0;case 19:if(e.prev=19,e.prev=20,!r||null==o.return){e.next=24;break}return e.next=24,o.return();case 24:if(e.prev=24,!s){e.next=27;break}throw n;case 27:return e.finish(24);case 28:return e.finish(19);case 29:return e.abrupt("return",Aw.apply(void 0,i));case 30:case"end":return e.stop()}}),e,null,[[3,15,19,29],[20,,24,28]])})))).apply(this,arguments)}var vw={};function gw(e){for(var t in vw)if(e.startsWith(t)){var i=vw[t];e=e.replace(t,i)}return e.startsWith("http://")||e.startsWith("https://")||(e="".concat("").concat(e)),e}var mw=function(e){return"function"==typeof e},_w=function(e){return null!==e&&"object"===B(e)},yw=function(e){return _w(e)&&e.constructor==={}.constructor},bw=function(e){return e&&"function"==typeof e[Symbol.iterator]},ww=function(e){return e&&"function"==typeof e[Symbol.asyncIterator]},Bw=function(e){return"undefined"!=typeof Response&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json},xw=function(e){return"undefined"!=typeof Blob&&e instanceof Blob},Pw=function(e){return function(e){return"undefined"!=typeof ReadableStream&&e instanceof ReadableStream||_w(e)&&mw(e.tee)&&mw(e.cancel)&&mw(e.getReader)}(e)||function(e){return _w(e)&&mw(e.read)&&mw(e.pipe)&&function(e){return"boolean"==typeof e}(e.readable)}(e)},Cw=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Mw=/^([-\w.]+\/[-\w.+]+)/;function Ew(e){var t=Mw.exec(e);return t?t[1]:e}function Fw(e){var t=Cw.exec(e);return t?t[1]:""}var kw=/\?.*/;function Iw(e){if(Bw(e)){var t=Sw(e.url||"");return{url:t,type:Ew(e.headers.get("content-type")||"")||Fw(t)}}return xw(e)?{url:Sw(e.name||""),type:e.type||""}:"string"==typeof e?{url:Sw(e),type:Fw(e)}:{url:"",type:""}}function Dw(e){return Bw(e)?e.headers["content-length"]||-1:xw(e)?e.size:"string"==typeof e?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}function Sw(e){return e.replace(kw,"")}function Tw(e){return Lw.apply(this,arguments)}function Lw(){return(Lw=u(a().mark((function e(t){var i,r,s,n,o,l,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Bw(t)){e.next=2;break}return e.abrupt("return",t);case 2:return i={},(r=Dw(t))>=0&&(i["content-length"]=String(r)),s=Iw(t),n=s.url,(o=s.type)&&(i["content-type"]=o),e.next=9,Qw(t);case 9:return(l=e.sent)&&(i["x-first-bytes"]=l),"string"==typeof t&&(t=(new TextEncoder).encode(t)),u=new Response(t,{headers:i}),Object.defineProperty(u,"url",{value:n}),e.abrupt("return",u);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Rw(e){return Uw.apply(this,arguments)}function Uw(){return(Uw=u(a().mark((function e(t){var i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.ok){e.next=5;break}return e.next=3,Ow(t);case 3:throw i=e.sent,new Error(i);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ow(e){return Nw.apply(this,arguments)}function Nw(){return(Nw=u(a().mark((function e(t){var i,r,s;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i="Failed to fetch resource ".concat(t.url," (").concat(t.status,"): "),e.prev=1,r=t.headers.get("Content-Type"),s=t.statusText,!r.includes("application/json")){e.next=11;break}return e.t0=s,e.t1=" ",e.next=9,t.text();case 9:e.t2=e.sent,s=e.t0+=e.t1.concat.call(e.t1,e.t2);case 11:i=(i+=s).length>60?"".concat(i.slice(0,60),"..."):i,e.next=17;break;case 15:e.prev=15,e.t3=e.catch(1);case 17:return e.abrupt("return",i);case 18:case"end":return e.stop()}}),e,null,[[1,15]])})))).apply(this,arguments)}function Qw(e){return Vw.apply(this,arguments)}function Vw(){return(Vw=u(a().mark((function e(t){var i,r,s,n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=5,"string"!=typeof t){e.next=3;break}return e.abrupt("return","data:,".concat(t.slice(0,i)));case 3:if(!(t instanceof Blob)){e.next=8;break}return r=t.slice(0,5),e.next=7,new Promise((function(e){var t=new FileReader;t.onload=function(t){var i;return e(null==t||null===(i=t.target)||void 0===i?void 0:i.result)},t.readAsDataURL(r)}));case 7:return e.abrupt("return",e.sent);case 8:if(!(t instanceof ArrayBuffer)){e.next=12;break}return s=t.slice(0,i),n=Hw(s),e.abrupt("return","data:base64,".concat(n));case 12:return e.abrupt("return",null);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Hw(e){for(var t="",i=new Uint8Array(e),r=0;r=0)}();function Jw(e){try{var t=window[e],i="__storage_test__";return t.setItem(i,i),t.removeItem(i),t}catch(e){return null}}var Zw=function(){function e(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";x(this,e),this.storage=Jw(r),this.id=t,this.config={},Object.assign(this.config,i),this._loadConfiguration()}return C(e,[{key:"getConfiguration",value:function(){return this.config}},{key:"setConfiguration",value:function(e){return this.config={},this.updateConfiguration(e)}},{key:"updateConfiguration",value:function(e){if(Object.assign(this.config,e),this.storage){var t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}return this}},{key:"_loadConfiguration",value:function(){var e={};if(this.storage){var t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}]),e}();function qw(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600,s=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>r&&(i=Math.min(i,r/e.width));var n=e.width*i,o=e.height*i,a=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(n/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(s,");"),"background-size:".concat(n,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}var $w={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function eB(e){return"string"==typeof e?$w[e.toUpperCase()]||$w.WHITE:e}function tB(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),s=Object.getOwnPropertyNames(r),n=A(s);try{var o=function(){var r=t.value;"function"==typeof e[r]&&(i.find((function(e){return r===e}))||(e[r]=e[r].bind(e)))};for(n.s();!(t=n.n()).done;)o()}catch(e){n.e(e)}finally{n.f()}}function iB(e,t){if(!e)throw new Error(t||"Assertion failed")}function rB(){var e;if(Yw&&Ww.performance)e=Ww.performance.now();else if(Kw.hrtime){var t=Kw.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}var sB={debug:Yw&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},nB={enabled:!0,level:0};function oB(){}var aB={},lB={once:!0};function uB(e){for(var t in e)for(var i in e[t])return i||"untitled";return"empty"}var AB=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""},i=t.id;x(this,e),this.id=i,this.VERSION=Xw,this._startTs=rB(),this._deltaTs=rB(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new Zw("__probe-".concat(this.id,"__"),nB),this.userData={},this.timeStamp("".concat(this.id," started")),tB(this),Object.seal(this)}return C(e,[{key:"level",get:function(){return this.getLevel()},set:function(e){this.setLevel(e)}},{key:"isEnabled",value:function(){return this._storage.config.enabled}},{key:"getLevel",value:function(){return this._storage.config.level}},{key:"getTotal",value:function(){return Number((rB()-this._startTs).toPrecision(10))}},{key:"getDelta",value:function(){return Number((rB()-this._deltaTs).toPrecision(10))}},{key:"priority",get:function(){return this.level},set:function(e){this.level=e}},{key:"getPriority",value:function(){return this.level}},{key:"enable",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:e}),this}},{key:"setLevel",value:function(e){return this._storage.updateConfiguration({level:e}),this}},{key:"assert",value:function(e,t){iB(e,t)}},{key:"warn",value:function(e){return this._getLogFunction(0,e,sB.warn,arguments,lB)}},{key:"error",value:function(e){return this._getLogFunction(0,e,sB.error,arguments)}},{key:"deprecated",value:function(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}},{key:"removed",value:function(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}},{key:"probe",value:function(e,t){return this._getLogFunction(e,t,sB.log,arguments,{time:!0,once:!0})}},{key:"log",value:function(e,t){return this._getLogFunction(e,t,sB.debug,arguments)}},{key:"info",value:function(e,t){return this._getLogFunction(e,t,console.info,arguments)}},{key:"once",value:function(e,t){return this._getLogFunction(e,t,sB.debug||sB.info,arguments,lB)}},{key:"table",value:function(e,t,i){return t?this._getLogFunction(e,t,console.table||oB,i&&[i],{tag:uB(t)}):oB}},{key:"image",value:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){var t=e.logLevel,i=e.priority,r=e.image,s=e.message,n=void 0===s?"":s,o=e.scale,a=void 0===o?1:o;return this._shouldLog(t||i)?Yw?function(e){var t=e.image,i=e.message,r=void 0===i?"":i,s=e.scale,n=void 0===s?1:s;if("string"==typeof t){var o=new Image;return o.onload=function(){var e,t=qw(o,r,n);(e=console).log.apply(e,h(t))},o.src=t,oB}var a=t.nodeName||"";if("img"===a.toLowerCase()){var l;return(l=console).log.apply(l,h(qw(t,r,n))),oB}if("canvas"===a.toLowerCase()){var u=new Image;return u.onload=function(){var e;return(e=console).log.apply(e,h(qw(u,r,n)))},u.src=t.toDataURL(),oB}return oB}({image:r,message:n,scale:a}):function(e){var t=e.image,i=(e.message,e.scale),r=void 0===i?1:i,s=null;try{s=module.require("asciify-image")}catch(e){}if(s)return function(){return s(t,{fit:"box",width:"".concat(Math.round(80*r),"%")}).then((function(e){return console.log(e)}))};return oB}({image:r,message:n,scale:a}):oB}))},{key:"settings",value:function(){console.table?console.table(this._storage.config):console.log(this._storage.config)}},{key:"get",value:function(e){return this._storage.config[e]}},{key:"set",value:function(e,t){this._storage.updateConfiguration(o({},e,t))}},{key:"time",value:function(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}},{key:"timeEnd",value:function(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}},{key:"timeStamp",value:function(e,t){return this._getLogFunction(e,t,console.timeStamp||oB)}},{key:"group",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1},r=i=hB({logLevel:e,message:t,opts:i}),s=r.collapsed;return i.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}},{key:"groupCollapsed",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(e,t,Object.assign({},i,{collapsed:!0}))}},{key:"groupEnd",value:function(e){return this._getLogFunction(e,"",console.groupEnd||oB)}},{key:"withGroup",value:function(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}},{key:"trace",value:function(){console.trace&&console.trace()}},{key:"_shouldLog",value:function(e){return this.isEnabled()&&this.getLevel()>=cB(e)}},{key:"_getLogFunction",value:function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=arguments.length>4?arguments[4]:void 0;if(this._shouldLog(e)){var n;s=hB({logLevel:e,message:t,args:r,opts:s}),iB(i=i||s.method),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=rB();var o=s.tag||s.message;if(s.once){if(aB[o])return oB;aB[o]=rB()}return t=dB(this.id,s.message,s),(n=i).bind.apply(n,[console,t].concat(h(s.args)))}return oB}}]),e}();function cB(e){if(!e)return 0;var t;switch(B(e)){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return iB(Number.isFinite(t)&&t>=0),t}function hB(e){var t=e.logLevel,i=e.message;e.logLevel=cB(t);for(var r=e.args?Array.from(e.args):[];r.length&&r.shift()!==i;);switch(e.args=r,B(t)){case"string":case"function":void 0!==i&&r.unshift(i),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());var s=B(e.message);return iB("string"===s||"object"===s),Object.assign(e,e.opts)}function dB(e,t,i){if("string"==typeof t){var r=i.time?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,i=Math.max(t-e.length,0);return"".concat(" ".repeat(i)).concat(e)}((s=i.total)<10?"".concat(s.toFixed(2),"ms"):s<100?"".concat(s.toFixed(1),"ms"):s<1e3?"".concat(s.toFixed(0),"ms"):"".concat((s/1e3).toFixed(2),"s")):"";t=function(e,t,i){return Yw||"string"!=typeof e||(t&&(t=eB(t),e="[".concat(t,"m").concat(e,"")),i&&(t=eB(i),e="[".concat(i+10,"m").concat(e,""))),e}(t=i.time?"".concat(e,": ").concat(r," ").concat(t):"".concat(e,": ").concat(t),i.color,i.background)}var s;return t}AB.VERSION=Xw;var pB=new AB({id:"loaders.gl"}),fB=function(){function e(){x(this,e)}return C(e,[{key:"log",value:function(){return function(){}}},{key:"info",value:function(){return function(){}}},{key:"warn",value:function(){return function(){}}},{key:"error",value:function(){return function(){}}}]),e}(),vB={fetch:null,mimeType:void 0,nothrow:!1,log:new(function(){function e(){x(this,e),Db(this,"console",void 0),this.console=console}return C(e,[{key:"log",value:function(){for(var e,t=arguments.length,i=new Array(t),r=0;r=0)}()}var FB={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"===("undefined"==typeof process?"undefined":B(process))&&process},kB=FB.window||FB.self||FB.global,IB=FB.process||{},DB="undefined"!=typeof __VERSION__?__VERSION__:"untranspiled source";function SB(e){try{var t=window[e],i="__storage_test__";return t.setItem(i,i),t.removeItem(i),t}catch(e){return null}}EB();var TB,LB=function(){function e(t){x(this,e);var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";Db(this,"storage",void 0),Db(this,"id",void 0),Db(this,"config",{}),this.storage=SB(r),this.id=t,this.config={},Object.assign(this.config,i),this._loadConfiguration()}return C(e,[{key:"getConfiguration",value:function(){return this.config}},{key:"setConfiguration",value:function(e){return this.config={},this.updateConfiguration(e)}},{key:"updateConfiguration",value:function(e){if(Object.assign(this.config,e),this.storage){var t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}return this}},{key:"_loadConfiguration",value:function(){var e={};if(this.storage){var t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}]),e}();function RB(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600,s=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>r&&(i=Math.min(i,r/e.width));var n=e.width*i,o=e.height*i,a=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(n/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(s,");"),"background-size:".concat(n,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}function UB(e){return"string"==typeof e?TB[e.toUpperCase()]||TB.WHITE:e}function OB(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),s=Object.getOwnPropertyNames(r),n=A(s);try{var o=function(){var r=t.value;"function"==typeof e[r]&&(i.find((function(e){return r===e}))||(e[r]=e[r].bind(e)))};for(n.s();!(t=n.n()).done;)o()}catch(e){n.e(e)}finally{n.f()}}function NB(e,t){if(!e)throw new Error(t||"Assertion failed")}function QB(){var e,t,i;if(EB&&"performance"in kB)e=null==kB||null===(t=kB.performance)||void 0===t||null===(i=t.now)||void 0===i?void 0:i.call(t);else if("hrtime"in IB){var r,s=null==IB||null===(r=IB.hrtime)||void 0===r?void 0:r.call(IB);e=1e3*s[0]+s[1]/1e6}else e=Date.now();return e}!function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(TB||(TB={}));var VB={debug:EB&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},HB={enabled:!0,level:0};function jB(){}var GB={},zB={once:!0},WB=function(){function e(){x(this,e);var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""},i=t.id;Db(this,"id",void 0),Db(this,"VERSION",DB),Db(this,"_startTs",QB()),Db(this,"_deltaTs",QB()),Db(this,"_storage",void 0),Db(this,"userData",{}),Db(this,"LOG_THROTTLE_TIMEOUT",0),this.id=i,this._storage=new LB("__probe-".concat(this.id,"__"),HB),this.userData={},this.timeStamp("".concat(this.id," started")),OB(this),Object.seal(this)}return C(e,[{key:"level",get:function(){return this.getLevel()},set:function(e){this.setLevel(e)}},{key:"isEnabled",value:function(){return this._storage.config.enabled}},{key:"getLevel",value:function(){return this._storage.config.level}},{key:"getTotal",value:function(){return Number((QB()-this._startTs).toPrecision(10))}},{key:"getDelta",value:function(){return Number((QB()-this._deltaTs).toPrecision(10))}},{key:"priority",get:function(){return this.level},set:function(e){this.level=e}},{key:"getPriority",value:function(){return this.level}},{key:"enable",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:e}),this}},{key:"setLevel",value:function(e){return this._storage.updateConfiguration({level:e}),this}},{key:"get",value:function(e){return this._storage.config[e]}},{key:"set",value:function(e,t){this._storage.updateConfiguration(o({},e,t))}},{key:"settings",value:function(){console.table?console.table(this._storage.config):console.log(this._storage.config)}},{key:"assert",value:function(e,t){NB(e,t)}},{key:"warn",value:function(e){return this._getLogFunction(0,e,VB.warn,arguments,zB)}},{key:"error",value:function(e){return this._getLogFunction(0,e,VB.error,arguments)}},{key:"deprecated",value:function(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}},{key:"removed",value:function(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}},{key:"probe",value:function(e,t){return this._getLogFunction(e,t,VB.log,arguments,{time:!0,once:!0})}},{key:"log",value:function(e,t){return this._getLogFunction(e,t,VB.debug,arguments)}},{key:"info",value:function(e,t){return this._getLogFunction(e,t,console.info,arguments)}},{key:"once",value:function(e,t){for(var i=arguments.length,r=new Array(i>2?i-2:0),s=2;s2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1},r=XB({logLevel:e,message:t,opts:i}),s=i.collapsed;return r.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}},{key:"groupCollapsed",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(e,t,Object.assign({},i,{collapsed:!0}))}},{key:"groupEnd",value:function(e){return this._getLogFunction(e,"",console.groupEnd||jB)}},{key:"withGroup",value:function(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}},{key:"trace",value:function(){console.trace&&console.trace()}},{key:"_shouldLog",value:function(e){return this.isEnabled()&&this.getLevel()>=KB(e)}},{key:"_getLogFunction",value:function(e,t,i,r,s){if(this._shouldLog(e)){var n;s=XB({logLevel:e,message:t,args:r,opts:s}),NB(i=i||s.method),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=QB();var o=s.tag||s.message;if(s.once){if(GB[o])return jB;GB[o]=QB()}return t=function(e,t,i){if("string"==typeof t){var r=i.time?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,i=Math.max(t-e.length,0);return"".concat(" ".repeat(i)).concat(e)}((s=i.total)<10?"".concat(s.toFixed(2),"ms"):s<100?"".concat(s.toFixed(1),"ms"):s<1e3?"".concat(s.toFixed(0),"ms"):"".concat((s/1e3).toFixed(2),"s")):"";t=function(e,t,i){return EB||"string"!=typeof e||(t&&(t=UB(t),e="[".concat(t,"m").concat(e,"")),i&&(t=UB(i),e="[".concat(i+10,"m").concat(e,""))),e}(t=i.time?"".concat(e,": ").concat(r," ").concat(t):"".concat(e,": ").concat(t),i.color,i.background)}var s;return t}(this.id,s.message,s),(n=i).bind.apply(n,[console,t].concat(h(s.args)))}return jB}}]),e}();function KB(e){if(!e)return 0;var t;switch(B(e)){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return NB(Number.isFinite(t)&&t>=0),t}function XB(e){var t=e.logLevel,i=e.message;e.logLevel=KB(t);for(var r=e.args?Array.from(e.args):[];r.length&&r.shift()!==i;);switch(B(t)){case"string":case"function":void 0!==i&&r.unshift(i),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());var s=B(e.message);return NB("string"===s||"object"===s),Object.assign(e,{args:r},e.opts)}function YB(e){for(var t in e)for(var i in e[t])return i||"untitled";return"empty"}Db(WB,"VERSION",DB);var JB=new WB({id:"loaders.gl"}),ZB=/\.([^.]+)$/;function qB(e){return $B.apply(this,arguments)}function $B(){return $B=u(a().mark((function e(t){var i,r,s,o,l=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=l.length>1&&void 0!==l[1]?l[1]:[],r=l.length>2?l[2]:void 0,s=l.length>3?l[3]:void 0,ix(t)){e.next=5;break}return e.abrupt("return",null);case 5:if(!(o=ex(t,i,n(n({},r),{},{nothrow:!0}),s))){e.next=8;break}return e.abrupt("return",o);case 8:if(!xw(t)){e.next=13;break}return e.next=11,t.slice(0,10).arrayBuffer();case 11:t=e.sent,o=ex(t,i,r,s);case 13:if(o||null!=r&&r.nothrow){e.next=15;break}throw new Error(rx(t));case 15:return e.abrupt("return",o);case 16:case"end":return e.stop()}}),e)}))),$B.apply(this,arguments)}function ex(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(!ix(e))return null;if(t&&!Array.isArray(t))return CB(t);var s,n=[];(t&&(n=n.concat(t)),null!=i&&i.ignoreRegisteredLoaders)||(s=n).push.apply(s,h(MB()));sx(n);var o=tx(e,n,i,r);if(!(o||null!=i&&i.nothrow))throw new Error(rx(e));return o}function tx(e,t,i,r){var s,n=Iw(e),o=n.url,a=n.type,l=o||(null==r?void 0:r.url),u=null,c="";(null!=i&&i.mimeType&&(u=nx(t,null==i?void 0:i.mimeType),c="match forced by supplied MIME type ".concat(null==i?void 0:i.mimeType)),u=u||function(e,t){var i=t&&ZB.exec(t),r=i&&i[1];return r?function(e,t){t=t.toLowerCase();var i,r=A(e);try{for(r.s();!(i=r.n()).done;){var s,n=i.value,o=A(n.extensions);try{for(o.s();!(s=o.n()).done;){if(s.value.toLowerCase()===t)return n}}catch(e){o.e(e)}finally{o.f()}}}catch(e){r.e(e)}finally{r.f()}return null}(e,r):null}(t,l),c=c||(u?"matched url ".concat(l):""),u=u||nx(t,a),c=c||(u?"matched MIME type ".concat(a):""),u=u||function(e,t){if(!t)return null;var i,r=A(e);try{for(r.s();!(i=r.n()).done;){var s=i.value;if("string"==typeof t){if(ox(t,s))return s}else if(ArrayBuffer.isView(t)){if(ax(t.buffer,t.byteOffset,s))return s}else if(t instanceof ArrayBuffer){if(ax(t,0,s))return s}}}catch(e){r.e(e)}finally{r.f()}return null}(t,e),c=c||(u?"matched initial data ".concat(lx(e)):""),u=u||nx(t,null==i?void 0:i.fallbackMimeType),c=c||(u?"matched fallback MIME type ".concat(a):""))&&JB.log(1,"selectLoader selected ".concat(null===(s=u)||void 0===s?void 0:s.name,": ").concat(c,"."));return u}function ix(e){return!(e instanceof Response&&204===e.status)}function rx(e){var t=Iw(e),i=t.url,r=t.type,s="No valid loader found (";s+=i?"".concat(function(e){var t=e&&e.lastIndexOf("/");return t>=0?e.substr(t+1):""}(i),", "):"no url provided, ",s+="MIME type: ".concat(r?'"'.concat(r,'"'):"not provided",", ");var n=e?lx(e):"";return s+=n?' first bytes: "'.concat(n,'"'):"first bytes: not available",s+=")"}function sx(e){var t,i=A(e);try{for(i.s();!(t=i.n()).done;){CB(t.value)}}catch(e){i.e(e)}finally{i.f()}}function nx(e,t){var i,r=A(e);try{for(r.s();!(i=r.n()).done;){var s=i.value;if(s.mimeTypes&&s.mimeTypes.includes(t))return s;if(t==="application/x.".concat(s.id))return s}}catch(e){r.e(e)}finally{r.f()}return null}function ox(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some((function(t){return e.startsWith(t)}))}function ax(e,t,i){return(Array.isArray(i.tests)?i.tests:[i.tests]).some((function(r){return function(e,t,i,r){if(r instanceof ArrayBuffer)return function(e,t,i){if(i=i||e.byteLength,e.byteLength1&&void 0!==arguments[1]?arguments[1]:5;if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return ux(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){var i=0;return ux(e,i,t)}return""}function ux(e,t,i){if(e.byteLength1&&void 0!==A[1]?A[1]:{},r=t.chunkSize,s=void 0===r?262144:r,n=0;case 3:if(!(n2&&void 0!==arguments[2]?arguments[2]:null;if(i)return i;var r=n({fetch:bB(t,e)},e);return Array.isArray(r.loaders)||(r.loaders=null),r}function wx(e,t){if(!t&&e&&!Array.isArray(e))return e;var i;if(e&&(i=Array.isArray(e)?e:[e]),t&&t.loaders){var r=Array.isArray(t.loaders)?t.loaders:[t.loaders];i=i?[].concat(h(i),h(r)):r}return i&&i.length?i:null}function Bx(e,t,i,r){return xx.apply(this,arguments)}function xx(){return(xx=u(a().mark((function e(t,i,r,s){var n,o,l,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Pb(!s||"object"===B(s)),!i||Array.isArray(i)||PB(i)||(s=void 0,r=i,i=void 0),e.next=4,t;case 4:return t=e.sent,r=r||{},n=Iw(t),o=n.url,l=wx(i,s),e.next=11,qB(t,l,r);case 11:if(u=e.sent){e.next=14;break}return e.abrupt("return",null);case 14:return r=yB(r,u,l,o),s=bx({url:o,parse:Bx,loaders:l},r,s),e.next=18,Px(u,t,r,s);case 18:return e.abrupt("return",e.sent);case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Px(e,t,i,r){return Cx.apply(this,arguments)}function Cx(){return(Cx=u(a().mark((function e(t,i,r,s){var n,o,l,u,A,c,h,d;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Wb(t),Bw(i)&&(o=(n=i).ok,l=n.redirected,u=n.status,A=n.statusText,c=n.type,h=n.url,d=Object.fromEntries(n.headers.entries()),s.response={headers:d,ok:o,redirected:l,status:u,statusText:A,type:c,url:h}),e.next=4,_x(i,t,r);case 4:if(i=e.sent,!t.parseTextSync||"string"!=typeof i){e.next=8;break}return r.dataType="text",e.abrupt("return",t.parseTextSync(i,r,s,t));case 8:if(!tw(t,r)){e.next=12;break}return e.next=11,iw(t,i,r,s,Bx);case 11:case 15:case 19:return e.abrupt("return",e.sent);case 12:if(!t.parseText||"string"!=typeof i){e.next=16;break}return e.next=15,t.parseText(i,r,s,t);case 16:if(!t.parse){e.next=20;break}return e.next=19,t.parse(i,r,s,t);case 20:throw Pb(!t.parseSync),new Error("".concat(t.id," loader - no parser found and worker is disabled"));case 22:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Mx,Ex,Fx="https://unpkg.com/@loaders.gl/textures@".concat("3.2.6","/dist/libs/basis_encoder.wasm"),kx="https://unpkg.com/@loaders.gl/textures@".concat("3.2.6","/dist/libs/basis_encoder.js");function Ix(e){return Dx.apply(this,arguments)}function Dx(){return(Dx=u(a().mark((function e(t){var i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=t.modules||{}).basis){e.next=3;break}return e.abrupt("return",i.basis);case 3:return Mx=Mx||Sx(t),e.next=6,Mx;case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Sx(e){return Tx.apply(this,arguments)}function Tx(){return(Tx=u(a().mark((function e(t){var i,r,s,n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null,r=null,e.t0=Promise,e.next=5,Yb("basis_transcoder.js","textures",t);case 5:return e.t1=e.sent,e.next=8,Yb("basis_transcoder.wasm","textures",t);case 8:return e.t2=e.sent,e.t3=[e.t1,e.t2],e.next=12,e.t0.all.call(e.t0,e.t3);case 12:return s=e.sent,n=c(s,2),i=n[0],r=n[1],i=i||globalThis.BASIS,e.next=19,Lx(i,r);case 19:return e.abrupt("return",e.sent);case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Lx(e,t){var i={};return t&&(i.wasmBinary=t),new Promise((function(t){e(i).then((function(e){var i=e.BasisFile;(0,e.initializeBasis)(),t({BasisFile:i})}))}))}function Rx(e){return Ux.apply(this,arguments)}function Ux(){return(Ux=u(a().mark((function e(t){var i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=t.modules||{}).basisEncoder){e.next=3;break}return e.abrupt("return",i.basisEncoder);case 3:return Ex=Ex||Ox(t),e.next=6,Ex;case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ox(e){return Nx.apply(this,arguments)}function Nx(){return(Nx=u(a().mark((function e(t){var i,r,s,n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null,r=null,e.t0=Promise,e.next=5,Yb(kx,"textures",t);case 5:return e.t1=e.sent,e.next=8,Yb(Fx,"textures",t);case 8:return e.t2=e.sent,e.t3=[e.t1,e.t2],e.next=12,e.t0.all.call(e.t0,e.t3);case 12:return s=e.sent,n=c(s,2),i=n[0],r=n[1],i=i||globalThis.BASIS,e.next=19,Qx(i,r);case 19:return e.abrupt("return",e.sent);case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qx(e,t){var i={};return t&&(i.wasmBinary=t),new Promise((function(t){e(i).then((function(e){var i=e.BasisFile,r=e.KTX2File,s=e.initializeBasis,n=e.BasisEncoder;s(),t({BasisFile:i,KTX2File:r,BasisEncoder:n})}))}))}var Vx,Hx,jx,Gx,zx,Wx,Kx,Xx,Yx,Jx=33776,Zx=33779,qx=35840,$x=35842,eP=36196,tP=37808,iP=["","WEBKIT_","MOZ_"],rP={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"},sP=null;function nP(e){if(!sP){e=e||function(){try{return document.createElement("canvas").getContext("webgl")}catch(e){return null}}()||void 0,sP=new Set;var t,i=A(iP);try{for(i.s();!(t=i.n()).done;){var r=t.value;for(var s in rP)if(e&&e.getExtension("".concat(r).concat(s))){var n=rP[s];sP.add(n)}}}catch(e){i.e(e)}finally{i.f()}}return sP}(Yx=Vx||(Vx={}))[Yx.NONE=0]="NONE",Yx[Yx.BASISLZ=1]="BASISLZ",Yx[Yx.ZSTD=2]="ZSTD",Yx[Yx.ZLIB=3]="ZLIB",function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(Hx||(Hx={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(jx||(jx={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(Gx||(Gx={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(zx||(zx={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Wx||(Wx={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(Kx||(Kx={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(Xx||(Xx={}));var oP=[171,75,84,88,32,50,48,187,13,10,26,10];function aP(e){var t=new Uint8Array(e);return!(t.byteLength1&&void 0!==r[1]?r[1]:null)&&TP||(i=null),!i){e.next=13;break}return e.prev=3,e.next=6,createImageBitmap(t,i);case 6:return e.abrupt("return",e.sent);case 9:e.prev=9,e.t0=e.catch(3),console.warn(e.t0),TP=!1;case 13:return e.next=15,createImageBitmap(t);case 15:return e.abrupt("return",e.sent);case 16:case"end":return e.stop()}}),e,null,[[3,9]])}))),OP.apply(this,arguments)}function NP(e){for(var t in e||SP)return!1;return!0}function QP(e){var t=VP(e);return function(e){var t=VP(e);if(!(t.byteLength>=24&&2303741511===t.getUint32(0,false)))return null;return{mimeType:"image/png",width:t.getUint32(16,false),height:t.getUint32(20,false)}}(t)||function(e){var t=VP(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,false)&&255===t.getUint8(2)))return null;var i=function(){for(var e=new Set([65499,65476,65484,65501,65534]),t=65504;t<65520;++t)e.add(t);var i=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:i}}(),r=i.tableMarkers,s=i.sofMarkers,n=2;for(;n+9=10&&1195984440===t.getUint32(0,false)))return null;return{mimeType:"image/gif",width:t.getUint16(6,true),height:t.getUint16(8,true)}}(t)||function(e){var t=VP(e);if(!(t.byteLength>=14&&16973===t.getUint16(0,false)&&t.getUint32(2,true)===t.byteLength))return null;return{mimeType:"image/bmp",width:t.getUint32(18,true),height:t.getUint32(22,true)}}(t)}function VP(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}function HP(e,t){return jP.apply(this,arguments)}function jP(){return jP=u(a().mark((function e(t,i){var r,s,n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=QP(t)||{},s=r.mimeType,wb(n=globalThis._parseImageNode),e.next=5,n(t,s);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)}))),jP.apply(this,arguments)}function GP(){return(GP=u(a().mark((function e(t,i,r){var s,n,o,l,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=(i=i||{}).image||{},n=s.type||"auto",o=(r||{}).url,l=zP(n),e.t0=l,e.next="imagebitmap"===e.t0?8:"image"===e.t0?12:"data"===e.t0?16:20;break;case 8:return e.next=10,LP(t,i,o);case 10:return u=e.sent,e.abrupt("break",21);case 12:return e.next=14,FP(t,i,o);case 14:return u=e.sent,e.abrupt("break",21);case 16:return e.next=18,HP(t);case 18:return u=e.sent,e.abrupt("break",21);case 20:wb(!1);case 21:return"data"===n&&(u=BP(u)),e.abrupt("return",u);case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function zP(e){switch(e){case"auto":case"data":return function(){if(_P)return"imagebitmap";if(mP)return"image";if(bP)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(e){switch(e){case"auto":return _P||mP||bP;case"imagebitmap":return _P;case"image":return mP;case"data":return bP;default:throw new Error("@loaders.gl/images: image ".concat(e," not supported in this environment"))}}(e),e}}var WP={id:"image",module:"images",name:"Images",version:"3.2.6",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:function(e,t,i){return GP.apply(this,arguments)},tests:[function(e){return Boolean(QP(new DataView(e)))}],options:{image:{type:"auto",decode:!0}}},KP=["image/png","image/jpeg","image/gif"],XP={};function YP(e){return void 0===XP[e]&&(XP[e]=function(e){switch(e){case"image/webp":return function(){if(!Bb)return!1;try{return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}catch(e){return!1}}();case"image/svg":return Bb;default:if(!Bb){var t=globalThis._parseImageNode;return Boolean(t)&&KP.includes(e)}return!0}}(e)),XP[e]}function JP(e,t){if(!e)throw new Error(t||"assert failed: gltf")}function ZP(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;var i=t.baseUri||t.uri;if(!i)throw new Error("'baseUri' must be provided to resolve relative url ".concat(e));return i.substr(0,i.lastIndexOf("/")+1)+e}function qP(e,t,i){var r=e.bufferViews[i];JP(r);var s=t[r.buffer];JP(s);var n=(r.byteOffset||0)+s.byteOffset;return new Uint8Array(s.arrayBuffer,n,r.byteLength)}var $P=["SCALAR","VEC2","VEC3","VEC4"],eC=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],tC=new Map(eC),iC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},rC={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},sC={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function nC(e){return $P[e-1]||$P[0]}function oC(e){var t=tC.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function aC(e,t){var i=sC[e.componentType],r=iC[e.type],s=rC[e.componentType],n=e.count*r,o=e.count*r*s;return JP(o>=0&&o<=t.byteLength),{ArrayType:i,length:n,byteLength:o}}var lC,uC={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]},AC=function(){function e(t){x(this,e),Db(this,"gltf",void 0),Db(this,"sourceBuffers",void 0),Db(this,"byteLength",void 0),this.gltf=t||{json:n({},uC),buffers:[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}return C(e,[{key:"json",get:function(){return this.gltf.json}},{key:"getApplicationData",value:function(e){return this.json[e]}},{key:"getExtraData",value:function(e){return(this.json.extras||{})[e]}},{key:"getExtension",value:function(e){var t=this.getUsedExtensions().find((function(t){return t===e})),i=this.json.extensions||{};return t?i[e]||!0:null}},{key:"getRequiredExtension",value:function(e){var t=this.getRequiredExtensions().find((function(t){return t===e}));return t?this.getExtension(e):null}},{key:"getRequiredExtensions",value:function(){return this.json.extensionsRequired||[]}},{key:"getUsedExtensions",value:function(){return this.json.extensionsUsed||[]}},{key:"getObjectExtension",value:function(e,t){return(e.extensions||{})[t]}},{key:"getScene",value:function(e){return this.getObject("scenes",e)}},{key:"getNode",value:function(e){return this.getObject("nodes",e)}},{key:"getSkin",value:function(e){return this.getObject("skins",e)}},{key:"getMesh",value:function(e){return this.getObject("meshes",e)}},{key:"getMaterial",value:function(e){return this.getObject("materials",e)}},{key:"getAccessor",value:function(e){return this.getObject("accessors",e)}},{key:"getTexture",value:function(e){return this.getObject("textures",e)}},{key:"getSampler",value:function(e){return this.getObject("samplers",e)}},{key:"getImage",value:function(e){return this.getObject("images",e)}},{key:"getBufferView",value:function(e){return this.getObject("bufferViews",e)}},{key:"getBuffer",value:function(e){return this.getObject("buffers",e)}},{key:"getObject",value:function(e,t){if("object"===B(t))return t;var i=this.json[e]&&this.json[e][t];if(!i)throw new Error("glTF file error: Could not find ".concat(e,"[").concat(t,"]"));return i}},{key:"getTypedArrayForBufferView",value:function(e){var t=(e=this.getBufferView(e)).buffer,i=this.gltf.buffers[t];JP(i);var r=(e.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,r,e.byteLength)}},{key:"getTypedArrayForAccessor",value:function(e){e=this.getAccessor(e);var t=this.getBufferView(e.bufferView),i=this.getBuffer(t.buffer).data,r=aC(e,t),s=r.ArrayType,n=r.length;return new s(i,t.byteOffset+e.byteOffset,n)}},{key:"getTypedArrayForImageData",value:function(e){e=this.getAccessor(e);var t=this.getBufferView(e.bufferView),i=this.getBuffer(t.buffer).data,r=t.byteOffset||0;return new Uint8Array(i,r,t.byteLength)}},{key:"addApplicationData",value:function(e,t){return this.json[e]=t,this}},{key:"addExtraData",value:function(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}},{key:"addObjectExtension",value:function(e,t,i){return e.extensions=e.extensions||{},e.extensions[t]=i,this.registerUsedExtension(t),this}},{key:"setObjectExtension",value:function(e,t,i){(e.extensions||{})[t]=i}},{key:"removeObjectExtension",value:function(e,t){var i=e.extensions||{},r=i[t];return delete i[t],r}},{key:"addExtension",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return JP(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}},{key:"addRequiredExtension",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return JP(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}},{key:"registerUsedExtension",value:function(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find((function(t){return t===e}))||this.json.extensionsUsed.push(e)}},{key:"registerRequiredExtension",value:function(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find((function(t){return t===e}))||this.json.extensionsRequired.push(e)}},{key:"removeExtension",value:function(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}},{key:"setDefaultScene",value:function(e){this.json.scene=e}},{key:"addScene",value:function(e){var t=e.nodeIndices;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}},{key:"addNode",value:function(e){var t=e.meshIndex,i=e.matrix;this.json.nodes=this.json.nodes||[];var r={mesh:t};return i&&(r.matrix=i),this.json.nodes.push(r),this.json.nodes.length-1}},{key:"addMesh",value:function(e){var t=e.attributes,i=e.indices,r=e.material,s=e.mode,n=void 0===s?4:s,o={primitives:[{attributes:this._addAttributes(t),mode:n}]};if(i){var a=this._addIndices(i);o.primitives[0].indices=a}return Number.isFinite(r)&&(o.primitives[0].material=r),this.json.meshes=this.json.meshes||[],this.json.meshes.push(o),this.json.meshes.length-1}},{key:"addPointCloud",value:function(e){var t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}},{key:"addImage",value:function(e,t){var i=QP(e),r=t||(null==i?void 0:i.mimeType),s={bufferView:this.addBufferView(e),mimeType:r};return this.json.images=this.json.images||[],this.json.images.push(s),this.json.images.length-1}},{key:"addBufferView",value:function(e){var t=e.byteLength;JP(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);var i={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=hw(t,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}},{key:"addAccessor",value:function(e,t){var i={bufferView:e,type:nC(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(i),this.json.accessors.length-1}},{key:"addBinaryBuffer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{size:3},i=this.addBufferView(e),r={min:t.min,max:t.max};r.min&&r.max||(r=this._getAccessorMinMax(e,t.size));var s={size:t.size,componentType:oC(e),count:Math.round(e.length/t.size),min:r.min,max:r.max};return this.addAccessor(i,Object.assign(s,t))}},{key:"addTexture",value:function(e){var t={source:e.imageIndex};return this.json.textures=this.json.textures||[],this.json.textures.push(t),this.json.textures.length-1}},{key:"addMaterial",value:function(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}},{key:"createBinaryChunk",value:function(){var e,t;this.gltf.buffers=[];var i,r=this.byteLength,s=new ArrayBuffer(r),n=new Uint8Array(s),o=0,a=A(this.sourceBuffers||[]);try{for(a.s();!(i=a.n()).done;){o=dw(i.value,n,o)}}catch(e){a.e(e)}finally{a.f()}null!==(e=this.json)&&void 0!==e&&null!==(t=e.buffers)&&void 0!==t&&t[0]?this.json.buffers[0].byteLength=r:this.json.buffers=[{byteLength:r}],this.gltf.binary=s,this.sourceBuffers=[s]}},{key:"_removeStringFromArray",value:function(e,t){for(var i=!0;i;){var r=e.indexOf(t);r>-1?e.splice(r,1):i=!1}}},{key:"_addAttributes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={};for(var i in e){var r=e[i],s=this._getGltfAttributeName(i),n=this.addBinaryBuffer(r.value,r);t[s]=n}return t}},{key:"_addIndices",value:function(e){return this.addBinaryBuffer(e,{size:1})}},{key:"_getGltfAttributeName",value:function(e){switch(e.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 e}}},{key:"_getAccessorMinMax",value:function(e,t){var i={min:null,max:null};if(e.length5&&void 0!==u[5]?u[5]:"NONE",e.next=3,_C();case 3:xC(l=e.sent,l.exports[vC[n]],t,i,r,s,l.exports[fC[o||"NONE"]]);case 5:case"end":return e.stop()}}),e)}))),mC.apply(this,arguments)}function _C(){return yC.apply(this,arguments)}function yC(){return(yC=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return lC||(lC=bC()),e.abrupt("return",lC);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bC(){return wC.apply(this,arguments)}function wC(){return(wC=u(a().mark((function e(){var t,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=cC,WebAssembly.validate(dC)&&(t=hC,console.log("Warning: meshopt_decoder is using experimental SIMD support")),e.next=4,WebAssembly.instantiate(BC(t),{});case 4:return i=e.sent,e.next=7,i.instance.exports.__wasm_call_ctors();case 7:return e.abrupt("return",i.instance);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function BC(e){for(var t=new Uint8Array(e.length),i=0;i96?r-71:r>64?r-65:r>47?r+4:r>46?63:62}for(var s=0,n=0;ns?A:s,n=c>n?c:n,o=h>o?h:o}return[[t,i,r],[s,n,o]]}var SC=function(){function e(t,i){x(this,e),Db(this,"fields",void 0),Db(this,"metadata",void 0),function(e,t){if(!e)throw new Error(t||"loader assertion failed.")}(Array.isArray(t)),function(e){var t,i={},r=A(e);try{for(r.s();!(t=r.n()).done;){var s=t.value;i[s.name]&&console.warn("Schema: duplicated field name",s.name,s),i[s.name]=!0}}catch(e){r.e(e)}finally{r.f()}}(t),this.fields=t,this.metadata=i||new Map}return C(e,[{key:"compareTo",value:function(e){if(this.metadata!==e.metadata)return!1;if(this.fields.length!==e.fields.length)return!1;for(var t=0;t2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Map;x(this,e),Db(this,"name",void 0),Db(this,"type",void 0),Db(this,"nullable",void 0),Db(this,"metadata",void 0),this.name=t,this.type=i,this.nullable=r,this.metadata=s}return C(e,[{key:"typeId",get:function(){return this.type&&this.type.typeId}},{key:"clone",value:function(){return new e(this.name,this.type,this.nullable,this.metadata)}},{key:"compareTo",value:function(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}},{key:"toString",value:function(){return"".concat(this.type).concat(this.nullable?", nullable":"").concat(this.metadata?", metadata: ".concat(this.metadata):"")}}]),e}();!function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(LC||(LC={}));var UC=function(){function e(){x(this,e)}return C(e,[{key:"typeId",get:function(){return LC.NONE}},{key:"compareTo",value:function(e){return this===e}}],[{key:"isNull",value:function(e){return e&&e.typeId===LC.Null}},{key:"isInt",value:function(e){return e&&e.typeId===LC.Int}},{key:"isFloat",value:function(e){return e&&e.typeId===LC.Float}},{key:"isBinary",value:function(e){return e&&e.typeId===LC.Binary}},{key:"isUtf8",value:function(e){return e&&e.typeId===LC.Utf8}},{key:"isBool",value:function(e){return e&&e.typeId===LC.Bool}},{key:"isDecimal",value:function(e){return e&&e.typeId===LC.Decimal}},{key:"isDate",value:function(e){return e&&e.typeId===LC.Date}},{key:"isTime",value:function(e){return e&&e.typeId===LC.Time}},{key:"isTimestamp",value:function(e){return e&&e.typeId===LC.Timestamp}},{key:"isInterval",value:function(e){return e&&e.typeId===LC.Interval}},{key:"isList",value:function(e){return e&&e.typeId===LC.List}},{key:"isStruct",value:function(e){return e&&e.typeId===LC.Struct}},{key:"isUnion",value:function(e){return e&&e.typeId===LC.Union}},{key:"isFixedSizeBinary",value:function(e){return e&&e.typeId===LC.FixedSizeBinary}},{key:"isFixedSizeList",value:function(e){return e&&e.typeId===LC.FixedSizeList}},{key:"isMap",value:function(e){return e&&e.typeId===LC.Map}},{key:"isDictionary",value:function(e){return e&&e.typeId===LC.Dictionary}}]),e}(),OC=function(e,t){g(r,UC);var i=_(r);function r(e,t){var s;return x(this,r),Db(b(s=i.call(this)),"isSigned",void 0),Db(b(s),"bitWidth",void 0),s.isSigned=e,s.bitWidth=t,s}return C(r,[{key:"typeId",get:function(){return LC.Int}},{key:t,get:function(){return"Int"}},{key:"toString",value:function(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}}]),r}(0,Symbol.toStringTag),NC=function(e){g(i,OC);var t=_(i);function i(){return x(this,i),t.call(this,!0,8)}return C(i)}(),QC=function(e){g(i,OC);var t=_(i);function i(){return x(this,i),t.call(this,!0,16)}return C(i)}(),VC=function(e){g(i,OC);var t=_(i);function i(){return x(this,i),t.call(this,!0,32)}return C(i)}(),HC=function(e){g(i,OC);var t=_(i);function i(){return x(this,i),t.call(this,!1,8)}return C(i)}(),jC=function(e){g(i,OC);var t=_(i);function i(){return x(this,i),t.call(this,!1,16)}return C(i)}(),GC=function(e){g(i,OC);var t=_(i);function i(){return x(this,i),t.call(this,!1,32)}return C(i)}(),zC=32,WC=64,KC=function(e,t){g(r,UC);var i=_(r);function r(e){var t;return x(this,r),Db(b(t=i.call(this)),"precision",void 0),t.precision=e,t}return C(r,[{key:"typeId",get:function(){return LC.Float}},{key:t,get:function(){return"Float"}},{key:"toString",value:function(){return"Float".concat(this.precision)}}]),r}(0,Symbol.toStringTag),XC=function(e){g(i,KC);var t=_(i);function i(){return x(this,i),t.call(this,zC)}return C(i)}(),YC=function(e){g(i,KC);var t=_(i);function i(){return x(this,i),t.call(this,WC)}return C(i)}(),JC=function(e,t){g(r,UC);var i=_(r);function r(e,t){var s;return x(this,r),Db(b(s=i.call(this)),"listSize",void 0),Db(b(s),"children",void 0),s.listSize=e,s.children=[t],s}return C(r,[{key:"typeId",get:function(){return LC.FixedSizeList}},{key:"valueType",get:function(){return this.children[0].type}},{key:"valueField",get:function(){return this.children[0]}},{key:t,get:function(){return"FixedSizeList"}},{key:"toString",value:function(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}}]),r}(0,Symbol.toStringTag);function ZC(e,t,i){var r=function(e){switch(e.constructor){case Int8Array:return new NC;case Uint8Array:return new HC;case Int16Array:return new QC;case Uint16Array:return new jC;case Int32Array:return new VC;case Uint32Array:return new GC;case Float32Array:return new XC;case Float64Array:return new YC;default:throw new Error("array type not supported")}}(t.value),s=i||function(e){var t=new Map;"byteOffset"in e&&t.set("byteOffset",e.byteOffset.toString(10));"byteStride"in e&&t.set("byteStride",e.byteStride.toString(10));"normalized"in e&&t.set("normalized",e.normalized.toString());return t}(t);return new RC(e,new JC(t.size,new RC("value",r)),!1,s)}function qC(e,t,i){var r=eM(t.metadata),s=[],n=function(e){var t={};for(var i in e){var r=e[i];t[r.name||"undefined"]=r}return t}(t.attributes);for(var o in e){var a=$C(o,e[o],n[o]);s.push(a)}if(i){var l=$C("indices",i);s.push(l)}return new SC(s,r)}function $C(e,t,i){return ZC(e,t,i?eM(i.metadata):void 0)}function eM(e){var t=new Map;for(var i in e)t.set("".concat(i,".string"),JSON.stringify(e[i]));return t}var tM={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},iM={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},rM=function(){function e(t){x(this,e),Db(this,"draco",void 0),Db(this,"decoder",void 0),Db(this,"metadataQuerier",void 0),this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}return C(e,[{key:"destroy",value:function(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}},{key:"parseSync",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=new this.draco.DecoderBuffer;i.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(t);var r=this.decoder.GetEncodedGeometryType(i),s=r===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{var o;switch(r){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(i,s);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(i,s);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!s.ptr){var a="DRACO decompression failed: ".concat(o.error_msg());throw new Error(a)}var l=this._getDracoLoaderData(s,r,t),u=this._getMeshData(s,l,t),A=DC(u.attributes),c=qC(u.attributes,l,u.indices),h=n(n({loader:"draco",loaderData:l,header:{vertexCount:s.num_points(),boundingBox:A}},u),{},{schema:c});return h}finally{this.draco.destroy(i),s&&this.draco.destroy(s)}}},{key:"_getDracoLoaderData",value:function(e,t,i){var r=this._getTopLevelMetadata(e),s=this._getDracoAttributes(e,i);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:r,attributes:s}}},{key:"_getDracoAttributes",value:function(e,t){for(var i={},r=0;r2&&void 0!==arguments[2]&&arguments[2];if(!e)return null;if(Array.isArray(e))return new t(e);if(i&&!(e instanceof t))return new t(e);return e}(t,Float32Array)),r=t.length/i);return{buffer:t,size:i,count:r}}(e),i=t.buffer,r=t.size;return{value:i,size:r,byteOffset:0,count:t.count,type:nC(r),componentType:oC(i)}}function gM(){return(gM=u(a().mark((function e(t,i,r){var s,n,o,l,u,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=i&&null!==(s=i.gltf)&&void 0!==s&&s.decompressMeshes){e.next=2;break}return e.abrupt("return");case 2:n=new AC(t),o=[],l=A(wM(n));try{for(l.s();!(u=l.n()).done;)c=u.value,n.getObjectExtension(c,"KHR_draco_mesh_compression")&&o.push(mM(n,c,i,r))}catch(e){l.e(e)}finally{l.f()}return e.next=8,Promise.all(o);case 8:n.removeExtension("KHR_draco_mesh_compression");case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mM(e,t,i,r){return _M.apply(this,arguments)}function _M(){return _M=u(a().mark((function e(t,i,r,s){var o,l,u,A,h,d,p,f,v,g,m,_,y,b;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.getObjectExtension(i,"KHR_draco_mesh_compression")){e.next=3;break}return e.abrupt("return");case 3:return l=t.getTypedArrayForBufferView(o.bufferView),u=cw(l.buffer,l.byteOffset),A=s.parse,delete(h=n({},r))["3d-tiles"],e.next=10,A(u,dM,h,s);case 10:for(d=e.sent,p=fM(d.attributes),f=0,v=Object.entries(p);f2&&void 0!==arguments[2]?arguments[2]:4,s=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;if(!s.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");var a=s.DracoWriter.encodeSync({attributes:e}),l=null==n||null===(i=n.parseSync)||void 0===i?void 0:i.call(n,{attributes:e}),u=s._addFauxAttributes(l.attributes),A=s.addBufferView(a),c={primitives:[{attributes:u,mode:r,extensions:o({},"KHR_draco_mesh_compression",{bufferView:A,attributes:u})}]};return c}function bM(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function wM(e){var t,i,s,n,o,l;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:t=A(e.json.meshes||[]),r.prev=1,t.s();case 3:if((i=t.n()).done){r.next=24;break}s=i.value,n=A(s.primitives),r.prev=6,n.s();case 8:if((o=n.n()).done){r.next=14;break}return l=o.value,r.next=12,l;case 12:r.next=8;break;case 14:r.next=19;break;case 16:r.prev=16,r.t0=r.catch(6),n.e(r.t0);case 19:return r.prev=19,n.f(),r.finish(19);case 22:r.next=3;break;case 24:r.next=29;break;case 26:r.prev=26,r.t1=r.catch(1),t.e(r.t1);case 29:return r.prev=29,t.f(),r.finish(29);case 32:case"end":return r.stop()}}),r,null,[[1,26,29,32],[6,16,19,22]])}function BM(){return(BM=u(a().mark((function e(t){var i,r,s,n,o,l,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=new AC(t),r=i.json,(s=i.getExtension("KHR_lights_punctual"))&&(i.json.lights=s.lights,i.removeExtension("KHR_lights_punctual")),n=A(r.nodes||[]);try{for(n.s();!(o=n.n()).done;)l=o.value,(u=i.getObjectExtension(l,"KHR_lights_punctual"))&&(l.light=u.light),i.removeObjectExtension(l,"KHR_lights_punctual")}catch(e){n.e(e)}finally{n.f()}case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xM(){return(xM=u(a().mark((function e(t){var i,r,s,n,o,l,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=new AC(t),(r=i.json).lights&&(JP(!(s=i.addExtension("KHR_lights_punctual")).lights),s.lights=r.lights,delete r.lights),i.json.lights){n=A(i.json.lights);try{for(n.s();!(o=n.n()).done;)l=o.value,u=l.node,i.addObjectExtension(u,"KHR_lights_punctual",l)}catch(e){n.e(e)}finally{n.f()}delete i.json.lights}case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function PM(){return(PM=u(a().mark((function e(t){var i,r,s,n,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=new AC(t),r=i.json,i.removeExtension("KHR_materials_unlit"),s=A(r.materials||[]);try{for(s.s();!(n=s.n()).done;)o=n.value,o.extensions&&o.extensions.KHR_materials_unlit&&(o.unlit=!0),i.removeObjectExtension(o,"KHR_materials_unlit")}catch(e){s.e(e)}finally{s.f()}case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function CM(){return(CM=u(a().mark((function e(t){var i,r,s,n,o,l,u,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=new AC(t),r=i.json,s=i.getExtension("KHR_techniques_webgl")){n=EM(s,i),o=A(r.materials||[]);try{for(o.s();!(l=o.n()).done;)u=l.value,(c=i.getObjectExtension(u,"KHR_techniques_webgl"))&&(u.technique=Object.assign({},c,n[c.technique]),u.technique.values=FM(u.technique,i)),i.removeObjectExtension(u,"KHR_techniques_webgl")}catch(e){o.e(e)}finally{o.f()}i.removeExtension("KHR_techniques_webgl")}case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function MM(){return(MM=u(a().mark((function e(t,i){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function EM(e,t){var i=e.programs,r=void 0===i?[]:i,s=e.shaders,n=void 0===s?[]:s,o=e.techniques,a=void 0===o?[]:o,l=new TextDecoder;return n.forEach((function(e){if(!Number.isFinite(e.bufferView))throw new Error("KHR_techniques_webgl: no shader code");e.code=l.decode(t.getTypedArrayForBufferView(e.bufferView))})),r.forEach((function(e){e.fragmentShader=n[e.fragmentShader],e.vertexShader=n[e.vertexShader]})),a.forEach((function(e){e.program=r[e.program]})),a}function FM(e,t){var i=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach((function(t){e.uniforms[t].value&&!(t in i)&&(i[t]=e.uniforms[t].value)})),Object.keys(i).forEach((function(e){"object"===B(i[e])&&void 0!==i[e].index&&(i[e].texture=t.getTexture(i[e].index))})),i}var kM=[EC,FC,kC,Object.freeze({__proto__:null,name:"KHR_draco_mesh_compression",preprocess:function(e,t,i){var r,s=new AC(e),n=A(wM(s));try{for(n.s();!(r=n.n()).done;){var o=r.value;s.getObjectExtension(o,"KHR_draco_mesh_compression")}}catch(e){n.e(e)}finally{n.f()}},decode:function(e,t,i){return gM.apply(this,arguments)},encode:function(e){var t,i=new AC(e),r=A(i.json.meshes||[]);try{for(r.s();!(t=r.n()).done;){var s=t.value;yM(s),i.addRequiredExtension("KHR_draco_mesh_compression")}}catch(e){r.e(e)}finally{r.f()}}}),Object.freeze({__proto__:null,name:"KHR_lights_punctual",decode:function(e){return BM.apply(this,arguments)},encode:function(e){return xM.apply(this,arguments)}}),Object.freeze({__proto__:null,name:"KHR_materials_unlit",decode:function(e){return PM.apply(this,arguments)},encode:function(e){var t=new AC(e),i=t.json;if(t.materials){var r,s=A(i.materials||[]);try{for(s.s();!(r=s.n()).done;){var n=r.value;n.unlit&&(delete n.unlit,t.addObjectExtension(n,"KHR_materials_unlit",{}),t.addExtension("KHR_materials_unlit"))}}catch(e){s.e(e)}finally{s.f()}}}}),Object.freeze({__proto__:null,name:"KHR_techniques_webgl",decode:function(e){return CM.apply(this,arguments)},encode:function(e,t){return MM.apply(this,arguments)}})];function IM(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,s=kM.filter((function(e){return TM(e.name,i)})),n=A(s);try{for(n.s();!(t=n.n()).done;){var o,a=t.value;null===(o=a.preprocess)||void 0===o||o.call(a,e,i,r)}}catch(e){n.e(e)}finally{n.f()}}function DM(e){return SM.apply(this,arguments)}function SM(){return SM=u(a().mark((function e(t){var i,r,s,n,o,l,u,c=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=c.length>1&&void 0!==c[1]?c[1]:{},r=c.length>2?c[2]:void 0,s=kM.filter((function(e){return TM(e.name,i)})),n=A(s),e.prev=4,n.s();case 6:if((o=n.n()).done){e.next=12;break}return l=o.value,e.next=10,null===(u=l.decode)||void 0===u?void 0:u.call(l,t,i,r);case 10:e.next=6;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(4),n.e(e.t0);case 17:return e.prev=17,n.f(),e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[4,14,17,20]])}))),SM.apply(this,arguments)}function TM(e,t){var i,r=(null==t||null===(i=t.gltf)||void 0===i?void 0:i.excludeExtensions)||{};return!(e in r&&!r[e])}var LM={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},RM={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},UM=function(){function e(){x(this,e),Db(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),Db(this,"json",void 0)}return C(e,[{key:"normalize",value:function(e,t){this.json=e.json;var i=e.json;switch(i.asset&&i.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version ".concat(i.asset.version))}if(!t.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(i),this._convertTopLevelObjectsToArrays(i),function(e){var t,i=new AC(e),r=i.json,s=A(r.images||[]);try{for(s.s();!(t=s.n()).done;){var n=t.value,o=i.getObjectExtension(n,"KHR_binary_glTF");o&&Object.assign(n,o),i.removeObjectExtension(n,"KHR_binary_glTF")}}catch(e){s.e(e)}finally{s.f()}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,i.removeExtension("KHR_binary_glTF")}(e),this._convertObjectIdsToArrayIndices(i),this._updateObjects(i),this._updateMaterial(i)}},{key:"_addAsset",value:function(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}},{key:"_convertTopLevelObjectsToArrays",value:function(e){for(var t in LM)this._convertTopLevelObjectToArray(e,t)}},{key:"_convertTopLevelObjectToArray",value:function(e,t){var i=e[t];if(i&&!Array.isArray(i))for(var r in e[t]=[],i){var s=i[r];s.id=s.id||r;var n=e[t].length;e[t].push(s),this.idToIndexMap[t][r]=n}}},{key:"_convertObjectIdsToArrayIndices",value:function(e){for(var t in LM)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));var i,r=A(e.textures);try{for(r.s();!(i=r.n()).done;){var s=i.value;this._convertTextureIds(s)}}catch(e){r.e(e)}finally{r.f()}var n,o=A(e.meshes);try{for(o.s();!(n=o.n()).done;){var a=n.value;this._convertMeshIds(a)}}catch(e){o.e(e)}finally{o.f()}var l,u=A(e.nodes);try{for(u.s();!(l=u.n()).done;){var c=l.value;this._convertNodeIds(c)}}catch(e){u.e(e)}finally{u.f()}var h,d=A(e.scenes);try{for(d.s();!(h=d.n()).done;){var p=h.value;this._convertSceneIds(p)}}catch(e){d.e(e)}finally{d.f()}}},{key:"_convertTextureIds",value:function(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}},{key:"_convertMeshIds",value:function(e){var t,i=A(e.primitives);try{for(i.s();!(t=i.n()).done;){var r=t.value,s=r.attributes,n=r.indices,o=r.material;for(var a in s)s[a]=this._convertIdToIndex(s[a],"accessor");n&&(r.indices=this._convertIdToIndex(n,"accessor")),o&&(r.material=this._convertIdToIndex(o,"material"))}}catch(e){i.e(e)}finally{i.f()}}},{key:"_convertNodeIds",value:function(e){var t=this;e.children&&(e.children=e.children.map((function(e){return t._convertIdToIndex(e,"node")}))),e.meshes&&(e.meshes=e.meshes.map((function(e){return t._convertIdToIndex(e,"mesh")})))}},{key:"_convertSceneIds",value:function(e){var t=this;e.nodes&&(e.nodes=e.nodes.map((function(e){return t._convertIdToIndex(e,"node")})))}},{key:"_convertIdsToIndices",value:function(e,t){e[t]||(console.warn("gltf v1: json doesn't contain attribute ".concat(t)),e[t]=[]);var i,r=A(e[t]);try{for(r.s();!(i=r.n()).done;){var s=i.value;for(var n in s){var o=s[n],a=this._convertIdToIndex(o,n);s[n]=a}}}catch(e){r.e(e)}finally{r.f()}}},{key:"_convertIdToIndex",value:function(e,t){var i=RM[t];if(i in this.idToIndexMap){var r=this.idToIndexMap[i][e];if(!Number.isFinite(r))throw new Error("gltf v1: failed to resolve ".concat(t," with id ").concat(e));return r}return e}},{key:"_updateObjects",value:function(e){var t,i=A(this.json.buffers);try{for(i.s();!(t=i.n()).done;){delete t.value.type}}catch(e){i.e(e)}finally{i.f()}}},{key:"_updateMaterial",value:function(e){var t,i=A(e.materials);try{var r=function(){var i=t.value;i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};var r=(null===(s=i.values)||void 0===s?void 0:s.tex)||(null===(n=i.values)||void 0===n?void 0:n.texture2d_0),o=e.textures.findIndex((function(e){return e.id===r}));-1!==o&&(i.pbrMetallicRoughness.baseColorTexture={index:o})};for(i.s();!(t=i.n()).done;){var s,n;r()}}catch(e){i.e(e)}finally{i.f()}}}]),e}();function OM(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(new UM).normalize(e,t)}var NM={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},QM={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},VM=10240,HM=10241,jM=10242,GM=10243,zM=10497,WM=9986,KM={magFilter:VM,minFilter:HM,wrapS:jM,wrapT:GM},XM=(o(e={},VM,9729),o(e,HM,WM),o(e,jM,zM),o(e,GM,zM),e);var YM=function(){function e(){x(this,e),Db(this,"baseUri",""),Db(this,"json",{}),Db(this,"buffers",[]),Db(this,"images",[])}return C(e,[{key:"postProcess",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.json,r=e.buffers,s=void 0===r?[]:r,n=e.images,o=void 0===n?[]:n,a=e.baseUri,l=void 0===a?"":a;return JP(i),this.baseUri=l,this.json=i,this.buffers=s,this.images=o,this._resolveTree(this.json,t),this.json}},{key:"_resolveTree",value:function(e){var t=this;e.bufferViews&&(e.bufferViews=e.bufferViews.map((function(e,i){return t._resolveBufferView(e,i)}))),e.images&&(e.images=e.images.map((function(e,i){return t._resolveImage(e,i)}))),e.samplers&&(e.samplers=e.samplers.map((function(e,i){return t._resolveSampler(e,i)}))),e.textures&&(e.textures=e.textures.map((function(e,i){return t._resolveTexture(e,i)}))),e.accessors&&(e.accessors=e.accessors.map((function(e,i){return t._resolveAccessor(e,i)}))),e.materials&&(e.materials=e.materials.map((function(e,i){return t._resolveMaterial(e,i)}))),e.meshes&&(e.meshes=e.meshes.map((function(e,i){return t._resolveMesh(e,i)}))),e.nodes&&(e.nodes=e.nodes.map((function(e,i){return t._resolveNode(e,i)}))),e.skins&&(e.skins=e.skins.map((function(e,i){return t._resolveSkin(e,i)}))),e.scenes&&(e.scenes=e.scenes.map((function(e,i){return t._resolveScene(e,i)}))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene])}},{key:"getScene",value:function(e){return this._get("scenes",e)}},{key:"getNode",value:function(e){return this._get("nodes",e)}},{key:"getSkin",value:function(e){return this._get("skins",e)}},{key:"getMesh",value:function(e){return this._get("meshes",e)}},{key:"getMaterial",value:function(e){return this._get("materials",e)}},{key:"getAccessor",value:function(e){return this._get("accessors",e)}},{key:"getCamera",value:function(e){return null}},{key:"getTexture",value:function(e){return this._get("textures",e)}},{key:"getSampler",value:function(e){return this._get("samplers",e)}},{key:"getImage",value:function(e){return this._get("images",e)}},{key:"getBufferView",value:function(e){return this._get("bufferViews",e)}},{key:"getBuffer",value:function(e){return this._get("buffers",e)}},{key:"_get",value:function(e,t){if("object"===B(t))return t;var i=this.json[e]&&this.json[e][t];return i||console.warn("glTF file error: Could not find ".concat(e,"[").concat(t,"]")),i}},{key:"_resolveScene",value:function(e,t){var i=this;return e.id=e.id||"scene-".concat(t),e.nodes=(e.nodes||[]).map((function(e){return i.getNode(e)})),e}},{key:"_resolveNode",value:function(e,t){var i=this;return e.id=e.id||"node-".concat(t),e.children&&(e.children=e.children.map((function(e){return i.getNode(e)}))),void 0!==e.mesh?e.mesh=this.getMesh(e.mesh):void 0!==e.meshes&&e.meshes.length&&(e.mesh=e.meshes.reduce((function(e,t){var r=i.getMesh(t);return e.id=r.id,e.primitives=e.primitives.concat(r.primitives),e}),{primitives:[]})),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}},{key:"_resolveSkin",value:function(e,t){return e.id=e.id||"skin-".concat(t),e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}},{key:"_resolveMesh",value:function(e,t){var i=this;return e.id=e.id||"mesh-".concat(t),e.primitives&&(e.primitives=e.primitives.map((function(e){var t=(e=n({},e)).attributes;for(var r in e.attributes={},t)e.attributes[r]=i.getAccessor(t[r]);return void 0!==e.indices&&(e.indices=i.getAccessor(e.indices)),void 0!==e.material&&(e.material=i.getMaterial(e.material)),e}))),e}},{key:"_resolveMaterial",value:function(e,t){if(e.id=e.id||"material-".concat(t),e.normalTexture&&(e.normalTexture=n({},e.normalTexture),e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture=n({},e.occlustionTexture),e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture=n({},e.emmisiveTexture),e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.emissiveFactor||(e.emissiveFactor=e.emmisiveTexture?[1,1,1]:[0,0,0]),e.pbrMetallicRoughness){e.pbrMetallicRoughness=n({},e.pbrMetallicRoughness);var i=e.pbrMetallicRoughness;i.baseColorTexture&&(i.baseColorTexture=n({},i.baseColorTexture),i.baseColorTexture.texture=this.getTexture(i.baseColorTexture.index)),i.metallicRoughnessTexture&&(i.metallicRoughnessTexture=n({},i.metallicRoughnessTexture),i.metallicRoughnessTexture.texture=this.getTexture(i.metallicRoughnessTexture.index))}return e}},{key:"_resolveAccessor",value:function(e,t){var i,r;if(e.id=e.id||"accessor-".concat(t),void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(i=e.componentType,QM[i]),e.components=(r=e.type,NM[r]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){var s=e.bufferView.buffer,n=aC(e,e.bufferView),o=n.ArrayType,a=n.byteLength,l=(e.bufferView.byteOffset||0)+(e.byteOffset||0)+s.byteOffset,u=s.arrayBuffer.slice(l,l+a);e.bufferView.byteStride&&(u=this._getValueFromInterleavedBuffer(s,l,e.bufferView.byteStride,e.bytesPerElement,e.count)),e.value=new o(u)}return e}},{key:"_getValueFromInterleavedBuffer",value:function(e,t,i,r,s){for(var n=new Uint8Array(s*r),o=0;o1&&void 0!==arguments[1]?arguments[1]:0;return"".concat(String.fromCharCode(e.getUint8(t+0))).concat(String.fromCharCode(e.getUint8(t+1))).concat(String.fromCharCode(e.getUint8(t+2))).concat(String.fromCharCode(e.getUint8(t+3)))}function $M(e,t,i){wb(e.header.byteLength>20);var r=t.getUint32(i+0,ZM),s=t.getUint32(i+4,ZM);return i+=8,wb(0===s),tE(e,t,i,r),i+=r,i+=iE(e,t,i,e.header.byteLength)}function eE(e,t,i,r){return wb(e.header.byteLength>20),function(e,t,i,r){for(;i+8<=e.header.byteLength;){var s=t.getUint32(i+0,ZM),n=t.getUint32(i+4,ZM);switch(i+=8,n){case 1313821514:tE(e,t,i,s);break;case 5130562:iE(e,t,i,s);break;case 0:r.strict||tE(e,t,i,s);break;case 1:r.strict||iE(e,t,i,s)}i+=hw(s,4)}}(e,t,i,r),i+e.header.byteLength}function tE(e,t,i,r){var s=new Uint8Array(t.buffer,i,r),n=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(n),hw(r,4)}function iE(e,t,i,r){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:i,byteLength:r,arrayBuffer:t.buffer}),hw(r,4)}function rE(e,t){return sE.apply(this,arguments)}function sE(){return sE=u(a().mark((function e(t,i){var r,s,n,o,l,u,A,c,h,d,p=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=p.length>2&&void 0!==p[2]?p[2]:0,s=p.length>3?p[3]:void 0,n=p.length>4?p[4]:void 0,nE(t,i,r,s),OM(t,{normalize:null==s||null===(o=s.gltf)||void 0===o?void 0:o.normalize}),IM(t,s,n),c=[],null==s||null===(l=s.gltf)||void 0===l||!l.loadBuffers||!t.json.buffers){e.next=10;break}return e.next=10,oE(t,s,n);case 10:return null!=s&&null!==(u=s.gltf)&&void 0!==u&&u.loadImages&&(h=lE(t,s,n),c.push(h)),d=DM(t,s,n),c.push(d),e.next=15,Promise.all(c);case 15:return e.abrupt("return",null!=s&&null!==(A=s.gltf)&&void 0!==A&&A.postProcess?JM(t,s):t);case 16:case"end":return e.stop()}}),e)}))),sE.apply(this,arguments)}function nE(e,t,i,r){(r.uri&&(e.baseUri=r.uri),t instanceof ArrayBuffer&&!function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new DataView(e),s=i.magic,n=void 0===s?1735152710:s,o=r.getUint32(t,!1);return o===n||1735152710===o}(t,i,r))&&(t=(new TextDecoder).decode(t));if("string"==typeof t)e.json=aw(t);else if(t instanceof ArrayBuffer){var s={};i=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=new DataView(t),s=qM(r,i+0),n=r.getUint32(i+4,ZM),o=r.getUint32(i+8,ZM);switch(Object.assign(e,{header:{byteOffset:i,byteLength:o,hasBinChunk:!1},type:s,version:n,json:{},binChunks:[]}),i+=12,e.version){case 1:return $M(e,r,i);case 2:return eE(e,r,i,{});default:throw new Error("Invalid GLB version ".concat(e.version,". Only supports v1 and v2."))}}(s,t,i,r.glb),JP("glTF"===s.type,"Invalid GLB magic string ".concat(s.type)),e._glb=s,e.json=s.json}else JP(!1,"GLTF: must be ArrayBuffer or string");var n=e.json.buffers||[];if(e.buffers=new Array(n.length).fill(null),e._glb&&e._glb.header.hasBinChunk){var o=e._glb.binChunks;e.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}var a=e.json.images||[];e.images=new Array(a.length).fill({})}function oE(e,t,i){return aE.apply(this,arguments)}function aE(){return(aE=u(a().mark((function e(t,i,r){var s,n,o,l,u,A,c,h;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=t.json.buffers||[],n=0;case 2:if(!(n1&&void 0!==u[1]?u[1]:{},r=u.length>2?u[2]:void 0,(i=n(n({},dE.options),i)).gltf=n(n({},dE.options.gltf),i.gltf),s=i.byteOffset,o=void 0===s?0:s,l={},e.next=8,rE(l,t,o,i,r);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)}))),pE.apply(this,arguments)}var fE=function(){function e(t){x(this,e)}return C(e,[{key:"load",value:function(e,t,i,r,s,n,o){!function(e,t,i,r,s,n,o){var a=e.viewer.scene.canvas.spinner;a.processes++,"glb"===t.split(".").pop()?e.dataSource.getGLB(t,(function(o){r.basePath=gE(t),mE(e,t,o,i,r,s,n),a.processes--}),(function(e){a.processes--,o(e)})):e.dataSource.getGLTF(t,(function(o){r.basePath=gE(t),mE(e,t,o,i,r,s,n),a.processes--}),(function(e){a.processes--,o(e)}))}(e,t,i,r=r||{},s,(function(){Be.scheduleTask((function(){s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1)})),n&&n()}),(function(t){e.error(t),o&&o(t),s.fire("error",t)}))}},{key:"parse",value:function(e,t,i,r,s,n,o){mE(e,"",t,i,r=r||{},s,(function(){s.scene.fire("modelLoaded",s.id),s.fire("loaded",!0,!1),n&&n()}))}}]),e}();function vE(e){for(var t={},i={},r=e.metaObjects||[],s={},n=0,o=r.length;n0)for(var A=0;A0){null==y&&e.log("Warning: 'name' properties not found on glTF scene nodes - will randomly-generate object IDs in XKT");var b=y;if(e.metaModelCorrections){var w=e.metaModelCorrections.eachChildRoot[b];if(w){var B=e.metaModelCorrections.eachRootStats[w.id];B.countChildren++,B.countChildren>=B.numChildren&&(n.createEntity({id:w.id,meshIds:BE,isObject:!0}),BE.length=0)}else{e.metaModelCorrections.metaObjectsMap[b]&&(n.createEntity({id:b,meshIds:BE,isObject:!0}),BE.length=0)}}else n.createEntity({id:b,meshIds:BE,isObject:!0}),BE.length=0}}}function PE(e,t){e.plugin.error(t)}var CE={DEFAULT:{}},ME=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"GLTFLoader",e,s))._sceneModelLoader=new fE(b(r),s),r.dataSource=s.dataSource,r.objectDefaults=s.objectDefaults,r}return C(i,[{key:"dataSource",get:function(){return this._dataSource},set:function(e){this._dataSource=e||new Yh}},{key:"objectDefaults",get:function(){return this._objectDefaults},set:function(e){this._objectDefaults=e||CE}},{key:"load",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.id&&this.viewer.scene.components[t.id]&&(this.error("Component with this ID already exists in viewer: "+t.id+" - will autogenerate this ID"),delete t.id);var i=new Ph(this.viewer.scene,he.apply(t,{isModel:!0,dtxEnabled:t.dtxEnabled})),r=i.id;if(!t.src&&!t.gltf)return this.error("load() param expected: src or gltf"),i;if(t.metaModelSrc||t.metaModelJSON){var s=t.objectDefaults||this._objectDefaults||CE,n=function(n){var o;if(e.viewer.metaScene.createMetaModel(r,n,{includeTypes:t.includeTypes,excludeTypes:t.excludeTypes}),e.viewer.scene.canvas.spinner.processes--,t.includeTypes){o={};for(var a=0,l=t.includeTypes.length;a2&&void 0!==arguments[2]?arguments[2]:{},r="lightgrey",s=i.hoverColor||"rgba(0,0,0,0.4)",n=i.textColor||"black",o=500,a=o+o/3,l=a/24,u=[{boundary:[6,6,6,6],color:i.frontColor||i.color||"#55FF55"},{boundary:[18,6,6,6],color:i.backColor||i.color||"#55FF55"},{boundary:[12,6,6,6],color:i.rightColor||i.color||"#FF5555"},{boundary:[0,6,6,6],color:i.leftColor||i.color||"#FF5555"},{boundary:[6,0,6,6],color:i.topColor||i.color||"#7777FF"},{boundary:[6,12,6,6],color:i.bottomColor||i.color||"#7777FF"}],A=[{label:"NavCube.front",boundaries:[[7,7,4,4]],dir:[0,1,0],up:[0,0,1]},{label:"NavCube.back",boundaries:[[19,7,4,4]],dir:[0,-1,0],up:[0,0,1]},{label:"NavCube.right",boundaries:[[13,7,4,4]],dir:[-1,0,0],up:[0,0,1]},{label:"NavCube.left",boundaries:[[1,7,4,4]],dir:[1,0,0],up:[0,0,1]},{label:"NavCube.top",boundaries:[[7,1,4,4]],dir:[0,0,-1],up:[0,1,0]},{label:"NavCube.bottom",boundaries:[[7,13,4,4]],dir:[0,0,1],up:[0,-1,0]},{boundaries:[[7,5,4,2]],dir:[0,1,-1],up:[0,1,1]},{boundaries:[[1,6,4,1],[6,1,1,4]],dir:[1,0,-1],up:[1,0,1]},{boundaries:[[7,0,4,1],[19,6,4,1]],dir:[0,-1,-1],up:[0,-1,1]},{boundaries:[[13,6,4,1],[11,1,1,4]],dir:[-1,0,-1],up:[-1,0,1]},{boundaries:[[7,11,4,2]],dir:[0,1,1],up:[0,-1,1]},{boundaries:[[1,11,4,1],[6,13,1,4]],dir:[1,0,1],up:[-1,0,1]},{boundaries:[[7,17,4,1],[19,11,4,1]],dir:[0,-1,1],up:[0,1,1]},{boundaries:[[13,11,4,1],[11,13,1,4]],dir:[-1,0,1],up:[1,0,1]},{boundaries:[[5,7,2,4]],dir:[1,1,0],up:[0,0,1]},{boundaries:[[11,7,2,4]],dir:[-1,1,0],up:[0,0,1]},{boundaries:[[17,7,2,4]],dir:[-1,-1,0],up:[0,0,1]},{boundaries:[[0,7,1,4],[23,7,1,4]],dir:[1,-1,0],up:[0,0,1]},{boundaries:[[5,11,2,2]],dir:[1,1,1],up:[-1,-1,1]},{boundaries:[[23,11,1,1],[6,17,1,1],[0,11,1,1]],dir:[1,-1,1],up:[-1,1,1]},{boundaries:[[5,5,2,2]],dir:[1,1,-1],up:[1,1,1]},{boundaries:[[11,17,1,1],[17,11,2,1]],dir:[-1,-1,1],up:[1,1,1]},{boundaries:[[17,6,2,1],[11,0,1,1]],dir:[-1,-1,-1],up:[-1,-1,1]},{boundaries:[[11,11,2,2]],dir:[-1,1,1],up:[1,-1,1]},{boundaries:[[0,6,1,1],[6,0,1,1],[23,6,1,1]],dir:[1,-1,-1],up:[1,-1,1]},{boundaries:[[11,5,2,2]],dir:[-1,1,-1],up:[-1,1,1]}];i.frontColor||i.color,i.backColor||i.color,i.rightColor||i.color,i.leftColor||i.color,i.topColor||i.color,i.bottomColor||i.color;for(var c=[{yUp:"",label:"NavCube.front",boundaries:[[7,7,4,4]],dir:[0,0,-1],up:[0,1,0]},{label:"NavCube.back",boundaries:[[19,7,4,4]],dir:[0,0,1],up:[0,1,0]},{label:"NavCube.right",boundaries:[[13,7,4,4]],dir:[-1,0,0],up:[0,1,0]},{label:"NavCube.left",boundaries:[[1,7,4,4]],dir:[1,0,0],up:[0,1,0]},{label:"NavCube.top",boundaries:[[7,1,4,4]],dir:[0,-1,0],up:[0,0,-1]},{label:"NavCube.bottom",boundaries:[[7,13,4,4]],dir:[0,1,0],up:[0,0,1]},{boundaries:[[7,5,4,2]],dir:[0,-.7071,-.7071],up:[0,.7071,-.7071]},{boundaries:[[1,6,4,1],[6,1,1,4]],dir:[1,-1,0],up:[1,1,0]},{boundaries:[[7,0,4,1],[19,6,4,1]],dir:[0,-.7071,.7071],up:[0,.7071,.7071]},{boundaries:[[13,6,4,1],[11,1,1,4]],dir:[-1,-1,0],up:[-1,1,0]},{boundaries:[[7,11,4,2]],dir:[0,1,-1],up:[0,1,1]},{boundaries:[[1,11,4,1],[6,13,1,4]],dir:[1,1,0],up:[-1,1,0]},{boundaries:[[7,17,4,1],[19,11,4,1]],dir:[0,1,1],up:[0,1,-1]},{boundaries:[[13,11,4,1],[11,13,1,4]],dir:[-1,1,0],up:[1,1,0]},{boundaries:[[5,7,2,4]],dir:[1,0,-1],up:[0,1,0]},{boundaries:[[11,7,2,4]],dir:[-1,0,-1],up:[0,1,0]},{boundaries:[[17,7,2,4]],dir:[-1,0,1],up:[0,1,0]},{boundaries:[[0,7,1,4],[23,7,1,4]],dir:[1,0,1],up:[0,1,0]},{boundaries:[[5,11,2,2]],dir:[.5,.7071,-.5],up:[-.5,.7071,.5]},{boundaries:[[23,11,1,1],[6,17,1,1],[0,11,1,1]],dir:[.5,.7071,.5],up:[-.5,.7071,-.5]},{boundaries:[[5,5,2,2]],dir:[.5,-.7071,-.5],up:[.5,.7071,-.5]},{boundaries:[[11,17,1,1],[17,11,2,1]],dir:[-.5,.7071,.5],up:[.5,.7071,-.5]},{boundaries:[[17,6,2,1],[11,0,1,1]],dir:[-.5,-.7071,.5],up:[-.5,.7071,.5]},{boundaries:[[11,11,2,2]],dir:[-.5,.7071,-.5],up:[.5,.7071,.5]},{boundaries:[[0,6,1,1],[6,0,1,1],[23,6,1,1]],dir:[.5,-.7071,.5],up:[.5,.7071,.5]},{boundaries:[[11,5,2,2]],dir:[-.5,-.7071,-.5],up:[-.5,.7071,-.5]}],h=0,d=A.length;h=c[0]*l&&t<=(c[0]+c[2])*l&&i>=c[1]*l&&i<=(c[1]+c[3])*l)return r}return-1},this.setAreaHighlighted=function(e,t){var i=v[e];if(!i)throw"Area not found: "+e;i.highlighted=!!t,y()},this.getAreaDir=function(e){var t=v[e];if(!t)throw"Unknown area: "+e;return t.dir},this.getAreaUp=function(e){var t=v[e];if(!t)throw"Unknown area: "+e;return t.up},this.getImage=function(){return this._textureCanvas},this.destroy=function(){this._textureCanvas&&(this._textureCanvas.parentNode.removeChild(this._textureCanvas),this._textureCanvas=null)}}var FE=re.vec3(),kE=re.vec3();re.mat4();var IE=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),r=t.call(this,"NavCube",e,s),e.navCube=b(r);var n=!0;try{r._navCubeScene=new cr(e,{canvasId:s.canvasId,canvasElement:s.canvasElement,transparent:!0}),r._navCubeCanvas=r._navCubeScene.canvas.canvas,r._navCubeScene.input.keyboardEnabled=!1}catch(e){return r.error(e),y(r)}var o=r._navCubeScene;o.clearLights(),new Si(o,{dir:[.4,-.4,.8],color:[.8,1,1],intensity:1,space:"view"}),new Si(o,{dir:[-.8,-.3,-.4],color:[.8,.8,.8],intensity:1,space:"view"}),new Si(o,{dir:[.8,-.6,-.8],color:[1,1,1],intensity:1,space:"view"}),r._navCubeCamera=o.camera,r._navCubeCamera.ortho.scale=7,r._navCubeCamera.ortho.near=.1,r._navCubeCamera.ortho.far=2e3,o.edgeMaterial.edgeColor=[.2,.2,.2],o.edgeMaterial.edgeAlpha=.6,r._zUp=Boolean(e.camera.zUp);var a=b(r);r.setIsProjectNorth(s.isProjectNorth),r.setProjectNorthOffsetAngle(s.projectNorthOffsetAngle);var l,u=(l=re.mat4(),function(e,t,i){return re.identityMat4(l),re.rotationMat4v(e*a._projectNorthOffsetAngle*re.DEGTORAD,[0,1,0],l),re.transformVec3(l,t,i)});r._synchCamera=function(){var t=re.rotationMat4c(-90*re.DEGTORAD,1,0,0),i=re.vec3(),r=re.vec3(),s=re.vec3();return function(){var n=e.camera.eye,o=e.camera.look,l=e.camera.up;i=re.mulVec3Scalar(re.normalizeVec3(re.subVec3(n,o,i)),5),a._isProjectNorth&&a._projectNorthOffsetAngle&&(i=u(-1,i,FE),l=u(-1,l,kE)),a._zUp?(re.transformVec3(t,i,r),re.transformVec3(t,l,s),a._navCubeCamera.look=[0,0,0],a._navCubeCamera.eye=re.transformVec3(t,i,r),a._navCubeCamera.up=re.transformPoint3(t,l,s)):(a._navCubeCamera.look=[0,0,0],a._navCubeCamera.eye=i,a._navCubeCamera.up=l)}}(),r._cubeTextureCanvas=new EE(e,o,s),r._cubeSampler=new Jn(o,{image:r._cubeTextureCanvas.getImage(),flipY:!0,wrapS:1001,wrapT:1001}),r._cubeMesh=new gn(o,{geometry:new Wi(o,{primitive:"triangles",normals:[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1],uv:[.5,.6666,.25,.6666,.25,.3333,.5,.3333,.5,.6666,.5,.3333,.75,.3333,.75,.6666,.5,.6666,.5,1,.25,1,.25,.6666,.25,.6666,0,.6666,0,.3333,.25,.3333,.25,0,.5,0,.5,.3333,.25,.3333,.75,.3333,1,.3333,1,.6666,.75,.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),material:new Zi(o,{diffuse:[.4,.4,.4],specular:[.4,.4,.4],emissive:[.6,.6,.6],diffuseMap:r._cubeSampler,emissiveMap:r._cubeSampler}),visible:!!n,edges:!0}),r._shadow=!1===s.shadowVisible?null:new gn(o,{geometry:new Wi(o,_n({center:[0,0,0],radiusTop:.001,radiusBottom:1.4,height:.01,radialSegments:20,heightSegments:1,openEnded:!0})),material:new Zi(o,{diffuse:[0,0,0],specular:[0,0,0],emissive:[0,0,0],alpha:.5}),position:[0,-1.5,0],visible:!!n,pickable:!1,backfaces:!1}),r._onCameraMatrix=e.camera.on("matrix",r._synchCamera),r._onCameraWorldAxis=e.camera.on("worldAxis",(function(){e.camera.zUp?(r._zUp=!0,r._cubeTextureCanvas.setZUp(),r._repaint(),r._synchCamera()):e.camera.yUp&&(r._zUp=!1,r._cubeTextureCanvas.setYUp(),r._repaint(),r._synchCamera())})),r._onCameraFOV=e.camera.perspective.on("fov",(function(e){r._synchProjection&&(r._navCubeCamera.perspective.fov=e)})),r._onCameraProjection=e.camera.on("projection",(function(e){r._synchProjection&&(r._navCubeCamera.projection="ortho"===e||"perspective"===e?e:"perspective")}));var A=-1;function c(t,i){var r=(t-d)*-_,s=(i-p)*-_;e.camera.orbitYaw(r),e.camera.orbitPitch(-s),d=t,p=i}function h(e){var t=[0,0];if(e){for(var i=e.target,r=0,s=0;i.offsetParent;)r+=i.offsetLeft,s+=i.offsetTop,i=i.offsetParent;t[0]=e.pageX-r,t[1]=e.pageY-s}else e=window.event,t[0]=e.x,t[1]=e.y;return t}var d,p,f=null,v=null,g=!1,m=!1,_=.5;a._navCubeCanvas.addEventListener("mouseenter",a._onMouseEnter=function(e){m=!0}),a._navCubeCanvas.addEventListener("mouseleave",a._onMouseLeave=function(e){m=!1}),a._navCubeCanvas.addEventListener("mousedown",a._onMouseDown=function(e){if(1===e.which){f=e.x,v=e.y,d=e.clientX,p=e.clientY;var t=h(e),i=o.pick({canvasPos:t});g=!!i}}),document.addEventListener("mouseup",a._onMouseUp=function(e){if(1===e.which&&(g=!1,null!==f)){var t=h(e),i=o.pick({canvasPos:t,pickSurface:!0});if(i&&i.uv){var r=a._cubeTextureCanvas.getArea(i.uv);if(r>=0&&(document.body.style.cursor="pointer",A>=0&&(a._cubeTextureCanvas.setAreaHighlighted(A,!1),a._repaint(),A=-1),r>=0)){if(a._cubeTextureCanvas.setAreaHighlighted(r,!0),A=r,a._repaint(),e.xf+3||e.yv+3)return;var s=a._cubeTextureCanvas.getAreaDir(r);if(s){var n=a._cubeTextureCanvas.getAreaUp(r);a._isProjectNorth&&a._projectNorthOffsetAngle&&(s=u(1,s,FE),n=u(1,n,kE)),w(s,n,(function(){A>=0&&(a._cubeTextureCanvas.setAreaHighlighted(A,!1),a._repaint(),A=-1),document.body.style.cursor="pointer",A>=0&&(a._cubeTextureCanvas.setAreaHighlighted(A,!1),a._repaint(),A=-1),r>=0&&(a._cubeTextureCanvas.setAreaHighlighted(r,!1),A=-1,a._repaint())}))}}}}}),document.addEventListener("mousemove",a._onMouseMove=function(e){if(A>=0&&(a._cubeTextureCanvas.setAreaHighlighted(A,!1),a._repaint(),A=-1),1!==e.buttons||g){if(g){var t=e.clientX,i=e.clientY;return document.body.style.cursor="move",void c(t,i)}if(m){var r=h(e),s=o.pick({canvasPos:r,pickSurface:!0});if(s){if(s.uv){document.body.style.cursor="pointer";var n=a._cubeTextureCanvas.getArea(s.uv);if(n===A)return;A>=0&&a._cubeTextureCanvas.setAreaHighlighted(A,!1),n>=0&&(a._cubeTextureCanvas.setAreaHighlighted(n,!0),a._repaint(),A=n)}}else document.body.style.cursor="default",A>=0&&(a._cubeTextureCanvas.setAreaHighlighted(A,!1),a._repaint(),A=-1)}}});var w=function(){var t=re.vec3();return function(i,r,s){var n=a._fitVisible?e.scene.getAABB(e.scene.visibleObjectIds):e.scene.aabb,o=re.getAABB3Diag(n);re.getAABB3Center(n,t);var l=Math.abs(o/Math.tan(a._cameraFitFOV*re.DEGTORAD));e.cameraControl.pivotPos=t,a._cameraFly?e.cameraFlight.flyTo({look:t,eye:[t[0]-l*i[0],t[1]-l*i[1],t[2]-l*i[2]],up:r||[0,1,0],orthoScale:1.1*o,fitFOV:a._cameraFitFOV,duration:a._cameraFlyDuration},s):e.cameraFlight.jumpTo({look:t,eye:[t[0]-l*i[0],t[1]-l*i[1],t[2]-l*i[2]],up:r||[0,1,0],orthoScale:1.1*o,fitFOV:a._cameraFitFOV},s)}}();return r._onUpdated=e.localeService.on("updated",(function(){r._cubeTextureCanvas.clear(),r._repaint()})),r.setVisible(s.visible),r.setCameraFitFOV(s.cameraFitFOV),r.setCameraFly(s.cameraFly),r.setCameraFlyDuration(s.cameraFlyDuration),r.setFitVisible(s.fitVisible),r.setSynchProjection(s.synchProjection),r}return C(i,[{key:"send",value:function(e,t){if("language"===e)this._cubeTextureCanvas.clear(),this._repaint()}},{key:"_repaint",value:function(){var e=this._cubeTextureCanvas.getImage();this._cubeMesh.material.diffuseMap.image=e,this._cubeMesh.material.emissiveMap.image=e}},{key:"setVisible",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._navCubeCanvas&&(this._cubeMesh.visible=e,this._shadow&&(this._shadow.visible=e),this._navCubeCanvas.style.visibility=e?"visible":"hidden")}},{key:"getVisible",value:function(){return!!this._navCubeCanvas&&this._cubeMesh.visible}},{key:"setFitVisible",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._fitVisible=e}},{key:"getFitVisible",value:function(){return this._fitVisible}},{key:"setCameraFly",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._cameraFly=e}},{key:"getCameraFly",value:function(){return this._cameraFly}},{key:"setCameraFitFOV",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:45;this._cameraFitFOV=e}},{key:"getCameraFitFOV",value:function(){return this._cameraFitFOV}},{key:"setCameraFlyDuration",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5;this._cameraFlyDuration=e}},{key:"getCameraFlyDuration",value:function(){return this._cameraFlyDuration}},{key:"setSynchProjection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._synchProjection=e}},{key:"getSynchProjection",value:function(){return this._synchProjection}},{key:"setIsProjectNorth",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._isProjectNorth=e}},{key:"getIsProjectNorth",value:function(){return this._isProjectNorth}},{key:"setProjectNorthOffsetAngle",value:function(e){this._projectNorthOffsetAngle=e}},{key:"getProjectNorthOffsetAngle",value:function(){return this._projectNorthOffsetAngle}},{key:"destroy",value:function(){this._navCubeCanvas&&(this.viewer.localeService.off(this._onUpdated),this.viewer.camera.off(this._onCameraMatrix),this.viewer.camera.off(this._onCameraWorldAxis),this.viewer.camera.perspective.off(this._onCameraFOV),this.viewer.camera.off(this._onCameraProjection),this._navCubeCanvas.removeEventListener("mouseenter",this._onMouseEnter),this._navCubeCanvas.removeEventListener("mouseleave",this._onMouseLeave),this._navCubeCanvas.removeEventListener("mousedown",this._onMouseDown),document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._navCubeCanvas=null,this._cubeTextureCanvas.destroy(),this._cubeTextureCanvas=null,this._onMouseEnter=null,this._onMouseLeave=null,this._onMouseDown=null,this._onMouseMove=null,this._onMouseUp=null),this._navCubeScene.destroy(),this._navCubeScene=null,this._cubeMesh=null,this._shadow=null,f(w(i.prototype),"destroy",this).call(this)}}]),i}(),DE=re.vec3(),SE=function(){function e(){x(this,e)}return C(e,[{key:"load",value:function(e,t){var i=e.scene.canvas.spinner;i.processes++,TE(e,t,(function(t){RE(e,t,(function(){NE(e,t),i.processes--,Be.scheduleTask((function(){e.fire("loaded",!0,!1)}))}))}))}},{key:"parse",value:function(e,t,i,r){if(t){var s=LE(e,t,null);i&&OE(e,i,r),NE(e,s),e.src=null,e.fire("loaded",!0,!1)}else this.warn("load() param expected: objText")}}]),e}(),TE=function(e,t,i){QE(t,(function(r){var s=LE(e,r,t);i(s)}),(function(t){e.error(t)}))},LE=function(){var e={vertex_pattern:/^v\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,normal_pattern:/^vn\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,uv_pattern:/^vt\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,face_vertex:/^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/,face_vertex_uv:/^f\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+))?/,face_vertex_uv_normal:/^f\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+)\/(-?\d+))?/,face_vertex_normal:/^f\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)(?:\s+(-?\d+)\/\/(-?\d+))?/,object_pattern:/^[og]\s*(.+)?/,smoothing_pattern:/^s\s+(\d+|on|off)/,material_library_pattern:/^mtllib /,material_use_pattern:/^usemtl /};return function(r,s,n){var o={src:n=n||"",basePath:t(n),objects:[],object:{},positions:[],normals:[],uv:[],materialLibraries:{}};i(o,"",!1),-1!==s.indexOf("\r\n")&&(s=s.replace("\r\n","\n"));for(var a=s.split("\n"),l="",u="",A="",d=[],p="function"==typeof"".trimLeft,f=0,v=a.length;f=0?i-1:i+t/3)}function s(e,t){var i=parseInt(e,10);return 3*(i>=0?i-1:i+t/3)}function n(e,t){var i=parseInt(e,10);return 2*(i>=0?i-1:i+t/2)}function o(e,t,i,r){var s=e.positions,n=e.object.geometry.positions;n.push(s[t+0]),n.push(s[t+1]),n.push(s[t+2]),n.push(s[i+0]),n.push(s[i+1]),n.push(s[i+2]),n.push(s[r+0]),n.push(s[r+1]),n.push(s[r+2])}function a(e,t){var i=e.positions,r=e.object.geometry.positions;r.push(i[t+0]),r.push(i[t+1]),r.push(i[t+2])}function l(e,t,i,r){var s=e.normals,n=e.object.geometry.normals;n.push(s[t+0]),n.push(s[t+1]),n.push(s[t+2]),n.push(s[i+0]),n.push(s[i+1]),n.push(s[i+2]),n.push(s[r+0]),n.push(s[r+1]),n.push(s[r+2])}function u(e,t,i,r){var s=e.uv,n=e.object.geometry.uv;n.push(s[t+0]),n.push(s[t+1]),n.push(s[i+0]),n.push(s[i+1]),n.push(s[r+0]),n.push(s[r+1])}function A(e,t){var i=e.uv,r=e.object.geometry.uv;r.push(i[t+0]),r.push(i[t+1])}function c(e,t,i,a,A,c,h,d,p,f,v,g,m){var _,y=e.positions.length,b=r(t,y),w=r(i,y),B=r(a,y);if(void 0===A?o(e,b,w,B):(o(e,b,w,_=r(A,y)),o(e,w,B,_)),void 0!==c){var x=e.uv.length;b=n(c,x),w=n(h,x),B=n(d,x),void 0===A?u(e,b,w,B):(u(e,b,w,_=n(p,x)),u(e,w,B,_))}if(void 0!==f){var P=e.normals.length;b=s(f,P),w=f===v?b:s(v,P),B=f===g?b:s(g,P),void 0===A?l(e,b,w,B):(l(e,b,w,_=s(m,P)),l(e,w,B,_))}}function h(e,t,i){e.object.geometry.type="Line";for(var s=e.positions.length,o=e.uv.length,l=0,u=t.length;l=0?o.substring(0,a):o).toLowerCase(),u=(u=a>=0?o.substring(a+1):"").trim(),l.toLowerCase()){case"newmtl":i(e,h),h={id:u},d=!0;break;case"ka":h.ambient=r(u);break;case"kd":h.diffuse=r(u);break;case"ks":h.specular=r(u);break;case"map_kd":h.diffuseMap||(h.diffuseMap=t(e,n,u,"sRGB"));break;case"map_ks":h.specularMap||(h.specularMap=t(e,n,u,"linear"));break;case"map_bump":case"bump":h.normalMap||(h.normalMap=t(e,n,u));break;case"ns":h.shininess=parseFloat(u);break;case"d":(A=parseFloat(u))<1&&(h.alpha=A,h.alphaMode="blend");break;case"tr":(A=parseFloat(u))>0&&(h.alpha=1-A,h.alphaMode="blend")}d&&i(e,h)};function t(e,t,i,r){var s={},n=i.split(/\s+/),o=n.indexOf("-bm");return o>=0&&n.splice(o,2),(o=n.indexOf("-s"))>=0&&(s.scale=[parseFloat(n[o+1]),parseFloat(n[o+2])],n.splice(o,4)),(o=n.indexOf("-o"))>=0&&(s.translate=[parseFloat(n[o+1]),parseFloat(n[o+2])],n.splice(o,4)),s.src=t+n.join(" ").trim(),s.flipY=!0,s.encoding=r||"linear",new Jn(e,s).id}function i(e,t){new Zi(e,t)}function r(t){var i=t.split(e,3);return[parseFloat(i[0]),parseFloat(i[1]),parseFloat(i[2])]}}();function NE(e,t){for(var i=0,r=t.objects.length;i0&&(o.normals=n.normals),n.uv.length>0&&(o.uv=n.uv);for(var a=new Array(o.positions.length/3),l=0;l0&&void 0!==arguments[0]?arguments[0]:{};t.id&&this.viewer.scene.components[t.id]&&(this.error("Component with this ID already exists in viewer: "+t.id+" - will autogenerate this ID"),delete t.id);var i=new Tn(this.viewer.scene,he.apply(t,{isModel:!0})),r=i.id,s=t.src;if(!s)return this.error("load() param expected: src"),i;if(t.metaModelSrc){var n=t.metaModelSrc;he.loadJSON(n,(function(n){e.viewer.metaScene.createMetaModel(r,n),e._sceneGraphLoader.load(i,s,t)}),(function(t){e.error("load(): Failed to load model modelMetadata for model '".concat(r," from '").concat(n,"' - ").concat(t))}))}else this._sceneGraphLoader.load(i,s,t);return i.once("destroyed",(function(){e.viewer.metaScene.destroyMetaModel(r)})),i}},{key:"destroy",value:function(){f(w(i.prototype),"destroy",this).call(this)}}]),i}(),HE=new Float64Array([0,0,1]),jE=new Float64Array(4),GE=function(){function e(t){x(this,e),this.id=null,this._viewer=t.viewer,this._visible=!1,this._pos=re.vec3(),this._origin=re.vec3(),this._rtcPos=re.vec3(),this._baseDir=re.vec3(),this._rootNode=null,this._displayMeshes=null,this._affordanceMeshes=null,this._ignoreNextSectionPlaneDirUpdate=!1,this._createNodes(),this._bindEvents()}return C(e,[{key:"_setSectionPlane",value:function(e){var t=this;this._sectionPlane&&(this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._onSectionPlanePos=null,this._onSectionPlaneDir=null,this._sectionPlane=null),e&&(this.id=e.id,this._setPos(e.pos),this._setDir(e.dir),this._sectionPlane=e,this._onSectionPlanePos=e.on("pos",(function(){t._setPos(t._sectionPlane.pos)})),this._onSectionPlaneDir=e.on("dir",(function(){t._ignoreNextSectionPlaneDirUpdate?t._ignoreNextSectionPlaneDirUpdate=!1:t._setDir(t._sectionPlane.dir)})))}},{key:"sectionPlane",get:function(){return this._sectionPlane}},{key:"_setPos",value:function(e){this._pos.set(e),He(this._pos,this._origin,this._rtcPos),this._rootNode.origin=this._origin,this._rootNode.position=this._rtcPos}},{key:"_setDir",value:function(e){this._baseDir.set(e),this._rootNode.quaternion=re.vec3PairToQuaternion(HE,e,jE)}},{key:"_setSectionPlaneDir",value:function(e){this._sectionPlane&&(this._ignoreNextSectionPlaneDirUpdate=!0,this._sectionPlane.dir=e)}},{key:"setVisible",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this._visible!==e){var t;for(t in this._visible=e,this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].visible=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].visible=e)}}},{key:"getVisible",value:function(){return this._visible}},{key:"setCulled",value:function(e){var t;for(t in this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].culled=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].culled=e)}},{key:"_createNodes",value:function(){var e=!1,t=this._viewer.scene,i=.01;this._rootNode=new Tn(t,{position:[0,0,0],scale:[5,5,5],isObject:!1});var r,s,n=this._rootNode,o={arrowHead:new Wi(n,_n({radiusTop:.001,radiusBottom:.07,radialSegments:32,heightSegments:1,height:.2,openEnded:!1})),arrowHeadBig:new Wi(n,_n({radiusTop:.001,radiusBottom:.09,radialSegments:32,heightSegments:1,height:.25,openEnded:!1})),arrowHeadHandle:new Wi(n,_n({radiusTop:.09,radiusBottom:.09,radialSegments:8,heightSegments:1,height:.37,openEnded:!1})),curve:new Wi(n,lo({radius:.8,tube:i,radialSegments:64,tubeSegments:14,arc:2*Math.PI/4})),curveHandle:new Wi(n,lo({radius:.8,tube:.06,radialSegments:64,tubeSegments:14,arc:2*Math.PI/4})),hoop:new Wi(n,lo({radius:.8,tube:i,radialSegments:64,tubeSegments:8,arc:2*Math.PI})),axis:new Wi(n,_n({radiusTop:i,radiusBottom:i,radialSegments:20,heightSegments:1,height:1,openEnded:!1})),axisHandle:new Wi(n,_n({radiusTop:.08,radiusBottom:.08,radialSegments:20,heightSegments:1,height:1,openEnded:!1}))},a={pickable:new Zi(n,{diffuse:[1,1,0],alpha:0,alphaMode:"blend"}),red:new Zi(n,{diffuse:[1,0,0],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightRed:new $i(n,{edges:!1,fill:!0,fillColor:[1,0,0],fillAlpha:.6}),green:new Zi(n,{diffuse:[0,1,0],emissive:[0,1,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightGreen:new $i(n,{edges:!1,fill:!0,fillColor:[0,1,0],fillAlpha:.6}),blue:new Zi(n,{diffuse:[0,0,1],emissive:[0,0,1],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightBlue:new $i(n,{edges:!1,fill:!0,fillColor:[0,0,1],fillAlpha:.2}),center:new Zi(n,{diffuse:[0,0,0],emissive:[0,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80}),highlightBall:new $i(n,{edges:!1,fill:!0,fillColor:[.5,.5,.5],fillAlpha:.5,vertices:!1}),highlightPlane:new $i(n,{edges:!0,edgeWidth:3,fill:!1,fillColor:[.5,.5,.5],fillAlpha:.5,vertices:!1})};this._displayMeshes={plane:n.addChild(new gn(n,{geometry:new Wi(n,{primitive:"triangles",positions:[.5,.5,0,.5,-.5,0,-.5,-.5,0,-.5,.5,0,.5,.5,-0,.5,-.5,-0,-.5,-.5,-0,-.5,.5,-0],indices:[0,1,2,2,3,0]}),material:new Zi(n,{emissive:[0,0,0],diffuse:[0,0,0],backfaces:!0}),opacity:.6,ghosted:!0,ghostMaterial:new $i(n,{edges:!1,filled:!0,fillColor:[1,1,0],edgeColor:[0,0,0],fillAlpha:.1,backfaces:!0}),pickable:!1,collidable:!0,clippable:!1,visible:!1,scale:[2.4,2.4,1],isObject:!1}),e),planeFrame:n.addChild(new gn(n,{geometry:new Wi(n,lo({center:[0,0,0],radius:1.7,tube:.02,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Zi(n,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),highlightMaterial:new $i(n,{edges:!1,edgeColor:[0,0,0],filled:!0,fillColor:[.8,.8,.8],fillAlpha:1}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,.1],rotation:[0,0,45],isObject:!1}),e),xCurve:n.addChild(new gn(n,{geometry:o.curve,material:a.red,matrix:(r=re.rotationMat4v(90*re.DEGTORAD,[0,1,0],re.identityMat4()),s=re.rotationMat4v(270*re.DEGTORAD,[1,0,0],re.identityMat4()),re.mulMat4(s,r,re.identityMat4())),pickable:!1,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),xCurveHandle:n.addChild(new gn(n,{geometry:o.curveHandle,material:a.pickable,matrix:function(){var e=re.rotationMat4v(90*re.DEGTORAD,[0,1,0],re.identityMat4()),t=re.rotationMat4v(270*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),xCurveArrow1:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.red,matrix:function(){var e=re.translateMat4c(0,-.07,-.8,re.identityMat4()),t=re.scaleMat4v([.6,.6,.6],re.identityMat4()),i=re.rotationMat4v(0*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(re.mulMat4(e,t,re.identityMat4()),i,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xCurveArrow2:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.red,matrix:function(){var e=re.translateMat4c(0,-.8,-.07,re.identityMat4()),t=re.scaleMat4v([.6,.6,.6],re.identityMat4()),i=re.rotationMat4v(90*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(re.mulMat4(e,t,re.identityMat4()),i,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yCurve:n.addChild(new gn(n,{geometry:o.curve,material:a.green,rotation:[-90,0,0],pickable:!1,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),yCurveHandle:n.addChild(new gn(n,{geometry:o.curveHandle,material:a.pickable,rotation:[-90,0,0],pickable:!0,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),yCurveArrow1:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.green,matrix:function(){var e=re.translateMat4c(.07,0,-.8,re.identityMat4()),t=re.scaleMat4v([.6,.6,.6],re.identityMat4()),i=re.rotationMat4v(90*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(re.mulMat4(e,t,re.identityMat4()),i,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yCurveArrow2:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.green,matrix:function(){var e=re.translateMat4c(.8,0,-.07,re.identityMat4()),t=re.scaleMat4v([.6,.6,.6],re.identityMat4()),i=re.rotationMat4v(90*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(re.mulMat4(e,t,re.identityMat4()),i,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurve:n.addChild(new gn(n,{geometry:o.curve,material:a.blue,matrix:re.rotationMat4v(180*re.DEGTORAD,[1,0,0],re.identityMat4()),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurveHandle:n.addChild(new gn(n,{geometry:o.curveHandle,material:a.pickable,matrix:re.rotationMat4v(180*re.DEGTORAD,[1,0,0],re.identityMat4()),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurveCurveArrow1:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.blue,matrix:function(){var e=re.translateMat4c(.8,-.07,0,re.identityMat4()),t=re.scaleMat4v([.6,.6,.6],re.identityMat4());return re.mulMat4(e,t,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zCurveArrow2:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.blue,matrix:function(){var e=re.translateMat4c(.05,-.8,0,re.identityMat4()),t=re.scaleMat4v([.6,.6,.6],re.identityMat4()),i=re.rotationMat4v(90*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(re.mulMat4(e,t,re.identityMat4()),i,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),center:n.addChild(new gn(n,{geometry:new Wi(n,yn({radius:.05})),material:a.center,pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxisArrow:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.red,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxisArrowHandle:n.addChild(new gn(n,{geometry:o.arrowHeadHandle,material:a.pickable,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxis:n.addChild(new gn(n,{geometry:o.axis,material:a.red,matrix:function(){var e=re.translateMat4c(0,.5,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),xAxisHandle:n.addChild(new gn(n,{geometry:o.axisHandle,material:a.pickable,matrix:function(){var e=re.translateMat4c(0,.5,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yAxisArrow:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.green,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(180*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yAxisArrowHandle:n.addChild(new gn(n,{geometry:o.arrowHeadHandle,material:a.pickable,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(180*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,opacity:.2,isObject:!1}),e),yShaft:n.addChild(new gn(n,{geometry:o.axis,material:a.green,position:[0,-.5,0],pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yShaftHandle:n.addChild(new gn(n,{geometry:o.axisHandle,material:a.pickable,position:[0,-.5,0],pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zAxisArrow:n.addChild(new gn(n,{geometry:o.arrowHead,material:a.blue,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[.8,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zAxisArrowHandle:n.addChild(new gn(n,{geometry:o.arrowHeadHandle,material:a.pickable,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[.8,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!0,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zShaft:n.addChild(new gn(n,{geometry:o.axis,material:a.blue,matrix:function(){var e=re.translateMat4c(0,.5,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),clippable:!1,pickable:!1,collidable:!0,visible:!1,isObject:!1}),e),zAxisHandle:n.addChild(new gn(n,{geometry:o.axisHandle,material:a.pickable,matrix:function(){var e=re.translateMat4c(0,.5,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),clippable:!1,pickable:!0,collidable:!0,visible:!1,isObject:!1}),e)},this._affordanceMeshes={planeFrame:n.addChild(new gn(n,{geometry:new Wi(n,lo({center:[0,0,0],radius:2,tube:i,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Zi(n,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:!0,highlightMaterial:new $i(n,{edges:!1,filled:!0,fillColor:[1,1,0],fillAlpha:1}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,1],rotation:[0,0,45],isObject:!1}),e),xHoop:n.addChild(new gn(n,{geometry:o.hoop,material:a.red,highlighted:!0,highlightMaterial:a.highlightRed,matrix:function(){var e=re.rotationMat4v(90*re.DEGTORAD,[0,1,0],re.identityMat4()),t=re.rotationMat4v(270*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yHoop:n.addChild(new gn(n,{geometry:o.hoop,material:a.green,highlighted:!0,highlightMaterial:a.highlightGreen,rotation:[-90,0,0],pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zHoop:n.addChild(new gn(n,{geometry:o.hoop,material:a.blue,highlighted:!0,highlightMaterial:a.highlightBlue,matrix:re.rotationMat4v(180*re.DEGTORAD,[1,0,0],re.identityMat4()),pickable:!1,collidable:!0,clippable:!1,backfaces:!0,visible:!1,isObject:!1}),e),xAxisArrow:n.addChild(new gn(n,{geometry:o.arrowHeadBig,material:a.red,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[0,0,1],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),yAxisArrow:n.addChild(new gn(n,{geometry:o.arrowHeadBig,material:a.green,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(180*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e),zAxisArrow:n.addChild(new gn(n,{geometry:o.arrowHeadBig,material:a.blue,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[.8,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1,isObject:!1}),e)}}},{key:"_bindEvents",value:function(){var e=this,t=this,i=!1,r=-1,s=0,n=1,o=2,a=3,l=4,u=5,A=this._rootNode,c=null,h=null,d=re.vec2(),p=re.vec3([1,0,0]),f=re.vec3([0,1,0]),v=re.vec3([0,0,1]),g=this._viewer.scene.canvas.canvas,m=this._viewer.camera,_=this._viewer.scene,y=re.vec3([0,0,0]),b=-1;this._onCameraViewMatrix=_.camera.on("viewMatrix",(function(){})),this._onCameraProjMatrix=_.camera.on("projMatrix",(function(){})),this._onSceneTick=_.on("tick",(function(){var t=Math.abs(re.lenVec3(re.subVec3(_.camera.eye,e._pos,y)));if(t!==b&&"perspective"===m.projection){var i=.07*(Math.tan(m.perspective.fov*re.DEGTORAD)*t);A.scale=[i,i,i],b=t}if("ortho"===m.projection){var r=m.ortho.scale/10;A.scale=[r,r,r],b=t}}));var w,B,x,P,C,M=function(){var e=new Float64Array(2);return function(t){if(t){for(var i=t.target,r=0,s=0;i.offsetParent;)r+=i.offsetLeft,s+=i.offsetTop,i=i.offsetParent;e[0]=t.pageX-r,e[1]=t.pageY-s}else t=window.event,e[0]=t.x,e[1]=t.y;return e}}(),E=function(){var e=re.mat4();return function(i,r){return re.quaternionToMat4(t._rootNode.quaternion,e),re.transformVec3(e,i,r),re.normalizeVec3(r),r}}(),F=(w=re.vec3(),function(e){var t=Math.abs(e[0]);return t>Math.abs(e[1])&&t>Math.abs(e[2])?re.cross3Vec3(e,[0,1,0],w):re.cross3Vec3(e,[1,0,0],w),re.cross3Vec3(w,e,w),re.normalizeVec3(w),w}),k=(B=re.vec3(),x=re.vec3(),P=re.vec4(),function(e,i,r){E(e,P);var s=F(P,i,r);D(i,s,B),D(r,s,x),re.subVec3(x,B);var n=re.dotVec3(x,P);t._pos[0]+=P[0]*n,t._pos[1]+=P[1]*n,t._pos[2]+=P[2]*n,t._rootNode.position=t._pos,t._sectionPlane&&(t._sectionPlane.pos=t._pos)}),I=function(){var e=re.vec4(),i=re.vec4(),r=re.vec4(),s=re.vec4();return function(n,o,a){if(E(n,s),!(D(o,s,e)&&D(a,s,i))){var l=F(s,o,a);D(o,l,e,1),D(a,l,i,1);var u=re.dotVec3(e,s);e[0]-=u*s[0],e[1]-=u*s[1],e[2]-=u*s[2],u=re.dotVec3(i,s),i[0]-=u*s[0],i[1]-=u*s[1],i[2]-=u*s[2]}re.normalizeVec3(e),re.normalizeVec3(i),u=re.dotVec3(e,i),u=re.clamp(u,-1,1);var A=Math.acos(u)*re.RADTODEG;re.cross3Vec3(e,i,r),re.dotVec3(r,s)<0&&(A=-A),t._rootNode.rotate(n,A),S()}}(),D=function(){var e=re.vec4([0,0,0,1]),i=re.mat4();return function(r,s,n,o){o=o||0,e[0]=r[0]/g.width*2-1,e[1]=-(r[1]/g.height*2-1),e[2]=0,e[3]=1,re.mulMat4(m.projMatrix,m.viewMatrix,i),re.inverseMat4(i),re.transformVec4(i,e,e),re.mulVec4Scalar(e,1/e[3]);var a=m.eye;re.subVec4(e,a,e);var l=t._sectionPlane.pos,u=-re.dotVec3(l,s)-o,A=re.dotVec3(s,e);if(Math.abs(A)>.005){var c=-(re.dotVec3(s,a)+u)/A;return re.mulVec3Scalar(e,c,n),re.addVec3(n,a),re.subVec3(n,l,n),!0}return!1}}(),S=function(){var e=re.vec3(),i=re.mat4();return function(){t.sectionPlane&&(re.quaternionToMat4(A.quaternion,i),re.transformVec3(i,[0,0,1],e),t._setSectionPlaneDir(e))}}(),T=!1;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",(function(t){if(e._visible&&!T){var A;switch(i=!1,C&&(C.visible=!1),t.entity.id){case e._displayMeshes.xAxisArrowHandle.id:case e._displayMeshes.xAxisHandle.id:A=e._affordanceMeshes.xAxisArrow,c=s;break;case e._displayMeshes.yAxisArrowHandle.id:case e._displayMeshes.yShaftHandle.id:A=e._affordanceMeshes.yAxisArrow,c=n;break;case e._displayMeshes.zAxisArrowHandle.id:case e._displayMeshes.zAxisHandle.id:A=e._affordanceMeshes.zAxisArrow,c=o;break;case e._displayMeshes.xCurveHandle.id:A=e._affordanceMeshes.xHoop,c=a;break;case e._displayMeshes.yCurveHandle.id:A=e._affordanceMeshes.yHoop,c=l;break;case e._displayMeshes.zCurveHandle.id:A=e._affordanceMeshes.zHoop,c=u;break;default:return void(c=r)}A&&(A.visible=!0),C=A,i=!0}})),this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOutEntity",(function(t){e._visible&&(C&&(C.visible=!1),C=null,c=r)})),g.addEventListener("mousedown",this._canvasMouseDownListener=function(t){if(t.preventDefault(),e._visible&&i&&(e._viewer.cameraControl.pointerEnabled=!1,1===t.which)){T=!0;var r=M(t);h=c,d[0]=r[0],d[1]=r[1]}}),g.addEventListener("mousemove",this._canvasMouseMoveListener=function(t){if(e._visible&&T){var i=M(t),r=i[0],A=i[1];switch(h){case s:k(p,d,i);break;case n:k(f,d,i);break;case o:k(v,d,i);break;case a:I(p,d,i);break;case l:I(f,d,i);break;case u:I(v,d,i)}d[0]=r,d[1]=A}}),g.addEventListener("mouseup",this._canvasMouseUpListener=function(t){e._visible&&(e._viewer.cameraControl.pointerEnabled=!0,T&&(t.which,T=!1,i=!1))}),g.addEventListener("wheel",this._canvasWheelListener=function(t){if(e._visible)Math.max(-1,Math.min(1,40*-t.deltaY))})}},{key:"_destroy",value:function(){this._unbindEvents(),this._destroyNodes()}},{key:"_unbindEvents",value:function(){var e=this._viewer,t=e.scene,i=t.canvas.canvas,r=e.camera,s=e.cameraControl;t.off(this._onSceneTick),i.removeEventListener("mousedown",this._canvasMouseDownListener),i.removeEventListener("mousemove",this._canvasMouseMoveListener),i.removeEventListener("mouseup",this._canvasMouseUpListener),i.removeEventListener("wheel",this._canvasWheelListener),r.off(this._onCameraViewMatrix),r.off(this._onCameraProjMatrix),s.off(this._onCameraControlHover),s.off(this._onCameraControlHoverLeave)}},{key:"_destroyNodes",value:function(){this._setSectionPlane(null),this._rootNode.destroy(),this._displayMeshes={},this._affordanceMeshes={}}}]),e}(),zE=function(){function e(t,i,r){var s=this;x(this,e),this.id=r.id,this._sectionPlane=r,this._mesh=new gn(i,{id:r.id,geometry:new Wi(i,Ki({xSize:.5,ySize:.5,zSize:.001})),material:new Zi(i,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:!1}),edgeMaterial:new tr(i,{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),highlightMaterial:new $i(i,{fill:!0,fillColor:[.5,1,.5],fillAlpha:.7,edges:!0,edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),selectedMaterial:new $i(i,{fill:!0,fillColor:[0,0,1],fillAlpha:.7,edges:!0,edgeColor:[1,0,0],edgeAlpha:1,edgeWidth:1}),highlighted:!0,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:.3,edges:!0});var n=re.vec3([0,0,0]),o=re.vec3(),a=re.vec3([0,0,1]),l=re.vec4(4),u=re.vec3(),A=function(){var e=s._sectionPlane.scene.center,t=[-s._sectionPlane.dir[0],-s._sectionPlane.dir[1],-s._sectionPlane.dir[2]];re.subVec3(e,s._sectionPlane.pos,n);var i=-re.dotVec3(t,n);re.normalizeVec3(t),re.mulVec3Scalar(t,i,o);var r=re.vec3PairToQuaternion(a,s._sectionPlane.dir,l);u[0]=.1*o[0],u[1]=.1*o[1],u[2]=.1*o[2],s._mesh.quaternion=r,s._mesh.position=u};this._onSectionPlanePos=this._sectionPlane.on("pos",A),this._onSectionPlaneDir=this._sectionPlane.on("dir",A),this._highlighted=!1,this._selected=!1}return C(e,[{key:"setHighlighted",value:function(e){this._highlighted=!!e,this._mesh.highlighted=this._highlighted,this._mesh.highlightMaterial.fillColor=e?[0,.7,0]:[0,0,0]}},{key:"getHighlighted",value:function(){return this._highlighted}},{key:"setSelected",value:function(e){this._selected=!!e,this._mesh.edgeMaterial.edgeWidth=e?3:1,this._mesh.highlightMaterial.edgeWidth=e?3:1}},{key:"getSelected",value:function(){return this._selected}},{key:"destroy",value:function(){this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._mesh.destroy()}}]),e}(),WE=function(){function e(t,i){var r=this;if(x(this,e),!(i.onHoverEnterPlane&&i.onHoverLeavePlane&&i.onClickedNothing&&i.onClickedPlane))throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";this.plugin=t,this._viewer=t.viewer,this._onHoverEnterPlane=i.onHoverEnterPlane,this._onHoverLeavePlane=i.onHoverLeavePlane,this._onClickedNothing=i.onClickedNothing,this._onClickedPlane=i.onClickedPlane,this._visible=!0,this._planes={},this._canvas=i.overviewCanvas,this._scene=new cr(this._viewer,{canvasId:this._canvas.id,transparent:!0}),this._scene.clearLights(),new Si(this._scene,{dir:[.4,-.4,.8],color:[.8,1,1],intensity:1,space:"view"}),new Si(this._scene,{dir:[-.8,-.3,-.4],color:[.8,.8,.8],intensity:1,space:"view"}),new Si(this._scene,{dir:[.8,-.6,-.8],color:[1,1,1],intensity:1,space:"view"}),this._scene.camera,this._scene.camera.perspective.fov=70,this._zUp=!1;var s=this._scene.camera,n=re.rotationMat4c(-90*re.DEGTORAD,1,0,0),o=re.vec3(),a=re.vec3(),l=re.vec3();this._synchCamera=function(){var e=r._viewer.camera.eye,t=r._viewer.camera.look,i=r._viewer.camera.up;re.mulVec3Scalar(re.normalizeVec3(re.subVec3(e,t,o)),7),r._zUp?(re.transformVec3(n,o,a),re.transformVec3(n,i,l),s.look=[0,0,0],s.eye=re.transformVec3(n,o,a),s.up=re.transformPoint3(n,i,l)):(s.look=[0,0,0],s.eye=o,s.up=i)},this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera),this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera),this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",(function(e){r._scene.camera.perspective.fov=e}));var u=null;this._onInputMouseMove=this._scene.input.on("mousemove",(function(e){var t=r._scene.pick({canvasPos:e});if(t){if(!u||t.entity.id!==u.id){if(u)r._planes[u.id]&&r._onHoverLeavePlane(u.id);u=t.entity,r._planes[u.id]&&r._onHoverEnterPlane(u.id)}}else u&&(r._onHoverLeavePlane(u.id),u=null)})),this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=function(){u?r._planes[u.id]&&r._onClickedPlane(u.id):r._onClickedNothing()}),this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=function(){u&&(r._onHoverLeavePlane(u.id),u=null)}),this.setVisible(i.overviewVisible)}return C(e,[{key:"addSectionPlane",value:function(e){this._planes[e.id]=new zE(this,this._scene,e)}},{key:"setPlaneHighlighted",value:function(e,t){var i=this._planes[e];i&&i.setHighlighted(t)}},{key:"setPlaneSelected",value:function(e,t){var i=this._planes[e];i&&i.setSelected(t)}},{key:"removeSectionPlane",value:function(e){var t=this._planes[e.id];t&&(t.destroy(),delete this._planes[e.id])}},{key:"setVisible",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._visible=e,this._canvas.style.visibility=e?"visible":"hidden"}},{key:"getVisible",value:function(){return this._visible}},{key:"destroy",value:function(){this._viewer.camera.off(this._onViewerCameraMatrix),this._viewer.camera.off(this._onViewerCameraWorldAxis),this._viewer.camera.perspective.off(this._onViewerCameraFOV),this._scene.input.off(this._onInputMouseMove),this._scene.canvas.canvas.removeEventListener("mouseup",this._onCanvasMouseUp),this._scene.canvas.canvas.removeEventListener("mouseout",this._onCanvasMouseOut),this._scene.destroy()}}]),e}(),KE=re.AABB3(),XE=re.vec3(),YE=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(r=t.call(this,"SectionPlanes",e))._freeControls=[],r._sectionPlanes=e.scene.sectionPlanes,r._controls={},r._shownControlId=null,null!==s.overviewCanvasId&&void 0!==s.overviewCanvasId){var n=document.getElementById(s.overviewCanvasId);n?r._overview=new WE(b(r),{overviewCanvas:n,visible:s.overviewVisible,onHoverEnterPlane:function(e){r._overview.setPlaneHighlighted(e,!0)},onHoverLeavePlane:function(e){r._overview.setPlaneHighlighted(e,!1)},onClickedPlane:function(e){if(r.getShownControl()!==e){r.showControl(e);var t=r.sectionPlanes[e].pos;KE.set(r.viewer.scene.aabb),re.getAABB3Center(KE,XE),KE[0]+=t[0]-XE[0],KE[1]+=t[1]-XE[1],KE[2]+=t[2]-XE[2],KE[3]+=t[0]-XE[0],KE[4]+=t[1]-XE[1],KE[5]+=t[2]-XE[2],r.viewer.cameraFlight.flyTo({aabb:KE,fitFOV:65})}else r.hideControl()},onClickedNothing:function(){r.hideControl()}}):r.warn("Can't find overview canvas: '"+s.overviewCanvasId+"' - will create plugin without overview")}return r._onSceneSectionPlaneCreated=e.scene.on("sectionPlaneCreated",(function(e){r._sectionPlaneCreated(e)})),r}return C(i,[{key:"setOverviewVisible",value:function(e){this._overview&&this._overview.setVisible(e)}},{key:"getOverviewVisible",value:function(){if(this._overview)return this._overview.getVisible()}},{key:"sectionPlanes",get:function(){return this._sectionPlanes}},{key:"createSectionPlane",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};void 0!==e.id&&null!==e.id&&this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);var t=new xn(this.viewer.scene,{id:e.id,pos:e.pos,dir:e.dir,active:!0});return t}},{key:"_sectionPlaneCreated",value:function(e){var t=this,i=this._freeControls.length>0?this._freeControls.pop():new GE(this);i._setSectionPlane(e),i.setVisible(!1),this._controls[e.id]=i,this._overview&&this._overview.addSectionPlane(e),e.once("destroyed",(function(){t._sectionPlaneDestroyed(e)}))}},{key:"flipSectionPlanes",value:function(){var e=this.viewer.scene.sectionPlanes;for(var t in e){e[t].flipDir()}}},{key:"showControl",value:function(e){var t=this._controls[e];t?(this.hideControl(),t.setVisible(!0),this._overview&&this._overview.setPlaneSelected(e,!0),this._shownControlId=e):this.error("Control not found: "+e)}},{key:"getShownControl",value:function(){return this._shownControlId}},{key:"hideControl",value:function(){for(var e in this._controls)this._controls.hasOwnProperty(e)&&(this._controls[e].setVisible(!1),this._overview&&this._overview.setPlaneSelected(e,!1));this._shownControlId=null}},{key:"destroySectionPlane",value:function(e){var t=this.viewer.scene.sectionPlanes[e];t?(this._sectionPlaneDestroyed(t),t.destroy(),e===this._shownControlId&&(this._shownControlId=null)):this.error("SectionPlane not found: "+e)}},{key:"_sectionPlaneDestroyed",value:function(e){this._overview&&this._overview.removeSectionPlane(e);var t=this._controls[e.id];t&&(t.setVisible(!1),t._setSectionPlane(null),delete this._controls[e.id],this._freeControls.push(t))}},{key:"clear",value:function(){for(var e=Object.keys(this._sectionPlanes),t=0,i=e.length;t1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"StoreyViews",e))._objectsMemento=new Cd,r._cameraMemento=new wd,r.storeys={},r.modelStoreys={},r._fitStoreyMaps=!!s.fitStoreyMaps,r._onModelLoaded=r.viewer.scene.on("modelLoaded",(function(e){r._registerModelStoreys(e),r.fire("storeys",r.storeys)})),r}return C(i,[{key:"_registerModelStoreys",value:function(e){var t=this,i=this.viewer,r=i.scene,s=i.metaScene,n=s.metaModels[e],o=r.models[e];if(n&&n.rootMetaObjects)for(var a=n.rootMetaObjects,l=0,u=a.length;l.5?p.length:0,g=new JE(this,o.aabb,f,e,d,v);g._onModelDestroyed=o.once("destroyed",(function(){t._deregisterModelStoreys(e),t.fire("storeys",t.storeys)})),this.storeys[d]=g,this.modelStoreys[e]||(this.modelStoreys[e]={}),this.modelStoreys[e][d]=g}}},{key:"_deregisterModelStoreys",value:function(e){var t=this.modelStoreys[e];if(t){var i=this.viewer.scene;for(var r in t)if(t.hasOwnProperty(r)){var s=t[r],n=i.models[s.modelId];n&&n.off(s._onModelDestroyed),delete this.storeys[r]}delete this.modelStoreys[e]}}},{key:"fitStoreyMaps",get:function(){return this._fitStoreyMaps}},{key:"gotoStoreyCamera",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=this.storeys[e];if(!i)return this.error("IfcBuildingStorey not found with this ID: "+e),void(t.done&&t.done());var r=this.viewer,s=r.scene,n=s.camera,o=i.storeyAABB;if(o[3]1&&void 0!==arguments[1]?arguments[1]:{},i=this.storeys[e];if(i){var r=this.viewer,s=r.scene,n=r.metaScene,o=n.metaObjects[e];o&&(t.hideOthers&&s.setObjectsVisible(r.scene.visibleObjectIds,!1),this.withStoreyObjects(e,(function(e,t){e&&(e.visible=!0)})))}else this.error("IfcBuildingStorey not found with this ID: "+e)}},{key:"withStoreyObjects",value:function(e,t){var i=this.viewer,r=i.scene,s=i.metaScene,n=s.metaObjects[e];if(n)for(var o=n.getObjectIDsInSubtree(),a=0,l=o.length;a1&&void 0!==arguments[1]?arguments[1]:{},i=this.storeys[e];if(!i)return this.error("IfcBuildingStorey not found with this ID: "+e),eF;var r,s,n=this.viewer,o=n.scene,a=t.format||"png",l=this._fitStoreyMaps?i.storeyAABB:i.modelAABB,u=Math.abs((l[5]-l[2])/(l[3]-l[0])),A=t.padding||0;t.width&&t.height?(r=t.width,s=t.height):t.height?(s=t.height,r=Math.round(s/u)):t.width?(r=t.width,s=Math.round(r*u)):(r=300,s=Math.round(r*u)),this._objectsMemento.saveObjects(o),this._cameraMemento.saveCamera(o),this.showStoreyObjects(e,he.apply(t,{hideOthers:!0})),this._arrangeStoreyMapCamera(i);var c=n.getSnapshot({width:r,height:s,format:a});return this._objectsMemento.restoreObjects(o),this._cameraMemento.restoreCamera(o),new ZE(e,c,a,r,s,A)}},{key:"_arrangeStoreyMapCamera",value:function(e){var t=this.viewer,i=t.scene.camera,r=this._fitStoreyMaps?e.storeyAABB:e.modelAABB,s=re.getAABB3Center(r),n=qE;n[0]=s[0]+.5*i.worldUp[0],n[1]=s[1]+.5*i.worldUp[1],n[2]=s[2]+.5*i.worldUp[2];var o=i.worldForward;t.cameraFlight.jumpTo({eye:n,look:s,up:o});var a=(r[3]-r[0])/2,l=(r[4]-r[1])/2,u=(r[5]-r[2])/2,A=-a,c=+a,h=-l,d=+l,p=-u,f=+u;t.camera.customProjection.matrix=re.orthoMat4c(A,c,p,f,h,d,$E),t.camera.projection="customProjection"}},{key:"pickStoreyMap",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=e.storeyId,s=this.storeys[r];if(!s)return this.error("IfcBuildingStorey not found with this ID: "+r),null;var n=1-t[0]/e.width,o=1-t[1]/e.height,a=this._fitStoreyMaps?s.storeyAABB:s.modelAABB,l=a[0],u=a[1],A=a[2],c=a[3],h=a[4],d=a[5],p=c-l,f=h-u,v=d-A,g=re.vec3([l+p*n,u+.5*f,A+v*o]),m=re.vec3([0,-1,0]),_=re.addVec3(g,m,qE),y=this.viewer.camera.worldForward,b=re.lookAtMat4v(g,_,y,$E),w=this.viewer.scene.pick({pickSurface:i.pickSurface,pickInvisible:!0,matrix:b});return w}},{key:"storeyMapToWorldPos",value:function(e,t){var i=e.storeyId,r=this.storeys[i];if(!r)return this.error("IfcBuildingStorey not found with this ID: "+i),null;var s=1-t[0]/e.width,n=1-t[1]/e.height,o=this._fitStoreyMaps?r.storeyAABB:r.modelAABB,a=o[0],l=o[1],u=o[2],A=o[3],c=o[4],h=o[5],d=A-a,p=c-l,f=h-u,v=re.vec3([a+d*s,l+.5*p,u+f*n]);return v}},{key:"getStoreyContainingWorldPos",value:function(e){for(var t in this.storeys){var i=this.storeys[t];if(re.point3AABB3Intersect(i.storeyAABB,e))return t}return null}},{key:"worldPosToStoreyMap",value:function(e,t,i){var r=e.storeyId,s=this.storeys[r];if(!s)return this.error("IfcBuildingStorey not found with this ID: "+r),!1;var n=this._fitStoreyMaps?s.storeyAABB:s.modelAABB,o=n[0],a=n[1],l=n[2],u=n[3]-o,A=n[4]-a,c=n[5]-l,h=this.viewer.camera.worldUp,d=h[0]>h[1]&&h[0]>h[2],p=!d&&h[1]>h[0]&&h[1]>h[2];!d&&!p&&h[2]>h[0]&&(h[2],h[1]);var f=e.width/u,v=p?e.height/c:e.height/A;return i[0]=Math.floor(e.width-(t[0]-o)*f),i[1]=Math.floor(e.height-(t[2]-l)*v),i[0]>=0&&i[0]=0&&i[1]<=e.height}},{key:"worldDirToStoreyMap",value:function(e,t,i){var r=this.viewer.camera,s=r.eye,n=r.look,o=re.subVec3(n,s,qE),a=r.worldUp,l=a[0]>a[1]&&a[0]>a[2],u=!l&&a[1]>a[0]&&a[1]>a[2];!l&&!u&&a[2]>a[0]&&(a[2],a[1]),l?(i[0]=o[1],i[1]=o[2]):u?(i[0]=o[0],i[1]=o[2]):(i[0]=o[0],i[1]=o[1]),re.normalizeVec2(i)}},{key:"destroy",value:function(){this.viewer.scene.off(this._onModelLoaded),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),iF=new Float64Array([0,0,1]),rF=new Float64Array(4),sF=function(){function e(t){x(this,e),this.id=null,this._viewer=t.viewer,this._plugin=t,this._visible=!1,this._pos=re.vec3(),this._origin=re.vec3(),this._rtcPos=re.vec3(),this._baseDir=re.vec3(),this._rootNode=null,this._displayMeshes=null,this._affordanceMeshes=null,this._ignoreNextSectionPlaneDirUpdate=!1,this._createNodes(),this._bindEvents()}return C(e,[{key:"_setSectionPlane",value:function(e){var t=this;this._sectionPlane&&(this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._onSectionPlanePos=null,this._onSectionPlaneDir=null,this._sectionPlane=null),e&&(this.id=e.id,this._setPos(e.pos),this._setDir(e.dir),this._sectionPlane=e,this._onSectionPlanePos=e.on("pos",(function(){t._setPos(t._sectionPlane.pos)})),this._onSectionPlaneDir=e.on("dir",(function(){t._ignoreNextSectionPlaneDirUpdate?t._ignoreNextSectionPlaneDirUpdate=!1:t._setDir(t._sectionPlane.dir)})))}},{key:"sectionPlane",get:function(){return this._sectionPlane}},{key:"_setPos",value:function(e){this._pos.set(e),He(this._pos,this._origin,this._rtcPos),this._rootNode.origin=this._origin,this._rootNode.position=this._rtcPos}},{key:"_setDir",value:function(e){this._baseDir.set(e),this._rootNode.quaternion=re.vec3PairToQuaternion(iF,e,rF)}},{key:"_setSectionPlaneDir",value:function(e){this._sectionPlane&&(this._ignoreNextSectionPlaneDirUpdate=!0,this._sectionPlane.dir=e)}},{key:"setVisible",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this._visible!==e){var t;for(t in this._visible=e,this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].visible=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].visible=e)}}},{key:"getVisible",value:function(){return this._visible}},{key:"setCulled",value:function(e){var t;for(t in this._displayMeshes)this._displayMeshes.hasOwnProperty(t)&&(this._displayMeshes[t].culled=e);if(!e)for(t in this._affordanceMeshes)this._affordanceMeshes.hasOwnProperty(t)&&(this._affordanceMeshes[t].culled=e)}},{key:"_createNodes",value:function(){var e=!1,t=this._viewer.scene,i=.01;this._rootNode=new Tn(t,{position:[0,0,0],scale:[5,5,5]});var r=this._rootNode,s={arrowHead:new Wi(r,_n({radiusTop:.001,radiusBottom:.07,radialSegments:32,heightSegments:1,height:.2,openEnded:!1})),arrowHeadBig:new Wi(r,_n({radiusTop:.001,radiusBottom:.09,radialSegments:32,heightSegments:1,height:.25,openEnded:!1})),axis:new Wi(r,_n({radiusTop:i,radiusBottom:i,radialSegments:20,heightSegments:1,height:1,openEnded:!1}))},n={red:new Zi(r,{diffuse:[1,0,0],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),green:new Zi(r,{diffuse:[0,1,0],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),blue:new Zi(r,{diffuse:[0,0,1],emissive:[1,0,0],ambient:[0,0,0],specular:[.6,.6,.3],shininess:80,lineWidth:2}),highlightRed:new $i(r,{edges:!1,fill:!0,fillColor:[1,0,0],fillAlpha:.6})};this._displayMeshes={plane:r.addChild(new gn(r,{geometry:new Wi(r,{primitive:"triangles",positions:[.5,.5,0,.5,-.5,0,-.5,-.5,0,-.5,.5,0,.5,.5,-0,.5,-.5,-0,-.5,-.5,-0,-.5,.5,-0],indices:[0,1,2,2,3,0]}),material:new Zi(r,{emissive:[0,0,0],diffuse:[0,0,0],backfaces:!0}),opacity:.6,ghosted:!0,pickable:!1,collidable:!0,clippable:!1,visible:!1,scale:[2.4,2.4,1]}),e),planeFrame:r.addChild(new gn(r,{geometry:new Wi(r,lo({center:[0,0,0],radius:1.7,tube:.02,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Zi(r,{emissive:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],shininess:0}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,.1],rotation:[0,0,45]}),e),center:r.addChild(new gn(r,{geometry:new Wi(r,yn({radius:.05})),material:n.center,pickable:!1,collidable:!0,clippable:!1,visible:!1}),e),zAxisArrow:r.addChild(new gn(r,{geometry:s.arrowHead,material:n.blue,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[.8,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1}),e),zShaft:r.addChild(new gn(r,{geometry:s.axis,material:n.blue,matrix:function(){var e=re.translateMat4c(0,.5,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[1,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),clippable:!1,pickable:!1,collidable:!0,visible:!1}),e)},this._affordanceMeshes={planeFrame:r.addChild(new gn(r,{geometry:new Wi(r,lo({center:[0,0,0],radius:2,tube:i,radialSegments:4,tubeSegments:4,arc:2*Math.PI})),material:new Zi(r,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:!0,highlightMaterial:new $i(r,{edges:!1,filled:!0,fillColor:[1,1,0],fillAlpha:1}),pickable:!1,collidable:!1,clippable:!1,visible:!1,scale:[1,1,1],rotation:[0,0,45]}),e),zAxisArrow:r.addChild(new gn(r,{geometry:s.arrowHeadBig,material:n.blue,matrix:function(){var e=re.translateMat4c(0,1.1,0,re.identityMat4()),t=re.rotationMat4v(-90*re.DEGTORAD,[.8,0,0],re.identityMat4());return re.mulMat4(t,e,re.identityMat4())}(),pickable:!1,collidable:!0,clippable:!1,visible:!1}),e)}}},{key:"_bindEvents",value:function(){var e=this,t=this._rootNode,i=re.vec2(),r=this._viewer.camera,s=this._viewer.scene,n=0,o=!1,a=re.vec3([0,0,0]),l=-1;this._onCameraViewMatrix=s.camera.on("viewMatrix",(function(){})),this._onCameraProjMatrix=s.camera.on("projMatrix",(function(){})),this._onSceneTick=s.on("tick",(function(){o=!1;var i=Math.abs(re.lenVec3(re.subVec3(s.camera.eye,e._pos,a)));if(i!==l&&"perspective"===r.projection){var u=.07*(Math.tan(r.perspective.fov*re.DEGTORAD)*i);t.scale=[u,u,u],l=i}if("ortho"===r.projection){var c=r.ortho.scale/10;t.scale=[c,c,c],l=i}0!==n&&(A(n),n=0)}));var u=function(){var e=new Float64Array(2);return function(t){if(t){for(var i=t.target,r=0,s=0;i.offsetParent;)r+=i.offsetLeft,s+=i.offsetTop,i=i.offsetParent;e[0]=t.pageX-r,e[1]=t.pageY-s}else t=window.event,e[0]=t.x,e[1]=t.y;return e}}(),A=function(t){var i=e._sectionPlane.pos,r=e._sectionPlane.dir;re.addVec3(i,re.mulVec3Scalar(r,.1*t*e._plugin.getDragSensitivity(),re.vec3())),e._sectionPlane.pos=i},c=!1;this._plugin._controlElement.addEventListener("mousedown",this._canvasMouseDownListener=function(t){if(t.preventDefault(),e._visible&&(e._viewer.cameraControl.pointerEnabled=!1,1===t.which)){c=!0;var r=u(t);i[0]=r[0],i[1]=r[1]}}),this._plugin._controlElement.addEventListener("mousemove",this._canvasMouseMoveListener=function(t){if(e._visible&&c&&!o){var r=u(t),s=r[0],n=r[1];A(n-i[1]),i[0]=s,i[1]=n}}),this._plugin._controlElement.addEventListener("mouseup",this._canvasMouseUpListener=function(t){e._visible&&(e._viewer.cameraControl.pointerEnabled=!0,c&&(t.which,c=!1))}),this._plugin._controlElement.addEventListener("wheel",this._canvasWheelListener=function(t){e._visible&&(n+=Math.max(-1,Math.min(1,40*-t.deltaY)))});var h,d,p=null;this._plugin._controlElement.addEventListener("touchstart",this._handleTouchStart=function(t){t.stopPropagation(),t.preventDefault(),e._visible&&(h=t.touches[0].clientY,p=h,n=0)}),this._plugin._controlElement.addEventListener("touchmove",this._handleTouchMove=function(t){t.stopPropagation(),t.preventDefault(),e._visible&&(o||(o=!0,d=t.touches[0].clientY,null!==p&&(n+=d-p),p=d))}),this._plugin._controlElement.addEventListener("touchend",this._handleTouchEnd=function(t){t.stopPropagation(),t.preventDefault(),e._visible&&(h=null,d=null,n=0)})}},{key:"_destroy",value:function(){this._unbindEvents(),this._destroyNodes()}},{key:"_unbindEvents",value:function(){var e=this._viewer,t=e.scene,i=t.canvas.canvas,r=e.camera,s=this._plugin._controlElement;t.off(this._onSceneTick),i.removeEventListener("mousedown",this._canvasMouseDownListener),i.removeEventListener("mousemove",this._canvasMouseMoveListener),i.removeEventListener("mouseup",this._canvasMouseUpListener),i.removeEventListener("wheel",this._canvasWheelListener),s.removeEventListener("touchstart",this._handleTouchStart),s.removeEventListener("touchmove",this._handleTouchMove),s.removeEventListener("touchend",this._handleTouchEnd),r.off(this._onCameraViewMatrix),r.off(this._onCameraProjMatrix)}},{key:"_destroyNodes",value:function(){this._setSectionPlane(null),this._rootNode.destroy(),this._displayMeshes={},this._affordanceMeshes={}}}]),e}(),nF=function(){function e(t,i,r){var s=this;x(this,e),this.id=r.id,this._sectionPlane=r,this._mesh=new gn(i,{id:r.id,geometry:new Wi(i,Ki({xSize:.5,ySize:.5,zSize:.001})),material:new Zi(i,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:!1}),edgeMaterial:new tr(i,{edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),highlightMaterial:new $i(i,{fill:!0,fillColor:[.5,1,.5],fillAlpha:.7,edges:!0,edgeColor:[0,0,0],edgeAlpha:1,edgeWidth:1}),selectedMaterial:new $i(i,{fill:!0,fillColor:[0,0,1],fillAlpha:.7,edges:!0,edgeColor:[1,0,0],edgeAlpha:1,edgeWidth:1}),highlighted:!0,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:.3,edges:!0});var n=re.vec3([0,0,0]),o=re.vec3(),a=re.vec3([0,0,1]),l=re.vec4(4),u=re.vec3(),A=function(){var e=s._sectionPlane.scene.center,t=[-s._sectionPlane.dir[0],-s._sectionPlane.dir[1],-s._sectionPlane.dir[2]];re.subVec3(e,s._sectionPlane.pos,n);var i=-re.dotVec3(t,n);re.normalizeVec3(t),re.mulVec3Scalar(t,i,o);var r=re.vec3PairToQuaternion(a,s._sectionPlane.dir,l);u[0]=.1*o[0],u[1]=.1*o[1],u[2]=.1*o[2],s._mesh.quaternion=r,s._mesh.position=u};this._onSectionPlanePos=this._sectionPlane.on("pos",A),this._onSectionPlaneDir=this._sectionPlane.on("dir",A),this._highlighted=!1,this._selected=!1}return C(e,[{key:"setHighlighted",value:function(e){this._highlighted=!!e,this._mesh.highlighted=this._highlighted,this._mesh.highlightMaterial.fillColor=e?[0,.7,0]:[0,0,0]}},{key:"getHighlighted",value:function(){return this._highlighted}},{key:"setSelected",value:function(e){this._selected=!!e,this._mesh.edgeMaterial.edgeWidth=e?3:1,this._mesh.highlightMaterial.edgeWidth=e?3:1}},{key:"getSelected",value:function(){return this._selected}},{key:"destroy",value:function(){this._sectionPlane.off(this._onSectionPlanePos),this._sectionPlane.off(this._onSectionPlaneDir),this._mesh.destroy()}}]),e}(),oF=function(){function e(t,i){var r=this;if(x(this,e),!(i.onHoverEnterPlane&&i.onHoverLeavePlane&&i.onClickedNothing&&i.onClickedPlane))throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";this.plugin=t,this._viewer=t.viewer,this._onHoverEnterPlane=i.onHoverEnterPlane,this._onHoverLeavePlane=i.onHoverLeavePlane,this._onClickedNothing=i.onClickedNothing,this._onClickedPlane=i.onClickedPlane,this._visible=!0,this._planes={},this._canvas=i.overviewCanvas,this._scene=new cr(this._viewer,{canvasId:this._canvas.id,transparent:!0}),this._scene.clearLights(),new Si(this._scene,{dir:[.4,-.4,.8],color:[.8,1,1],intensity:1,space:"view"}),new Si(this._scene,{dir:[-.8,-.3,-.4],color:[.8,.8,.8],intensity:1,space:"view"}),new Si(this._scene,{dir:[.8,-.6,-.8],color:[1,1,1],intensity:1,space:"view"}),this._scene.camera,this._scene.camera.perspective.fov=70,this._zUp=!1;var s=this._scene.camera,n=re.rotationMat4c(-90*re.DEGTORAD,1,0,0),o=re.vec3(),a=re.vec3(),l=re.vec3();this._synchCamera=function(){var e=r._viewer.camera.eye,t=r._viewer.camera.look,i=r._viewer.camera.up;re.mulVec3Scalar(re.normalizeVec3(re.subVec3(e,t,o)),7),r._zUp?(re.transformVec3(n,o,a),re.transformVec3(n,i,l),s.look=[0,0,0],s.eye=re.transformVec3(n,o,a),s.up=re.transformPoint3(n,i,l)):(s.look=[0,0,0],s.eye=o,s.up=i)},this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera),this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera),this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",(function(e){r._scene.camera.perspective.fov=e}));var u=null;this._onInputMouseMove=this._scene.input.on("mousemove",(function(e){var t=r._scene.pick({canvasPos:e});if(t){if(!u||t.entity.id!==u.id){if(u)r._planes[u.id]&&r._onHoverLeavePlane(u.id);u=t.entity,r._planes[u.id]&&r._onHoverEnterPlane(u.id)}}else u&&(r._onHoverLeavePlane(u.id),u=null)})),this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=function(){u?r._planes[u.id]&&r._onClickedPlane(u.id):r._onClickedNothing()}),this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=function(){u&&(r._onHoverLeavePlane(u.id),u=null)}),this.setVisible(i.overviewVisible)}return C(e,[{key:"addSectionPlane",value:function(e){this._planes[e.id]=new nF(this,this._scene,e)}},{key:"setPlaneHighlighted",value:function(e,t){var i=this._planes[e];i&&i.setHighlighted(t)}},{key:"setPlaneSelected",value:function(e,t){var i=this._planes[e];i&&i.setSelected(t)}},{key:"removeSectionPlane",value:function(e){var t=this._planes[e.id];t&&(t.destroy(),delete this._planes[e.id])}},{key:"setVisible",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._visible=e,this._canvas.style.visibility=e?"visible":"hidden"}},{key:"getVisible",value:function(){return this._visible}},{key:"destroy",value:function(){this._viewer.camera.off(this._onViewerCameraMatrix),this._viewer.camera.off(this._onViewerCameraWorldAxis),this._viewer.camera.perspective.off(this._onViewerCameraFOV),this._scene.input.off(this._onInputMouseMove),this._scene.canvas.canvas.removeEventListener("mouseup",this._onCanvasMouseUp),this._scene.canvas.canvas.removeEventListener("mouseout",this._onCanvasMouseOut),this._scene.destroy()}}]),e}(),aF=re.AABB3(),lF=re.vec3(),uF=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(r=t.call(this,"FaceAlignedSectionPlanesPlugin",e))._freeControls=[],r._sectionPlanes=e.scene.sectionPlanes,r._controls={},r._shownControlId=null,r._dragSensitivity=s.dragSensitivity||1,null!==s.overviewCanvasId&&void 0!==s.overviewCanvasId){var n=document.getElementById(s.overviewCanvasId);n?r._overview=new oF(b(r),{overviewCanvas:n,visible:s.overviewVisible,onHoverEnterPlane:function(e){r._overview.setPlaneHighlighted(e,!0)},onHoverLeavePlane:function(e){r._overview.setPlaneHighlighted(e,!1)},onClickedPlane:function(e){if(r.getShownControl()!==e){r.showControl(e);var t=r.sectionPlanes[e].pos;aF.set(r.viewer.scene.aabb),re.getAABB3Center(aF,lF),aF[0]+=t[0]-lF[0],aF[1]+=t[1]-lF[1],aF[2]+=t[2]-lF[2],aF[3]+=t[0]-lF[0],aF[4]+=t[1]-lF[1],aF[5]+=t[2]-lF[2],r.viewer.cameraFlight.flyTo({aabb:aF,fitFOV:65})}else r.hideControl()},onClickedNothing:function(){r.hideControl()}}):r.warn("Can't find overview canvas: '"+s.overviewCanvasId+"' - will create plugin without overview")}return null===s.controlElementId||void 0===s.controlElementId?r.error("Parameter expected: controlElementId"):(r._controlElement=document.getElementById(s.controlElementId),r._controlElement||r.warn("Can't find control element: '"+s.controlElementId+"' - will create plugin without control element")),r._onSceneSectionPlaneCreated=e.scene.on("sectionPlaneCreated",(function(e){r._sectionPlaneCreated(e)})),r}return C(i,[{key:"setDragSensitivity",value:function(e){this._dragSensitivity=e||1}},{key:"getDragSensitivity",value:function(){return this._dragSensitivity}},{key:"setOverviewVisible",value:function(e){this._overview&&this._overview.setVisible(e)}},{key:"getOverviewVisible",value:function(){if(this._overview)return this._overview.getVisible()}},{key:"sectionPlanes",get:function(){return this._sectionPlanes}},{key:"createSectionPlane",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};void 0!==e.id&&null!==e.id&&this.viewer.scene.components[e.id]&&(this.error("Viewer component with this ID already exists: "+e.id),delete e.id);var t=new xn(this.viewer.scene,{id:e.id,pos:e.pos,dir:e.dir,active:!0});return t}},{key:"_sectionPlaneCreated",value:function(e){var t=this,i=this._freeControls.length>0?this._freeControls.pop():new sF(this);i._setSectionPlane(e),i.setVisible(!1),this._controls[e.id]=i,this._overview&&this._overview.addSectionPlane(e),e.once("destroyed",(function(){t._sectionPlaneDestroyed(e)}))}},{key:"flipSectionPlanes",value:function(){var e=this.viewer.scene.sectionPlanes;for(var t in e){e[t].flipDir()}}},{key:"showControl",value:function(e){var t=this._controls[e];t?(this.hideControl(),t.setVisible(!0),this._overview&&this._overview.setPlaneSelected(e,!0),this._shownControlId=e):this.error("Control not found: "+e)}},{key:"getShownControl",value:function(){return this._shownControlId}},{key:"hideControl",value:function(){for(var e in this._controls)this._controls.hasOwnProperty(e)&&(this._controls[e].setVisible(!1),this._overview&&this._overview.setPlaneSelected(e,!1));this._shownControlId=null}},{key:"destroySectionPlane",value:function(e){var t=this.viewer.scene.sectionPlanes[e];t?(this._sectionPlaneDestroyed(t),t.destroy(),e===this._shownControlId&&(this._shownControlId=null)):this.error("SectionPlane not found: "+e)}},{key:"_sectionPlaneDestroyed",value:function(e){this._overview&&this._overview.removeSectionPlane(e);var t=this._controls[e.id];t&&(t.setVisible(!1),t._setSectionPlane(null),delete this._controls[e.id],this._freeControls.push(t))}},{key:"clear",value:function(){for(var e=Object.keys(this._sectionPlanes),t=0,i=e.length;t0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this.cacheBuster=!1!==t.cacheBuster}return C(e,[{key:"_cacheBusterURL",value:function(e){if(!this.cacheBuster)return e;var t=(new Date).getTime();return e.indexOf("?")>-1?e+"&_="+t:e+"?_="+t}},{key:"getSTL",value:function(e,t,i){e=this._cacheBusterURL(e);var r=new XMLHttpRequest;r.overrideMimeType("application/json"),r.open("GET",e,!0),r.responseType="arraybuffer",r.onreadystatechange=function(){4===r.readyState&&(200===r.status?t(r.response):i(r.statusText))},r.send(null)}}]),e}(),hF=re.vec3(),dF=function(){function e(){x(this,e)}return C(e,[{key:"load",value:function(e,t,i,r,s,n){r=r||{};var o=e.viewer.scene.canvas.spinner;o.processes++,e.dataSource.getSTL(i,(function(i){!function(e,t,i,r){try{var s=_F(i);pF(s)?fF(e,s,t,r):vF(e,mF(i),t,r)}catch(e){t.fire("error",e)}}(e,t,i,r);try{var a=_F(i);pF(a)?fF(e,a,t,r):vF(e,mF(i),t,r),o.processes--,Be.scheduleTask((function(){t.fire("loaded",!0,!1)})),s&&s()}catch(i){o.processes--,e.error(i),n&&n(i),t.fire("error",i)}}),(function(i){o.processes--,e.error(i),n&&n(i),t.fire("error",i)}))}},{key:"parse",value:function(e,t,i,r){var s=e.viewer.scene.canvas.spinner;s.processes++;try{var n=_F(i);pF(n)?fF(e,n,t,r):vF(e,mF(i),t,r),s.processes--,Be.scheduleTask((function(){t.fire("loaded",!0,!1)}))}catch(e){s.processes--,t.fire("error",e)}}}]),e}();function pF(e){var t=new DataView(e);if(84+50*t.getUint32(80,!0)===t.byteLength)return!0;for(var i=[115,111,108,105,100],r=0;r<5;r++)if(i[r]!==t.getUint8(r,!1))return!0;return!1}function fF(e,t,i,r){for(var s,n,o,a,l,u,A,c=new DataView(t),h=c.getUint32(80,!0),d=!1,p=null,f=null,v=null,g=!1,m=0;m<70;m++)1129270351===c.getUint32(m,!1)&&82===c.getUint8(m+4)&&61===c.getUint8(m+5)&&(d=!0,a=[],l=c.getUint8(m+6)/255,u=c.getUint8(m+7)/255,A=c.getUint8(m+8)/255,c.getUint8(m+9));for(var _=new On(i,{roughness:.5}),y=[],b=[],w=r.splitMeshes,B=0;B>5&31)/31,o=(E>>10&31)/31):(s=l,n=u,o=A),(w&&s!==p||n!==f||o!==v)&&(null!==p&&(g=!0),p=s,f=n,v=o)}for(var F=1;F<=3;F++){var k=x+12*F;y.push(c.getFloat32(k,!0)),y.push(c.getFloat32(k+4,!0)),y.push(c.getFloat32(k+8,!0)),b.push(P,C,M),d&&a.push(s,n,o,1)}w&&g&&(gF(i,y,b,a,_,r),y=[],b=[],a=a?[]:null,g=!1)}y.length>0&&gF(i,y,b,a,_,r)}function vF(e,t,i,r){for(var s,n,o,a,l,u,A,c=/facet([\s\S]*?)endfacet/g,h=0,d=/[\s]+([+-]?(?:\d+.\d+|\d+.|\d+|.\d+)(?:[eE][+-]?\d+)?)/.source,p=new RegExp("vertex"+d+d+d,"g"),f=new RegExp("normal"+d+d+d,"g"),v=[],g=[];null!==(a=c.exec(t));){for(l=0,u=0,A=a[0];null!==(a=f.exec(A));)s=parseFloat(a[1]),n=parseFloat(a[2]),o=parseFloat(a[3]),u++;for(;null!==(a=p.exec(A));)v.push(parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3])),g.push(s,n,o),l++;1!==u&&e.error("Error in normal of face "+h),3!==l&&e.error("Error in positions of face "+h),h++}gF(i,v,g,null,new On(i,{roughness:.5}),r)}function gF(e,t,i,r,s,n){for(var o=new Int32Array(t.length/3),a=0,l=o.length;a0?i:null,r=r&&r.length>0?r:null,n.smoothNormals&&re.faceToVertexNormals(t,i,n);var u=hF;je(t,t,u);var A=new Wi(e,{primitive:"triangles",positions:t,normals:i,colors:r,indices:o}),c=new gn(e,{origin:0!==u[0]||0!==u[1]||0!==u[2]?u:null,geometry:A,material:s,edges:n.edges});e.addChild(c)}function mF(e){return"string"!=typeof e?function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",i=0,r=e.length;i1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"STLLoader",e,s))._sceneGraphLoader=new dF,r.dataSource=s.dataSource,r}return C(i,[{key:"dataSource",get:function(){return this._dataSource},set:function(e){this._dataSource=e||new cF}},{key:"load",value:function(e){e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);var t=new Tn(this.viewer.scene,he.apply(e,{isModel:!0})),i=e.src,r=e.stl;return i||r?(i?this._sceneGraphLoader.load(this,t,i,e):this._sceneGraphLoader.parse(this,t,r,e),t):(this.error("load() param expected: either 'src' or 'stl'"),t)}}]),i}(),bF=function(){function e(){x(this,e)}return C(e,[{key:"createRootNode",value:function(){return document.createElement("ul")}},{key:"createNodeElement",value:function(e,t,i,r,s){var n=document.createElement("li");if(n.id=e.nodeId,e.xrayed&&n.classList.add("xrayed-node"),e.children.length>0){var o=document.createElement("a");o.href="#",o.id="switch-".concat(e.nodeId),o.textContent="+",o.classList.add("plus"),t&&o.addEventListener("click",t),n.appendChild(o)}var a=document.createElement("input");a.id="checkbox-".concat(e.nodeId),a.type="checkbox",a.checked=e.checked,a.style["pointer-events"]="all",i&&a.addEventListener("change",i),n.appendChild(a);var l=document.createElement("span");return l.textContent=e.title,n.appendChild(l),r&&(l.oncontextmenu=r),s&&(l.onclick=s),n}},{key:"createDisabledNodeElement",value:function(e){var t=document.createElement("li"),i=document.createElement("a");i.href="#",i.textContent="!",i.classList.add("warn"),i.classList.add("warning"),t.appendChild(i);var r=document.createElement("span");return r.textContent=e,t.appendChild(r),t}},{key:"addChildren",value:function(e,t){var i=document.createElement("ul");t.forEach((function(e){i.appendChild(e)})),e.parentElement.appendChild(i)}},{key:"expand",value:function(e,t,i){e.classList.remove("plus"),e.classList.add("minus"),e.textContent="-",e.removeEventListener("click",t),e.addEventListener("click",i)}},{key:"collapse",value:function(e,t,i){if(e){var r=e.parentElement;if(r){var s=r.querySelector("ul");s&&(r.removeChild(s),e.classList.remove("minus"),e.classList.add("plus"),e.textContent="+",e.removeEventListener("click",i),e.addEventListener("click",t))}}}},{key:"isExpanded",value:function(e){return void 0!==e.parentElement.getElementsByTagName("li")[0]}},{key:"getId",value:function(e){return e.parentElement.id}},{key:"getIdFromCheckbox",value:function(e){return e.id.replace("checkbox-","")}},{key:"getSwitchElement",value:function(e){return document.getElementById("switch-".concat(e))}},{key:"isChecked",value:function(e){return e.checked}},{key:"setCheckbox",value:function(e,t){var i=document.getElementById("checkbox-".concat(e));i&&t!==i.checked&&(i.checked=t)}},{key:"setXRayed",value:function(e,t){var i=document.getElementById(e);i&&(t?i.classList.add("xrayed-node"):i.classList.remove("xrayed-node"))}},{key:"setHighlighted",value:function(e,t){var i=document.getElementById(e);i&&(t?(i.scrollIntoView({block:"center"}),i.classList.add("highlighted-node")):i.classList.remove("highlighted-node"))}}]),e}(),wF=[],BF=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,i),(r=t.call(this,"TreeViewPlugin",e)).errors=[],r.valid=!0;var n=s.containerElement||document.getElementById(s.containerElementId);if(!(n instanceof HTMLElement))return r.error("Mandatory config expected: valid containerElementId or containerElement"),y(r);for(var o=0;;o++)if(!wF[o]){wF[o]=b(r),r._index=o,r._id="tree-".concat(o);break}if(r._containerElement=n,r._metaModels={},r._autoAddModels=!1!==s.autoAddModels,r._autoExpandDepth=s.autoExpandDepth||0,r._sortNodes=!1!==s.sortNodes,r._viewer=e,r._rootElement=null,r._muteSceneEvents=!1,r._muteTreeEvents=!1,r._rootNodes=[],r._objectNodes={},r._nodeNodes={},r._rootNames={},r._sortNodes=s.sortNodes,r._pruneEmptyNodes=s.pruneEmptyNodes,r._showListItemElementId=null,r._renderService=s.renderService||new bF,!r._renderService)throw new Error("TreeViewPlugin: no render service set");if(r._containerElement.oncontextmenu=function(e){e.preventDefault()},r._onObjectVisibility=r._viewer.scene.on("objectVisibility",(function(e){if(!r._muteSceneEvents){var t=e.id,i=r._objectNodes[t];if(i){var s=e.visible;if(s!==i.checked){r._muteTreeEvents=!0,i.checked=s,s?i.numVisibleEntities++:i.numVisibleEntities--,r._renderService.setCheckbox(i.nodeId,s);for(var n=i.parent;n;)n.checked=s,s?n.numVisibleEntities++:n.numVisibleEntities--,r._renderService.setCheckbox(n.nodeId,n.numVisibleEntities>0),n=n.parent;r._muteTreeEvents=!1}}}})),r._onObjectXrayed=r._viewer.scene.on("objectXRayed",(function(e){if(!r._muteSceneEvents){var t=e.id,i=r._objectNodes[t];if(i){r._muteTreeEvents=!0;var s=e.xrayed;s!==i.xrayed&&(i.xrayed=s,r._renderService.setXRayed(i.nodeId,s),r._muteTreeEvents=!1)}}})),r._switchExpandHandler=function(e){e.preventDefault(),e.stopPropagation();var t=e.target;r._expandSwitchElement(t)},r._switchCollapseHandler=function(e){e.preventDefault(),e.stopPropagation();var t=e.target;r._collapseSwitchElement(t)},r._checkboxChangeHandler=function(e){if(!r._muteTreeEvents){r._muteSceneEvents=!0;var t=e.target,i=r._renderService.isChecked(t),s=r._renderService.getIdFromCheckbox(t),n=r._nodeNodes[s],o=r._viewer.scene.objects,a=0;r._withNodeTree(n,(function(e){var t=e.objectId,s=o[t],n=0===e.children.length;e.numVisibleEntities=i?e.numEntities:0,n&&i!==e.checked&&a++,e.checked=i,r._renderService.setCheckbox(e.nodeId,i),s&&(s.visible=i)}));for(var l=n.parent;l;)l.checked=i,i?l.numVisibleEntities+=a:l.numVisibleEntities-=a,r._renderService.setCheckbox(l.nodeId,l.numVisibleEntities>0),l=l.parent;r._muteSceneEvents=!1}},r._hierarchy=s.hierarchy||"containment",r._autoExpandDepth=s.autoExpandDepth||0,r._autoAddModels){for(var a=Object.keys(r.viewer.metaScene.metaModels),l=0,u=a.length;l1&&void 0!==arguments[1]?arguments[1]:{};if(this._containerElement){var r=this.viewer.scene.models[e];if(!r)throw"Model not found: "+e;var s=this.viewer.metaScene.metaModels[e];s?this._metaModels[e]?this.warn("Model already added: "+e):(this._metaModels[e]=s,i&&i.rootName&&(this._rootNames[e]=i.rootName),r.on("destroyed",(function(){t.removeModel(r.id)})),this._createNodes()):this.error("MetaModel not found: "+e)}}},{key:"removeModel",value:function(e){this._containerElement&&(this._metaModels[e]&&(this._rootNames[e]&&delete this._rootNames[e],delete this._metaModels[e],this._createNodes()))}},{key:"showNode",value:function(e){this.unShowNode();var t=this._objectNodes[e];if(t){var i=t.nodeId,r=this._renderService.getSwitchElement(i);if(r)return this._expandSwitchElement(r),r.scrollIntoView(),!0;var s=[];s.unshift(t);for(var n=t.parent;n;)s.unshift(n),n=n.parent;for(var o=0,a=s.length;o0;return this.valid}},{key:"_validateMetaModelForStoreysHierarchy",value:function(){return!0}},{key:"_createEnabledNodes",value:function(){switch(this._pruneEmptyNodes&&this._findEmptyNodes(),this._hierarchy){case"storeys":this._createStoreysNodes(),0===this._rootNodes.length&&this.error("Failed to build storeys hierarchy");break;case"types":this._createTypesNodes();break;default:this._createContainmentNodes()}this._sortNodes&&this._doSortNodes(),this._synchNodesToEntities(),this._createTrees(),this.expandToDepth(this._autoExpandDepth)}},{key:"_createDisabledNodes",value:function(){var e=this._renderService.createRootNode();this._rootElement=e,this._containerElement.appendChild(e);var t=this._viewer.metaScene.rootMetaObjects;for(var i in t){var r=t[i],s=r.type,n=r.name,o=n&&""!==n&&"Undefined"!==n&&"Default"!==n?n:s,a=this._renderService.createDisabledNodeElement(o);e.appendChild(a)}}},{key:"_findEmptyNodes",value:function(){var e=this._viewer.metaScene.rootMetaObjects;for(var t in e)this._findEmptyNodes2(e[t])}},{key:"_findEmptyNodes2",value:function(e){var t=this.viewer,i=t.scene,r=e.children,s=e.id,n=i.objects[s];if(e._countEntities=0,n&&e._countEntities++,r)for(var o=0,a=r.length;os.aabb[n]?-1:e.aabb[n]r?1:0}},{key:"_synchNodesToEntities",value:function(){for(var e=Object.keys(this.viewer.metaScene.metaObjects),t=this._viewer.metaScene.metaObjects,i=this._viewer.scene.objects,r=0,s=e.length;r0){for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"ViewCull",e))._objectCullStates=CF(e.scene),r._maxTreeDepth=s.maxTreeDepth||8,r._modelInfos={},r._frustum=new Ie,r._kdRoot=null,r._frustumDirty=!1,r._kdTreeDirty=!1,r._onViewMatrix=e.scene.camera.on("viewMatrix",(function(){r._frustumDirty=!0})),r._onProjMatrix=e.scene.camera.on("projMatMatrix",(function(){r._frustumDirty=!0})),r._onModelLoaded=e.scene.on("modelLoaded",(function(e){var t=r.viewer.scene.models[e];t&&r._addModel(t)})),r._onSceneTick=e.scene.on("tick",(function(){r._doCull()})),r}return C(i,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}},{key:"_addModel",value:function(e){var t=this,i={model:e,onDestroyed:e.on("destroyed",(function(){t._removeModel(e)}))};this._modelInfos[e.id]=i,this._kdTreeDirty=!0}},{key:"_removeModel",value:function(e){var t=this._modelInfos[e.id];t&&(t.model.off(t.onDestroyed),delete this._modelInfos[e.id],this._kdTreeDirty=!0)}},{key:"_doCull",value:function(){var e=this._frustumDirty||this._kdTreeDirty;if(this._frustumDirty&&this._buildFrustum(),this._kdTreeDirty&&this._buildKDTree(),e){var t=this._kdRoot;t&&this._visitKDNode(t)}}},{key:"_buildFrustum",value:function(){var e=this.viewer.scene.camera;De(this._frustum,e.viewMatrix,e.projMatrix),this._frustumDirty=!1}},{key:"_buildKDTree",value:function(){var e=this.viewer.scene;this._kdRoot,this._kdRoot={aabb:e.getAABB(),intersection:Ie.INTERSECT};for(var t=0,i=this._objectCullStates.numObjects;t=this._maxTreeDepth)return e.objects=e.objects||[],e.objects.push(i),void re.expandAABB3(e.aabb,s);if(e.left&&re.containsAABB3(e.left.aabb,s))this._insertEntityIntoKDTree(e.left,t,i,r+1);else if(e.right&&re.containsAABB3(e.right.aabb,s))this._insertEntityIntoKDTree(e.right,t,i,r+1);else{var n=e.aabb;MF[0]=n[3]-n[0],MF[1]=n[4]-n[1],MF[2]=n[5]-n[2];var o=0;if(MF[1]>MF[o]&&(o=1),MF[2]>MF[o]&&(o=2),!e.left){var a=n.slice();if(a[o+3]=(n[o]+n[o+3])/2,e.left={aabb:a,intersection:Ie.INTERSECT},re.containsAABB3(a,s))return void this._insertEntityIntoKDTree(e.left,t,i,r+1)}if(!e.right){var l=n.slice();if(l[o]=(n[o]+n[o+3])/2,e.right={aabb:l,intersection:Ie.INTERSECT},re.containsAABB3(l,s))return void this._insertEntityIntoKDTree(e.right,t,i,r+1)}e.objects=e.objects||[],e.objects.push(i),re.expandAABB3(e.aabb,s)}}},{key:"_visitKDNode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ie.INTERSECT;if(t===Ie.INTERSECT||e.intersects!==t){t===Ie.INTERSECT&&(t=Se(this._frustum,e.aabb),e.intersects=t);var i=t===Ie.OUTSIDE,r=e.objects;if(r&&r.length>0)for(var s=0,n=r.length;s0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this.cacheBuster=!1!==t.cacheBuster}return C(e,[{key:"_cacheBusterURL",value:function(e){if(!this.cacheBuster)return e;var t=(new Date).getTime();return e.indexOf("?")>-1?e+"&_="+t:e+"?_="+t}},{key:"getManifest",value:function(e,t,i){he.loadJSON(this._cacheBusterURL(e),(function(e){t(e)}),(function(e){i(e)}))}},{key:"getMetaModel",value:function(e,t,i){he.loadJSON(this._cacheBusterURL(e),(function(e){t(e)}),(function(e){i(e)}))}},{key:"getXKT",value:function(e,t,i){var r=function(){};t=t||r,i=i||r;var s=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(s){var n=!!s[2],o=s[3];o=window.decodeURIComponent(o),n&&(o=window.atob(o));try{for(var a=new ArrayBuffer(o.length),l=new Uint8Array(a),u=0;u=0;)e[t]=0}var i=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]),r=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]),s=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),n=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=new Array(576);t(o);var a=new Array(60);t(a);var l=new Array(512);t(l);var u=new Array(256);t(u);var A=new Array(29);t(A);var c,h,d,p=new Array(30);function f(e,t,i,r,s){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=s,this.has_stree=e&&e.length}function v(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}t(p);var g=function(e){return e<256?l[e]:l[256+(e>>>7)]},m=function(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},_=function(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<>>=1,i<<=1}while(--t>0);return i>>>1},w=function(e,t,i){var r,s,n=new Array(16),o=0;for(r=1;r<=15;r++)o=o+i[r-1]<<1,n[r]=o;for(s=0;s<=t;s++){var a=e[2*s+1];0!==a&&(e[2*s]=b(n[a]++,a))}},x=function(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},P=function(e){e.bi_valid>8?m(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},C=function(e,t,i,r){var s=2*t,n=2*i;return e[s]>1;i>=1;i--)M(e,n,i);s=l;do{i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],M(e,n,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,n[2*s]=n[2*i]+n[2*r],e.depth[s]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,n[2*i+1]=n[2*r+1]=s,e.heap[1]=s++,M(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,r,s,n,o,a,l=t.dyn_tree,u=t.max_code,A=t.stat_desc.static_tree,c=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,f=0;for(n=0;n<=15;n++)e.bl_count[n]=0;for(l[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)(n=l[2*l[2*(r=e.heap[i])+1]+1]+1)>p&&(n=p,f++),l[2*r+1]=n,r>u||(e.bl_count[n]++,o=0,r>=d&&(o=h[r-d]),a=l[2*r],e.opt_len+=a*(n+o),c&&(e.static_len+=a*(A[2*r+1]+o)));if(0!==f){do{for(n=p-1;0===e.bl_count[n];)n--;e.bl_count[n]--,e.bl_count[n+1]+=2,e.bl_count[p]--,f-=2}while(f>0);for(n=p;0!==n;n--)for(r=e.bl_count[n];0!==r;)(s=e.heap[--i])>u||(l[2*s+1]!==n&&(e.opt_len+=(n-l[2*s+1])*l[2*s],l[2*s+1]=n),r--)}}(e,t),w(n,u,e.bl_count)},k=function(e,t,i){var r,s,n=-1,o=t[1],a=0,l=7,u=4;for(0===o&&(l=138,u=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)s=o,o=t[2*(r+1)+1],++a>=7;v<30;v++)for(p[v]=g<<7,e=0;e<1<0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),F(e,e.l_desc),F(e,e.d_desc),u=function(e){var t;for(k(e,e.dyn_ltree,e.l_desc.max_code),k(e,e.dyn_dtree,e.d_desc.max_code),F(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*n[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),s=e.opt_len+3+7>>>3,(l=e.static_len+3+7>>>3)<=s&&(s=l)):s=l=i+5,i+4<=s&&-1!==t?S(e,t,i,r):4===e.strategy||l===s?(_(e,2+(r?1:0),3),E(e,o,a)):(_(e,4+(r?1:0),3),function(e,t,i,r){var s;for(_(e,t-257,5),_(e,i-1,5),_(e,r-4,4),s=0;s>8,e.pending_buf[e.sym_buf+e.sym_next++]=i,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(u[i]+256+1)]++,e.dyn_dtree[2*g(t)]++),e.sym_next===e.sym_end},O=function(e){_(e,2,3),y(e,256,o),function(e){16===e.bi_valid?(m(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)},N=function(e,t,i,r){for(var s=65535&e|0,n=e>>>16&65535|0,o=0;0!==i;){i-=o=i>2e3?2e3:i;do{n=n+(s=s+t[r++]|0)|0}while(--o);s%=65521,n%=65521}return s|n<<16|0},Q=new Uint32Array(function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}()),V=function(e,t,i,r){var s=Q,n=r+i;e^=-1;for(var o=r;o>>8^s[255&(e^t[o])];return-1^e},H={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"},j={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},G=T,z=L,W=R,K=U,X=O,Y=j.Z_NO_FLUSH,J=j.Z_PARTIAL_FLUSH,Z=j.Z_FULL_FLUSH,q=j.Z_FINISH,$=j.Z_BLOCK,ee=j.Z_OK,te=j.Z_STREAM_END,ie=j.Z_STREAM_ERROR,re=j.Z_DATA_ERROR,se=j.Z_BUF_ERROR,ne=j.Z_DEFAULT_COMPRESSION,oe=j.Z_FILTERED,ae=j.Z_HUFFMAN_ONLY,le=j.Z_RLE,ue=j.Z_FIXED,Ae=j.Z_UNKNOWN,ce=j.Z_DEFLATED,he=258,de=262,pe=42,fe=113,ve=666,ge=function(e,t){return e.msg=H[t],t},me=function(e){return 2*e-(e>4?9:0)},_e=function(e){for(var t=e.length;--t>=0;)e[t]=0},ye=function(e){var t,i,r,s=e.w_size;r=t=e.hash_size;do{i=e.head[--r],e.head[r]=i>=s?i-s:0}while(--t);r=t=s;do{i=e.prev[--r],e.prev[r]=i>=s?i-s:0}while(--t)},be=function(e,t,i){return(t<e.avail_out&&(i=e.avail_out),0!==i&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+i),e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))},Be=function(e,t){W(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,we(e.strm)},xe=function(e,t){e.pending_buf[e.pending++]=t},Pe=function(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Ce=function(e,t,i,r){var s=e.avail_in;return s>r&&(s=r),0===s?0:(e.avail_in-=s,t.set(e.input.subarray(e.next_in,e.next_in+s),i),1===e.state.wrap?e.adler=N(e.adler,t,s,i):2===e.state.wrap&&(e.adler=V(e.adler,t,s,i)),e.next_in+=s,e.total_in+=s,s)},Me=function(e,t){var i,r,s=e.max_chain_length,n=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-de?e.strstart-(e.w_size-de):0,u=e.window,A=e.w_mask,c=e.prev,h=e.strstart+he,d=u[n+o-1],p=u[n+o];e.prev_length>=e.good_match&&(s>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(i=t)+o]===p&&u[i+o-1]===d&&u[i]===u[n]&&u[++i]===u[n+1]){n+=2,i++;do{}while(u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&no){if(e.match_start=t,o=r,r>=a)break;d=u[n+o-1],p=u[n+o]}}}while((t=c[t&A])>l&&0!=--s);return o<=e.lookahead?o:e.lookahead},Ee=function(e){var t,i,r,s=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=s+(s-de)&&(e.window.set(e.window.subarray(s,s+s-i),0),e.match_start-=s,e.strstart-=s,e.block_start-=s,e.insert>e.strstart&&(e.insert=e.strstart),ye(e),i+=s),0===e.strm.avail_in)break;if(t=Ce(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=t,e.lookahead+e.insert>=3)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=be(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=be(e,e.ins_h,e.window[r+3-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookaheade.w_size?e.w_size:e.pending_buf_size-5,o=0,a=e.strm.avail_in;do{if(i=65535,s=e.bi_valid+42>>3,e.strm.avail_out(r=e.strstart-e.block_start)+e.strm.avail_in&&(i=r+e.strm.avail_in),i>s&&(i=s),i>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,we(e.strm),r&&(r>i&&(r=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,i-=r),i&&(Ce(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(0===o);return(a-=e.strm.avail_in)&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_waters&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,s+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),s>e.strm.avail_in&&(s=e.strm.avail_in),s&&(Ce(e.strm,e.window,e.strstart,s),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.high_water>3,n=(s=e.pending_buf_size-s>65535?65535:e.pending_buf_size-s)>e.w_size?e.w_size:s,((r=e.strstart-e.block_start)>=n||(r||t===q)&&t!==Y&&0===e.strm.avail_in&&r<=s)&&(i=r>s?s:r,o=t===q&&0===e.strm.avail_in&&i===r?1:0,z(e,e.block_start,i,o),e.block_start+=i,we(e.strm)),o?3:1)},ke=function(e,t){for(var i,r;;){if(e.lookahead=3&&(e.ins_h=be(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-de&&(e.match_length=Me(e,i)),e.match_length>=3)if(r=K(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=be(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=be(e,e.ins_h,e.window[e.strstart+1]);else r=K(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Be(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===q?(Be(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Be(e,!1),0===e.strm.avail_out)?1:2},Ie=function(e,t){for(var i,r,s;;){if(e.lookahead=3&&(e.ins_h=be(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){s=e.strstart+e.lookahead-3,r=K(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=s&&(e.ins_h=be(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(Be(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=K(e,0,e.window[e.strstart-1]))&&Be(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=K(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===q?(Be(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Be(e,!1),0===e.strm.avail_out)?1:2};function De(e,t,i,r,s){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=s}var Se=[new De(0,0,0,0,Fe),new De(4,4,8,4,ke),new De(4,5,16,8,ke),new De(4,6,32,32,ke),new De(4,4,16,16,Ie),new De(8,16,32,32,Ie),new De(8,16,128,128,Ie),new De(8,32,128,256,Ie),new De(32,128,258,1024,Ie),new De(32,258,258,4096,Ie)];function Te(){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=ce,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),_e(this.dyn_ltree),_e(this.dyn_dtree),_e(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),_e(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),_e(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 Le=function(e){if(!e)return 1;var t=e.state;return!t||t.strm!==e||t.status!==pe&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==fe&&t.status!==ve?1:0},Re=function(e){if(Le(e))return ge(e,ie);e.total_in=e.total_out=0,e.data_type=Ae;var t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?pe:fe,e.adler=2===t.wrap?0:1,t.last_flush=-2,G(t),ee},Ue=function(e){var t,i=Re(e);return i===ee&&((t=e.state).window_size=2*t.w_size,_e(t.head),t.max_lazy_match=Se[t.level].max_lazy,t.good_match=Se[t.level].good_length,t.nice_match=Se[t.level].nice_length,t.max_chain_length=Se[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),i},Oe=function(e,t,i,r,s,n){if(!e)return ie;var o=1;if(t===ne&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),s<1||s>9||i!==ce||r<8||r>15||t<0||t>9||n<0||n>ue||8===r&&1!==o)return ge(e,ie);8===r&&(r=9);var a=new Te;return e.state=a,a.strm=e,a.status=pe,a.wrap=o,a.gzhead=null,a.w_bits=r,a.w_size=1<$||t<0)return e?ge(e,ie):ie;var i=e.state;if(!e.output||0!==e.avail_in&&!e.input||i.status===ve&&t!==q)return ge(e,0===e.avail_out?se:ie);var r=i.last_flush;if(i.last_flush=t,0!==i.pending){if(we(e),0===e.avail_out)return i.last_flush=-1,ee}else if(0===e.avail_in&&me(t)<=me(r)&&t!==q)return ge(e,se);if(i.status===ve&&0!==e.avail_in)return ge(e,se);if(i.status===pe&&0===i.wrap&&(i.status=fe),i.status===pe){var s=ce+(i.w_bits-8<<4)<<8;if(s|=(i.strategy>=ae||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(s|=32),Pe(i,s+=31-s%31),0!==i.strstart&&(Pe(i,e.adler>>>16),Pe(i,65535&e.adler)),e.adler=1,i.status=fe,we(e),0!==i.pending)return i.last_flush=-1,ee}if(57===i.status)if(e.adler=0,xe(i,31),xe(i,139),xe(i,8),i.gzhead)xe(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),xe(i,255&i.gzhead.time),xe(i,i.gzhead.time>>8&255),xe(i,i.gzhead.time>>16&255),xe(i,i.gzhead.time>>24&255),xe(i,9===i.level?2:i.strategy>=ae||i.level<2?4:0),xe(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(xe(i,255&i.gzhead.extra.length),xe(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=V(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(xe(i,0),xe(i,0),xe(i,0),xe(i,0),xe(i,0),xe(i,9===i.level?2:i.strategy>=ae||i.level<2?4:0),xe(i,3),i.status=fe,we(e),0!==i.pending)return i.last_flush=-1,ee;if(69===i.status){if(i.gzhead.extra){for(var n=i.pending,o=(65535&i.gzhead.extra.length)-i.gzindex;i.pending+o>i.pending_buf_size;){var a=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+a),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>n&&(e.adler=V(e.adler,i.pending_buf,i.pending-n,n)),i.gzindex+=a,we(e),0!==i.pending)return i.last_flush=-1,ee;n=0,o-=a}var l=new Uint8Array(i.gzhead.extra);i.pending_buf.set(l.subarray(i.gzindex,i.gzindex+o),i.pending),i.pending+=o,i.gzhead.hcrc&&i.pending>n&&(e.adler=V(e.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){var u,A=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>A&&(e.adler=V(e.adler,i.pending_buf,i.pending-A,A)),we(e),0!==i.pending)return i.last_flush=-1,ee;A=0}u=i.gzindexA&&(e.adler=V(e.adler,i.pending_buf,i.pending-A,A)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){var c,h=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>h&&(e.adler=V(e.adler,i.pending_buf,i.pending-h,h)),we(e),0!==i.pending)return i.last_flush=-1,ee;h=0}c=i.gzindexh&&(e.adler=V(e.adler,i.pending_buf,i.pending-h,h))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(we(e),0!==i.pending))return i.last_flush=-1,ee;xe(i,255&e.adler),xe(i,e.adler>>8&255),e.adler=0}if(i.status=fe,we(e),0!==i.pending)return i.last_flush=-1,ee}if(0!==e.avail_in||0!==i.lookahead||t!==Y&&i.status!==ve){var d=0===i.level?Fe(i,t):i.strategy===ae?function(e,t){for(var i;;){if(0===e.lookahead&&(Ee(e),0===e.lookahead)){if(t===Y)return 1;break}if(e.match_length=0,i=K(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(Be(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===q?(Be(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Be(e,!1),0===e.strm.avail_out)?1:2}(i,t):i.strategy===le?function(e,t){for(var i,r,s,n,o=e.window;;){if(e.lookahead<=he){if(Ee(e),e.lookahead<=he&&t===Y)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&((r=o[s=e.strstart-1])===o[++s]&&r===o[++s]&&r===o[++s])){n=e.strstart+he;do{}while(r===o[++s]&&r===o[++s]&&r===o[++s]&&r===o[++s]&&r===o[++s]&&r===o[++s]&&r===o[++s]&&r===o[++s]&&se.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=K(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=K(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(Be(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===q?(Be(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Be(e,!1),0===e.strm.avail_out)?1:2}(i,t):Se[i.level].func(i,t);if(3!==d&&4!==d||(i.status=ve),1===d||3===d)return 0===e.avail_out&&(i.last_flush=-1),ee;if(2===d&&(t===J?X(i):t!==$&&(z(i,0,0,!1),t===Z&&(_e(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),we(e),0===e.avail_out))return i.last_flush=-1,ee}return t!==q?ee:i.wrap<=0?te:(2===i.wrap?(xe(i,255&e.adler),xe(i,e.adler>>8&255),xe(i,e.adler>>16&255),xe(i,e.adler>>24&255),xe(i,255&e.total_in),xe(i,e.total_in>>8&255),xe(i,e.total_in>>16&255),xe(i,e.total_in>>24&255)):(Pe(i,e.adler>>>16),Pe(i,65535&e.adler)),we(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?ee:te)},He=function(e){if(Le(e))return ie;var t=e.state.status;return e.state=null,t===fe?ge(e,re):ee},je=function(e,t){var i=t.length;if(Le(e))return ie;var r=e.state,s=r.wrap;if(2===s||1===s&&r.status!==pe||r.lookahead)return ie;if(1===s&&(e.adler=N(e.adler,t,i,0)),r.wrap=0,i>=r.w_size){0===s&&(_e(r.head),r.strstart=0,r.block_start=0,r.insert=0);var n=new Uint8Array(r.w_size);n.set(t.subarray(i-r.w_size,i),0),t=n,i=r.w_size}var o=e.avail_in,a=e.next_in,l=e.input;for(e.avail_in=i,e.next_in=0,e.input=t,Ee(r);r.lookahead>=3;){var u=r.strstart,A=r.lookahead-2;do{r.ins_h=be(r,r.ins_h,r.window[u+3-1]),r.prev[u&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=u,u++}while(--A);r.strstart=u,r.lookahead=2,Ee(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=a,e.input=l,e.avail_in=o,r.wrap=s,ee},Ge=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},ze=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=B(i))throw new TypeError(i+"must be non-object");for(var r in i)Ge(i,r)&&(e[r]=i[r])}}return e},We=function(e){for(var t=0,i=0,r=e.length;i=252?6:Ye>=248?5:Ye>=240?4:Ye>=224?3:Ye>=192?2:1;Xe[254]=Xe[254]=1;var Je=function(e){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);var t,i,r,s,n,o=e.length,a=0;for(s=0;s>>6,t[n++]=128|63&i):i<65536?(t[n++]=224|i>>>12,t[n++]=128|i>>>6&63,t[n++]=128|63&i):(t[n++]=240|i>>>18,t[n++]=128|i>>>12&63,t[n++]=128|i>>>6&63,t[n++]=128|63&i);return t},Ze=function(e,t){var i,r,s=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));var n=new Array(2*s);for(r=0,i=0;i4)n[r++]=65533,i+=a-1;else{for(o&=2===a?31:3===a?15:7;a>1&&i1?n[r++]=65533:o<65536?n[r++]=o:(o-=65536,n[r++]=55296|o>>10&1023,n[r++]=56320|1023&o)}}}return function(e,t){if(t<65534&&e.subarray&&Ke)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));for(var i="",r=0;re.length&&(t=e.length);for(var i=t-1;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+Xe[e[i]]>t?i:t},$e=function(){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},et=Object.prototype.toString,tt=j.Z_NO_FLUSH,it=j.Z_SYNC_FLUSH,rt=j.Z_FULL_FLUSH,st=j.Z_FINISH,nt=j.Z_OK,ot=j.Z_STREAM_END,at=j.Z_DEFAULT_COMPRESSION,lt=j.Z_DEFAULT_STRATEGY,ut=j.Z_DEFLATED;function At(e){this.options=ze({level:at,method:ut,chunkSize:16384,windowBits:15,memLevel:8,strategy:lt},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $e,this.strm.avail_out=0;var i=Ne(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==nt)throw new Error(H[i]);if(t.header&&Qe(this.strm,t.header),t.dictionary){var r;if(r="string"==typeof t.dictionary?Je(t.dictionary):"[object ArrayBuffer]"===et.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(i=je(this.strm,r))!==nt)throw new Error(H[i]);this._dict_set=!0}}function ct(e,t){var i=new At(t);if(i.push(e,!0),i.err)throw i.msg||H[i.err];return i.result}At.prototype.push=function(e,t){var i,r,s=this.strm,n=this.options.chunkSize;if(this.ended)return!1;for(r=t===~~t?t:!0===t?st:tt,"string"==typeof e?s.input=Je(e):"[object ArrayBuffer]"===et.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;;)if(0===s.avail_out&&(s.output=new Uint8Array(n),s.next_out=0,s.avail_out=n),(r===it||r===rt)&&s.avail_out<=6)this.onData(s.output.subarray(0,s.next_out)),s.avail_out=0;else{if((i=Ve(s,r))===ot)return s.next_out>0&&this.onData(s.output.subarray(0,s.next_out)),i=He(this.strm),this.onEnd(i),this.ended=!0,i===nt;if(0!==s.avail_out){if(r>0&&s.next_out>0)this.onData(s.output.subarray(0,s.next_out)),s.avail_out=0;else if(0===s.avail_in)break}else this.onData(s.output)}return!0},At.prototype.onData=function(e){this.chunks.push(e)},At.prototype.onEnd=function(e){e===nt&&(this.result=We(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ht=At,dt=ct,pt=function(e,t){return(t=t||{}).raw=!0,ct(e,t)},ft=function(e,t){return(t=t||{}).gzip=!0,ct(e,t)},vt=16209,gt=function(e,t){var i,r,s,n,o,a,l,u,A,c,h,d,p,f,v,g,m,_,y,b,w,B,x,P,C=e.state;i=e.next_in,x=e.input,r=i+(e.avail_in-5),s=e.next_out,P=e.output,n=s-(t-e.avail_out),o=s+(e.avail_out-257),a=C.dmax,l=C.wsize,u=C.whave,A=C.wnext,c=C.window,h=C.hold,d=C.bits,p=C.lencode,f=C.distcode,v=(1<>>=_=m>>>24,d-=_,0===(_=m>>>16&255))P[s++]=65535&m;else{if(!(16&_)){if(0==(64&_)){m=p[(65535&m)+(h&(1<<_)-1)];continue t}if(32&_){C.mode=16191;break e}e.msg="invalid literal/length code",C.mode=vt;break e}y=65535&m,(_&=15)&&(d<_&&(h+=x[i++]<>>=_,d-=_),d<15&&(h+=x[i++]<>>=_=m>>>24,d-=_,!(16&(_=m>>>16&255))){if(0==(64&_)){m=f[(65535&m)+(h&(1<<_)-1)];continue i}e.msg="invalid distance code",C.mode=vt;break e}if(b=65535&m,d<(_&=15)&&(h+=x[i++]<a){e.msg="invalid distance too far back",C.mode=vt;break e}if(h>>>=_,d-=_,b>(_=s-n)){if((_=b-_)>u&&C.sane){e.msg="invalid distance too far back",C.mode=vt;break e}if(w=0,B=c,0===A){if(w+=l-_,_2;)P[s++]=B[w++],P[s++]=B[w++],P[s++]=B[w++],y-=3;y&&(P[s++]=B[w++],y>1&&(P[s++]=B[w++]))}else{w=s-b;do{P[s++]=P[w++],P[s++]=P[w++],P[s++]=P[w++],y-=3}while(y>2);y&&(P[s++]=P[w++],y>1&&(P[s++]=P[w++]))}break}}break}}while(i>3,h&=(1<<(d-=y<<3))-1,e.next_in=i,e.next_out=s,e.avail_in=i=1&&0===F[b];b--);if(w>b&&(w=b),0===b)return s[n++]=20971520,s[n++]=20971520,a.bits=1,0;for(y=1;y0&&(0===e||1!==b))return-1;for(k[1]=0,m=1;m<15;m++)k[m+1]=k[m]+F[m];for(_=0;_852||2===e&&C>592)return 1;for(;;){p=m-x,o[_]+1=d?(f=I[o[_]-d],v=E[o[_]-d]):(f=96,v=0),l=1<>x)+(u-=l)]=p<<24|f<<16|v|0}while(0!==u);for(l=1<>=1;if(0!==l?(M&=l-1,M+=l):M=0,_++,0==--F[m]){if(m===b)break;m=t[i+o[_]]}if(m>w&&(M&c)!==A){for(0===x&&(x=w),h+=y,P=1<<(B=m-x);B+x852||2===e&&C>592)return 1;s[A=M&c]=w<<24|B<<16|h-n|0}}return 0!==M&&(s[h+M]=m-x<<24|64<<16|0),a.bits=w,0},Bt=j.Z_FINISH,xt=j.Z_BLOCK,Pt=j.Z_TREES,Ct=j.Z_OK,Mt=j.Z_STREAM_END,Et=j.Z_NEED_DICT,Ft=j.Z_STREAM_ERROR,kt=j.Z_DATA_ERROR,It=j.Z_MEM_ERROR,Dt=j.Z_BUF_ERROR,St=j.Z_DEFLATED,Tt=16180,Lt=16190,Rt=16191,Ut=16192,Ot=16194,Nt=16199,Qt=16200,Vt=16206,Ht=16209,jt=function(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)};function Gt(){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 zt,Wt,Kt=function(e){if(!e)return 1;var t=e.state;return!t||t.strm!==e||t.mode16211?1:0},Xt=function(e){if(Kt(e))return Ft;var t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Tt,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Ct},Yt=function(e){if(Kt(e))return Ft;var t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Xt(e)},Jt=function(e,t){var i;if(Kt(e))return Ft;var r=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Ft:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,Yt(e))},Zt=function(e,t){if(!e)return Ft;var i=new Gt;e.state=i,i.strm=e,i.window=null,i.mode=Tt;var r=Jt(e,t);return r!==Ct&&(e.state=null),r},qt=!0,$t=function(e){if(qt){zt=new Int32Array(512),Wt=new Int32Array(32);for(var t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(wt(1,e.lens,0,288,zt,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;wt(2,e.lens,0,32,Wt,0,e.work,{bits:5}),qt=!1}e.lencode=zt,e.lenbits=9,e.distcode=Wt,e.distbits=5},ei=function(e,t,i,r){var s,n=e.state;return null===n.window&&(n.wsize=1<=n.wsize?(n.window.set(t.subarray(i-n.wsize,i),0),n.wnext=0,n.whave=n.wsize):((s=n.wsize-n.wnext)>r&&(s=r),n.window.set(t.subarray(i-r,i-r+s),n.wnext),(r-=s)?(n.window.set(t.subarray(i-r,i),0),n.wnext=r,n.whave=n.wsize):(n.wnext+=s,n.wnext===n.wsize&&(n.wnext=0),n.whave>>8&255,i.check=V(i.check,M,2,0),u=0,A=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",i.mode=Ht;break}if((15&u)!==St){e.msg="unknown compression method",i.mode=Ht;break}if(A-=4,w=8+(15&(u>>>=4)),0===i.wbits&&(i.wbits=w),w>15||w>i.wbits){e.msg="invalid window size",i.mode=Ht;break}i.dmax=1<>8&1),512&i.flags&&4&i.wrap&&(M[0]=255&u,M[1]=u>>>8&255,i.check=V(i.check,M,2,0)),u=0,A=0,i.mode=16182;case 16182:for(;A<32;){if(0===a)break e;a--,u+=r[n++]<>>8&255,M[2]=u>>>16&255,M[3]=u>>>24&255,i.check=V(i.check,M,4,0)),u=0,A=0,i.mode=16183;case 16183:for(;A<16;){if(0===a)break e;a--,u+=r[n++]<>8),512&i.flags&&4&i.wrap&&(M[0]=255&u,M[1]=u>>>8&255,i.check=V(i.check,M,2,0)),u=0,A=0,i.mode=16184;case 16184:if(1024&i.flags){for(;A<16;){if(0===a)break e;a--,u+=r[n++]<>>8&255,i.check=V(i.check,M,2,0)),u=0,A=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&((d=i.length)>a&&(d=a),d&&(i.head&&(w=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(r.subarray(n,n+d),w)),512&i.flags&&4&i.wrap&&(i.check=V(i.check,r,d,n)),a-=d,n+=d,i.length-=d),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break e;d=0;do{w=r[n+d++],i.head&&w&&i.length<65536&&(i.head.name+=String.fromCharCode(w))}while(w&&d>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Rt;break;case 16189:for(;A<32;){if(0===a)break e;a--,u+=r[n++]<>>=7&A,A-=7&A,i.mode=Vt;break}for(;A<3;){if(0===a)break e;a--,u+=r[n++]<>>=1)){case 0:i.mode=16193;break;case 1:if($t(i),i.mode=Nt,t===Pt){u>>>=2,A-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=Ht}u>>>=2,A-=2;break;case 16193:for(u>>>=7&A,A-=7&A;A<32;){if(0===a)break e;a--,u+=r[n++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=Ht;break}if(i.length=65535&u,u=0,A=0,i.mode=Ot,t===Pt)break e;case Ot:i.mode=16195;case 16195:if(d=i.length){if(d>a&&(d=a),d>l&&(d=l),0===d)break e;s.set(r.subarray(n,n+d),o),a-=d,n+=d,l-=d,o+=d,i.length-=d;break}i.mode=Rt;break;case 16196:for(;A<14;){if(0===a)break e;a--,u+=r[n++]<>>=5,A-=5,i.ndist=1+(31&u),u>>>=5,A-=5,i.ncode=4+(15&u),u>>>=4,A-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=Ht;break}i.have=0,i.mode=16197;case 16197:for(;i.have>>=3,A-=3}for(;i.have<19;)i.lens[E[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,x={bits:i.lenbits},B=wt(0,i.lens,0,19,i.lencode,0,i.work,x),i.lenbits=x.bits,B){e.msg="invalid code lengths set",i.mode=Ht;break}i.have=0,i.mode=16198;case 16198:for(;i.have>>16&255,m=65535&C,!((v=C>>>24)<=A);){if(0===a)break e;a--,u+=r[n++]<>>=v,A-=v,i.lens[i.have++]=m;else{if(16===m){for(P=v+2;A>>=v,A-=v,0===i.have){e.msg="invalid bit length repeat",i.mode=Ht;break}w=i.lens[i.have-1],d=3+(3&u),u>>>=2,A-=2}else if(17===m){for(P=v+3;A>>=v)),u>>>=3,A-=3}else{for(P=v+7;A>>=v)),u>>>=7,A-=7}if(i.have+d>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=Ht;break}for(;d--;)i.lens[i.have++]=w}}if(i.mode===Ht)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=Ht;break}if(i.lenbits=9,x={bits:i.lenbits},B=wt(1,i.lens,0,i.nlen,i.lencode,0,i.work,x),i.lenbits=x.bits,B){e.msg="invalid literal/lengths set",i.mode=Ht;break}if(i.distbits=6,i.distcode=i.distdyn,x={bits:i.distbits},B=wt(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,x),i.distbits=x.bits,B){e.msg="invalid distances set",i.mode=Ht;break}if(i.mode=Nt,t===Pt)break e;case Nt:i.mode=Qt;case Qt:if(a>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=n,e.avail_in=a,i.hold=u,i.bits=A,gt(e,h),o=e.next_out,s=e.output,l=e.avail_out,n=e.next_in,r=e.input,a=e.avail_in,u=i.hold,A=i.bits,i.mode===Rt&&(i.back=-1);break}for(i.back=0;g=(C=i.lencode[u&(1<>>16&255,m=65535&C,!((v=C>>>24)<=A);){if(0===a)break e;a--,u+=r[n++]<>_)])>>>16&255,m=65535&C,!(_+(v=C>>>24)<=A);){if(0===a)break e;a--,u+=r[n++]<>>=_,A-=_,i.back+=_}if(u>>>=v,A-=v,i.back+=v,i.length=m,0===g){i.mode=16205;break}if(32&g){i.back=-1,i.mode=Rt;break}if(64&g){e.msg="invalid literal/length code",i.mode=Ht;break}i.extra=15&g,i.mode=16201;case 16201:if(i.extra){for(P=i.extra;A>>=i.extra,A-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;g=(C=i.distcode[u&(1<>>16&255,m=65535&C,!((v=C>>>24)<=A);){if(0===a)break e;a--,u+=r[n++]<>_)])>>>16&255,m=65535&C,!(_+(v=C>>>24)<=A);){if(0===a)break e;a--,u+=r[n++]<>>=_,A-=_,i.back+=_}if(u>>>=v,A-=v,i.back+=v,64&g){e.msg="invalid distance code",i.mode=Ht;break}i.offset=m,i.extra=15&g,i.mode=16203;case 16203:if(i.extra){for(P=i.extra;A>>=i.extra,A-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=Ht;break}i.mode=16204;case 16204:if(0===l)break e;if(d=h-l,i.offset>d){if((d=i.offset-d)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=Ht;break}d>i.wnext?(d-=i.wnext,p=i.wsize-d):p=i.wnext-d,d>i.length&&(d=i.length),f=i.window}else f=s,p=o-i.offset,d=i.length;d>l&&(d=l),l-=d,i.length-=d;do{s[o++]=f[p++]}while(--d);0===i.length&&(i.mode=Qt);break;case 16205:if(0===l)break e;s[o++]=i.length,l--,i.mode=Qt;break;case Vt:if(i.wrap){for(;A<32;){if(0===a)break e;a--,u|=r[n++]<=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $e,this.strm.avail_out=0;var i=ii(this.strm,t.windowBits);if(i!==ci)throw new Error(H[i]);if(this.header=new ai,ni(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Je(t.dictionary):"[object ArrayBuffer]"===li.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=oi(this.strm,t.dictionary))!==ci))throw new Error(H[i])}function mi(e,t){var i=new gi(t);if(i.push(e),i.err)throw i.msg||H[i.err];return i.result}gi.prototype.push=function(e,t){var i,r,s,n=this.strm,o=this.options.chunkSize,a=this.options.dictionary;if(this.ended)return!1;for(r=t===~~t?t:!0===t?Ai:ui,"[object ArrayBuffer]"===li.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(o),n.next_out=0,n.avail_out=o),(i=ri(n,r))===di&&a&&((i=oi(n,a))===ci?i=ri(n,r):i===fi&&(i=di));n.avail_in>0&&i===hi&&n.state.wrap>0&&0!==e[n.next_in];)ti(n),i=ri(n,r);switch(i){case pi:case fi:case di:case vi:return this.onEnd(i),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(0===n.avail_out||i===hi))if("string"===this.options.to){var l=qe(n.output,n.next_out),u=n.next_out-l,A=Ze(n.output,l);n.next_out=u,n.avail_out=o-u,u&&n.output.set(n.output.subarray(l,l+u),0),this.onData(A)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(i!==ci||0!==s){if(i===hi)return i=si(this.strm),this.onEnd(i),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},gi.prototype.onData=function(e){this.chunks.push(e)},gi.prototype.onEnd=function(e){e===ci&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=We(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var _i=function(e,t){return(t=t||{}).raw=!0,mi(e,t)},yi=ht,bi=dt,wi=pt,Bi=ft,xi=gi,Pi=mi,Ci=_i,Mi=mi,Ei=j,Fi={Deflate:yi,deflate:bi,deflateRaw:wi,gzip:Bi,Inflate:xi,inflate:Pi,inflateRaw:Ci,ungzip:Mi,constants:Ei};e.Deflate=yi,e.Inflate=xi,e.constants=Ei,e.default=Fi,e.deflate=bi,e.deflateRaw=wi,e.gzip=Bi,e.inflate=Pi,e.inflateRaw=Ci,e.ungzip=Mi,Object.defineProperty(e,"__esModule",{value:!0})}));var kF=Object.freeze({__proto__:null}),IF=window.pako||kF;IF.inflate||(IF=IF.default);var DF,SF=(DF=new Float32Array(3),function(e){return DF[0]=e[0]/255,DF[1]=e[1]/255,DF[2]=e[2]/255,DF});var TF={version:1,parse:function(e,t,i,r,s,n){var o=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],meshPositions:e[4],meshIndices:e[5],meshEdgesIndices:e[6],meshColors:e[7],entityIDs:e[8],entityMeshes:e[9],entityIsObjects:e[10],positionsDecodeMatrix:e[11]}}(i),a=function(e){return{positions:new Uint16Array(IF.inflate(e.positions).buffer),normals:new Int8Array(IF.inflate(e.normals).buffer),indices:new Uint32Array(IF.inflate(e.indices).buffer),edgeIndices:new Uint32Array(IF.inflate(e.edgeIndices).buffer),meshPositions:new Uint32Array(IF.inflate(e.meshPositions).buffer),meshIndices:new Uint32Array(IF.inflate(e.meshIndices).buffer),meshEdgesIndices:new Uint32Array(IF.inflate(e.meshEdgesIndices).buffer),meshColors:new Uint8Array(IF.inflate(e.meshColors).buffer),entityIDs:IF.inflate(e.entityIDs,{to:"string"}),entityMeshes:new Uint32Array(IF.inflate(e.entityMeshes).buffer),entityIsObjects:new Uint8Array(IF.inflate(e.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(IF.inflate(e.positionsDecodeMatrix).buffer)}}(o);!function(e,t,i,r,s,n){n.getNextId(),r.positionsCompression="precompressed",r.normalsCompression="precompressed";for(var o=i.positions,a=i.normals,l=i.indices,u=i.edgeIndices,A=i.meshPositions,c=i.meshIndices,h=i.meshEdgesIndices,d=i.meshColors,p=JSON.parse(i.entityIDs),f=i.entityMeshes,v=i.entityIsObjects,g=A.length,m=f.length,_=0;_v[t]?1:0}));for(var E=0;E1||(F[R]=k)}for(var U=0;U1,V=HF(g.subarray(4*O,4*O+3)),H=g[4*O+3]/255,j=a.subarray(d[O],N?a.length:d[O+1]),G=l.subarray(d[O],N?l.length:d[O+1]),z=u.subarray(p[O],N?u.length:p[O+1]),W=A.subarray(f[O],N?A.length:f[O+1]),K=c.subarray(v[O],v[O]+16);if(Q){var X="".concat(o,"-geometry.").concat(O);r.createGeometry({id:X,primitive:"triangles",positionsCompressed:j,normalsCompressed:G,indices:z,edgeIndices:W,positionsDecodeMatrix:K})}else{var Y="".concat(o,"-").concat(O);_[F[O]],r.createMesh(he.apply({},{id:Y,primitive:"triangles",positionsCompressed:j,normalsCompressed:G,indices:z,edgeIndices:W,positionsDecodeMatrix:K,color:V,opacity:H}))}}for(var J=0,Z=0;Z1){var oe="".concat(o,"-instance.").concat(J++),ae="".concat(o,"-geometry.").concat(ne),le=16*b[Z],ue=h.subarray(le,le+16);r.createMesh(he.apply({},{id:oe,geometryId:ae,matrix:ue})),re.push(oe)}else re.push(ne)}re.length>0&&r.createEntity(he.apply({},{id:ee,isObject:!0,meshIds:re}))}}(0,0,a,r,0,n)}},GF=window.pako||kF;GF.inflate||(GF=GF.default);var zF=function(){var e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();var WF={version:5,parse:function(e,t,i,r,s,n){var o=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],eachPrimitivePositionsAndNormalsPortion:e[5],eachPrimitiveIndicesPortion:e[6],eachPrimitiveEdgeIndicesPortion:e[7],eachPrimitiveColor:e[8],primitiveInstances:e[9],eachEntityId:e[10],eachEntityPrimitiveInstancesPortion:e[11],eachEntityMatricesPortion:e[12]}}(i),a=function(e){return{positions:new Float32Array(GF.inflate(e.positions).buffer),normals:new Int8Array(GF.inflate(e.normals).buffer),indices:new Uint32Array(GF.inflate(e.indices).buffer),edgeIndices:new Uint32Array(GF.inflate(e.edgeIndices).buffer),matrices:new Float32Array(GF.inflate(e.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(GF.inflate(e.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(GF.inflate(e.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(GF.inflate(e.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveColor:new Uint8Array(GF.inflate(e.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(GF.inflate(e.primitiveInstances).buffer),eachEntityId:GF.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(GF.inflate(e.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(GF.inflate(e.eachEntityMatricesPortion).buffer)}}(o);!function(e,t,i,r,s,n){var o=n.getNextId();r.positionsCompression="disabled",r.normalsCompression="precompressed";for(var a=i.positions,l=i.normals,u=i.indices,A=i.edgeIndices,c=i.matrices,h=i.eachPrimitivePositionsAndNormalsPortion,d=i.eachPrimitiveIndicesPortion,p=i.eachPrimitiveEdgeIndicesPortion,f=i.eachPrimitiveColor,v=i.primitiveInstances,g=JSON.parse(i.eachEntityId),m=i.eachEntityPrimitiveInstancesPortion,_=i.eachEntityMatricesPortion,y=h.length,b=v.length,w=new Uint8Array(y),B=g.length,x=0;x1||(P[D]=C)}for(var S=0;S1,R=zF(f.subarray(4*S,4*S+3)),U=f[4*S+3]/255,O=a.subarray(h[S],T?a.length:h[S+1]),N=l.subarray(h[S],T?l.length:h[S+1]),Q=u.subarray(d[S],T?u.length:d[S+1]),V=A.subarray(p[S],T?A.length:p[S+1]);if(L){var H="".concat(o,"-geometry.").concat(S);r.createGeometry({id:H,primitive:"triangles",positionsCompressed:O,normalsCompressed:N,indices:Q,edgeIndices:V})}else{var j=S;g[P[S]],r.createMesh(he.apply({},{id:j,primitive:"triangles",positionsCompressed:O,normalsCompressed:N,indices:Q,edgeIndices:V,color:R,opacity:U}))}}for(var G=0,z=0;z1){var ee="instance."+G++,te="geometry"+$,ie=16*_[z],re=c.subarray(ie,ie+16);r.createMesh(he.apply({},{id:ee,geometryId:te,matrix:re})),Z.push(ee)}else Z.push($)}Z.length>0&&r.createEntity(he.apply({},{id:X,isObject:!0,meshIds:Z}))}}(0,0,a,r,0,n)}},KF=window.pako||kF;KF.inflate||(KF=KF.default);var XF,YF=(XF=new Float32Array(3),function(e){return XF[0]=e[0]/255,XF[1]=e[1]/255,XF[2]=e[2]/255,XF});var JF={version:6,parse:function(e,t,i,r,s,n){var o=function(e){return{positions:e[0],normals:e[1],indices:e[2],edgeIndices:e[3],matrices:e[4],reusedPrimitivesDecodeMatrix:e[5],eachPrimitivePositionsAndNormalsPortion:e[6],eachPrimitiveIndicesPortion:e[7],eachPrimitiveEdgeIndicesPortion:e[8],eachPrimitiveColorAndOpacity:e[9],primitiveInstances:e[10],eachEntityId:e[11],eachEntityPrimitiveInstancesPortion:e[12],eachEntityMatricesPortion:e[13],eachTileAABB:e[14],eachTileEntitiesPortion:e[15]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:KF.inflate(e,t).buffer}return{positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedPrimitivesDecodeMatrix:new Float32Array(t(e.reusedPrimitivesDecodeMatrix)),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(t(e.eachPrimitivePositionsAndNormalsPortion)),eachPrimitiveIndicesPortion:new Uint32Array(t(e.eachPrimitiveIndicesPortion)),eachPrimitiveEdgeIndicesPortion:new Uint32Array(t(e.eachPrimitiveEdgeIndicesPortion)),eachPrimitiveColorAndOpacity:new Uint8Array(t(e.eachPrimitiveColorAndOpacity)),primitiveInstances:new Uint32Array(t(e.primitiveInstances)),eachEntityId:KF.inflate(e.eachEntityId,{to:"string"}),eachEntityPrimitiveInstancesPortion:new Uint32Array(t(e.eachEntityPrimitiveInstancesPortion)),eachEntityMatricesPortion:new Uint32Array(t(e.eachEntityMatricesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(o);!function(e,t,i,r,s,n){for(var o=n.getNextId(),a=i.positions,l=i.normals,u=i.indices,A=i.edgeIndices,c=i.matrices,h=i.reusedPrimitivesDecodeMatrix,d=i.eachPrimitivePositionsAndNormalsPortion,p=i.eachPrimitiveIndicesPortion,f=i.eachPrimitiveEdgeIndicesPortion,v=i.eachPrimitiveColorAndOpacity,g=i.primitiveInstances,m=JSON.parse(i.eachEntityId),_=i.eachEntityPrimitiveInstancesPortion,y=i.eachEntityMatricesPortion,b=i.eachTileAABB,w=i.eachTileEntitiesPortion,B=d.length,x=g.length,P=m.length,C=w.length,M=new Uint32Array(B),E=0;E1,ie=ee===B-1,se=a.subarray(d[ee],ie?a.length:d[ee+1]),ne=l.subarray(d[ee],ie?l.length:d[ee+1]),oe=u.subarray(p[ee],ie?u.length:p[ee+1]),ae=A.subarray(f[ee],ie?A.length:f[ee+1]),le=YF(v.subarray(4*ee,4*ee+3)),ue=v[4*ee+3]/255,Ae=n.getNextId();if(te){var ce="".concat(o,"-geometry.").concat(D,".").concat(ee);N[ce]||(r.createGeometry({id:ce,primitive:"triangles",positionsCompressed:se,indices:oe,edgeIndices:ae,positionsDecodeMatrix:h}),N[ce]=!0),r.createMesh(he.apply(Z,{id:Ae,geometryId:ce,origin:k,matrix:G,color:le,opacity:ue})),X.push(Ae)}else r.createMesh(he.apply(Z,{id:Ae,origin:k,primitive:"triangles",positionsCompressed:se,normalsCompressed:ne,indices:oe,edgeIndices:ae,positionsDecodeMatrix:O,color:le,opacity:ue})),X.push(Ae)}X.length>0&&r.createEntity(he.apply(J,{id:H,isObject:!0,meshIds:X}))}}}(e,t,a,r,0,n)}},ZF=window.pako||kF;ZF.inflate||(ZF=ZF.default);var qF=function(){var e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function $F(e){for(var t=[],i=0,r=e.length;i1,ne=ie===M-1,oe=qF(w.subarray(6*te,6*te+3)),ae=w[6*te+3]/255,le=w[6*te+4]/255,ue=w[6*te+5]/255,Ae=n.getNextId();if(se){var ce=b[te],de=h.slice(ce,ce+16),pe="".concat(o,"-geometry.").concat(R,".").concat(ie);if(!j[pe]){var fe=void 0,ve=void 0,ge=void 0,me=void 0,_e=void 0,ye=void 0;switch(p[ie]){case 0:fe="solid",ve=a.subarray(f[ie],ne?a.length:f[ie+1]),ge=l.subarray(v[ie],ne?l.length:v[ie+1]),_e=A.subarray(m[ie],ne?A.length:m[ie+1]),ye=c.subarray(_[ie],ne?c.length:_[ie+1]);break;case 1:fe="surface",ve=a.subarray(f[ie],ne?a.length:f[ie+1]),ge=l.subarray(v[ie],ne?l.length:v[ie+1]),_e=A.subarray(m[ie],ne?A.length:m[ie+1]),ye=c.subarray(_[ie],ne?c.length:_[ie+1]);break;case 2:fe="points",ve=a.subarray(f[ie],ne?a.length:f[ie+1]),me=$F(u.subarray(g[ie],ne?u.length:g[ie+1]));break;case 3:fe="lines",ve=a.subarray(f[ie],ne?a.length:f[ie+1]),_e=A.subarray(m[ie],ne?A.length:m[ie+1]);break;default:continue}r.createGeometry({id:pe,primitive:fe,positionsCompressed:ve,normalsCompressed:ge,colors:me,indices:_e,edgeIndices:ye,positionsDecodeMatrix:d}),j[pe]=!0}r.createMesh(he.apply($,{id:Ae,geometryId:pe,origin:T,matrix:de,color:oe,metallic:le,roughness:ue,opacity:ae})),J.push(Ae)}else{var be=void 0,we=void 0,Be=void 0,xe=void 0,Pe=void 0,Ce=void 0;switch(p[ie]){case 0:be="solid",we=a.subarray(f[ie],ne?a.length:f[ie+1]),Be=l.subarray(v[ie],ne?l.length:v[ie+1]),Pe=A.subarray(m[ie],ne?A.length:m[ie+1]),Ce=c.subarray(_[ie],ne?c.length:_[ie+1]);break;case 1:be="surface",we=a.subarray(f[ie],ne?a.length:f[ie+1]),Be=l.subarray(v[ie],ne?l.length:v[ie+1]),Pe=A.subarray(m[ie],ne?A.length:m[ie+1]),Ce=c.subarray(_[ie],ne?c.length:_[ie+1]);break;case 2:be="points",we=a.subarray(f[ie],ne?a.length:f[ie+1]),xe=$F(u.subarray(g[ie],ne?u.length:g[ie+1]));break;case 3:be="lines",we=a.subarray(f[ie],ne?a.length:f[ie+1]),Pe=A.subarray(m[ie],ne?A.length:m[ie+1]);break;default:continue}r.createMesh(he.apply($,{id:Ae,origin:T,primitive:be,positionsCompressed:we,normalsCompressed:Be,colors:xe,indices:Pe,edgeIndices:Ce,positionsDecodeMatrix:H,color:oe,metallic:le,roughness:ue,opacity:ae})),J.push(Ae)}}J.length>0&&r.createEntity(he.apply(q,{id:W,isObject:!0,meshIds:J}))}}}(e,t,a,r,0,n)}},tk=window.pako||kF;tk.inflate||(tk=tk.default);var ik=re.vec4(),rk=re.vec4();var sk=function(){var e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function nk(e){for(var t=[],i=0,r=e.length;i1,ye=me===S-1,be=sk(M.subarray(6*ge,6*ge+3)),we=M[6*ge+3]/255,Be=M[6*ge+4]/255,xe=M[6*ge+5]/255,Pe=n.getNextId();if(_e){var Ce=C[ge],Me=g.slice(Ce,Ce+16),Ee="".concat(o,"-geometry.").concat(J,".").concat(me),Fe=Y[Ee];if(!Fe){Fe={batchThisMesh:!t.reuseGeometries};var ke=!1;switch(_[me]){case 0:Fe.primitiveName="solid",Fe.geometryPositions=h.subarray(y[me],ye?h.length:y[me+1]),Fe.geometryNormals=d.subarray(b[me],ye?d.length:b[me+1]),Fe.geometryIndices=f.subarray(B[me],ye?f.length:B[me+1]),Fe.geometryEdgeIndices=v.subarray(x[me],ye?v.length:x[me+1]),ke=Fe.geometryPositions.length>0&&Fe.geometryIndices.length>0;break;case 1:Fe.primitiveName="surface",Fe.geometryPositions=h.subarray(y[me],ye?h.length:y[me+1]),Fe.geometryNormals=d.subarray(b[me],ye?d.length:b[me+1]),Fe.geometryIndices=f.subarray(B[me],ye?f.length:B[me+1]),Fe.geometryEdgeIndices=v.subarray(x[me],ye?v.length:x[me+1]),ke=Fe.geometryPositions.length>0&&Fe.geometryIndices.length>0;break;case 2:Fe.primitiveName="points",Fe.geometryPositions=h.subarray(y[me],ye?h.length:y[me+1]),Fe.geometryColors=nk(p.subarray(w[me],ye?p.length:w[me+1])),ke=Fe.geometryPositions.length>0;break;case 3:Fe.primitiveName="lines",Fe.geometryPositions=h.subarray(y[me],ye?h.length:y[me+1]),Fe.geometryIndices=f.subarray(B[me],ye?f.length:B[me+1]),ke=Fe.geometryPositions.length>0&&Fe.geometryIndices.length>0;break;default:continue}if(ke||(Fe=null),Fe&&(Fe.geometryPositions.length,Fe.batchThisMesh)){Fe.decompressedPositions=new Float32Array(Fe.geometryPositions.length);for(var Ie=Fe.geometryPositions,De=Fe.decompressedPositions,Se=0,Te=Ie.length;Se0&&je.length>0;break;case 1:Ne="surface",Qe=h.subarray(y[me],ye?h.length:y[me+1]),Ve=d.subarray(b[me],ye?d.length:b[me+1]),je=f.subarray(B[me],ye?f.length:B[me+1]),Ge=v.subarray(x[me],ye?v.length:x[me+1]),ze=Qe.length>0&&je.length>0;break;case 2:Ne="points",Qe=h.subarray(y[me],ye?h.length:y[me+1]),He=nk(p.subarray(w[me],ye?p.length:w[me+1])),ze=Qe.length>0;break;case 3:Ne="lines",Qe=h.subarray(y[me],ye?h.length:y[me+1]),je=f.subarray(B[me],ye?f.length:B[me+1]),ze=Qe.length>0&&je.length>0;break;default:continue}ze&&(r.createMesh(he.apply(fe,{id:Pe,origin:K,primitive:Ne,positionsCompressed:Qe,normalsCompressed:Ve,colorsCompressed:He,indices:je,edgeIndices:Ge,positionsDecodeMatrix:ie,color:be,metallic:Be,roughness:xe,opacity:we})),ce.push(Pe))}}ce.length>0&&r.createEntity(he.apply(pe,{id:ae,isObject:!0,meshIds:ce}))}}}(e,t,a,r,s,n)}},ak=window.pako||kF;ak.inflate||(ak=ak.default);var lk=re.vec4(),uk=re.vec4();var Ak=function(){var e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();var ck={version:9,parse:function(e,t,i,r,s,n){var o=function(e){return{metadata:e[0],positions:e[1],normals:e[2],colors:e[3],indices:e[4],edgeIndices:e[5],matrices:e[6],reusedGeometriesDecodeMatrix:e[7],eachGeometryPrimitiveType:e[8],eachGeometryPositionsPortion:e[9],eachGeometryNormalsPortion:e[10],eachGeometryColorsPortion:e[11],eachGeometryIndicesPortion:e[12],eachGeometryEdgeIndicesPortion:e[13],eachMeshGeometriesPortion:e[14],eachMeshMatricesPortion:e[15],eachMeshMaterial:e[16],eachEntityId:e[17],eachEntityMeshesPortion:e[18],eachTileAABB:e[19],eachTileEntitiesPortion:e[20]}}(i),a=function(e){function t(e,t){return 0===e.length?[]:ak.inflate(e,t).buffer}return{metadata:JSON.parse(ak.inflate(e.metadata,{to:"string"})),positions:new Uint16Array(t(e.positions)),normals:new Int8Array(t(e.normals)),colors:new Uint8Array(t(e.colors)),indices:new Uint32Array(t(e.indices)),edgeIndices:new Uint32Array(t(e.edgeIndices)),matrices:new Float32Array(t(e.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(t(e.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(t(e.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(t(e.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(t(e.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(t(e.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(t(e.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(t(e.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(t(e.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(t(e.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(t(e.eachMeshMaterial)),eachEntityId:JSON.parse(ak.inflate(e.eachEntityId,{to:"string"})),eachEntityMeshesPortion:new Uint32Array(t(e.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(t(e.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(t(e.eachTileEntitiesPortion))}}(o);!function(e,t,i,r,s,n){var o=n.getNextId(),a=i.metadata,l=i.positions,u=i.normals,A=i.colors,c=i.indices,h=i.edgeIndices,d=i.matrices,p=i.reusedGeometriesDecodeMatrix,f=i.eachGeometryPrimitiveType,v=i.eachGeometryPositionsPortion,g=i.eachGeometryNormalsPortion,m=i.eachGeometryColorsPortion,_=i.eachGeometryIndicesPortion,y=i.eachGeometryEdgeIndicesPortion,b=i.eachMeshGeometriesPortion,w=i.eachMeshMatricesPortion,B=i.eachMeshMaterial,x=i.eachEntityId,P=i.eachEntityMeshesPortion,C=i.eachTileAABB,M=i.eachTileEntitiesPortion,E=v.length,F=b.length,k=P.length,I=M.length;s&&s.loadData(a,{includeTypes:t.includeTypes,excludeTypes:t.excludeTypes,globalizeObjectIds:t.globalizeObjectIds});for(var D=new Uint32Array(E),S=0;S1,ae=ne===E-1,le=Ak(B.subarray(6*se,6*se+3)),ue=B[6*se+3]/255,Ae=B[6*se+4]/255,ce=B[6*se+5]/255,de=n.getNextId();if(oe){var pe=w[se],fe=d.slice(pe,pe+16),ve="".concat(o,"-geometry.").concat(O,".").concat(ne),ge=U[ve];if(!ge){ge={batchThisMesh:!t.reuseGeometries};var me=!1;switch(f[ne]){case 0:ge.primitiveName="solid",ge.geometryPositions=l.subarray(v[ne],ae?l.length:v[ne+1]),ge.geometryNormals=u.subarray(g[ne],ae?u.length:g[ne+1]),ge.geometryIndices=c.subarray(_[ne],ae?c.length:_[ne+1]),ge.geometryEdgeIndices=h.subarray(y[ne],ae?h.length:y[ne+1]),me=ge.geometryPositions.length>0&&ge.geometryIndices.length>0;break;case 1:ge.primitiveName="surface",ge.geometryPositions=l.subarray(v[ne],ae?l.length:v[ne+1]),ge.geometryNormals=u.subarray(g[ne],ae?u.length:g[ne+1]),ge.geometryIndices=c.subarray(_[ne],ae?c.length:_[ne+1]),ge.geometryEdgeIndices=h.subarray(y[ne],ae?h.length:y[ne+1]),me=ge.geometryPositions.length>0&&ge.geometryIndices.length>0;break;case 2:ge.primitiveName="points",ge.geometryPositions=l.subarray(v[ne],ae?l.length:v[ne+1]),ge.geometryColors=A.subarray(m[ne],ae?A.length:m[ne+1]),me=ge.geometryPositions.length>0;break;case 3:ge.primitiveName="lines",ge.geometryPositions=l.subarray(v[ne],ae?l.length:v[ne+1]),ge.geometryIndices=c.subarray(_[ne],ae?c.length:_[ne+1]),me=ge.geometryPositions.length>0&&ge.geometryIndices.length>0;break;default:continue}if(me||(ge=null),ge&&(ge.geometryPositions.length,ge.batchThisMesh)){ge.decompressedPositions=new Float32Array(ge.geometryPositions.length),ge.transformedAndRecompressedPositions=new Uint16Array(ge.geometryPositions.length);for(var _e=ge.geometryPositions,ye=ge.decompressedPositions,be=0,we=_e.length;be0&&Ie.length>0;break;case 1:Me="surface",Ee=l.subarray(v[ne],ae?l.length:v[ne+1]),Fe=u.subarray(g[ne],ae?u.length:g[ne+1]),Ie=c.subarray(_[ne],ae?c.length:_[ne+1]),De=h.subarray(y[ne],ae?h.length:y[ne+1]),Se=Ee.length>0&&Ie.length>0;break;case 2:Me="points",Ee=l.subarray(v[ne],ae?l.length:v[ne+1]),ke=A.subarray(m[ne],ae?A.length:m[ne+1]),Se=Ee.length>0;break;case 3:Me="lines",Ee=l.subarray(v[ne],ae?l.length:v[ne+1]),Ie=c.subarray(_[ne],ae?c.length:_[ne+1]),Se=Ee.length>0&&Ie.length>0;break;default:continue}Se&&(r.createMesh(he.apply(te,{id:de,origin:L,primitive:Me,positionsCompressed:Ee,normalsCompressed:Fe,colorsCompressed:ke,indices:Ie,edgeIndices:De,positionsDecodeMatrix:G,color:le,metallic:Ae,roughness:ce,opacity:ue})),q.push(de))}}q.length>0&&r.createEntity(he.apply(ee,{id:X,isObject:!0,meshIds:q}))}}}(e,t,a,r,s,n)}},hk=window.pako||kF;hk.inflate||(hk=hk.default);var dk=re.vec4(),pk=re.vec4();var fk=function(){var e=new Float32Array(3);return function(t){return e[0]=t[0]/255,e[1]=t[1]/255,e[2]=t[2]/255,e}}();function vk(e,t){var i=[];if(t.length>1)for(var r=0,s=t.length-1;r1)for(var n=0,o=e.length/3-1;n0,W=9*V,K=1===A[W+0],X=A[W+1];A[W+2],A[W+3];var Y=A[W+4],J=A[W+5],Z=A[W+6],q=A[W+7],$=A[W+8];if(z){var ee=new Uint8Array(l.subarray(j,G)).buffer,te="".concat(o,"-texture-").concat(V);if(K)r.createTexture({id:te,buffers:[ee],minFilter:Y,magFilter:J,wrapS:Z,wrapT:q,wrapR:$});else{var ie=new Blob([ee],{type:10001===X?"image/jpeg":10002===X?"image/png":"image/gif"}),se=(window.URL||window.webkitURL).createObjectURL(ie),ne=document.createElement("img");ne.src=se,r.createTexture({id:te,image:ne,minFilter:Y,magFilter:J,wrapS:Z,wrapT:q,wrapR:$})}}}for(var oe=0;oe=0?"".concat(o,"-texture-").concat(ue):null,normalsTextureId:ce>=0?"".concat(o,"-texture-").concat(ce):null,metallicRoughnessTextureId:Ae>=0?"".concat(o,"-texture-").concat(Ae):null,emissiveTextureId:de>=0?"".concat(o,"-texture-").concat(de):null,occlusionTextureId:pe>=0?"".concat(o,"-texture-").concat(pe):null})}for(var fe=new Uint32Array(U),ve=0;ve1,je=Ve===U-1,Ge=F[Qe],ze=Ge>=0?"".concat(o,"-textureSet-").concat(Ge):null,We=fk(k.subarray(6*Qe,6*Qe+3)),Ke=k[6*Qe+3]/255,Xe=k[6*Qe+4]/255,Ye=k[6*Qe+5]/255,Je=n.getNextId();if(He){var Ze=E[Qe],qe=m.slice(Ze,Ze+16),$e="".concat(o,"-geometry.").concat(be,".").concat(Ve),et=ye[$e];if(!et){et={batchThisMesh:!t.reuseGeometries};var tt=!1;switch(y[Ve]){case 0:et.primitiveName="solid",et.geometryPositions=c.subarray(b[Ve],je?c.length:b[Ve+1]),et.geometryNormals=h.subarray(w[Ve],je?h.length:w[Ve+1]),et.geometryUVs=p.subarray(x[Ve],je?p.length:x[Ve+1]),et.geometryIndices=f.subarray(P[Ve],je?f.length:P[Ve+1]),et.geometryEdgeIndices=v.subarray(C[Ve],je?v.length:C[Ve+1]),tt=et.geometryPositions.length>0&&et.geometryIndices.length>0;break;case 1:et.primitiveName="surface",et.geometryPositions=c.subarray(b[Ve],je?c.length:b[Ve+1]),et.geometryNormals=h.subarray(w[Ve],je?h.length:w[Ve+1]),et.geometryUVs=p.subarray(x[Ve],je?p.length:x[Ve+1]),et.geometryIndices=f.subarray(P[Ve],je?f.length:P[Ve+1]),et.geometryEdgeIndices=v.subarray(C[Ve],je?v.length:C[Ve+1]),tt=et.geometryPositions.length>0&&et.geometryIndices.length>0;break;case 2:et.primitiveName="points",et.geometryPositions=c.subarray(b[Ve],je?c.length:b[Ve+1]),et.geometryColors=d.subarray(B[Ve],je?d.length:B[Ve+1]),tt=et.geometryPositions.length>0;break;case 3:et.primitiveName="lines",et.geometryPositions=c.subarray(b[Ve],je?c.length:b[Ve+1]),et.geometryIndices=f.subarray(P[Ve],je?f.length:P[Ve+1]),tt=et.geometryPositions.length>0&&et.geometryIndices.length>0;break;case 4:et.primitiveName="lines",et.geometryPositions=c.subarray(b[Ve],je?c.length:b[Ve+1]),et.geometryIndices=vk(et.geometryPositions,f.subarray(P[Ve],je?f.length:P[Ve+1])),tt=et.geometryPositions.length>0&&et.geometryIndices.length>0;break;default:continue}if(tt||(et=null),et&&(et.geometryPositions.length,et.batchThisMesh)){et.decompressedPositions=new Float32Array(et.geometryPositions.length),et.transformedAndRecompressedPositions=new Uint16Array(et.geometryPositions.length);for(var it=et.geometryPositions,rt=et.decompressedPositions,st=0,nt=it.length;st0&&ft.length>0;break;case 1:At="surface",ct=c.subarray(b[Ve],je?c.length:b[Ve+1]),ht=h.subarray(w[Ve],je?h.length:w[Ve+1]),dt=p.subarray(x[Ve],je?p.length:x[Ve+1]),ft=f.subarray(P[Ve],je?f.length:P[Ve+1]),vt=v.subarray(C[Ve],je?v.length:C[Ve+1]),gt=ct.length>0&&ft.length>0;break;case 2:At="points",ct=c.subarray(b[Ve],je?c.length:b[Ve+1]),pt=d.subarray(B[Ve],je?d.length:B[Ve+1]),gt=ct.length>0;break;case 3:At="lines",ct=c.subarray(b[Ve],je?c.length:b[Ve+1]),ft=f.subarray(P[Ve],je?f.length:P[Ve+1]),gt=ct.length>0&&ft.length>0;break;case 4:At="lines",ft=vk(ct=c.subarray(b[Ve],je?c.length:b[Ve+1]),f.subarray(P[Ve],je?f.length:P[Ve+1])),gt=ct.length>0&&ft.length>0;break;default:continue}gt&&(r.createMesh(he.apply(Oe,{id:Je,textureSetId:ze,origin:me,primitive:At,positionsCompressed:ct,normalsCompressed:ht,uv:dt&&dt.length>0?dt:null,colorsCompressed:pt,indices:ft,edgeIndices:vt,positionsDecodeMatrix:Me,color:We,metallic:Xe,roughness:Ye,opacity:Ke})),Le.push(Je))}}Le.length>0&&r.createEntity(he.apply(Ue,{id:Ie,isObject:!0,meshIds:Le}))}}}(e,t,a,r,s,n)}},mk={};mk[TF.version]=TF,mk[UF.version]=UF,mk[QF.version]=QF,mk[jF.version]=jF,mk[WF.version]=WF,mk[JF.version]=JF,mk[ek.version]=ek,mk[ok.version]=ok,mk[ck.version]=ck,mk[gk.version]=gk;var _k=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"XKTLoader",e,s))._maxGeometryBatchSize=s.maxGeometryBatchSize,r.textureTranscoder=s.textureTranscoder,r.dataSource=s.dataSource,r.objectDefaults=s.objectDefaults,r.includeTypes=s.includeTypes,r.excludeTypes=s.excludeTypes,r.excludeUnclassifiedObjects=s.excludeUnclassifiedObjects,r.reuseGeometries=s.reuseGeometries,r}return C(i,[{key:"supportedVersions",get:function(){return Object.keys(mk)}},{key:"textureTranscoder",get:function(){return this._textureTranscoder},set:function(e){this._textureTranscoder=e}},{key:"dataSource",get:function(){return this._dataSource},set:function(e){this._dataSource=e||new FF}},{key:"objectDefaults",get:function(){return this._objectDefaults},set:function(e){this._objectDefaults=e||CE}},{key:"includeTypes",get:function(){return this._includeTypes},set:function(e){this._includeTypes=e}},{key:"excludeTypes",get:function(){return this._excludeTypes},set:function(e){this._excludeTypes=e}},{key:"excludeUnclassifiedObjects",get:function(){return this._excludeUnclassifiedObjects},set:function(e){this._excludeUnclassifiedObjects=!!e}},{key:"globalizeObjectIds",get:function(){return this._globalizeObjectIds},set:function(e){this._globalizeObjectIds=!!e}},{key:"reuseGeometries",get:function(){return this._reuseGeometries},set:function(e){this._reuseGeometries=!1!==e}},{key:"load",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.id&&this.viewer.scene.components[t.id]&&(this.error("Component with this ID already exists in viewer: "+t.id+" - will autogenerate this ID"),delete t.id),!(t.src||t.xkt||t.manifestSrc||t.manifest))return this.error("load() param expected: src, xkt, manifestSrc or manifestData"),A;var i={},r=t.includeTypes||this._includeTypes,s=t.excludeTypes||this._excludeTypes,n=t.objectDefaults||this._objectDefaults;if(i.reuseGeometries=null!==t.reuseGeometries&&void 0!==t.reuseGeometries?t.reuseGeometries:!1!==this._reuseGeometries,r){i.includeTypesMap={};for(var o=0,a=r.length;o=t.length?n():e._dataSource.getMetaModel("".concat(m).concat(t[a]),(function(t){h.loadData(t,{includeTypes:r,excludeTypes:s,globalizeObjectIds:i.globalizeObjectIds}),a++,e.scheduleTask(l,100)}),o)}()},y=function(r,s,n){var o=0;!function a(){o>=r.length?s():e._dataSource.getXKT("".concat(m).concat(r[o]),(function(r){e._parseModel(r,t,i,A,null,v),o++,e.scheduleTask(a,100)}),n)}()},b=function(r,s,n){var o=0;!function a(){o>=r.length?s():e._dataSource.getXKT("".concat(m).concat(r[o]),(function(r){e._parseModel(r,t,i,A,h,v),o++,e.scheduleTask(a,100)}),n)}()};if(t.manifest){var w=t.manifest,B=w.xktFiles;if(!B||0===B.length)return void p("load(): Failed to load model manifest - manifest not valid");var x=w.metaModelFiles;x?_(x,(function(){y(B,d,p)}),p):b(B,d,p)}else this._dataSource.getManifest(t.manifestSrc,(function(e){if(!A.destroyed){var t=e.xktFiles;if(t&&0!==t.length){var i=e.metaModelFiles;i?_(i,(function(){y(t,d,p)}),p):b(t,d,p)}else p("load(): Failed to load model manifest - manifest not valid")}}),p)}return A}},{key:"_loadModel",value:function(e,t,i,r,s,n,o,a){var l=this;this._dataSource.getXKT(t.src,(function(e){l._parseModel(e,t,i,r,s,n),o()}),a)}},{key:"_parseModel",value:function(e,t,i,r,s,n){if(!r.destroyed){var o=new DataView(e),a=new Uint8Array(e),l=o.getUint32(0,!0),u=mk[l];if(u){this.log("Loading .xkt V"+l);for(var A=o.getUint32(4,!0),c=[],h=4*(A+2),d=0;de.size)throw new RangeError("offset:"+t+", length:"+i+", size:"+e.size);return e.slice?e.slice(t,t+i):e.webkitSlice?e.webkitSlice(t,t+i):e.mozSlice?e.mozSlice(t,t+i):e.msSlice?e.msSlice(t,t+i):void 0}(e,t,i))}catch(e){s(e)}}}function p(){}function f(e){var i,r=this;r.init=function(e){i=new Blob([],{type:o}),e()},r.writeUint8Array=function(e,r){i=new Blob([i,t?e:e.buffer],{type:o}),r()},r.getData=function(t,r){var s=new FileReader;s.onload=function(e){t(e.target.result)},s.onerror=r,s.readAsText(i,e)}}function v(t){var i=this,r="",s="";i.init=function(e){r+="data:"+(t||"")+";base64,",e()},i.writeUint8Array=function(t,i){var n,o=s.length,a=s;for(s="",n=0;n<3*Math.floor((o+t.length)/3)-o;n++)a+=String.fromCharCode(t[n]);for(;n2?r+=e.btoa(a):s=a,i()},i.getData=function(t){t(r+e.btoa(s))}}function g(e){var i,r=this;r.init=function(t){i=new Blob([],{type:e}),t()},r.writeUint8Array=function(r,s){i=new Blob([i,t?r:r.buffer],{type:e}),s()},r.getData=function(e){e(i)}}function m(e,t,i,r,s,o,a,l,u,A){var c,h,d,p=0,f=t.sn;function v(){e.removeEventListener("message",g,!1),l(h,d)}function g(t){var i=t.data,s=i.data,n=i.error;if(n)return n.toString=function(){return"Error: "+this.message},void u(n);if(i.sn===f)switch("number"==typeof i.codecTime&&(e.codecTime+=i.codecTime),"number"==typeof i.crcTime&&(e.crcTime+=i.crcTime),i.type){case"append":s?(h+=s.length,r.writeUint8Array(s,(function(){m()}),A)):m();break;case"flush":d=i.crc,s?(h+=s.length,r.writeUint8Array(s,(function(){v()}),A)):v();break;case"progress":a&&a(c+i.loaded,o);break;case"importScripts":case"newTask":case"echo":break;default:console.warn("zip.js:launchWorkerProcess: unknown message: ",i)}}function m(){(c=p*n)<=o?i.readUint8Array(s+c,Math.min(n,o-c),(function(i){a&&a(c,o);var r=0===c?t:{sn:f};r.type="append",r.data=i;try{e.postMessage(r,[i.buffer])}catch(t){e.postMessage(r)}p++}),u):e.postMessage({sn:f,type:"flush"})}h=0,e.addEventListener("message",g,!1),m()}function _(e,t,i,r,s,o,l,u,A,c){var h,d=0,p=0,f="input"===o,v="output"===o,g=new a;!function o(){var a;if((h=d*n)127?s[i-128]:String.fromCharCode(i);return r}function w(e){return decodeURIComponent(escape(e))}function B(e){var t,i="";for(t=0;t>16,i=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&i)>>11,(2016&i)>>5,2*(31&i),0)}catch(e){}}(e.lastModDateRaw),1!=(1&e.bitFlag)?((r||8!=(8&e.bitFlag))&&(e.crc32=t.view.getUint32(i+10,!0),e.compressedSize=t.view.getUint32(i+14,!0),e.uncompressedSize=t.view.getUint32(i+18,!0)),4294967295!==e.compressedSize&&4294967295!==e.uncompressedSize?(e.filenameLength=t.view.getUint16(i+22,!0),e.extraFieldLength=t.view.getUint16(i+24,!0)):s("File is using Zip64 (4gb+ file size).")):s("File contains encrypted entry.")}function P(t,n,o){var a=0;function l(){}l.prototype.getData=function(r,n,l,A){var c=this;function h(e,t){A&&!function(e){var t=u(4);return t.view.setUint32(0,e),c.crc32==t.view.getUint32(0)}(t)?o("CRC failed."):r.getData((function(e){n(e)}))}function d(e){o(e||s)}function p(e){o(e||"Error while writing file data.")}t.readUint8Array(c.offset,30,(function(s){var n,f=u(s.length,s);1347093252==f.view.getUint32(0)?(x(c,f,4,!1,o),n=c.offset+30+c.filenameLength+c.extraFieldLength,r.init((function(){0===c.compressionMethod?y(c._worker,a++,t,r,n,c.compressedSize,A,h,l,d,p):function(t,i,r,s,n,o,a,l,u,A,c){var h=a?"output":"none";e.zip.useWebWorkers?m(t,{sn:i,codecClass:"Inflater",crcType:h},r,s,n,o,u,l,A,c):_(new e.zip.Inflater,r,s,n,o,h,u,l,A,c)}(c._worker,a++,t,r,n,c.compressedSize,A,h,l,d,p)}),p)):o(i)}),d)};var A={getEntries:function(e){var s=this._worker;!function(e){t.size<22?o(i):s(22,(function(){s(Math.min(65558,t.size),(function(){o(i)}))}));function s(i,s){t.readUint8Array(t.size-i,i,(function(t){for(var i=t.length-22;i>=0;i--)if(80===t[i]&&75===t[i+1]&&5===t[i+2]&&6===t[i+3])return void e(new DataView(t.buffer,i,22));s()}),(function(){o(r)}))}}((function(n){var a,A;a=n.getUint32(16,!0),A=n.getUint16(8,!0),a<0||a>=t.size?o(i):t.readUint8Array(a,t.size-a,(function(t){var r,n,a,c,h=0,d=[],p=u(t.length,t);for(r=0;r>>8^i[255&(t^e[r])];this.crc=t},a.prototype.get=function(){return~this.crc},a.prototype.table=function(){var e,t,i,r=[];for(e=0;e<256;e++){for(i=e,t=0;t<8;t++)1&i?i=i>>>1^3988292384:i>>>=1;r[e]=i}return r}(),l.prototype.append=function(e,t){return e},l.prototype.flush=function(){},c.prototype=new A,c.prototype.constructor=c,h.prototype=new A,h.prototype.constructor=h,d.prototype=new A,d.prototype.constructor=d,p.prototype.getData=function(e){e(this.data)},f.prototype=new p,f.prototype.constructor=f,v.prototype=new p,v.prototype.constructor=v,g.prototype=new p,g.prototype.constructor=g;var F={deflater:["z-worker.js","deflate.js"],inflater:["z-worker.js","inflate.js"]};function k(t,i,r){if(null===e.zip.workerScripts||null===e.zip.workerScriptsPath){var s;if(e.zip.workerScripts){if(s=e.zip.workerScripts[t],!Array.isArray(s))return void r(new Error("zip.workerScripts."+t+" is not an array!"));s=function(e){var t=document.createElement("a");return e.map((function(e){return t.href=e,t.href}))}(s)}else(s=F[t].slice(0))[0]=(e.zip.workerScriptsPath||"")+s[0];var n=new Worker(s[0]);n.codecTime=n.crcTime=0,n.postMessage({type:"importScripts",scripts:s.slice(1)}),n.addEventListener("message",(function e(t){var s=t.data;if(s.error)return n.terminate(),void r(s.error);"importScripts"===s.type&&(n.removeEventListener("message",e),n.removeEventListener("error",o),i(n))})),n.addEventListener("error",o)}else r(new Error("Either zip.workerScripts or zip.workerScriptsPath may be set, not both."));function o(e){n.terminate(),r(e)}}function I(e){console.error(e)}e.zip={Reader:A,Writer:p,BlobReader:d,Data64URIReader:h,TextReader:c,BlobWriter:g,Data64URIWriter:v,TextWriter:f,createReader:function(e,t,i){i=i||I,e.init((function(){P(e,t,i)}),i)},createWriter:function(e,t,i,r){i=i||I,r=!!r,e.init((function(){E(e,t,i,r)}),i)},useWebWorkers:!0,workerScriptsPath:null,workerScripts:null}}(bk);var wk=bk.zip;!function(e){var t,i,r=e.Reader,s=e.Writer;try{i=0===new Blob([new DataView(new ArrayBuffer(0))]).size}catch(e){}function n(e){var t=this;function i(i,r){var s;t.data?i():((s=new XMLHttpRequest).addEventListener("load",(function(){t.size||(t.size=Number(s.getResponseHeader("Content-Length"))||Number(s.response.byteLength)),t.data=new Uint8Array(s.response),i()}),!1),s.addEventListener("error",r,!1),s.open("GET",e),s.responseType="arraybuffer",s.send())}t.size=0,t.init=function(r,s){if(function(e){var t=document.createElement("a");return t.href=e,"http:"===t.protocol||"https:"===t.protocol}(e)){var n=new XMLHttpRequest;n.addEventListener("load",(function(){t.size=Number(n.getResponseHeader("Content-Length")),t.size?r():i(r,s)}),!1),n.addEventListener("error",s,!1),n.open("HEAD",e),n.send()}else i(r,s)},t.readUint8Array=function(e,r,s,n){i((function(){s(new Uint8Array(t.data.subarray(e,e+r)))}),n)}}function o(e){var t=this;t.size=0,t.init=function(i,r){var s=new XMLHttpRequest;s.addEventListener("load",(function(){t.size=Number(s.getResponseHeader("Content-Length")),"bytes"==s.getResponseHeader("Accept-Ranges")?i():r("HTTP Range not supported.")}),!1),s.addEventListener("error",r,!1),s.open("HEAD",e),s.send()},t.readUint8Array=function(t,i,r,s){!function(t,i,r,s){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="arraybuffer",n.setRequestHeader("Range","bytes="+t+"-"+(t+i-1)),n.addEventListener("load",(function(){r(n.response)}),!1),n.addEventListener("error",s,!1),n.send()}(t,i,(function(e){r(new Uint8Array(e))}),s)}}function a(e){var t=this;t.size=0,t.init=function(i,r){t.size=e.byteLength,i()},t.readUint8Array=function(t,i,r,s){r(new Uint8Array(e.slice(t,t+i)))}}function l(){var e,t=this;t.init=function(t,i){e=new Uint8Array,t()},t.writeUint8Array=function(t,i,r){var s=new Uint8Array(e.length+t.length);s.set(e),s.set(t,e.length),e=s,i()},t.getData=function(t){t(e.buffer)}}function u(e,t){var r,s=this;s.init=function(t,i){e.createWriter((function(e){r=e,t()}),i)},s.writeUint8Array=function(e,s,n){var o=new Blob([i?e:e.buffer],{type:t});r.onwrite=function(){r.onwrite=null,s()},r.onerror=n,r.write(o)},s.getData=function(t){e.file(t)}}n.prototype=new r,n.prototype.constructor=n,o.prototype=new r,o.prototype.constructor=o,a.prototype=new r,a.prototype.constructor=a,l.prototype=new s,l.prototype.constructor=l,u.prototype=new s,u.prototype.constructor=u,e.FileWriter=u,e.HttpReader=n,e.HttpRangeReader=o,e.ArrayBufferReader=a,e.ArrayBufferWriter=l,e.fs&&((t=e.fs.ZipDirectoryEntry).prototype.addHttpContent=function(i,r,s){return function(i,r,s,n){if(i.directory)return n?new t(i.fs,r,s,i):new e.fs.ZipFileEntry(i.fs,r,s,i);throw"Parent entry is not a directory."}(this,i,{data:r,Reader:s?o:n})},t.prototype.importHttpContent=function(e,t,i,r){this.importZip(t?new o(e):new n(e),i,r)},e.fs.FS.prototype.importHttpContent=function(e,i,r,s){this.entries=[],this.root=new t(this),this.root.importHttpContent(e,i,r,s)})}(wk);var Bk=["4.2"],xk=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x(this,e),this.supportedSchemas=Bk,this._xrayOpacity=.7,this._src=null,this._options=i,this.viewpoint=null,i.workerScriptsPath?(wk.workerScriptsPath=i.workerScriptsPath,this.src=i.src,this.xrayOpacity=.7,this.displayEffect=i.displayEffect,this.createMetaModel=i.createMetaModel):t.error("Config expected: workerScriptsPath")}return C(e,[{key:"load",value:function(e,t,i,r,s,n){switch(r.materialType){case"MetallicMaterial":t._defaultMaterial=new On(t,{baseColor:[1,1,1],metallic:.6,roughness:.6});break;case"SpecularMaterial":t._defaultMaterial=new Vn(t,{diffuse:[1,1,1],specular:re.vec3([1,1,1]),glossiness:.5});break;default:t._defaultMaterial=new Zi(t,{reflectivity:.75,shiness:100,diffuse:[1,1,1]})}t._wireframeMaterial=new Ln(t,{color:[0,0,0],lineWidth:2});var o=t.scene.canvas.spinner;o.processes++,Pk(e,t,i,r,(function(){o.processes--,s&&s(),t.fire("loaded",!0,!1)}),(function(e){o.processes--,t.error(e),n&&n(e),t.fire("error",e)}),(function(e){console.log("Error, Will Robinson: "+e)}))}}]),e}(),Pk=function(e,t,i,r,s,n){!function(e,t,i){var r=new Sk;r.load(e,(function(){t(r)}),(function(e){i("Error loading ZIP archive: "+e)}))}(i,(function(i){Ck(e,i,r,t,s,n)}),n)},Ck=function(){return function(t,i,r,s,n){var o={plugin:t,zip:i,edgeThreshold:30,materialType:r.materialType,scene:s.scene,modelNode:s,info:{references:{}},materials:{}};r.createMetaModel&&(o.metaModelData={modelId:s.id,metaObjects:[{name:s.id,type:"Default",id:s.id}]}),s.scene.loading++,function(t,i){t.zip.getFile("Manifest.xml",(function(r,s){for(var n=s.children,o=0,a=n.length;o0){for(var o=n.trim().split(" "),a=new Int16Array(o.length),l=0,u=0,A=o.length;u0){i.primitive="triangles";for(var n=[],o=0,a=s.length;o=t.length)i();else{var a=t[n].id,l=a.lastIndexOf(":");l>0&&(a=a.substring(l+1));var u=a.lastIndexOf("#");u>0&&(a=a.substring(0,u)),r[a]?s(n+1):function(e,t,i){e.zip.getFile(t,(function(t,r){!function(e,t,i){for(var r,s=t.children,n=0,o=s.length;n0)for(var r=0,s=t.length;r1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),r=t.call(this,"XML3DLoader",e,s),s.workerScriptsPath?(r._workerScriptsPath=s.workerScriptsPath,r._loader=new xk(b(r),s),r.supportedSchemas=r._loader.supportedSchemas,r):(r.error("Config expected: workerScriptsPath"),y(r))}return C(i,[{key:"load",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.workerScriptsPath=this._workerScriptsPath,e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);var t=new Tn(this.viewer.scene,he.apply(e,{isModel:!0})),i=e.src;return i?(this._loader.load(this,t,i,e),t):(this.error("load() param expected: src"),t)}}]),i}(),Rk=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this.cacheBuster=!1!==t.cacheBuster}return C(e,[{key:"_cacheBusterURL",value:function(e){if(!this.cacheBuster)return e;var t=(new Date).getTime();return e.indexOf("?")>-1?e+"&_="+t:e+"?_="+t}},{key:"getIFC",value:function(e,t,i){e=this._cacheBusterURL(e);var r=function(){};t=t||r,i=i||r;var s=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(s){var n=!!s[2],o=s[3];o=window.decodeURIComponent(o),n&&(o=window.atob(o));try{for(var a=new ArrayBuffer(o.length),l=new Uint8Array(a),u=0;u1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(r=t.call(this,"ifcLoader",e,s)).dataSource=s.dataSource,r.objectDefaults=s.objectDefaults,r.includeTypes=s.includeTypes,r.excludeTypes=s.excludeTypes,r.excludeUnclassifiedObjects=s.excludeUnclassifiedObjects,!s.WebIFC)throw"Parameter expected: WebIFC";if(!s.IfcAPI)throw"Parameter expected: IfcAPI";return r._webIFC=s.WebIFC,r._ifcAPI=s.IfcAPI,r}return C(i,[{key:"supportedVersions",get:function(){return["2x3","4"]}},{key:"dataSource",get:function(){return this._dataSource},set:function(e){this._dataSource=e||new Rk}},{key:"objectDefaults",get:function(){return this._objectDefaults},set:function(e){this._objectDefaults=e||CE}},{key:"includeTypes",get:function(){return this._includeTypes},set:function(e){this._includeTypes=e}},{key:"excludeTypes",get:function(){return this._excludeTypes},set:function(e){this._excludeTypes=e}},{key:"excludeUnclassifiedObjects",get:function(){return this._excludeUnclassifiedObjects},set:function(e){this._excludeUnclassifiedObjects=!!e}},{key:"globalizeObjectIds",get:function(){return this._globalizeObjectIds},set:function(e){this._globalizeObjectIds=!!e}},{key:"load",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);var t=new Ph(this.viewer.scene,he.apply(e,{isModel:!0}));if(!e.src&&!e.ifc)return this.error("load() param expected: src or IFC"),t;var i={autoNormals:!0};if(!1!==e.loadMetadata){var r=e.includeTypes||this._includeTypes,s=e.excludeTypes||this._excludeTypes,n=e.objectDefaults||this._objectDefaults;if(r){i.includeTypesMap={};for(var o=0,a=r.length;o0){for(var l=n.Name.value,u=[],A=0,c=a.length;A0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this.cacheBuster=!1!==t.cacheBuster}return C(e,[{key:"_cacheBusterURL",value:function(e){if(!this.cacheBuster)return e;var t=(new Date).getTime();return e.indexOf("?")>-1?e+"&_="+t:e+"?_="+t}},{key:"getLAS",value:function(e,t,i){e=this._cacheBusterURL(e);var r=function(){};t=t||r,i=i||r;var s=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(s){var n=!!s[2],o=s[3];o=window.decodeURIComponent(o),n&&(o=window.atob(o));try{for(var a=new ArrayBuffer(o.length),l=new Uint8Array(a),u=0;u1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"lasLoader",e,s)).dataSource=s.dataSource,r.skip=s.skip,r.fp64=s.fp64,r.colorDepth=s.colorDepth,r}return C(i,[{key:"dataSource",get:function(){return this._dataSource},set:function(e){this._dataSource=e||new Ok}},{key:"skip",get:function(){return this._skip},set:function(e){this._skip=e||1}},{key:"fp64",get:function(){return this._fp64},set:function(e){this._fp64=!!e}},{key:"colorDepth",get:function(){return this._colorDepth},set:function(e){this._colorDepth=e||"auto"}},{key:"load",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.id&&this.viewer.scene.components[t.id]&&(this.error("Component with this ID already exists in viewer: "+t.id+" - will autogenerate this ID"),delete t.id);var i=new Ph(this.viewer.scene,he.apply(t,{isModel:!0}));if(!t.src&&!t.las)return this.error("load() param expected: src or las"),i;var r={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(t.src)this._loadModel(t.src,t,r,i);else{var s=this.viewer.scene.canvas.spinner;s.processes++,this._parseModel(t.las,t,r,i).then((function(){s.processes--}),(function(t){s.processes--,e.error(t),i.fire("error",t)}))}return i}},{key:"_loadModel",value:function(e,t,i,r){var s=this,n=this.viewer.scene.canvas.spinner;n.processes++,this._dataSource.getLAS(t.src,(function(e){s._parseModel(e,t,i,r).then((function(){n.processes--}),(function(e){n.processes--,s.error(e),r.fire("error",e)}))}),(function(e){n.processes--,s.error(e),r.fire("error",e)}))}},{key:"_parseModel",value:function(e,t,i,r){var s=this;function n(e){var i=e.value;if(t.rotateX&&i)for(var r=0,s=i.length;r=e.length)return[e];for(var i=[],r=0;r0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this.cacheBuster=!1!==t.cacheBuster}return C(e,[{key:"_cacheBusterURL",value:function(e){if(!this.cacheBuster)return e;var t=(new Date).getTime();return e.indexOf("?")>-1?e+"&_="+t:e+"?_="+t}},{key:"getCityJSON",value:function(e,t,i){he.loadJSON(this._cacheBusterURL(e),(function(e){t(e)}),(function(e){i(e)}))}}]),e}();function Xk(e,t,i){i=i||2;var r,s,n,o,a,l,u,A=t&&t.length,c=A?t[0]*i:e.length,h=Yk(e,0,c,i,!0),d=[];if(!h||h.next===h.prev)return d;if(A&&(h=function(e,t,i,r){var s,n,o,a=[];for(s=0,n=t.length;s80*i){r=n=e[0],s=o=e[1];for(var p=i;pn&&(n=a),l>o&&(o=l);u=0!==(u=Math.max(n-r,o-s))?1/u:0}return Zk(h,d,i,r,s,u),d}function Yk(e,t,i,r,s){var n,o;if(s===_I(e,t,i,r)>0)for(n=t;n=t;n-=r)o=vI(n,e[n],e[n+1],o);return o&&AI(o,o.next)&&(gI(o),o=o.next),o}function Jk(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=!1,r.steiner||!AI(r,r.next)&&0!==uI(r.prev,r,r.next))r=r.next;else{if(gI(r),(r=t=r.prev)===r.next)break;i=!0}}while(i||r!==t);return t}function Zk(e,t,i,r,s,n,o){if(e){!o&&n&&function(e,t,i,r){var s=e;do{null===s.z&&(s.z=nI(s.x,s.y,t,i,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,function(e){var t,i,r,s,n,o,a,l,u=1;do{for(i=e,e=null,n=null,o=0;i;){for(o++,r=i,a=0,t=0;t0||l>0&&r;)0!==a&&(0===l||!r||i.z<=r.z)?(s=i,i=i.nextZ,a--):(s=r,r=r.nextZ,l--),n?n.nextZ=s:e=s,s.prevZ=n,n=s;i=r}n.nextZ=null,u*=2}while(o>1)}(s)}(e,r,s,n);for(var a,l,u=e;e.prev!==e.next;)if(a=e.prev,l=e.next,n?$k(e,r,s,n):qk(e))t.push(a.i/i),t.push(e.i/i),t.push(l.i/i),gI(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?Zk(e=eI(Jk(e),t,i),t,i,r,s,n,2):2===o&&tI(e,t,i,r,s,n):Zk(Jk(e),t,i,r,s,n,1);break}}}function qk(e){var t=e.prev,i=e,r=e.next;if(uI(t,i,r)>=0)return!1;for(var s=e.next.next;s!==e.prev;){if(aI(t.x,t.y,i.x,i.y,r.x,r.y,s.x,s.y)&&uI(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function $k(e,t,i,r){var s=e.prev,n=e,o=e.next;if(uI(s,n,o)>=0)return!1;for(var a=s.xn.x?s.x>o.x?s.x:o.x:n.x>o.x?n.x:o.x,A=s.y>n.y?s.y>o.y?s.y:o.y:n.y>o.y?n.y:o.y,c=nI(a,l,t,i,r),h=nI(u,A,t,i,r),d=e.prevZ,p=e.nextZ;d&&d.z>=c&&p&&p.z<=h;){if(d!==e.prev&&d!==e.next&&aI(s.x,s.y,n.x,n.y,o.x,o.y,d.x,d.y)&&uI(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==e.prev&&p!==e.next&&aI(s.x,s.y,n.x,n.y,o.x,o.y,p.x,p.y)&&uI(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==e.prev&&d!==e.next&&aI(s.x,s.y,n.x,n.y,o.x,o.y,d.x,d.y)&&uI(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=h;){if(p!==e.prev&&p!==e.next&&aI(s.x,s.y,n.x,n.y,o.x,o.y,p.x,p.y)&&uI(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function eI(e,t,i){var r=e;do{var s=r.prev,n=r.next.next;!AI(s,n)&&cI(s,r,r.next,n)&&pI(s,n)&&pI(n,s)&&(t.push(s.i/i),t.push(r.i/i),t.push(n.i/i),gI(r),gI(r.next),r=e=n),r=r.next}while(r!==e);return Jk(r)}function tI(e,t,i,r,s,n){var o=e;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&lI(o,a)){var l=fI(o,a);return o=Jk(o,o.next),l=Jk(l,l.next),Zk(o,t,i,r,s,n),void Zk(l,t,i,r,s,n)}a=a.next}o=o.next}while(o!==e)}function iI(e,t){return e.x-t.x}function rI(e,t){if(t=function(e,t){var i,r=t,s=e.x,n=e.y,o=-1/0;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){var a=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=s&&a>o){if(o=a,a===s){if(n===r.y)return r;if(n===r.next.y)return r.next}i=r.x=r.x&&r.x>=A&&s!==r.x&&aI(ni.x||r.x===i.x&&sI(i,r)))&&(i=r,h=l)),r=r.next}while(r!==u);return i}(e,t),t){var i=fI(t,e);Jk(t,t.next),Jk(i,i.next)}}function sI(e,t){return uI(e.prev,e,t.prev)<0&&uI(t.next,e,e.next)<0}function nI(e,t,i,r,s){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*s)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*s)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function oI(e){var t=e,i=e;do{(t.x=0&&(e-o)*(r-a)-(i-o)*(t-a)>=0&&(i-o)*(n-a)-(s-o)*(r-a)>=0}function lI(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&cI(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(pI(e,t)&&pI(t,e)&&function(e,t){var i=e,r=!1,s=(e.x+t.x)/2,n=(e.y+t.y)/2;do{i.y>n!=i.next.y>n&&i.next.y!==i.y&&s<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(uI(e.prev,e,t.prev)||uI(e,t.prev,t))||AI(e,t)&&uI(e.prev,e,e.next)>0&&uI(t.prev,t,t.next)>0)}function uI(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function AI(e,t){return e.x===t.x&&e.y===t.y}function cI(e,t,i,r){var s=dI(uI(e,t,i)),n=dI(uI(e,t,r)),o=dI(uI(i,r,e)),a=dI(uI(i,r,t));return s!==n&&o!==a||(!(0!==s||!hI(e,i,t))||(!(0!==n||!hI(e,r,t))||(!(0!==o||!hI(i,e,r))||!(0!==a||!hI(i,t,r)))))}function hI(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function dI(e){return e>0?1:e<0?-1:0}function pI(e,t){return uI(e.prev,e,e.next)<0?uI(e,t,e.next)>=0&&uI(e,e.prev,t)>=0:uI(e,t,e.prev)<0||uI(e,e.next,t)<0}function fI(e,t){var i=new mI(e.i,e.x,e.y),r=new mI(t.i,t.x,t.y),s=e.next,n=t.prev;return e.next=t,t.prev=e,i.next=s,s.prev=i,r.next=i,i.prev=r,n.next=r,r.prev=n,r}function vI(e,t,i,r){var s=new mI(e,t,i);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function gI(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function mI(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function _I(e,t,i,r){for(var s=0,n=t,o=i-r;n0&&(r+=e[s-1].length,i.holes.push(r))}return i};var yI=re.vec2(),bI=re.vec3(),wI=re.vec3(),BI=re.vec3(),xI=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"cityJSONLoader",e,s)).dataSource=s.dataSource,r}return C(i,[{key:"dataSource",get:function(){return this._dataSource},set:function(e){this._dataSource=e||new Kk}},{key:"load",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.id&&this.viewer.scene.components[e.id]&&(this.error("Component with this ID already exists in viewer: "+e.id+" - will autogenerate this ID"),delete e.id);var t=new Ph(this.viewer.scene,he.apply(e,{isModel:!0,edges:!0}));if(!e.src&&!e.cityJSON)return this.error("load() param expected: src or cityJSON"),t;var i={};if(e.src)this._loadModel(e.src,e,i,t);else{var r=this.viewer.scene.canvas.spinner;r.processes++,this._parseModel(e.cityJSON,e,i,t),r.processes--}return t}},{key:"_loadModel",value:function(e,t,i,r){var s=this,n=this.viewer.scene.canvas.spinner;n.processes++,this._dataSource.getCityJSON(t.src,(function(e){s._parseModel(e,t,i,r),n.processes--}),(function(e){n.processes--,s.error(e),r.fire("error",e)}))}},{key:"_parseModel",value:function(e,t,i,r){if(!r.destroyed){var s=e.transform?this._transformVertices(e.vertices,e.transform,i.rotateX):e.vertices,n=t.stats||{};n.sourceFormat=e.type||"CityJSON",n.schemaVersion=e.version||"",n.title="",n.author="",n.created="",n.numMetaObjects=0,n.numPropertySets=0,n.numObjects=0,n.numGeometries=0,n.numTriangles=0,n.numVertices=0;var o=!1!==t.loadMetadata,a=o?{id:re.createUUID(),name:"Model",type:"Model"}:null,l=o?{id:"",projectId:"",author:"",createdAt:"",schema:e.version||"",creatingApplication:"",metaObjects:[a],propertySets:[]}:null,u={data:e,vertices:s,sceneModel:r,loadMetadata:o,metadata:l,rootMetaObject:a,nextId:0,stats:n};if(this._parseCityJSON(u),r.finalize(),o){var A=r.id;this.viewer.metaScene.createMetaModel(A,u.metadata,i)}r.scene.once("tick",(function(){r.destroyed||(r.scene.fire("modelLoaded",r.id),r.fire("loaded",!0,!1))}))}}},{key:"_transformVertices",value:function(e,t,i){for(var r=[],s=t.scale||re.vec3([1,1,1]),n=t.translate||re.vec3([0,0,0]),o=0,a=0;o0){for(var u=[],A=0,c=t.geometry.length;A0){var _=g[m[0]];if(void 0!==_.value)d=v[_.value];else{var y=_.values;if(y){p=[];for(var b=0,w=y.length;b0&&(r.createEntity({id:i,meshIds:u,isObject:!0}),e.stats.numObjects++)}}},{key:"_parseGeometrySurfacesWithOwnMaterials",value:function(e,t,i,r){switch(t.type){case"MultiPoint":case"MultiLineString":break;case"MultiSurface":case"CompositeSurface":var s=t.boundaries;this._parseSurfacesWithOwnMaterials(e,i,s,r);break;case"Solid":for(var n=t.boundaries,o=0;o0&&A.push(u.length);var f=this._extractLocalIndices(e,a[p],c,d);u.push.apply(u,h(f))}if(3===u.length)d.indices.push(u[0]),d.indices.push(u[1]),d.indices.push(u[2]);else if(u.length>3){for(var v=[],g=0;g0&&o.indices.length>0){var f=""+e.nextId++;s.createMesh({id:f,primitive:"triangles",positions:o.positions,indices:o.indices,color:i&&i.diffuseColor?i.diffuseColor:[.8,.8,.8],opacity:1}),r.push(f),e.stats.numGeometries++,e.stats.numVertices+=o.positions.length/3,e.stats.numTriangles+=o.indices.length/3}}},{key:"_parseSurfacesWithSharedMaterial",value:function(e,t,i,r){for(var s=e.vertices,n=0;n0&&a.push(o.length);var u=this._extractLocalIndices(e,t[n][l],i,r);o.push.apply(o,h(u))}if(3===o.length)r.indices.push(o[0]),r.indices.push(o[1]),r.indices.push(o[2]);else if(o.length>3){for(var A=[],c=0;c0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this.cacheBuster=!1!==t.cacheBuster}return C(e,[{key:"_cacheBusterURL",value:function(e){if(!this.cacheBuster)return e;var t=(new Date).getTime();return e.indexOf("?")>-1?e+"&_="+t:e+"?_="+t}},{key:"getDotBIM",value:function(e,t,i){he.loadJSON(this._cacheBusterURL(e),(function(e){t(e)}),(function(e){i(e)}))}}]),e}(),CI=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"DotBIMLoader",e,s)).dataSource=s.dataSource,r.objectDefaults=s.objectDefaults,r}return C(i,[{key:"dataSource",get:function(){return this._dataSource},set:function(e){this._dataSource=e||new PI}},{key:"objectDefaults",get:function(){return this._objectDefaults},set:function(e){this._objectDefaults=e||CE}},{key:"load",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.id&&this.viewer.scene.components[t.id]&&(this.error("Component with this ID already exists in viewer: "+t.id+" - will autogenerate this ID"),delete t.id);var i=new Ph(this.viewer.scene,he.apply(t,{isModel:!0,backfaces:t.backfaces,dtxEnabled:t.dtxEnabled,rotation:t.rotation,origin:t.origin})),r=i.id;if(!t.src&&!t.dotBIM)return this.error("load() param expected: src or dotBIM"),i;var s,n,o=t.objectDefaults||this._objectDefaults||CE;if(t.includeTypes){s={};for(var a=0,l=t.includeTypes.length;a=0?A:2*Math.PI-A}return s0||o>0||a>0))}}(),n=[],o=(r?t:t.slice(0).reverse()).map((function(e){return{idx:e}}));o.forEach((function(e,t){e.prev=o[(t-1+o.length)%o.length],e.next=o[(t+1)%o.length]}));for(var a=re.vec2(),l=re.vec2();o.length>2;){for(var u=0,A=function(){if(u>=o.length)throw"isCCW = ".concat(r,"; earIdx = ").concat(u,"; len = ").concat(o.length);var t=o[u],i=e[t.prev.idx],n=e[t.idx],A=e[t.next.idx];if(re.subVec2(i,n,a),re.subVec2(A,n,l),a[0]*l[1]-a[1]*l[0]>=0&&o.every((function(r){return r===t||r===t.prev||r===t.next||!s(e[r.idx],i,n,A)})))return"break";++u};;){if("break"===A())break}var c=o[u];o.splice(u,1),n.push([c.idx,c.next.idx,c.prev.idx]),c.prev.next=c.next,c.next.prev=c.prev}return[e,n]},FI=function(e,t){var i=e.canvas.canvas,r=i.parentNode,s=document.createElement("div");r.insertBefore(s,i);var n=5;s.style.background=t,s.style.border="2px solid white",s.style.margin="0 0",s.style.zIndex="100",s.style.position="absolute",s.style.pointerEvents="none",s.style.display="none";var o=new ot(e,{}),a=function(e){return e+"px"},l=function(){var e=o.canvasPos.slice();lt(i,r,e),s.style.left=a(e[0]-3-n/2),s.style.top=a(e[1]-3-n/2),s.style.borderRadius=a(2*n),s.style.width=a(n),s.style.height=a(n)},u=e.camera.on("viewMatrix",l),A=e.camera.on("projMatrix",l);return{update:function(e){e&&(o.worldPos=e,l()),s.style.display=e?"":"none"},setHighlighted:function(e){n=e?10:5,l()},getCanvasPos:function(){return o.canvasPos},getWorldPos:function(){return o.worldPos},destroy:function(){s.parentNode.removeChild(s),e.camera.off(u),e.camera.off(A),o.destroy()}}},kI=function(e,t,i){var r=null,s=function(s){if(s){r&&r.destroy();try{var n,o,a=EI(s.map((function(e){return[e[0],e[2]]}))),l=c(a,2),u=l[0],A=l[1],d=(n=[]).concat.apply(n,h(u.map((function(e){return[e[0],s[0][1],e[1]]})))),p=(o=[]).concat.apply(o,h(A));r=new gn(e,{pickable:!1,geometry:new Wi(e,{positions:d,indices:p,normals:re.buildNormals(d,p)}),material:new Zi(e,{alpha:void 0!==i?i:.5,backfaces:!0,diffuse:MI(t)})})}catch(e){r=null}}r&&(r.visible=!!s)};return s(null),{updateBase:s,destroy:function(){return r&&r.destroy()}}},II=function(e,t,i,r,s,n,o,a,l){var u=FI(e,r),A=FI(e,r),c=kI(e,r,s),h=n?function(e){n.visible=!!e,e&&(n.canvasPos=e)}:function(){},d=a((function(){h(null),u.update(null)}),(function(e,t){h(e),u.update(t)}),(function(e,n){u.update(n),d=a((function(){h(null),A.update(null),c.updateBase(null)}),(function(e,t){if(h(e),A.update(t),re.distVec3(n,t)>.01){var i=function(e){return Math.min(n[e],t[e])},r=function(e){return Math.max(n[e],t[e])},s=i(0),o=i(1),a=i(2),l=r(0);r(1);var u=r(2);c.updateBase([[s,o,u],[l,o,u],[l,o,a],[s,o,a]])}else c.updateBase(null)}),(function(e,a){A.update(a),u.destroy(),A.destroy(),c.destroy(),h(null);var d=function(e){return Math.min(n[e],a[e])},p=function(e){return Math.max(n[e],a[e])},f=d(0),v=d(2),g=p(0),m=p(2),_=o.createZone({id:re.createUUID(),geometry:{planeCoordinates:[[f,m],[g,m],[g,v],[f,v]],altitude:t,height:i},alpha:s,color:r});l(_)}))}));return{deactivate:function(){d(),u.destroy(),A.destroy(),c.destroy(),h(null)}}},DI=function(e,t){return function(i,r,s){var n=e.scene,o=n.canvas.canvas,a=function(e,t){return t[0]=e.clientX,t[1]=e.clientY,lt(o.ownerDocument.body,o,t),t},l=function(e){var i=re.vec3(),r=re.vec3();return re.canvasPosToWorldRay(o,n.camera.viewMatrix,n.camera.projMatrix,n.camera.projection,e,i,r),t(i,r)},u=!1,A=function(){u=!1},c=function(){A(),o.removeEventListener("mousedown",d),o.removeEventListener("mousemove",p),e.cameraControl.off(f),o.removeEventListener("mouseup",v)},h=re.vec2(),d=function(e){1===e.which&&(a(e,h),u=!0)};o.addEventListener("mousedown",d);var p=function(e){var t=a(e,re.vec2());u&&re.distVec2(h,t)>20&&(A(),i())};o.addEventListener("mousemove",p);var f=e.cameraControl.on("rayMove",(function(e){var t=e.canvasPos;r(t,l(t))})),v=function(e){if(1===e.which&&u){c();var t=a(e,re.vec2());s(t,l(t))}};return o.addEventListener("mouseup",v),c}},SI=function(e,t,i){return function(r,s,n){var o,a=e.scene,l=a.canvas.canvas,u=function(e,t){return t[0]=e.clientX,t[1]=e.clientY,lt(l.ownerDocument.body,l,t),t},A=function(e){var t=re.vec3(),r=re.vec3();return re.canvasPosToWorldRay(l,a.camera.viewMatrix,a.camera.projMatrix,a.camera.projection,e,t,r),i(t,r)},c=null,d=function(){},p=d,f=function(){t.stop(),clearTimeout(c),e.cameraControl.active=!0,p=d,o=null},v=function(){f(),l.removeEventListener("touchstart",g),l.removeEventListener("touchmove",m),l.removeEventListener("touchend",_)},g=function(i){var n=i.touches;if(1!==n.length)f(),r();else{var a=n[0],l=u(a,re.vec2());A(l)&&(o=a.identifier,p=function(e){re.distVec2(l,e)>20&&f()},c=setTimeout((function(){t.start(l),c=setTimeout((function(){t.stop(),e.cameraControl.active=!1,p=function(e){s(e,A(e))},p(l)}),300)}),250))}};l.addEventListener("touchstart",g,{passive:!0});var m=function(e){var t=h(e.changedTouches).find((function(e){return e.identifier===o}));t&&p(u(t,re.vec2()))};l.addEventListener("touchmove",m,{passive:!0});var _=function(e){var t=h(e.changedTouches).find((function(e){return e.identifier===o}));if(t){v();var i=u(t,re.vec2());n(i,A(i))}};return l.addEventListener("touchend",_,{passive:!0}),v}},TI=function(e,t,i,r){var s=-(re.dotVec3(i,t)-e)/re.dotVec3(r,t),n=re.vec3();return re.mulVec3Scalar(r,s,n),re.addVec3(i,n,n),n},LI=function(e){g(i,Ce);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(x(this,i),(r=t.call(this,e.viewer.scene,s)).plugin=e,r._container=s.container,!r._container)throw"config missing: container";return r._eventSubs={},r.plugin.viewer.scene,r._geometry=s.geometry,s.onMouseOver,s.onMouseLeave,s.onContextMenu,r._alpha="alpha"in s&&void 0!==s.alpha?s.alpha:.5,r.color=s.color,r._visible=!0,r._rebuildMesh(),r}return C(i,[{key:"_rebuildMesh",value:function(){var e,t=this.plugin.viewer.scene,i=this._geometry.planeCoordinates.slice(),r=this._geometry.height<0,s=this._geometry.altitude+(r?this._geometry.height:0),n=this._geometry.height*(r?-1:1),o=c(EI(i),2),a=o[0],l=o[1],u=[],d=[],p=function(e){var t,i=u.length,r=A(a);try{for(r.s();!(t=r.n()).done;){var o=t.value;u.push([o[0],s+(e?n:0),o[1]])}}catch(e){r.e(e)}finally{r.f()}var c,p=A(l);try{for(p.s();!(c=p.n()).done;){var f=c.value;d.push.apply(d,h((e?f:f.slice(0).reverse()).map((function(e){return e+i}))))}}catch(e){p.e(e)}finally{p.f()}};p(!1),p(!0);for(var f=function(e){var t=a[e],i=a[(e+1)%a.length],r=s,o=s+n,l=u.length;u.push([t[0],r,t[1]],[i[0],r,i[1]],[i[0],o,i[1]],[t[0],o,t[1]]),d.push.apply(d,h([0,1,2,0,2,3].map((function(e){return e+l}))))},v=0;vb?1:0;w|=C,B.push(C)}switch(w){case 0:case 1:m.push(y);break;case 2:break;case 3:for(var M=[],E=0;E=3&&m.push(M)}}}catch(e){_.e(e)}finally{_.f()}i=m}}catch(e){d.e(e)}finally{d.f()}if(0===i.length)return null;var U,O=re.vec3([0,0,0]),N=new Set,Q=A(i);try{for(Q.s();!(U=Q.n()).done;){var V,H=A(U.value);try{for(H.s();!(V=H.n()).done;){var j=V.value,G=j.map((function(e){return e.toFixed(3)})).join(":");N.has(G)||(N.add(G),re.addVec3(O,j,O))}}catch(e){H.e(e)}finally{H.f()}}}catch(e){Q.e(e)}finally{Q.f()}return re.mulVec3Scalar(O,1/N.size,O),O}},{key:"center",get:function(){return this._center}},{key:"altitude",get:function(){return this._geometry.altitude},set:function(e){this._geometry.altitude=e,this._rebuildMesh()}},{key:"height",get:function(){return this._geometry.height},set:function(e){this._geometry.height=e,this._rebuildMesh()}},{key:"highlighted",get:function(){return this._highlighted},set:function(e){this._highlighted=e,this._zoneMesh&&(this._zoneMesh.highlighted=e)}},{key:"color",get:function(){return this._color},set:function(e){this._color=e,this._zoneMesh&&(this._zoneMesh.material.diffuse=MI(this._color))}},{key:"alpha",get:function(){return this._alpha},set:function(e){this._alpha=e,this._zoneMesh&&(this._zoneMesh.material.alpha=this._alpha)}},{key:"edges",get:function(){return this._edges},set:function(e){this._edges=e,this._zoneMesh&&(this._zoneMesh.edges=this._edges)}},{key:"visible",get:function(){return this._visible},set:function(e){this._visible=!!e,this._zoneMesh.visible=this._visible,this._needUpdate()}},{key:"getJSON",value:function(){return{id:this.id,geometry:this._geometry,alpha:this._alpha,color:this._color}}},{key:"duplicate",value:function(){return this.plugin.createZone({id:re.createUUID(),geometry:{planeCoordinates:this._geometry.planeCoordinates.map((function(e){return e.slice()})),altitude:this._geometry.altitude,height:this._geometry.height},alpha:this._alpha,color:this._color})}},{key:"destroy",value:function(){this._zoneMesh.destroy(),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),RI=function(e){g(i,Ce);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,e.viewer.scene)).zonesPlugin=e,r.pointerLens=s.pointerLens,r._deactivate=null,r}return C(i,[{key:"active",get:function(){return!!this._deactivate}},{key:"activate",value:function(e,t,i,r){if(!this._deactivate){if("object"===B(e)&&null!==e){var s=e,n=function(e,t){if(e in s)return s[e];if(void 0!==t)return t;throw"config missing: "+e};e=n("altitude"),t=n("height"),i=n("color","#008000"),r=n("alpha",.5)}var o=this.zonesPlugin,a=o.viewer,l=a.scene,u=this,A=DI(a,(function(t,i){return TI(e,re.vec3([0,1,0]),t,i)}));!function s(){u._deactivate=II(l,e,t,i,r,u.pointerLens,o,A,(function(e){var t=!0;u._deactivate=function(){t=!1},u.fire("zoneEnd",e),t&&s()})).deactivate}()}}},{key:"deactivate",value:function(){this._deactivate&&(this._deactivate(),this._deactivate=null)}},{key:"destroy",value:function(){this.deactivate(),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),UI=function(e){g(i,Ue);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,"Zones",e))._pointerLens=s.pointerLens,r._container=s.container||document.body,r._zones=[],r.defaultColor=void 0!==s.defaultColor?s.defaultColor:"#00BBFF",r.zIndex=s.zIndex||1e4,r._onMouseOver=function(e,t){r.fire("mouseOver",{plugin:b(r),zone:t,event:e})},r._onMouseLeave=function(e,t){r.fire("mouseLeave",{plugin:b(r),zone:t,event:e})},r._onContextMenu=function(e,t){r.fire("contextMenu",{plugin:b(r),zone:t,event:e})},r}return C(i,[{key:"createZone",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.viewer.scene.components[t.id]&&(this.error("Viewer scene component with this ID already exists: "+t.id),delete t.id);var i=new LI(this,{id:t.id,plugin:this,container:this._container,geometry:t.geometry,alpha:t.alpha,color:t.color,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});return this._zones.push(i),i.on("destroyed",(function(){var t=e._zones.indexOf(i);t>=0&&e._zones.splice(t,1)})),this.fire("zoneCreated",i),i}},{key:"zones",get:function(){return this._zones}},{key:"destroy",value:function(){f(w(i.prototype),"destroy",this).call(this)}}]),i}(),OI=function(e){g(i,Ce);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,e.viewer.scene)).zonesPlugin=e,r.pointerLens=s.pointerLens,r.pointerCircle=new Re(e.viewer),r._deactivate=null,r}return C(i,[{key:"active",get:function(){return!!this._deactivate}},{key:"activate",value:function(e,t,i,r){if("object"===B(e)&&null!==e){var s=e,n=function(e,t){if(e in s)return s[e];if(void 0!==t)return t;throw"config missing: "+e};e=n("altitude"),t=n("height"),i=n("color","#008000"),r=n("alpha",.5)}if(!this._deactivate){var o=this.zonesPlugin,a=o.viewer,l=a.scene,u=this,A=SI(a,this.pointerCircle,(function(t,i){return TI(e,re.vec3([0,1,0]),t,i)}));!function s(){u._deactivate=II(l,e,t,i,r,u.pointerLens,o,A,(function(e){var t=!0;u._deactivate=function(){t=!1},u.fire("zoneEnd",e),t&&s()})).deactivate}()}}},{key:"deactivate",value:function(){this._deactivate&&(this._deactivate(),this._deactivate=null)}},{key:"destroy",value:function(){this.deactivate(),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),NI=function(e,t,i,r,s,n,o,a,l){var u,A=n?function(e){n.visible=!!e,e&&(n.canvasPos=e)}:function(){},c=[function(){return A(null)}],h=kI(e,r,s);return c.push((function(){return h.destroy()})),function n(d){var p=FI(e,r),f=d.length>0&&function(e,t,i){var r=e.canvas.canvas,s=new ot(e,{});s.worldPos=i;var n=new ot(e,{}),o=r.ownerDocument.body,a=new ht(o,{color:t,thickness:1,thicknessClickable:6});a.setVisible(!1);var l=function(){var e=s.canvasPos.slice(),t=n.canvasPos.slice();lt(r,o,e),lt(r,o,t),a.setStartAndEnd(e[0],e[1],t[0],t[1])},u=e.camera.on("viewMatrix",l),A=e.camera.on("projMatrix",l);return{update:function(e){e&&(n.worldPos=e,l()),a.setVisible(!!e)},destroy:function(){e.camera.off(u),e.camera.off(A),s.destroy(),n.destroy(),a.destroy()}}}(e,r,d[d.length-1].getWorldPos());c.push((function(){p.destroy(),f&&f.destroy()}));var v=d.length>0&&d[0],g=function(e){var t=v&&v.getCanvasPos();return t&&re.distVec2(t,e)<10&&{canvasPos:t,worldPos:v.getWorldPos()}},m=function(){var e=function(e,t,i){return t[0]<=Math.max(e[0],i[0])&&t[0]>=Math.min(e[0],i[0])&&t[1]<=Math.max(e[1],i[1])&&t[1]>=Math.min(e[1],i[1])},t=function(e,t,i){var r=(t[1]-e[1])*(i[0]-t[0])-(t[0]-e[0])*(i[1]-t[1]);return 0===r?0:r>0?1:2};return function(i,r){for(var s=i[i.length-2],n=i[i.length-1],o=r?1:0;o2?d.map((function(e){return e.getWorldPos()})):null)}),(function(e,t){var i=d.length>2&&g(e);if(v&&v.setHighlighted(!!i),A(i?i.canvasPos:e),p.update(!i&&t),f&&f.update(i?i.worldPos:t),d.length>=2){var r=d.map((function(e){return e.getWorldPos()})).concat(i?[]:[t]),s=m(r.map((function(e){return[e[0],e[2]]})),i);h.updateBase(s?null:r)}else h.updateBase(null)}),(function(e,a){var u=d.length>2&&g(e),A=d.map((function(e){return e.getWorldPos()})).concat(u?[]:[a]);h.updateBase(A);var v=A.map((function(e){return[e[0],e[2]]}));d.length>2&&m(v,u)?(c.pop()(),n(d)):u?(p.update(a),c.forEach((function(e){return e()})),l(o.createZone({id:re.createUUID(),geometry:{planeCoordinates:v,altitude:t,height:i},alpha:s,color:r}))):(p.update(a),f&&f.update(a),n(d.concat(p)))}))}([]),{closeSurface:function(){throw"TODO"},deactivate:function(){u(),c.forEach((function(e){return e()}))}}},QI=function(e){g(i,Ce);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,e.viewer.scene)).zonesPlugin=e,r.pointerLens=s.pointerLens,r._action=null,r}return C(i,[{key:"active",get:function(){return!!this._action}},{key:"activate",value:function(e,t,i,r){if("object"===B(e)&&null!==e){var s=e,n=function(e,t){if(e in s)return s[e];if(void 0!==t)return t;throw"config missing: "+e};e=n("altitude"),t=n("height"),i=n("color","#008000"),r=n("alpha",.5)}if(!this._action){var o=this.zonesPlugin,a=o.viewer,l=a.scene,u=this,A=DI(a,(function(t,i){return TI(e,re.vec3([0,1,0]),t,i)}));!function s(){u._action=NI(l,e,t,i,r,u.pointerLens,o,A,(function(e){var t=!0;u._action={deactivate:function(){t=!1}},u.fire("zoneEnd",e),t&&s()}))}()}}},{key:"deactivate",value:function(){this._action&&(this._action.deactivate(),this._action=null)}},{key:"destroy",value:function(){this.deactivate(),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),VI=function(e){g(i,Ce);var t=_(i);function i(e){var r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return x(this,i),(r=t.call(this,e.viewer.scene)).zonesPlugin=e,r.pointerLens=s.pointerLens,r.pointerCircle=new Re(e.viewer),r._action=null,r}return C(i,[{key:"active",get:function(){return!!this._action}},{key:"activate",value:function(e,t,i,r){if("object"===B(e)&&null!==e){var s=e,n=function(e,t){if(e in s)return s[e];if(void 0!==t)return t;throw"config missing: "+e};e=n("altitude"),t=n("height"),i=n("color","#008000"),r=n("alpha",.5)}if(!this._action){var o=this.zonesPlugin,a=o.viewer,l=a.scene,u=this,A=SI(a,this.pointerCircle,(function(t,i){return TI(e,re.vec3([0,1,0]),t,i)}));!function s(){u._action=NI(l,e,t,i,r,u.pointerLens,o,A,(function(e){var t=!0;u._action={deactivate:function(){t=!1}},u.fire("zoneEnd",e),t&&s()}))}()}}},{key:"deactivate",value:function(){this._action&&(this._action.deactivate(),this._action=null)}},{key:"destroy",value:function(){this.deactivate(),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),HI=function(e){g(i,Ce);var t=_(i);function i(e,r,s,n){var o;x(this,i);var a=e.plugin.viewer,l=a.scene;o=t.call(this,l);var u=e._geometry.altitude,A=e._geometry.planeCoordinates.map((function(t){var i=l.canvas.canvas.ownerDocument.body,r=new ut(l,{},i,{fillColor:e._color});return r.worldPos=re.vec3([t[0],u,t[1]]),r.on("worldPos",(function(){t[0]=r.worldPos[0],t[1]=r.worldPos[2];try{e._rebuildMesh()}catch(t){e._zoneMesh&&(e._zoneMesh.destroy(),e._zoneMesh=null)}})),r})),c=ct({viewer:a,handleMouseEvents:s,handleTouchEvents:n,pointerLens:r&&r.pointerLens,dots:A,ray2WorldPos:function(e,t){return TI(u,re.vec3([0,1,0]),e,t)},onEnd:function(t,i){return e._zoneMesh&&o.fire("edited"),!!e._zoneMesh}}),h=function(){c(),A.forEach((function(e){return e.destroy()}))},d=e.on("destroyed",h);return o._deactivate=function(){e.off("destroyed",d),h()},o}return C(i,[{key:"deactivate",value:function(){this._deactivate(),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),jI=function(e){g(i,HI);var t=_(i);function i(e,r){return x(this,i),t.call(this,e,r,!0,!1)}return C(i)}(),GI=function(e){g(i,HI);var t=_(i);function i(e,r){return x(this,i),t.call(this,e,r,!1,!0)}return C(i)}(),zI=function(e){g(i,Ce);var t=_(i);function i(e,r,s,n){var o;x(this,i);var a=e.plugin.viewer,l=a.scene,u=l.canvas.canvas,A=b(o=t.call(this,l)),c=e._geometry.altitude,d=r&&r.pointerLens,p=d?function(e){d.visible=!!e,e&&(d.canvasPos=e)}:function(){},f=function(e){var t,i,r=re.vec3(),s=re.vec3();return re.canvasPosToWorldRay(u,l.camera.viewMatrix,l.camera.projMatrix,l.camera.projection,e,r,s),t=r,i=s,TI(c,re.vec3([0,1,0]),t,i)},v=function(e,t){return t[0]=e.clientX,t[1]=e.clientY,lt(u.ownerDocument.body,u,t),t},g=function(e,t){var i=function(e){e.preventDefault(),t(e)};return u.addEventListener(e,i),function(){return u.removeEventListener(e,i)}},m=function(){},_=function(t,i,r,s){var n,o,l,c,h=s(t),d=v(h,re.vec2()),_=a.scene.pick({canvasPos:d,includeEntities:[e._zoneMesh.id]});if((_&&_.entity&&_.entity.zone)===e){m(),u.style.cursor="move",a.cameraControl.active=!1;var y=(n=e._geometry.planeCoordinates.map((function(e){return e.slice()})),o=f(d),l=re.vec2([o[0],o[2]]),c=re.vec2(),function(t){var i=f(t);c[0]=i[0],c[1]=i[2],re.subVec2(l,c,c),e._geometry.planeCoordinates.forEach((function(e,t){re.subVec2(n[t],c,e)}));try{e._rebuildMesh()}catch(t){e._zoneMesh&&(e._zoneMesh.destroy(),e._zoneMesh=null)}}),b=g(i,(function(e){var t=s(e);if(t){var i=v(t,re.vec2());y(i),p(i)}})),w=g(r,(function(e){var t=s(e);if(t){var i=v(t,re.vec2());y(i),p(null),m(),A.fire("translated")}}));m=function(){m=function(){},u.style.cursor="default",a.cameraControl.active=!0,b(),w()}}},y=[];s&&y.push(g("mousedown",(function(e){1===e.which&&_(e,"mousemove","mouseup",(function(e){return 1===e.which&&e}))}))),n&&y.push(g("touchstart",(function(e){if(1===e.touches.length){var t=e.touches[0].identifier;_(e,"touchmove","touchend",(function(e){return h(e.changedTouches).find((function(e){return e.identifier===t}))}))}})));var w=function(){m(),y.forEach((function(e){return e()})),p(null)},B=e.on("destroyed",w);return o._deactivate=function(){e.off("destroyed",B),w()},o}return C(i,[{key:"deactivate",value:function(){this._deactivate(),f(w(i.prototype),"destroy",this).call(this)}}]),i}(),WI=function(e){g(i,zI);var t=_(i);function i(e,r){return x(this,i),t.call(this,e,r,!0,!1)}return C(i)}(),KI=function(e){g(i,zI);var t=_(i);function i(e,r){return x(this,i),t.call(this,e,r,!1,!0)}return C(i)}();export{Rr as AlphaFormat,Ti as AmbientLight,wt as AngleMeasurementEditMouseControl,Bt as AngleMeasurementEditTouchControl,gt as AngleMeasurementsControl,mt as AngleMeasurementsMouseControl,_t as AngleMeasurementsPlugin,yt as AngleMeasurementsTouchControl,Et as AnnotationsPlugin,Bn as AxisGizmoPlugin,Dh as BCFViewpointsPlugin,ho as Bitmap,Cr as ByteType,wd as CameraMemento,id as CameraPath,ud as CameraPathAnimation,xI as CityJSONLoaderPlugin,dr as ClampToEdgeWrapping,Ce as Component,Ps as CompressedMediaType,la as Configs,Y as ContextMenu,Md as CubicBezierCurve,$h as Curve,jc as DefaultLoadingManager,Vr as DepthFormat,Hr as DepthStencilFormat,Si as DirLight,zh as DistanceMeasurementEditControl,Wh as DistanceMeasurementEditMouseControl,Kh as DistanceMeasurementEditTouchControl,Vh as DistanceMeasurementsControl,Hh as DistanceMeasurementsMouseControl,jh as DistanceMeasurementsPlugin,Gh as DistanceMeasurementsTouchControl,PI as DotBIMDefaultDataSource,CI as DotBIMLoaderPlugin,tr as EdgeMaterial,$i as EmphasisMaterial,uF as FaceAlignedSectionPlanesPlugin,Xh as FastNavPlugin,Ir as FloatType,Zn as Fresnel,Ie as Frustum,ke as FrustumPlane,ws as GIFMediaType,Yh as GLTFDefaultDataSource,ME as GLTFLoaderPlugin,Dr as HalfFloatType,pd as ImagePlane,Fr as IntType,Bs as JPEGMediaType,Yc as KTX2TextureTranscoder,zk as LASLoaderPlugin,Ln as LambertMaterial,yd as LightMap,Mh as LineSet,ys as LinearEncoding,yr as LinearFilter,xr as LinearMipMapLinearFilter,wr as LinearMipMapNearestFilter,Br as LinearMipmapLinearFilter,br as LinearMipmapNearestFilter,Gc as Loader,Hc as LoadingManager,Jh as LocaleService,Qr as LuminanceAlphaFormat,Nr as LuminanceFormat,G as Map,ot as Marker,Te as MarqueePicker,Le as MarqueePickerMouseControl,gn as Mesh,On as MetallicMaterial,pr as MirroredRepeatWrapping,xd as ModelMemento,IE as NavCubePlugin,fr as NearestFilter,_r as NearestMipMapLinearFilter,vr as NearestMipMapNearestFilter,mr as NearestMipmapLinearFilter,gr as NearestMipmapNearestFilter,Tn as Node,VE as OBJLoaderPlugin,ne as ObjectsKdTree3,Cd as ObjectsMemento,xs as PNGMediaType,Ed as Path,kd as PerformanceModel,Zi as PhongMaterial,Rt as PickResult,Ue as Plugin,fd as PointLight,Re as PointerCircle,J as PointerLens,Fd as QuadraticBezierCurve,oe as Queue,Or as RGBAFormat,Kr as RGBAIntegerFormat,vs as RGBA_ASTC_10x10_Format,ds as RGBA_ASTC_10x5_Format,ps as RGBA_ASTC_10x6_Format,fs as RGBA_ASTC_10x8_Format,gs as RGBA_ASTC_12x10_Format,ms as RGBA_ASTC_12x12_Format,ns as RGBA_ASTC_4x4_Format,os as RGBA_ASTC_5x4_Format,as as RGBA_ASTC_5x5_Format,ls as RGBA_ASTC_6x5_Format,us as RGBA_ASTC_6x6_Format,As as RGBA_ASTC_8x5_Format,cs as RGBA_ASTC_8x6_Format,hs as RGBA_ASTC_8x8_Format,_s as RGBA_BPTC_Format,ss as RGBA_ETC2_EAC_Format,ts as RGBA_PVRTC_2BPPV1_Format,es as RGBA_PVRTC_4BPPV1_Format,Yr as RGBA_S3TC_DXT1_Format,Jr as RGBA_S3TC_DXT3_Format,Zr as RGBA_S3TC_DXT5_Format,Ur as RGBFormat,is as RGB_ETC1_Format,rs as RGB_ETC2_Format,$r as RGB_PVRTC_2BPPV1_Format,qr as RGB_PVRTC_4BPPV1_Format,Xr as RGB_S3TC_DXT1_Format,zr as RGFormat,Wr as RGIntegerFormat,Wi as ReadableGeometry,jr as RedFormat,Gr as RedIntegerFormat,_d as ReflectionMap,hr as RepeatWrapping,cF as STLDefaultDataSource,yF as STLLoaderPlugin,Ph as SceneModel,go as SceneModelMesh,vh as SceneModelTransform,xn as SectionPlane,YE as SectionPlanesPlugin,Mr as ShortType,Id as Skybox,AF as SkyboxesPlugin,Vn as SpecularMaterial,ed as SplineCurve,bd as SpriteMarker,tF as StoreyViewsPlugin,Jn as Texture,Dd as TextureTranscoder,BF as TreeViewPlugin,Pr as UnsignedByteType,Lr as UnsignedInt248Type,kr as UnsignedIntType,Sr as UnsignedShort4444Type,Tr as UnsignedShort5551Type,Er as UnsignedShortType,eo as VBOGeometry,EF as ViewCullPlugin,bb as Viewer,Uk as WebIFCLoaderPlugin,Kc as WorkerPool,FF as XKTDefaultDataSource,_k as XKTLoaderPlugin,Lk as XML3DLoaderPlugin,HI as ZoneEditControl,jI as ZoneEditMouseControl,GI as ZoneEditTouchControl,zI as ZoneTranslateControl,WI as ZoneTranslateMouseControl,KI as ZoneTranslateTouchControl,RI as ZonesMouseControl,UI as ZonesPlugin,QI as ZonesPolysurfaceMouseControl,VI as ZonesPolysurfaceTouchControl,OI as ZonesTouchControl,Ki as buildBoxGeometry,so as buildBoxLinesGeometry,no as buildBoxLinesGeometryFromAABB,_n as buildCylinderGeometry,oo as buildGridGeometry,co as buildLineGeometry,ao as buildPlaneGeometry,uo as buildPolylineGeometry,Ao as buildPolylineGeometryFromCurve,yn as buildSphereGeometry,lo as buildTorusGeometry,wn as buildVectorTextGeometry,Ve as createRTCViewMat,Se as frustumIntersectsAABB3,Zc as getKTX2TextureTranscoder,ze as getPlaneRTCPos,io as load3DSGeometry,ro as loadOBJGeometry,re as math,Ge as rtcToWorldPos,bs as sRGBEncoding,De as setFrustum,ae as stats,he as utils,He as worldToRTCPos,je as worldToRTCPositions};