UNPKG

@jdultra/threedtiles

Version:

An OGC 3DTiles viewer for Three.js

2 lines 346 kB
/*! For license information please see threedtiles.min.js.LICENSE.txt */ !function webpackUniversalModuleDefinition(t,a){"object"==typeof exports&&"object"==typeof module?module.exports=a(require("three")):"function"==typeof define&&define.amd?define("threedtiles",["three"],a):"object"==typeof exports?exports.threedtiles=a(require("three")):t.threedtiles=a(t.THREE)}(this,(t=>(()=>{var a={649:(t,a,r)=>{const i=r(180),o=r(31),A=r(839);t.exports={Heap:i,Queue:o,LinkedHashMap:A}},180:t=>{t.exports=class Heap{constructor(t,a){if(this._data=[],this._comparator=function compare(t,a){return t>=a},null!=t){if(!Array.isArray(t))throw Error("Constructor expects data to be an array");this._data=t}if(null!=a){if("function"!=typeof a)throw Error("Constructor expects comparator to be a function");this._comparator=a}}peek(){return this.size()<1?null:this._data[0]}pop(){if(this.size()<1)return null;const t=this._data[0];return this.swap(this.size()-1,0),this._data.pop(),this.heapifyDown(0),t}replaceTop(t){if(this.size()<1)return null;const a=this._data[0];return this._data[0]=t,this.heapifyDown(0),a}push(t){this._data.push(t),this.heapifyUp(this._data.length-1)}size(){return this._data.length}swap(t,a){const r=this._data[t];this._data[t]=this._data[a],this._data[a]=r}heapifyUp(t){if(0===t)return;const a=Math.floor((t-1)/2);this._comparator(this._data[t],this._data[a])||(this.swap(t,a),this.heapifyUp(a))}heapifyDown(t){const a=2*t+1,r=2*t+2;if(a>=this._data.length)return;const i=r<this._data.length&&!this._comparator(this._data[r],this._data[a])?r:a;this._comparator(this._data[t],this._data[i])&&(this.swap(t,i),this.heapifyDown(i))}}},839:t=>{t.exports=class LinkedHashMap{constructor(){this._data=new Map,this._link=new Map,this._head=void 0,this._tail=void 0}put(t,a,r=!1){this.has(t)?this._data.set(t,a):(this._data.set(t,a),this._link.set(t,{previous:void 0,next:void 0}),null==this._head?(this._head=t,this._tail=t):r?(this._link.get(this._head).previous=t,this._link.get(t).next=this._head,this._head=t):(this._link.get(this._tail).next=t,this._link.get(t).previous=this._tail,this._tail=t))}head(){return{key:this._head,value:this.get(this._head),next:()=>this.next(this._head),previous:()=>null}}tail(){return{key:this._tail,value:this.get(this._tail),next:()=>null,previous:()=>this.previous(this._tail)}}get(t){return this._data.get(t)}previousKey(t){const a=this._link.get(t);return null!=a?a.previous:void 0}previousValue(t){return this.get(this.previousKey(t))}previous(t){const a=this.previousKey(t);return{key:a,value:this.get(a),next:()=>this.next(a),previous:()=>this.previous(a)}}nextKey(t){const a=this._link.get(t);return null!=a?a.next:void 0}nextValue(t){return this.get(this.nextKey(t))}next(t){const a=this.nextKey(t);return{key:a,value:this.get(a),next:()=>this.next(a),previous:()=>this.previous(a)}}remove(t){const a=this._data.get(t);if(null!=a)if(1===this.size())this.reset();else{if(t===this._head){const t=this._link.get(this._head);this._link.get(t.next).previous=null,this._head=t.next}else if(t===this._tail){const t=this._link.get(this._tail);this._link.get(t.previous).next=null,this._tail=t.previous}else{const a=this._link.get(t),r=this._link.get(a.previous),i=this._link.get(a.next);r.next=a.next,i.previous=a.previous}this._link.delete(t),this._data.delete(t)}return a}has(t){return this._data.has(t)}size(){return this._data.size}reset(){this._data.clear(),this._link.clear(),this._head=void 0,this._tail=void 0}keys(){return this._data.keys()}values(){return this._data.values()}entries(){return this._data.entries()}toArray(t="orderByInsert"){if("orderByInsert"!==t){const t=[];let a=this._head;for(;null!=a;)t.push({key:a,value:this.get(a)}),a=this.nextKey(a);return t}return Array.from(this.keys()).map((t=>({key:t,value:this.get(t)})))}}},31:t=>{t.exports=class Queue{constructor(t,a){if(this._data=[],this._head=0,this._cap=null,null!=t){if(!Array.isArray(t))throw Error("Constructor expects data to be an array");this._data=t}if(null!=a){if("number"!=typeof a)throw Error("Constructor expects capacity to be a number");this._cap=a}}enqueue(t){return!(null!=this._cap&&this.size()>=this._cap)&&(this._data.push(t),!0)}dequeue(){if(0===this.size())return null;const t=this._data[this._head];return this._head+=1,2*this._head>=this._data.length&&(this._data=this._data.slice(this._head),this._head=0),t}peek(t=!1){return this.size()>0?t?this._data[this._data.length-1]:this._data[this._head]:null}size(){return this._data.length-this._head}updateCapacity(t){this._cap=t}reset(){this._data=[],this._head=0}forEach(t){for(let a=this._head;a<this._data.length;a+=1)t(this._data[a],a-this._head)}toArray(){return this._data.slice(this._head)}}},975:t=>{"use strict";function assertPath(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function normalizeStringPosix(t,a){for(var r,i="",o=0,A=-1,c=0,l=0;l<=t.length;++l){if(l<t.length)r=t.charCodeAt(l);else{if(47===r)break;r=47}if(47===r){if(A===l-1||1===c);else if(A!==l-1&&2===c){if(i.length<2||2!==o||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var d=i.lastIndexOf("/");if(d!==i.length-1){-1===d?(i="",o=0):o=(i=i.slice(0,d)).length-1-i.lastIndexOf("/"),A=l,c=0;continue}}else if(2===i.length||1===i.length){i="",o=0,A=l,c=0;continue}a&&(i.length>0?i+="/..":i="..",o=2)}else i.length>0?i+="/"+t.slice(A+1,l):i=t.slice(A+1,l),o=l-A-1;A=l,c=0}else 46===r&&-1!==c?++c:c=-1}return i}var a={resolve:function resolve(){for(var t,a="",r=!1,i=arguments.length-1;i>=-1&&!r;i--){var o;i>=0?o=arguments[i]:(void 0===t&&(t=process.cwd()),o=t),assertPath(o),0!==o.length&&(a=o+"/"+a,r=47===o.charCodeAt(0))}return a=normalizeStringPosix(a,!r),r?a.length>0?"/"+a:"/":a.length>0?a:"."},normalize:function normalize(t){if(assertPath(t),0===t.length)return".";var a=47===t.charCodeAt(0),r=47===t.charCodeAt(t.length-1);return 0!==(t=normalizeStringPosix(t,!a)).length||a||(t="."),t.length>0&&r&&(t+="/"),a?"/"+t:t},isAbsolute:function isAbsolute(t){return assertPath(t),t.length>0&&47===t.charCodeAt(0)},join:function join(){if(0===arguments.length)return".";for(var t,r=0;r<arguments.length;++r){var i=arguments[r];assertPath(i),i.length>0&&(void 0===t?t=i:t+="/"+i)}return void 0===t?".":a.normalize(t)},relative:function relative(t,r){if(assertPath(t),assertPath(r),t===r)return"";if((t=a.resolve(t))===(r=a.resolve(r)))return"";for(var i=1;i<t.length&&47===t.charCodeAt(i);++i);for(var o=t.length,A=o-i,c=1;c<r.length&&47===r.charCodeAt(c);++c);for(var l=r.length-c,d=A<l?A:l,h=-1,b=0;b<=d;++b){if(b===d){if(l>d){if(47===r.charCodeAt(c+b))return r.slice(c+b+1);if(0===b)return r.slice(c+b)}else A>d&&(47===t.charCodeAt(i+b)?h=b:0===b&&(h=0));break}var u=t.charCodeAt(i+b);if(u!==r.charCodeAt(c+b))break;47===u&&(h=b)}var g="";for(b=i+h+1;b<=o;++b)b!==o&&47!==t.charCodeAt(b)||(0===g.length?g+="..":g+="/..");return g.length>0?g+r.slice(c+h):(c+=h,47===r.charCodeAt(c)&&++c,r.slice(c))},_makeLong:function _makeLong(t){return t},dirname:function dirname(t){if(assertPath(t),0===t.length)return".";for(var a=t.charCodeAt(0),r=47===a,i=-1,o=!0,A=t.length-1;A>=1;--A)if(47===(a=t.charCodeAt(A))){if(!o){i=A;break}}else o=!1;return-1===i?r?"/":".":r&&1===i?"//":t.slice(0,i)},basename:function basename(t,a){if(void 0!==a&&"string"!=typeof a)throw new TypeError('"ext" argument must be a string');assertPath(t);var r,i=0,o=-1,A=!0;if(void 0!==a&&a.length>0&&a.length<=t.length){if(a.length===t.length&&a===t)return"";var c=a.length-1,l=-1;for(r=t.length-1;r>=0;--r){var d=t.charCodeAt(r);if(47===d){if(!A){i=r+1;break}}else-1===l&&(A=!1,l=r+1),c>=0&&(d===a.charCodeAt(c)?-1==--c&&(o=r):(c=-1,o=l))}return i===o?o=l:-1===o&&(o=t.length),t.slice(i,o)}for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!A){i=r+1;break}}else-1===o&&(A=!1,o=r+1);return-1===o?"":t.slice(i,o)},extname:function extname(t){assertPath(t);for(var a=-1,r=0,i=-1,o=!0,A=0,c=t.length-1;c>=0;--c){var l=t.charCodeAt(c);if(47!==l)-1===i&&(o=!1,i=c+1),46===l?-1===a?a=c:1!==A&&(A=1):-1!==a&&(A=-1);else if(!o){r=c+1;break}}return-1===a||-1===i||0===A||1===A&&a===i-1&&a===r+1?"":t.slice(a,i)},format:function format(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function _format(t,a){var r=a.dir||a.root,i=a.base||(a.name||"")+(a.ext||"");return r?r===a.root?r+i:r+t+i:i}("/",t)},parse:function parse(t){assertPath(t);var a={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return a;var r,i=t.charCodeAt(0),o=47===i;o?(a.root="/",r=1):r=0;for(var A=-1,c=0,l=-1,d=!0,h=t.length-1,b=0;h>=r;--h)if(47!==(i=t.charCodeAt(h)))-1===l&&(d=!1,l=h+1),46===i?-1===A?A=h:1!==b&&(b=1):-1!==A&&(b=-1);else if(!d){c=h+1;break}return-1===A||-1===l||0===b||1===b&&A===l-1&&A===c+1?-1!==l&&(a.base=a.name=0===c&&o?t.slice(1,l):t.slice(c,l)):(0===c&&o?(a.name=t.slice(1,A),a.base=t.slice(1,l)):(a.name=t.slice(c,A),a.base=t.slice(c,l)),a.ext=t.slice(A,l)),c>0?a.dir=t.slice(0,c-1):o&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,t.exports=a},818:a=>{"use strict";a.exports=t}},r={};function __webpack_require__(t){var i=r[t];if(void 0!==i)return i.exports;var o=r[t]={exports:{}};return a[t](o,o.exports,__webpack_require__),o.exports}__webpack_require__.d=(t,a)=>{for(var r in a)__webpack_require__.o(a,r)&&!__webpack_require__.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},__webpack_require__.o=(t,a)=>Object.prototype.hasOwnProperty.call(t,a),__webpack_require__.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";__webpack_require__.r(i),__webpack_require__.d(i,{InstancedOGC3DTile:()=>Me,InstancedTileLoader:()=>Ue,OGC3DTile:()=>xe,OcclusionCullingService:()=>a,TileLoader:()=>he,getOGC3DTilesCopyrightInfo:()=>getOGC3DTilesCopyrightInfo});var t=__webpack_require__(818);function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _defineProperties(t,a){for(var r=0;r<a.length;r++){var i=a[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,_toPropertyKey(i.key),i)}}function _toPropertyKey(t){var a=function _toPrimitive(t,a){if("object"!=_typeof(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,a||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===a?String:Number)(t)}(t,"string");return"symbol"==_typeof(a)?a:a+""}var a=function(){return function _createClass(t,a,r){return a&&_defineProperties(t.prototype,a),r&&_defineProperties(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}((function OcclusionCullingService(){!function _classCallCheck(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}(this,OcclusionCullingService),this.cullMap=[],this.cullMaterial=new t.MeshBasicMaterial({vertexColors:!0}),this.cullMaterial.side=t.FrontSide,this.cullTarget=this._createCullTarget(),this.cullPixels=new Uint8Array(4*this.cullTarget.width*this.cullTarget.height)}),[{key:"setSide",value:function setSide(t){this.cullMaterial.side=t}},{key:"_createCullTarget",value:function _createCullTarget(){var a=new t.WebGLRenderTarget(Math.floor(.05*window.innerWidth),Math.floor(.05*window.innerHeight));return a.texture.format=t.RGBAFormat,a.texture.colorSpace=t.LinearSRGBColorSpace,a.texture.minFilter=t.NearestFilter,a.texture.magFilter=t.NearestFilter,a.texture.generateMipmaps=!1,a.stencilBuffer=!1,a.depthBuffer=!0,a.depthTexture=new t.DepthTexture,a.depthTexture.format=t.DepthFormat,a.depthTexture.type=t.UnsignedShortType,a}},{key:"update",value:function update(a,r,i){var o=r.getRenderTarget(),A=a.overrideMaterial;a.overrideMaterial=this.cullMaterial,r.setRenderTarget(this.cullTarget),r.render(a,i),a.overrideMaterial=A,r.setRenderTarget(o),r.readRenderTargetPixels(this.cullTarget,0,0,this.cullTarget.width,this.cullTarget.height,this.cullPixels),this.cullMap=[];for(var c=0;c<this.cullPixels.length;c+=4){var l=t.MathUtils.clamp(this.cullPixels[c],0,255)<<16^t.MathUtils.clamp(this.cullPixels[c+1],0,255)<<8^t.MathUtils.clamp(this.cullPixels[c+2],0,255);this.cullMap[l]=!0}}},{key:"hasID",value:function hasID(t){return this.cullMap[t]}}])}();function obb_typeof(t){return obb_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},obb_typeof(t)}function _createForOfIteratorHelper(t,a){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function _unsupportedIterableToArray(t,a){if(t){if("string"==typeof t)return _arrayLikeToArray(t,a);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,a):void 0}}(t))||a&&t&&"number"==typeof t.length){r&&(t=r);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var A,c=!0,l=!1;return{s:function s(){r=r.call(t)},n:function n(){var t=r.next();return c=t.done,t},e:function e(t){l=!0,A=t},f:function f(){try{c||null==r.return||r.return()}finally{if(l)throw A}}}}function _arrayLikeToArray(t,a){(null==a||a>t.length)&&(a=t.length);for(var r=0,i=Array(a);r<a;r++)i[r]=t[r];return i}function obb_defineProperties(t,a){for(var r=0;r<a.length;r++){var i=a[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,obb_toPropertyKey(i.key),i)}}function obb_toPropertyKey(t){var a=function obb_toPrimitive(t,a){if("object"!=obb_typeof(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,a||"default");if("object"!=obb_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===a?String:Number)(t)}(t,"string");return"symbol"==obb_typeof(a)?a:a+""}var r=function(){return function obb_createClass(t,a,r){return a&&obb_defineProperties(t.prototype,a),r&&obb_defineProperties(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}((function OBB(a){!function obb_classCallCheck(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}(this,OBB),this.center=new t.Vector3(a[0],a[1],a[2]);var r=new t.Vector3(a[3],a[4],a[4]),i=new t.Vector3(a[6],a[7],a[8]),o=new t.Vector3(a[9],a[10],a[11]);this.halfWidth=r.length(),this.halfHeight=i.length(),this.halfDepth=o.length(),this.aabb=new t.Box3;for(var A=new t.Vector3,c=[-1,1],l=0,d=c;l<d.length;l++){var h,b=d[l],u=_createForOfIteratorHelper(c);try{for(u.s();!(h=u.n()).done;){var g,p=h.value,I=_createForOfIteratorHelper(c);try{for(I.s();!(g=I.n()).done;){var y=g.value;A.copy(this.center).addScaledVector(r,b).addScaledVector(i,p).addScaledVector(o,y),this.aabb.expandByPoint(A)}}catch(t){I.e(t)}finally{I.f()}}}catch(t){u.e(t)}finally{u.f()}}r.normalize(),i.normalize(),o.normalize(),this.sphere=new t.Sphere(this.center,Math.sqrt(this.halfWidth*this.halfWidth+this.halfHeight*this.halfHeight+this.halfDepth*this.halfDepth)),this.matrixToOBBCoordinateSystem=new t.Matrix3,this.matrixToOBBCoordinateSystem.set(r.x,r.y,r.z,i.x,i.y,i.z,o.x,o.y,o.z)}),[{key:"inFrustum",value:function inFrustum(t){return t.intersectsSphere(this.sphere)}},{key:"distanceToPoint",value:function distanceToPoint(t){var a=t.clone();a.sub(this.center),a.applyMatrix3(this.matrixToOBBCoordinateSystem);var r=Math.max(0,Math.max(-this.halfWidth-a.x,a.x-this.halfWidth)),i=Math.max(0,Math.max(-this.halfHeight-a.y,a.y-this.halfHeight)),o=Math.max(0,Math.max(-this.halfDepth-a.z,a.z-this.halfDepth));return Math.sqrt(r*r+i*i+o*o)}}])}(),o=__webpack_require__(649);function FeatureTable_typeof(t){return FeatureTable_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},FeatureTable_typeof(t)}function _callSuper(t,a,r){return a=_getPrototypeOf(a),function _possibleConstructorReturn(t,a){if(a&&("object"==FeatureTable_typeof(a)||"function"==typeof a))return a;if(void 0!==a)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,_isNativeReflectConstruct()?Reflect.construct(a,r||[],_getPrototypeOf(t).constructor):a.apply(t,r))}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t})()}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,a,r){var i=function _superPropBase(t,a){for(;!{}.hasOwnProperty.call(t,a)&&null!==(t=_getPrototypeOf(t)););return t}(t,a);if(i){var o=Object.getOwnPropertyDescriptor(i,a);return o.get?o.get.call(arguments.length<3?t:r):o.value}},_get.apply(null,arguments)}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_getPrototypeOf(t)}function _setPrototypeOf(t,a){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,a){return t.__proto__=a,t},_setPrototypeOf(t,a)}function FeatureTable_classCallCheck(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function FeatureTable_defineProperties(t,a){for(var r=0;r<a.length;r++){var i=a[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,FeatureTable_toPropertyKey(i.key),i)}}function FeatureTable_createClass(t,a,r){return a&&FeatureTable_defineProperties(t.prototype,a),r&&FeatureTable_defineProperties(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function FeatureTable_toPropertyKey(t){var a=function FeatureTable_toPrimitive(t,a){if("object"!=FeatureTable_typeof(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,a||"default");if("object"!=FeatureTable_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===a?String:Number)(t)}(t,"string");return"symbol"==FeatureTable_typeof(a)?a:a+""}var A=new TextDecoder,c=function(){return FeatureTable_createClass((function FeatureTable(t,a,r,i){FeatureTable_classCallCheck(this,FeatureTable),this.buffer=t,this.binOffset=a+r,this.binLength=i;var o=null;if(0!==r)try{var c=new Uint8Array(t,a,r);o=JSON.parse(A.decode(c))}catch(t){o={}}else o={};this.header=o}),[{key:"getKeys",value:function getKeys(){return Object.keys(this.header)}},{key:"getData",value:function getData(t,a){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=this.header;if(!(t in o))return null;var A=o[t];if(A instanceof Object){if(Array.isArray(A))return A;var c,l,d=this.buffer,h=this.binOffset,b=this.binLength,u=A.byteOffset||0,g=A.type||i,p=A.componentType||r;if("type"in A&&i&&A.type!==i)throw new Error("FeatureTable: Specified type does not match expected type.");switch(g){case"SCALAR":c=1;break;case"VEC2":c=2;break;case"VEC3":c=3;break;case"VEC4":c=4;break;default:throw new Error('FeatureTable : Feature type not provided for "'.concat(t,'".'))}var I=h+u,y=a*c;switch(p){case"BYTE":l=new Int8Array(d,I,y);break;case"UNSIGNED_BYTE":l=new Uint8Array(d,I,y);break;case"SHORT":l=new Int16Array(d,I,y);break;case"UNSIGNED_SHORT":l=new Uint16Array(d,I,y);break;case"INT":l=new Int32Array(d,I,y);break;case"UNSIGNED_INT":l=new Uint32Array(d,I,y);break;case"FLOAT":l=new Float32Array(d,I,y);break;case"DOUBLE":l=new Float64Array(d,I,y);break;default:throw new Error('FeatureTable : Feature component type not provided for "'.concat(t,'".'))}if(I+y*l.BYTES_PER_ELEMENT>h+b)throw new Error("FeatureTable: Feature data read outside binary body length.");return l}return A}}])}(),l=function(t){function BatchTable(t,a,r,i,o){var A;return FeatureTable_classCallCheck(this,BatchTable),(A=_callSuper(this,BatchTable,[t,r,i,o])).batchSize=a,A}return function _inherits(t,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(a&&a.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),a&&_setPrototypeOf(t,a)}(BatchTable,t),FeatureTable_createClass(BatchTable,[{key:"getData",value:function getData(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return _get(_getPrototypeOf(BatchTable.prototype),"getData",this).call(this,t,this.batchSize,a,r)}}])}(c);function mergeAttributes(a){let r,i,o,A=-1,c=0;for(let t=0;t<a.length;++t){const l=a[t];if(void 0===r&&(r=l.array.constructor),r!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===i&&(i=l.itemSize),i!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===o&&(o=l.normalized),o!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===A&&(A=l.gpuType),A!==l.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;c+=l.count*i}const l=new r(c),d=new t.BufferAttribute(l,i,o);let h=0;for(let t=0;t<a.length;++t){const r=a[t];if(r.isInterleavedBufferAttribute){const t=h/i;for(let a=0,o=r.count;a<o;a++)for(let o=0;o<i;o++){const i=r.getComponent(a,o);d.setComponent(a+t,o,i)}}else l.set(r.array,h);h+=r.count*i}return void 0!==A&&(d.gpuType=A),d}function toTrianglesDrawMode(a,r){if(r===t.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),a;if(r===t.TriangleFanDrawMode||r===t.TriangleStripDrawMode){let i=a.getIndex();if(null===i){const t=[],r=a.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),a;for(let a=0;a<r.count;a++)t.push(a);a.setIndex(t),i=a.getIndex()}const o=i.count-2,A=[];if(r===t.TriangleFanDrawMode)for(let t=1;t<=o;t++)A.push(i.getX(0)),A.push(i.getX(t)),A.push(i.getX(t+1));else for(let t=0;t<o;t++)t%2==0?(A.push(i.getX(t)),A.push(i.getX(t+1)),A.push(i.getX(t+2))):(A.push(i.getX(t+2)),A.push(i.getX(t+1)),A.push(i.getX(t)));A.length/3!==o&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const c=a.clone();return c.setIndex(A),c.clearGroups(),c}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",r),a}function B3DMDecoder_typeof(t){return B3DMDecoder_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B3DMDecoder_typeof(t)}function _regeneratorRuntime(){_regeneratorRuntime=function _regeneratorRuntime(){return a};var t,a={},r=Object.prototype,i=r.hasOwnProperty,o=Object.defineProperty||function(t,a,r){t[a]=r.value},A="function"==typeof Symbol?Symbol:{},c=A.iterator||"@@iterator",l=A.asyncIterator||"@@asyncIterator",d=A.toStringTag||"@@toStringTag";function define(t,a,r){return Object.defineProperty(t,a,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[a]}try{define({},"")}catch(t){define=function define(t,a,r){return t[a]=r}}function wrap(t,a,r,i){var A=a&&a.prototype instanceof Generator?a:Generator,c=Object.create(A.prototype),l=new Context(i||[]);return o(c,"_invoke",{value:makeInvokeMethod(t,r,l)}),c}function tryCatch(t,a,r){try{return{type:"normal",arg:t.call(a,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=wrap;var h="suspendedStart",b="suspendedYield",u="executing",g="completed",p={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var I={};define(I,c,(function(){return this}));var y=Object.getPrototypeOf,m=y&&y(y(values([])));m&&m!==r&&i.call(m,c)&&(I=m);var C=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(I);function defineIteratorMethods(t){["next","throw","return"].forEach((function(a){define(t,a,(function(t){return this._invoke(a,t)}))}))}function AsyncIterator(t,a){function invoke(r,o,A,c){var l=tryCatch(t[r],t,o);if("throw"!==l.type){var d=l.arg,h=d.value;return h&&"object"==B3DMDecoder_typeof(h)&&i.call(h,"__await")?a.resolve(h.__await).then((function(t){invoke("next",t,A,c)}),(function(t){invoke("throw",t,A,c)})):a.resolve(h).then((function(t){d.value=t,A(d)}),(function(t){return invoke("throw",t,A,c)}))}c(l.arg)}var r;o(this,"_invoke",{value:function value(t,i){function callInvokeWithMethodAndArg(){return new a((function(a,r){invoke(t,i,a,r)}))}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(a,r,i){var o=h;return function(A,c){if(o===u)throw Error("Generator is already running");if(o===g){if("throw"===A)throw c;return{value:t,done:!0}}for(i.method=A,i.arg=c;;){var l=i.delegate;if(l){var d=maybeInvokeDelegate(l,i);if(d){if(d===p)continue;return d}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(o===h)throw o=g,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o=u;var I=tryCatch(a,r,i);if("normal"===I.type){if(o=i.done?g:b,I.arg===p)continue;return{value:I.arg,done:i.done}}"throw"===I.type&&(o=g,i.method="throw",i.arg=I.arg)}}}function maybeInvokeDelegate(a,r){var i=r.method,o=a.iterator[i];if(o===t)return r.delegate=null,"throw"===i&&a.iterator.return&&(r.method="return",r.arg=t,maybeInvokeDelegate(a,r),"throw"===r.method)||"return"!==i&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+i+"' method")),p;var A=tryCatch(o,a.iterator,r.arg);if("throw"===A.type)return r.method="throw",r.arg=A.arg,r.delegate=null,p;var c=A.arg;return c?c.done?(r[a.resultName]=c.value,r.next=a.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,p):c:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function pushTryEntry(t){var a={tryLoc:t[0]};1 in t&&(a.catchLoc=t[1]),2 in t&&(a.finallyLoc=t[2],a.afterLoc=t[3]),this.tryEntries.push(a)}function resetTryEntry(t){var a=t.completion||{};a.type="normal",delete a.arg,t.completion=a}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(a){if(a||""===a){var r=a[c];if(r)return r.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var o=-1,A=function next(){for(;++o<a.length;)if(i.call(a,o))return next.value=a[o],next.done=!1,next;return next.value=t,next.done=!0,next};return A.next=A}}throw new TypeError(B3DMDecoder_typeof(a)+" is not iterable")}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(C,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,d,"GeneratorFunction"),a.isGeneratorFunction=function(t){var a="function"==typeof t&&t.constructor;return!!a&&(a===GeneratorFunction||"GeneratorFunction"===(a.displayName||a.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,d,"GeneratorFunction")),t.prototype=Object.create(C),t},a.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,l,(function(){return this})),a.AsyncIterator=AsyncIterator,a.async=function(t,r,i,o,A){void 0===A&&(A=Promise);var c=new AsyncIterator(wrap(t,r,i,o),A);return a.isGeneratorFunction(r)?c:c.next().then((function(t){return t.done?t.value:c.next()}))},defineIteratorMethods(C),define(C,d,"Generator"),define(C,c,(function(){return this})),define(C,"toString",(function(){return"[object Generator]"})),a.keys=function(t){var a=Object(t),r=[];for(var i in a)r.push(i);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in a)return next.value=t,next.done=!1,next}return next.done=!0,next}},a.values=values,Context.prototype={constructor:Context,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!a)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(a){if(this.done)throw a;var r=this;function handle(i,o){return c.type="throw",c.arg=a,r.next=i,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var A=this.tryEntries[o],c=A.completion;if("root"===A.tryLoc)return handle("end");if(A.tryLoc<=this.prev){var l=i.call(A,"catchLoc"),d=i.call(A,"finallyLoc");if(l&&d){if(this.prev<A.catchLoc)return handle(A.catchLoc,!0);if(this.prev<A.finallyLoc)return handle(A.finallyLoc)}else if(l){if(this.prev<A.catchLoc)return handle(A.catchLoc,!0)}else{if(!d)throw Error("try statement without catch or finally");if(this.prev<A.finallyLoc)return handle(A.finallyLoc)}}}},abrupt:function abrupt(t,a){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var A=o;break}}A&&("break"===t||"continue"===t)&&A.tryLoc<=a&&a<=A.finallyLoc&&(A=null);var c=A?A.completion:{};return c.type=t,c.arg=a,A?(this.method="next",this.next=A.finallyLoc,p):this.complete(c)},complete:function complete(t,a){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&a&&(this.next=a),p},finish:function finish(t){for(var a=this.tryEntries.length-1;a>=0;--a){var r=this.tryEntries[a];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),p}},catch:function _catch(t){for(var a=this.tryEntries.length-1;a>=0;--a){var r=this.tryEntries[a];if(r.tryLoc===t){var i=r.completion;if("throw"===i.type){var o=i.arg;resetTryEntry(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function delegateYield(a,r,i){return this.delegate={iterator:values(a),resultName:r,nextLoc:i},"next"===this.method&&(this.arg=t),p}},a}function asyncGeneratorStep(t,a,r,i,o,A,c){try{var l=t[A](c),d=l.value}catch(t){return void r(t)}l.done?a(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var a=this,r=arguments;return new Promise((function(i,o){var A=t.apply(a,r);function _next(t){asyncGeneratorStep(A,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(A,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function B3DMDecoder_defineProperties(t,a){for(var r=0;r<a.length;r++){var i=a[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,B3DMDecoder_toPropertyKey(i.key),i)}}function B3DMDecoder_toPropertyKey(t){var a=function B3DMDecoder_toPrimitive(t,a){if("object"!=B3DMDecoder_typeof(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,a||"default");if("object"!=B3DMDecoder_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===a?String:Number)(t)}(t,"string");return"symbol"==B3DMDecoder_typeof(a)?a:a+""}var d=function(){return function B3DMDecoder_createClass(t,a,r){return a&&B3DMDecoder_defineProperties(t.prototype,a),r&&B3DMDecoder_defineProperties(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}((function B3DMDecoder(a){var r=this;!function B3DMDecoder_classCallCheck(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}(this,B3DMDecoder),function _defineProperty(t,a,r){return(a=B3DMDecoder_toPropertyKey(a))in t?Object.defineProperty(t,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[a]=r,t}(this,"checkLoaderInitialized",_asyncToGenerator(_regeneratorRuntime().mark((function _callee(){return _regeneratorRuntime().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){var a=setInterval((function(){r.gltfLoader.hasDracoLoader&&!r.gltfLoader.dracoLoader||r.gltfLoader.hasKTX2Loader&&!r.gltfLoader.ktx2Loader||(clearInterval(a),t())}),10)})));case 1:case"end":return t.stop()}}),_callee)})))),this.gltfLoader=a,this.tempMatrix=new t.Matrix4,this.zUpToYUpMatrix=new t.Matrix4,this.zUpToYUpMatrix.set(1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1)}),[{key:"parseB3DM",value:function parseB3DM(t,a,r,i){var o=this,A=this,d=new DataView(t),h=String.fromCharCode(d.getUint8(0))+String.fromCharCode(d.getUint8(1))+String.fromCharCode(d.getUint8(2))+String.fromCharCode(d.getUint8(3));console.assert("b3dm"===h);var b=d.getUint32(8,!0);console.assert(b===t.byteLength);var u=d.getUint32(12,!0),g=d.getUint32(16,!0),p=d.getUint32(20,!0),I=d.getUint32(24,!0),y=new c(t,28,u,g),m=28+u+g,C=(new l(t,y.getData("BATCH_LENGTH"),m,p,I),m+p+I),E=new Uint8Array(t,C,b-C).slice().buffer;return new Promise(function(){var t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee2(t,c){return _regeneratorRuntime().wrap((function _callee2$(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,o.checkLoaderInitialized();case 2:o.gltfLoader.parse(E,null,(function(c){var l=y.getData("RTC_CENTER");l?(o.tempMatrix.makeTranslation(l[0],l[1],l[2]),c.scene.applyMatrix4(o.tempMatrix)):c.userData.gltfExtensions&&c.userData.gltfExtensions.CESIUM_RTC&&(o.tempMatrix.makeTranslation(c.userData.gltfExtensions.CESIUM_RTC.center[0],c.userData.gltfExtensions.CESIUM_RTC.center[1],c.userData.gltfExtensions.CESIUM_RTC.center[2]),c.scene.applyMatrix4(o.tempMatrix)),r&&c.scene.applyMatrix4(A.zUpToYUpMatrix),c.scene.asset=c.asset,c.scene.traverse((function(t){t.isMesh&&(i&&t.applyMatrix4(A.zUpToYUpMatrix),a&&a(t))})),t(c.scene)}),(function(t){console.error(t)}));case 3:case"end":return c.stop()}}),_callee2)})));return function(a,r){return t.apply(this,arguments)}}())}},{key:"parseB3DMInstanced",value:function parseB3DMInstanced(a,r,i,o,A){return this.parseB3DM(a,r,o,A).then((function(a){var r,o=[],A=[];a.updateWorldMatrix(!1,!0),a.traverse((function(t){t.isMesh&&(t.geometry.applyMatrix4(t.matrixWorld),o.push(t.geometry),A.push(t.material))}));var c=function normalizeAndMergeGeometries(a){var r=new Set;a.forEach((function(t){for(var a in t.attributes)r.add(a)})),a.forEach((function(a){r.forEach((function(r){if(!a.attributes[r]){var i=function getAttributeSize(t){switch(t){case"position":case"normal":case"color":return 3;case"uv":case"uv2":return 2;default:throw new Error("Unknown attribute ".concat(t))}}(r),o=new Float32Array(i*a.getAttribute("position").count).fill(0);a.setAttribute(r,new t.BufferAttribute(o,i))}}))}));var i=function mergeGeometries(a,r=!1){const i=null!==a[0].index,o=new Set(Object.keys(a[0].attributes)),A=new Set(Object.keys(a[0].morphAttributes)),c={},l={},d=a[0].morphTargetsRelative,h=new t.BufferGeometry;let b=0;for(let t=0;t<a.length;++t){const u=a[t];let g=0;if(i!==(null!==u.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const a in u.attributes){if(!o.has(a))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+'. All geometries must have compatible attributes; make sure "'+a+'" attribute exists among all geometries, or in none of them.'),null;void 0===c[a]&&(c[a]=[]),c[a].push(u.attributes[a]),g++}if(g!==o.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". Make sure all geometries have the same number of attributes."),null;if(d!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const a in u.morphAttributes){if(!A.has(a))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". .morphAttributes must be consistent throughout all geometries."),null;void 0===l[a]&&(l[a]=[]),l[a].push(u.morphAttributes[a])}if(r){let a;if(i)a=u.index.count;else{if(void 0===u.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". The geometry must have either an index or a position attribute"),null;a=u.attributes.position.count}h.addGroup(b,a,t),b+=a}}if(i){let t=0;const r=[];for(let i=0;i<a.length;++i){const o=a[i].index;for(let a=0;a<o.count;++a)r.push(o.getX(a)+t);t+=a[i].attributes.position.count}h.setIndex(r)}for(const t in c){const a=mergeAttributes(c[t]);if(!a)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+t+" attribute."),null;h.setAttribute(t,a)}for(const t in l){const a=l[t][0].length;if(0===a)break;h.morphAttributes=h.morphAttributes||{},h.morphAttributes[t]=[];for(let r=0;r<a;++r){const a=[];for(let i=0;i<l[t].length;++i)a.push(l[t][i][r]);const i=mergeAttributes(a);if(!i)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+t+" morphAttribute."),null;h.morphAttributes[t].push(i)}}return h}(a,!0);return i}(o);return(r=new t.InstancedMesh(c,A,i)).baseMatrix=(new t.Matrix4).identity(),r}))}}])}();class GLTFLoader extends t.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(t){return new GLTFMaterialsClearcoatExtension(t)})),this.register((function(t){return new GLTFMaterialsDispersionExtension(t)})),this.register((function(t){return new GLTFTextureBasisUExtension(t)})),this.register((function(t){return new GLTFTextureWebPExtension(t)})),this.register((function(t){return new GLTFTextureAVIFExtension(t)})),this.register((function(t){return new GLTFMaterialsSheenExtension(t)})),this.register((function(t){return new GLTFMaterialsTransmissionExtension(t)})),this.register((function(t){return new GLTFMaterialsVolumeExtension(t)})),this.register((function(t){return new GLTFMaterialsIorExtension(t)})),this.register((function(t){return new GLTFMaterialsEmissiveStrengthExtension(t)})),this.register((function(t){return new GLTFMaterialsSpecularExtension(t)})),this.register((function(t){return new GLTFMaterialsIridescenceExtension(t)})),this.register((function(t){return new GLTFMaterialsAnisotropyExtension(t)})),this.register((function(t){return new GLTFMaterialsBumpExtension(t)})),this.register((function(t){return new GLTFLightsExtension(t)})),this.register((function(t){return new GLTFMeshoptCompression(t)})),this.register((function(t){return new GLTFMeshGpuInstancing(t)}))}load(a,r,i,o){const A=this;let c;if(""!==this.resourcePath)c=this.resourcePath;else if(""!==this.path){const r=t.LoaderUtils.extractUrlBase(a);c=t.LoaderUtils.resolveURL(r,this.path)}else c=t.LoaderUtils.extractUrlBase(a);this.manager.itemStart(a);const _onError=function(t){o?o(t):console.error(t),A.manager.itemError(a),A.manager.itemEnd(a)},l=new t.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(a,(function(t){try{A.parse(t,c,(function(t){r(t),A.manager.itemEnd(a)}),_onError)}catch(t){_onError(t)}}),i,_onError)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,a,r,i){let o;const A={},c={},l=new TextDecoder;if("string"==typeof t)o=JSON.parse(t);else if(t instanceof ArrayBuffer){if(l.decode(new Uint8Array(t,0,4))===b){try{A[h.KHR_BINARY_GLTF]=new GLTFBinaryExtension(t)}catch(t){return void(i&&i(t))}o=JSON.parse(A[h.KHR_BINARY_GLTF].content)}else o=JSON.parse(l.decode(t))}else o=t;if(void 0===o.asset||o.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const d=new GLTFParser(o,{path:a||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(let t=0;t<this.pluginCallbacks.length;t++){const a=this.pluginCallbacks[t](d);a.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[a.name]=a,A[a.name]=!0}if(o.extensionsUsed)for(let t=0;t<o.extensionsUsed.length;++t){const a=o.extensionsUsed[t],r=o.extensionsRequired||[];switch(a){case h.KHR_MATERIALS_UNLIT:A[a]=new GLTFMaterialsUnlitExtension;break;case h.KHR_DRACO_MESH_COMPRESSION:A[a]=new GLTFDracoMeshCompressionExtension(o,this.dracoLoader);break;case h.KHR_TEXTURE_TRANSFORM:A[a]=new GLTFTextureTransformExtension;break;case h.KHR_MESH_QUANTIZATION:A[a]=new GLTFMeshQuantizationExtension;break;default:r.indexOf(a)>=0&&void 0===c[a]&&console.warn('THREE.GLTFLoader: Unknown extension "'+a+'".')}}d.setExtensions(A),d.setPlugins(c),d.parse(r,i)}parseAsync(t,a){const r=this;return new Promise((function(i,o){r.parse(t,a,i,o)}))}}function GLTFRegistry(){let t={};return{get:function(a){return t[a]},add:function(a,r){t[a]=r},remove:function(a){delete t[a]},removeAll:function(){t={}}}}const h={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class GLTFLightsExtension{constructor(t){this.parser=t,this.name=h.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,a=this.parser.json.nodes||[];for(let r=0,i=a.length;r<i;r++){const i=a[r];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&t._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(a){const r=this.parser,i="light:"+a;let o=r.cache.get(i);if(o)return o;const A=r.json,c=((A.extensions&&A.extensions[this.name]||{}).lights||[])[a];let l;const d=new t.Color(16777215);void 0!==c.color&&d.setRGB(c.color[0],c.color[1],c.color[2],t.LinearSRGBColorSpace);const h=void 0!==c.range?c.range:0;switch(c.type){case"directional":l=new t.DirectionalLight(d),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new t.PointLight(d),l.distance=h;break;case"spot":l=new t.SpotLight(d),l.distance=h,c.spot=c.spot||{},c.spot.innerConeAngle=void 0!==c.spot.innerConeAngle?c.spot.innerConeAngle:0,c.spot.outerConeAngle=void 0!==c.spot.outerConeAngle?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),l.decay=2,assignExtrasToUserData(l,c),void 0!==c.intensity&&(l.intensity=c.intensity),l.name=r.createUniqueName(c.name||"light_"+a),o=Promise.resolve(l),r.cache.add(i,o),o}getDependency(t,a){if("light"===t)return this._loadLight(a)}createNodeAttachment(t){const a=this,r=this.parser,i=r.json.nodes[t],o=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===o?null:this._loadLight(o).then((function(t){return r._getNodeRef(a.cache,o,t)}))}}class GLTFMaterialsUnlitExtension{constructor(){this.name=h.KHR_MATERIALS_UNLIT}getMaterialType(){return t.MeshBasicMaterial}extendParams(a,r,i){const o=[];a.color=new t.Color(1,1,1),a.opacity=1;const A=r.pbrMetallicRoughness;if(A){if(Array.isArray(A.baseColorFactor)){const r=A.baseColorFactor;a.color.setRGB(r[0],r[1],r[2],t.LinearSRGBColorSpace),a.opacity=r[3]}void 0!==A.baseColorTexture&&o.push(i.assignTexture(a,"map",A.baseColorTexture,t.SRGBColorSpace))}return Promise.all(o)}}class GLTFMaterialsEmissiveStrengthExtension{constructor(t){this.parser=t,this.name=h.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,a){const r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=r.extensions[this.name].emissiveStrength;return void 0!==i&&(a.emissiveIntensity=i),Promise.resolve()}}class GLTFMaterialsClearcoatExtension{constructor(t){this.parser=t,this.name=h.KHR_MATERIALS_CLEARCOAT}getMaterialType(a){const r=this.parser.json.materials[a];return r.extensions&&r.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(a,r){const i=this.parser,o=i.json.materials[a];if(!o.extensions||!o.extensions[this.name])return Promise.resolve();const A=[],c=o.extensions[this.name];if(void 0!==c.clearcoatFactor&&(r.clearcoat=c.clearcoatFactor),void 0!==c.clearcoatTexture&&A.push(i.assignTexture(r,"clearcoatMap",c.clearcoatTexture)),void 0!==c.clearcoatRoughnessFactor&&(r.clearcoatRoughness=c.clearcoatRoughnessFactor),void 0!==c.clearcoatRoughnessTexture&&A.push(i.assignTexture(r,"clearcoatRoughnessMap",c.clearcoatRoughnessTexture)),void 0!==c.clearcoatNormalTexture&&(A.push(i.assignTexture(r,"clearcoatNormalMap",c.clearcoatNormalTexture)),void 0!==c.clearcoatNormalTexture.scale)){const a=c.clearcoatNormalTexture.scale;r.clearcoatNormalScale=new t.Vector2(a,a)}return Promise.all(A)}}class GLTFMaterialsDispersionExtension{constructor(t){this.parser=t,this.name=h.KHR_MATERIALS_DISPERSION}getMaterialType(a){const r=this.parser.json.materials[a];return r.extensions&&r.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(t,a){const r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=r.extensions[this.name];return a.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class GLTFMaterialsIridescenceExtension{constructor(t){this.parser=t,this.name=h.KHR_MATERIALS_IRIDESCENCE}getMaterialType(a){const r=this.parser.json.materials[a];return r.extensions&&r.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(t,a){const r=this.parser,i=r.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],A=i.extensions[this.name];return void 0!==A.iridescenceFactor&&(a.iridescence=A.iridescenceFactor),void 0!==A.iridescenceTexture&&o.push(r.assignTexture(a,"iridescenceMap",A.iridescenceTexture)),void 0!==A.iridescenceIor&&(a.iridescenceIOR=A.iridescenceIor),void 0===a.iridescenceThicknessRange&&(a.iridescenceThicknessRange=[100,400]),void 0!==A.iridescenceThicknessMinimum&&(a.iridescenceThicknessRange[0]=A.iridescenceThicknessMinimum),void 0!==A.iridescenceThicknessMaximum&&(a.iridescenceThicknessRange[1]=A.iridescenceThicknessMaximum),void 0!==A.iridescenceThicknessTexture&&o.push(r.assignTexture(a,"iridescenceThicknessMap",A.iridescenceThicknessTexture)),Promise.all(o)}}class GLTFMaterialsSheenExtension{constructor(t){this.parser=t,this.name=h.KHR_MATERIALS_SHEEN}getMaterialType(a){const r=this.parser.json.materials[a];return r.extensions&&r.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(a,r){const i=this.parser,o=i.json.materials[a];if(!o.extensions||!o.extensions[this.name])return Promise.resolve();const A=[];r.sheenColor=new t.Color(0,0,0),r.sheenRoughness=0,r.sheen=1;const c=o.extensions[this.name];if(void 0!==c.sheenColorFactor){const a=c.sheenColorFactor;r.sheenColor.setRGB(a[0],a[1],a[2],t.LinearSRGBColorSpace)}return void 0!==c.sheenRoughnessFactor&&(r.sheenRoughness=c.sheenRoughnessFactor),void 0!==c.sheenColorTexture&&A.push(i.assignTexture(r,"sheenColorMap",c.shee