map-core-func 0.1.50 → 0.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function t(){t=function(){return r};var e,r={},n=Object.prototype,i=n.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",u=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function h(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(e){h=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,s=Object.create(i.prototype),a=new R(n||[]);return o(s,"_invoke",{value:B(t,r,a)}),s}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=c;var p="suspendedStart",g="suspendedYield",d="executing",A="completed",y={};function v(){}function m(){}function E(){}var _={};h(_,a,(function(){return this}));var I=Object.getPrototypeOf,x=I&&I(I(L([])));x&&x!==n&&i.call(x,a)&&(_=x);var C=E.prototype=v.prototype=Object.create(_);function w(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(n,o,s,a){var u=f(t[n],t,o);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&i.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,s,a)}),(function(t){r("throw",t,s,a)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,a)}))}a(u.arg)}var n;o(this,"_invoke",{value:function(t,i){function o(){return new e((function(e,n){r(t,i,e,n)}))}return n=n?n.then(o,o):o()}})}function B(t,r,n){var i=p;return function(o,s){if(i===d)throw new Error("Generator is already running");if(i===A){if("throw"===o)throw s;return{value:e,done:!0}}for(n.method=o,n.arg=s;;){var a=n.delegate;if(a){var u=S(a,n);if(u){if(u===y)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===p)throw i=A,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=d;var l=f(t,r,n);if("normal"===l.type){if(i=n.done?A:g,l.arg===y)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=A,n.method="throw",n.arg=l.arg)}}}function S(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var o=f(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var s=o.arg;return s?s.done?(r[t.resultName]=s.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function L(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n<t.length;)if(i.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=e,r.done=!0,r};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return m.prototype=E,o(C,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:m,configurable:!0}),m.displayName=h(E,l,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,h(t,l,"GeneratorFunction")),t.prototype=Object.create(C),t},r.awrap=function(t){return{__await:t}},w(b.prototype),h(b.prototype,u,(function(){return this})),r.AsyncIterator=b,r.async=function(t,e,n,i,o){void 0===o&&(o=Promise);var s=new b(c(t,e,n,i),o);return r.isGeneratorFunction(e)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},w(C),h(C,l,"Generator"),h(C,a,(function(){return this})),h(C,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=L,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(M),!t)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,i){return a.type="throw",a.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var u=i.call(s,"catchLoc"),l=i.call(s,"finallyLoc");if(u&&l){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(s)},complete:function(t,e){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&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),M(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;M(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},r}function e(t){return e="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},e(t)}function r(t,e,r,n,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,i)}function n(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var s=t.apply(e,n);function a(t){r(s,i,o,a,u,"next",t)}function u(t){r(s,i,o,a,u,"throw",t)}a(void 0)}))}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,I(n.key),n)}}function s(t,e,r){return e&&o(t.prototype,e),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function a(t,e,r){return(e=I(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var i=l(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return c(t)}(this,r)}}function p(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}function g(){return g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=p(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},g.apply(this,arguments)}function d(t,e,r,n){return d="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,r,n){var i,o=p(t,e);if(o){if((i=Object.getOwnPropertyDescriptor(o,e)).set)return i.set.call(n,r),!0;if(!i.writable)return!1}if(i=Object.getOwnPropertyDescriptor(n,e)){if(!i.writable)return!1;i.value=r,Object.defineProperty(n,e,i)}else a(n,e,r);return!0},d(t,e,r,n)}function A(t,e,r,n,i){if(!d(t,e,r,n||t)&&i)throw new TypeError("failed to set property");return r}function y(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o,s,a=[],u=!0,l=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(a.push(n.value),a.length!==e);u=!0);}catch(t){l=!0,i=t}finally{try{if(!u&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}(t,e)||m(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t){return function(t){if(Array.isArray(t))return E(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||m(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){if(t){if("string"==typeof t)return E(t,e);var r=Object.prototype.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)?E(t,e):void 0}}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=m(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function I(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function x(t){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=null!==t[0].index,n=new Set(Object.keys(t[0].attributes)),i=new Set(Object.keys(t[0].morphAttributes)),o={},s={},a=t[0].morphTargetsRelative,u=new THREE.BufferGeometry,l=0,h=0;h<t.length;++h){var c=t[h],f=0;if(r!==(null!==c.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(var p in c.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;void 0===o[p]&&(o[p]=[]),o[p].push(c.attributes[p]),f++}if(f!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==c.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(var g in c.morphAttributes){if(!i.has(g))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;void 0===s[g]&&(s[g]=[]),s[g].push(c.morphAttributes[g])}if(e){var d=void 0;if(r)d=c.index.count;else{if(void 0===c.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;d=c.attributes.position.count}u.addGroup(l,d,h),l+=d}}if(r){for(var A=0,y=[],v=0;v<t.length;++v){for(var m=t[v].index,E=0;E<m.count;++E)y.push(m.getX(E)+A);A+=t[v].attributes.position.count}u.setIndex(y)}for(var _ in o){var I=C(o[_]);if(!I)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+_+" attribute."),null;u.setAttribute(_,I)}for(var x in s){var w=s[x][0].length;if(0===w)break;u.morphAttributes=u.morphAttributes||{},u.morphAttributes[x]=[];for(var b=0;b<w;++b){for(var B=[],S=0;S<s[x].length;++S)B.push(s[x][S][b]);var T=C(B);if(!T)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+x+" morphAttribute."),null;u.morphAttributes[x].push(T)}}return u}function C(t){for(var e,r,n,i=0,o=0;o<t.length;++o){var s=t[o];if(s.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(void 0===e&&(e=s.array.constructor),e!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===r&&(r=s.itemSize),r!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===n&&(n=s.normalized),n!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=s.array.length}for(var a=new e(i),u=0,l=0;l<t.length;++l)a.set(t[l].array,u),u+=t[l].array.length;return new THREE.BufferAttribute(a,r,n)}var w=Math.PI/180,b=6378137;function B(){var t="xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}));return"iep".concat(t,"layer")}function S(t){return new Promise((function(e){return setTimeout(e,t)}))}function T(t,e){return e.split("").forEach((function(e){-1===t.indexOf(e)&&(t+=e)})),t}function M(t,e){return 256*(t=THREE.MathUtils.clamp(Math.floor(t),0,255))+(e=THREE.MathUtils.clamp(Math.floor(e),0,255))}function R(t){for(var e=1/0,r=1/0,n=-1/0,i=-1/0,o=0,s=t.length;o<s;o++){var a=t[o],u=a.coordinate,l=a.lnglat,h=a.lnglats,c=a.xy,f=a.xys,p=u||l||h||c||f||t[o],g=void 0,d=void 0;Array.isArray(p)?(g=p[0],d=p[1]):p instanceof maptalks.Coordinate&&(g=p.x,d=p.y),e=Math.min(e,g),r=Math.min(r,d),n=Math.max(n,g),i=Math.max(i,d)}return new maptalks.Coordinate((e+n)/2,(r+i)/2)}function L(t,e,r,n){var i=t,o=e.getShell(),s=[];o.forEach((function(t){var e=r.coordinateToVector3(t).sub(i);s.push(e)}));for(var a=[],u=0,l=s.length;u<l;u++)if(u!==s.length-1){var h=new Float32Array(12),c=s[u],f=s[u+1];h[0]=c.x,h[1]=c.y,h[2]=n,h[6]=c.x,h[7]=c.y,h[8]=0,h[3]=f.x,h[4]=f.y,h[5]=n,h[9]=f.x,h[10]=f.y,h[11]=0;var p=new THREE.BufferGeometry;p.setAttribute("position",new THREE.BufferAttribute(h,3)),p.setIndex([0,2,1,2,3,1]),a.push(p)}var g=new Float32Array(12),d=s[s.length-1],A=s[0];g[0]=d.x,g[1]=d.y,g[2]=n,g[6]=d.x,g[7]=d.y,g[8]=0,g[3]=A.x,g[4]=A.y,g[5]=n,g[9]=A.x,g[10]=A.y,g[11]=0;var y=new THREE.BufferGeometry;y.setAttribute("position",new THREE.BufferAttribute(g,3)),y.setIndex([0,2,1,2,3,1]),a.push(y);var v=x(a);return v.computeVertexNormals(),v}function N(t){for(var e=t.length,r=0,n=0;n<e;n++){r+=t[n].position.count}return new Float32Array(3*r)}function P(t){return t*w}function k(t,e){if(!t||!e)return 0;Array.isArray(t)||(t=t.toArray()),Array.isArray(e)||(e=e.toArray());var r=P(t[1]),n=P(e[1]),i=r-n,o=P(t[0])-P(e[0]);return r=2*Math.asin(Math.sqrt(Math.pow(Math.sin(i/2),2)+Math.cos(r)*Math.cos(n)*Math.pow(Math.sin(o/2),2))),r*=b,Math.round(1e5*r)/1e5}function D(t){for(var e=function(t){return t.getCoordinates().map((function(t){return t.toArray()}))}(t),r=0,n=0,i=e.length;n<i-1;n++)r+=k(e[n],e[n+1]);return r}var Q={altitude:0,imageWidth:512,imageHeight:512,texture:null},O=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r);var u=n=maptalks.Util.extend({},Q,n),l=u.altitude;u.imageHeight,u.imageWidth,t instanceof maptalks.Extent||(t=new maptalks.Extent(t));var h=t,c=h.xmin,f=h.ymin,p=h.xmax,g=h.ymax,d=1/0,A=1/0,y=-1/0,v=-1/0;[[c,f],[c,g],[p,g],[p,f]].forEach((function(t){var e=s.coordinateToVector3(t),r=e.x,n=e.y;d=Math.min(r,d),A=Math.min(n,A),y=Math.max(r,y),v=Math.max(n,v)}));var m=Math.abs(y-d),E=Math.abs(v-A),_=new THREE.PlaneGeometry(m,E);(a=e.call(this))._initOptions(n),a._createMesh(_,o);var I=s.distanceToVector3(l,l).x,x=s.coordinateToVector3(t.getCenter(),I);return a.getObject3d().position.copy(x),a.parent=null,a.type="Image",a}return s(r)}(),F=function(){function t(e,r,n,o,s,a){var u=this;i(this,t),this.threelayer=s,this.map=s.map,this.groupId=a,this.textureLoader=new THREE.TextureLoader;var l=e.split(","),h=r.split(","),c=parseFloat(l[0]),f=parseFloat(l[1]),p=parseFloat(h[0]),g=parseFloat(h[1]),d=o.maxZoom||11,A=o.renderOrder||0,y=o.opacity||1,v=o.minZoom||3,m=new maptalks.Extent(c,f,p,g);this.xmin_g=c,this.ymin_g=f,this.xmax_g=p,this.ymax_g=g,this.cacheTextureFlag=o.cacheTextureFlag,this.cacheTexture={},this.textureLoader.load(n,(function(t){var e=new THREE.MeshBasicMaterial({map:t,transparent:!0,opacity:y}),r=new O(m,{imageWidth:512,imageHeight:512,maxZoom:d,minZoom:v,interactive:void 0!==o.interactive&&o.interactive},e,u.threelayer);r.object3d.renderOrder=A,u.imgMesh=r,u.imgMesh.parent=u,u.m=e,u.texture=t,u.groupId?u.threelayer.addMesh1(u.imgMesh,u.groupId):u.threelayer.addMesh(u.imgMesh),o.opacityItems&&o.opacityItems.length>0&&!isNaN(o.opacityItems[0])&&!isNaN(o.opacityItems[1])&&o.opacityItems[0]>3&&o.opacityItems[0]<=18&&o.opacityItems[1]>=0&&o.opacityItems[1]<=1&&(u.opacityItems=o.opacityItems,u._bindMapEvents(),u._viewChange()),u.cacheTextureFlag&&void 0===u.cacheTexture[n]&&(u.cacheTexture[n]=t)}))}return s(t,[{key:"_bindMapEvents",value:function(){this.map.on("viewchange",this._viewChange,this)}},{key:"_viewChange",value:function(){this.opacityItems[0]<=this.map.getZoom()?this.imgMesh.object3d.material.opacity=this.opacityItems[1]:this.imgMesh.object3d.material.opacity=1}},{key:"_closeEvent",value:function(){this.map.off("viewchange",this._viewChange,this)}},{key:"updateImage",value:function(t,e){var r=this;if(e&&e.leftbottom&&e.righttop){var n=parseFloat(e.leftbottom[0]),i=parseFloat(e.leftbottom[1]),o=parseFloat(e.righttop[0]),s=parseFloat(e.righttop[1]);if(n!==this.xmin_g||i!==this.ymin_g||o!==this.xmax_g||s!==this.ymax_g){var a=new maptalks.Extent(n,i,o,s),u=1/0,l=1/0,h=-1/0,c=-1/0;[[n,i],[n,s],[o,s],[o,i]].forEach((function(t){var e=r.threelayer.coordinateToVector3(t),n=e.x,i=e.y;u=Math.min(n,u),l=Math.min(i,l),h=Math.max(n,h),c=Math.max(i,c)}));for(var f=Math.abs(h-u),p=Math.abs(c-l),g=new THREE.PlaneBufferGeometry(f,p),d=g.attributes.position.array,A=this.imgMesh.object3d.geometry.attributes.position.array,y=0;y<A.length;y++)A[y]=d[y];this.imgMesh.object3d.geometry.attributes.position.needsUpdate=!0;var v=this.threelayer.coordinateToVector3(a.getCenter(),0);this.imgMesh.getObject3d().position.copy(v),g.dispose(),this.xmin_g=n,this.ymin_g=i,this.xmax_g=o,this.ymax_g=s}}this.cacheTextureFlag?void 0===this.cacheTexture[t]?this.textureLoader.load(t,(function(e){e.magFilter=THREE.NearestFilter,e.minFilter=THREE.NearestFilter,r.imgMesh.object3d.material.map=e,r.imgMesh.object3d.material.map.needsUpdate=!0,r.cacheTexture[t]=e})):(this.imgMesh.object3d.material.map=this.cacheTexture[t],this.imgMesh.object3d.material.map.needsUpdate=!0):this.textureLoader.load(t,(function(t){r.texture&&r.texture.dispose(),delete r.texture,t.magFilter=THREE.NearestFilter,t.minFilter=THREE.NearestFilter,r.imgMesh.object3d.material.map=t,r.imgMesh.object3d.material.map.needsUpdate=!0,r.texture=t})),!1===this.imgMesh.isAdd&&(this.threelayer?(this.groupId?this.threelayer.addMesh1(this.imgMesh,this.groupId):this.threelayer.addMesh(this.imgMesh),this.opacityItems&&this._bindMapEvents()):this.dispose())}},{key:"clearImage",value:function(){this.imgMesh&&(this.groupId?this.threelayer.removeMesh1(this.imgMesh,this.groupId):this.threelayer.removeMesh(this.imgMesh),this.opacityItems&&this._closeEvent())}},{key:"show",value:function(){this.imgMesh&&(this.threelayer.addMesh(this.imgMesh),this.opacityItems&&this._bindMapEvents())}},{key:"dispose",value:function(){var t;for(var e in this.imgMesh&&(!0===this.imgMesh.isAdd&&(this.groupId?this.threelayer.removeMesh1(this.imgMesh,this.groupId):this.threelayer.removeMesh(this.imgMesh)),this.imgMesh.object3d.geometry&&this.imgMesh.object3d.geometry.dispose(),this.imgMesh.object3d.material&&(this.imgMesh.object3d.material.dispose(),delete this.m)),this.cacheTexture)this.cacheTexture[e].dispose(),delete this.cacheTexture[e];null===(t=this.texture)||void 0===t||t.dispose(),this.texture=null,this.opacityItems&&(this._closeEvent(),delete this.opacityItems),this.threelayer=null,this.textureLoader&&delete this.textureLoader}}]),t}(),G={interactive:!1,altitude:0,imageWidth:512,imageHeight:512,texture:null},U=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s,a){var u;i(this,r);var l=(o=maptalks.Util.extend({},G,o)).altitude,h=a.distanceToVector3(n,n).x,c=new THREE.CircleGeometry(h,32);(u=e.call(this))._initOptions(o),u._createMesh(c,s);var f=a.distanceToVector3(l,l).x,p=a.coordinateToVector3(t,f);return u.getObject3d().position.copy(p),u.parent=null,u.type="radarObject",u}return s(r)}(),H=function(){function t(e,r,n,o,s,a){i(this,t),this.threelayer=o,this.map=o.map,this.layerClass=s,this.groupId=a,this.imgUrl=n.imgUrl,this.loader=new THREE.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var u=new THREE.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n const float PI = 3.14159265359;\n const float TWO_PI = 6.28318530718;\n const int N = 3;\n const float r0 = 0.01;\n const float r_blue = 0.025;\n const float r_red = 0.015;\n const float edge = 0.95;\n const float offset = 0.05;\n\n uniform float time;\n varying vec2 vUv;\n uniform sampler2D map;\n float plot(const vec2 st, const float pct, const float width)\n {\n return smoothstep(pct - width, pct, st.y) -\n smoothstep(pct, pct + width, st.y);\n }\n float drawPolygon(const vec2 polygonCenter, const int N, const float radius, vec2 pos)\n {\n pos = pos - polygonCenter;\n float d = 0.0;\n float a = atan(pos.x, pos.y);\n float r = TWO_PI / float(N);\n d = cos(floor(0.5 + a / r)*r - a)*length(pos);\n return (1.0 - smoothstep(radius, radius + radius/10.0, d));\n }\n float gradations(const float a, const float gradNum, const float outRad, const float tickLen, const float tickWidth, const float r, const float move)\n {\n float f = step(0.0, cos((a + move)*gradNum) - tickWidth)*tickLen + (outRad - tickLen);\n return 1.0 - step(f, r) * 1.0 - step(r, outRad - tickLen);\n }\n void main() {\n // Normalized pixel coordinates (from 0 to 1)\n vec2 uv = vUv;\n vec2 pos = uv.xy - vec2(0.5, 0.5) ; // center what being drawn\n vec4 grndSpd = vec4(0.0, time/5.0, 0.0, 0.0);\n vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.85, 0.0, 1.0);\n //vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.58, 1.0, 1.0);\n //vec3 color = vec3(0.0, 0.0, 0.0);\n vec3 color = vec3(0.0, 147. / 255., 1.0);\n float r = length(pos) * 2.0;\n float a = atan(pos.y, pos.x); // angle of pixel\n float an = PI - mod(time/ 1.0, TWO_PI); // angle of radar sweep\n float blipSpd = 3.0; // Blip / Trace speed\n vec2 translate1 = vec2(cos(time/ blipSpd), sin(time/ blipSpd));\n vec2 translate2 = vec2(sin(time/ blipSpd), cos(time/ blipSpd));\n vec2 left1 = translate1 * 0.35;\n vec2 right1 = -translate1 * 0.30;\n vec2 left2 = translate2 * 0.15;\n vec2 right2 = -translate2 * 0.25;\n // Radar Sweep\n float sn = step(PI/2.0, an) * step(-PI/2.0, (a + an)) * step(r, edge) * (1.0 - 0.55 * (a + (TWO_PI) - an));\n float sw = step(an, a) * step(r, edge);\n float s_blade = sw * (1.0 - (a - an) * 20.0);\n float s = sw * (1.0 - 0.55 * (a - an));\n s = max(sn,s);\n float se = step(r, edge - 0.05);\n // Center point\n float s1 = smoothstep(edge - 0.00, edge + 0.01, r)* smoothstep(edge + 0.02, edge + 0.01, r);\n // Circular concentric rings\n float s0 = 1.0 - smoothstep(r0 / 2.0, r0, length(pos));\n float smb = (1.0 - smoothstep(0.2, 0.2 + 0.01, length(pos))) * (1.0 - smoothstep(0.2 +0.01, 0.2, length(pos)));\n float smr = (1.0 - smoothstep(0.3, 0.3 + 0.01, length(pos))) * (1.0 - smoothstep(0.3 +0.01, 0.3, length(pos)));\n // Circular concentric gradations\n float gradNum = 120.0;\n float tickWidth = 0.9;\n const float tickLen = 0.04;\n float outRad = edge;\n float move = 0.0;\n float sm = 0.75*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n gradNum = 36.0;\n tickWidth = 0.95;\n outRad = 0.6;\n move = sin(time/10.0);\n smr += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n outRad = 0.4;\n move = cos(time/10.0);\n smb += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n // Radial spoke gradations\n float sr = plot(pos, pos.x, 0.003) * step(r, edge - 0.06);\n sr += plot(vec2(0.0, 0.0), pos.x, 0.002) * step(r, edge - 0.06);\n sr += plot(vec2(0.0, 0.0), pos.y, 0.003) * step(r, edge - 0.06);\n sr += plot(-pos, pos.x, 0.003) * step(r, edge - 0.06);\n sr *= 0.75;\n // Blue circular radar blip traces\n vec2 st_trace1 = left2;\n float s_trace1 = s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1)));\n s_trace1 += s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1 + vec2(+offset, +offset))));\n s_trace1 += s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1 + vec2(+2.0 *offset, +2.0 *offset))));\n\n vec2 st_trace2 = right1;\n float s_trace2 = s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace2)));\n // Red Trianglular radar flight blip trace\n vec2 st_trace3 = left1;\n float st1 = s * (drawPolygon(st_trace3, N, r_red , pos));\n st1 += s * (drawPolygon(st_trace3 + vec2(-offset, -offset), N, r_red, pos));\n st1 += s * (drawPolygon(st_trace3 + vec2(+offset, -offset), N, r_red, pos));\n\n vec2 st_trace4 = right2;\n float st2 = s * (drawPolygon(st_trace4, N, r_red, pos)); \n // Lets add all the bits together and send them to screen\n float s_grn = max(s * mapcol.y, s_blade);\n s_grn = max(s_grn, (s0 + sr + sm));\n s_grn += s1 / 1.5 + smb + smr;\n\n float s_red = st1*2.0 + st2*2.0 + smr;\n \n float s_blue = max(s_trace1 + s_trace2, s_blade) + smb;\n\n if (s_trace1 > 0.0 || s_trace2 > 0.0) { s_blue = max(s, s_blue); s_grn = max(s_grn, s_blue); }\n\n color += vec3(s_red , s_grn, s_blue); \n vec4 texColor = mapcol * s;\n // Output to screen \n gl_FragColor = vec4(color, 0.5);//Set the screen pixel to that color\n }",side:THREE.DoubleSide,transparent:!0});this.radar=new U(e,r,{},u,o),this.radar.parent=this,this.groupId?this.threelayer.addMesh1(this.radar,this.groupId):this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return s(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.groupId?this.threelayer.removeMesh1(this.radar,this.groupId):this.threelayer.removeMesh(this.radar),this.radar.object3d.geometry&&this.radar.object3d.geometry.dispose(),this.radar.object3d.material&&this.radar.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),j={radius:100,altitude:0},q=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),n=maptalks.Util.extend({},j,n,{layer:s,coordinate:t}),(a=e.call(this))._initOptions(n);var u=n,l=u.altitude,h=u.radius,c=s.distanceToVector3(h,h).x,f=n.thetaStart||0,p=n.thetaLength||90,g=new THREE.CircleGeometry(c,128,f*Math.PI/180,p*Math.PI/180);a._createMesh(g,o);var d=s.distanceToVector3(l,l).x,A=s.coordinateToVector3(t,d);return a.getObject3d().position.copy(A),a}return s(r)}(),V=function(){function t(e,r,n,o,s){i(this,t),this.threelayer=o,this.map=o.map,this.layerClass=s;var a=n.thetaLength||90,u=n.rotation||0,l=a/2;this.imgUrl=n.imgUrl,this.loader=new THREE.TextureLoader,this.texture=this.loader.load(this.imgUrl);var h=u-l;h=h<0?h+360:h,this._uniforms={map:{value:this.texture},time:{value:0}};var c=new THREE.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D map;\n varying vec2 vUv;\n void main() {\n vec2 uv = vUv;\n //uv = uv.xy - vec2(0.5, 0.5);\n //gl_FragColor = texture2D(map, uv);\n gl_FragColor = vec4(1.0, 1.0, 1.0, 0.5);\n }",side:THREE.DoubleSide,transparent:!0,depthTest:!1});this.sector=new q(e,{thetaStart:h,thetaLength:n.thetaLength,radius:r},c,o),this.threelayer.addMesh(this.sector)}return s(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"dispose",value:function(){}}]),t}(),z={altitude:0,height:0},Y=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),o=maptalks.Util.extend({},z,o,{layer:s}),a=e.call(this);var u=o,l=u.width,h=u.height,c=u.altitude;a._initOptions(o);var f=new THREE.PlaneGeometry(l,h);f.computeBoundingBox();var p=new THREE.Mesh(f,n);a._createGroup(),a.getObject3d().add(p);var g=s.distanceToVector3(c,c).x,d=s.coordinateToVector3(t,g);return p.position.set(0,f.boundingBox.max.y,0),a.getObject3d().position.copy(d),a}return s(r)}();function X(t,e,r,n,i,o){this.tilesHorizontal=e,this.tilesVertical=r,this.numberOfTiles=n,t.wrapS=t.wrapT=THREE.RepeatWrapping,t.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=i,this.currentDisplayTime=0,this.currentTile=0,this.flag=o,this.update=function(e){for(this.currentDisplayTime+=e;this.currentDisplayTime>this.tileDisplayDuration;){this.currentDisplayTime-=this.tileDisplayDuration,this.currentTile++,this.currentTile==this.numberOfTiles&&(this.currentTile=0);var r=this.currentTile%this.tilesHorizontal;t.offset.x=r/this.tilesHorizontal;var n=Math.floor(this.currentTile/this.tilesHorizontal);this.flag?t.offset.y=this.tilesVertical-n/this.tilesVertical:t.offset.y=1-n/this.tilesVertical-1/this.tilesVertical}}}var J=function(){function t(e,r,n,o,s){var a=this;i(this,t),this.threelayer=o,this.map=o.map,this.layerClass=s;var u=n.thetaLength||45;this.millsec=n.millsec||1e3,this.duration=n.duration||75,this.tilesHoriz=n.tilesHoriz||12,this.tilesVert=n.tilesVert||5,this.numTiles=n.numTiles||49;var l=n.rotation||0,h=u/2,c=o.distanceToVector3(r,r).x,f=Math.sin(h*Math.PI/180)*c*2,p=void 0===n.flag;this.imgUrl=n.imgUrl,this.textureLoader=new THREE.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){a.texture=t,a.annie=new X(t,a.tilesHoriz,a.tilesVert,a.numTiles,a.duration,p);var r=new THREE.MeshBasicMaterial({transparent:!0,map:t,side:THREE.DoubleSide,depthTest:!1});a.imgObj=new Y(e,r,{width:f,height:c},o),a.imgObj.object3d.renderOrder=1,a.imgObj.object3d.rotation.z=l*Math.PI/180,a.threelayer.addMesh(a.imgObj),a.layerClass.updatables.push(a)}))}return s(t,[{key:"tick",value:function(t){var e;null===(e=this.annie)||void 0===e||e.update(this.millsec*t)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.threelayer.removeMesh(this.imgObj),this.imgObj.object3d.geometry&&this.imgObj.object3d.geometry.dispose(),this.imgObj.object3d.material&&this.imgObj.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),W={radius:100,altitude:0},K=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),n=maptalks.Util.extend({},W,n,{layer:s}),a=e.call(this);var u=n,l=u.width;u.height;var h=u.altitude;a._initOptions(n);var c=new THREE.CircleGeometry(l,32);a._createMesh(c,o);var f=s.distanceToVector3(h,h).x,p=s.coordinateToVector3(t,f);return a.getObject3d().position.copy(p),a}return s(r)}(),Z=function(){function t(e,r,n,o){var s=this;i(this,t),this.threelayer=n,this.map=n.map,this.layerClass=o,this.time=0,n.coordinateToVector3(e,0),this.imgUrl=r.imgUrl,this.textureLoader=new THREE.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){s.texture=t,s._uniforms={impactPosition:{value:new THREE.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:s.texture}};var r=new THREE.ShaderMaterial({uniforms:s._uniforms,vertexShader:"\n varying vec3 vPosition;\n varying vec2 vUv;\n void main(){\n vUv = uv;\n vPosition = position;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D map;\n uniform vec3 impactPosition;\n uniform float impactMaxRadius;\n uniform float impactRatio;\n varying vec3 vPosition;\n varying vec2 vUv;\n void main() {\n float dist = distance(vPosition, impactPosition);\n float curRadius = impactMaxRadius * impactRatio;\n float sstep = smoothstep(0., curRadius, dist) - smoothstep(curRadius - ( 0.25 * impactRatio ), curRadius, dist);\n sstep = 1. - sstep * (1. - impactRatio);\n vec3 col = mix(vec3(1., 0.5, 0.0625), vec3(1., 0.25, 0.125), impactRatio);\n gl_FragColor = texture2D(map, vUv);\n gl_FragColor = vec4( mix( col, gl_FragColor.rgb, sstep), 1.0 );\n }",side:THREE.DoubleSide,transparent:!0,depthTest:!1}),i=new K(e,{width:2,height:2},r,n);s.threelayer.addMesh(i),s.layerClass.updatables.push(s)}))}return s(t,[{key:"tick",value:function(t){this.time+=.2*t,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),t}(),$=6371008.8,tt={centimeters:100*$,centimetres:100*$,degrees:$/111325,feet:3.28084*$,inches:39.37*$,kilometers:$/1e3,kilometres:$/1e3,meters:$,metres:$,miles:$/1609.344,millimeters:1e3*$,millimetres:1e3*$,nauticalmiles:$/1852,radians:1,yards:1.0936*$},et={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/$,yards:1.0936133},rt={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function nt(t,e,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function it(t,e,r){switch(t){case"Point":return ot(e).geometry;case"LineString":return lt(e).geometry;case"Polygon":return at(e).geometry;case"MultiPoint":return pt(e).geometry;case"MultiLineString":return ft(e).geometry;case"MultiPolygon":return gt(e).geometry;default:throw new Error(t+" is invalid")}}function ot(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!wt(t[0])||!wt(t[1]))throw new Error("coordinates must contain numbers");return nt({type:"Point",coordinates:t},e,r)}function st(t,e,r){return void 0===r&&(r={}),ct(t.map((function(t){return ot(t,e)})),r)}function at(t,e,r){void 0===r&&(r={});for(var n=0,i=t;n<i.length;n++){var o=i[n];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return nt({type:"Polygon",coordinates:t},e,r)}function ut(t,e,r){return void 0===r&&(r={}),ct(t.map((function(t){return at(t,e)})),r)}function lt(t,e,r){if(void 0===r&&(r={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return nt({type:"LineString",coordinates:t},e,r)}function ht(t,e,r){return void 0===r&&(r={}),ct(t.map((function(t){return lt(t,e)})),r)}function ct(t,e){void 0===e&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function ft(t,e,r){return void 0===r&&(r={}),nt({type:"MultiLineString",coordinates:t},e,r)}function pt(t,e,r){return void 0===r&&(r={}),nt({type:"MultiPoint",coordinates:t},e,r)}function gt(t,e,r){return void 0===r&&(r={}),nt({type:"MultiPolygon",coordinates:t},e,r)}function dt(t,e,r){return void 0===r&&(r={}),nt({type:"GeometryCollection",geometries:t},e,r)}function At(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r}function yt(t,e){void 0===e&&(e="kilometers");var r=tt[e];if(!r)throw new Error(e+" units is invalid");return t*r}function vt(t,e){void 0===e&&(e="kilometers");var r=tt[e];if(!r)throw new Error(e+" units is invalid");return t/r}function mt(t,e){return _t(vt(t,e))}function Et(t){var e=t%360;return e<0&&(e+=360),e}function _t(t){return 180*(t%(2*Math.PI))/Math.PI}function It(t){return t%360*Math.PI/180}function xt(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return yt(vt(t,e),r)}function Ct(t,e,r){if(void 0===e&&(e="meters"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("area must be a positive number");var n=rt[e];if(!n)throw new Error("invalid original units");var i=rt[r];if(!i)throw new Error("invalid final units");return t/n*i}function wt(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function bt(t){return!!t&&t.constructor===Object}function Bt(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!wt(t))throw new Error("bbox must only contain numbers")}))}function St(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}var Tt=Object.freeze({__proto__:null,earthRadius:$,factors:tt,unitsFactors:et,areaFactors:rt,feature:nt,geometry:it,point:ot,points:st,polygon:at,polygons:ut,lineString:lt,lineStrings:ht,featureCollection:ct,multiLineString:ft,multiPoint:pt,multiPolygon:gt,geometryCollection:dt,round:At,radiansToLength:yt,lengthToRadians:vt,lengthToDegrees:mt,bearingToAzimuth:Et,radiansToDegrees:_t,degreesToRadians:It,convertLength:xt,convertArea:Ct,isNumber:wt,isObject:bt,validateBBox:Bt,validateId:St});function Mt(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Rt(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Lt(t){if(t.length>1&&wt(t[0])&&wt(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return Lt(t[0]);throw new Error("coordinates must only contain numbers")}function Nt(t,e,r){if(!e||!r)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.type)}function Pt(t,e,r){if(!t)throw new Error("No feature passed");if(!r)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.geometry.type)}function kt(t,e,r){if(!t)throw new Error("No featureCollection passed");if(!r)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+r+", FeatureCollection required");for(var n=0,i=t.features;n<i.length;n++){var o=i[n];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+o.geometry.type)}}function Dt(t){return"Feature"===t.type?t.geometry:t}function Qt(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}var Ot=Object.freeze({__proto__:null,getCoord:Mt,getCoords:Rt,containsNumber:Lt,geojsonType:Nt,featureOf:Pt,collectionOf:kt,getGeom:Dt,getType:Qt});function Ft(t,e,r){void 0===r&&(r={});var n=Mt(t),i=Mt(e),o=It(i[1]-n[1]),s=It(i[0]-n[0]),a=It(n[1]),u=It(i[1]),l=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(u);return yt(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),r.units)}function Gt(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var n=Mt(t),i=Dt(e),o=i.type,s=e.bbox,a=i.coordinates;if(s&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(n,s))return!1;"Polygon"===o&&(a=[a]);for(var u=!1,l=0;l<a.length&&!u;l++)if(Ut(n,a[l][0],r.ignoreBoundary)){for(var h=!1,c=1;c<a[l].length&&!h;)Ut(n,a[l][c],!r.ignoreBoundary)&&(h=!0),c++;h||(u=!0)}return u}function Ut(t,e,r){var n=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var i=0,o=e.length-1;i<e.length;o=i++){var s=e[i][0],a=e[i][1],u=e[o][0],l=e[o][1];if(t[1]*(s-u)+a*(u-t[0])+l*(t[0]-s)==0&&(s-t[0])*(u-t[0])<=0&&(a-t[1])*(l-t[1])<=0)return!r;a>t[1]!=l>t[1]&&t[0]<(u-s)*(t[1]-a)/(l-a)+s&&(n=!n)}return n}var Ht=document.createElement("canvas"),jt=function(){function e(){i(this,e),this.type="gisCommon"}var r;return s(e,null,[{key:"getTexture",value:function(t,e,r,n){var i=t.getContext("2d");i.drawImage(e,r,n);var o=new THREE.Texture(i.getImageData(0,0,t.width,t.height));return o.minFilter=THREE.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{key:"getTexture1",value:function(t,e,r,n,i){Ht.width=Ht.height=128;var o=Ht.getContext("2d");o.drawImage(t,e,r,n,i);var s=new THREE.Texture(o.getImageData(0,0,Ht.width,Ht.height));return s.minFilter=THREE.LinearFilter,s.generateMipmaps=!1,s.needsUpdate=!0,s}},{key:"addImageProcessImage",value:function(t){return new Promise((function(e,r){var n=document.createElement("img");n&&!n.crossOrigin&&(n.crossOrigin="Anonymous"),n.onload=function(){return e(n)},n.onerror=r,n.setAttribute("src",t)}))}},{key:"addImageProcess",value:function(t){return new Promise((function(e,r){var n=document.createElement("img");n.onload=function(){return e(n)},n.onerror=r,n.setAttribute("src","data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(t))))}))}},{key:"containsCoordinate3",value:function(t,e,r){if(1e3*Ft({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[e.x,e.y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t}},"kilometers")<e.radius){var n=r.coordinateToVector3([e.x,e.y],0),i=r.coordinateToVector3(t,0).sub(n).normalize(),o=r.distanceToVector3(e.radius,e.radius).x,s=new THREE.Vector3(n.x,n.y+o,0).sub(n).normalize(),a=((i.clone().cross(s).z<0?-1:1)*Math.acos(i.dot(s))*180/Math.PI).toFixed(2);(a=parseFloat(a))<0&&(a=a+180+180);var u=parseFloat(e.begin),l=parseFloat(e.end);if(u>l){if(a>=u||a<=l)return!0}else if(a>=u&&a<=l)return!0;return!1}return!1}},{key:"containsCoordinate1",value:function(t,e){return 1e3*Ft({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[e.getCenter().x,e.getCenter().y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t}},"kilometers")<e.getRadius()}},{key:"containsCoordinate2",value:function(t,e){return Gt({type:"Feature",geometry:{type:"Point",coordinates:t}},{type:"Feature",geometry:{type:"Polygon",coordinates:e.geometry.coordinates[0]}})}},{key:"containsCoordinate",value:function(t,e){var r,n;Array.isArray(t)?(r=t[0],n=t[1]):t instanceof maptalks.Coordinate&&(r=t.x,n=t.y);var i=e.xmin,o=e.ymin,s=e.xmax,a=e.ymax;return i<=r&&r<=s&&o<=n&&n<=a}},{key:"isInLevels",value:function(t,e){for(var r=!1,n=0;n<t.rangeArr.length;n+=2){var i=1*t.rangeArr[n],o=1*t.rangeArr[n+1];if(e>i&&e<=o){r=!0;break}}return r}},{key:"getExtent",value:function(t){if(0!==t.length){var e=1/0,r=1/0,n=-1/0,i=-1/0;return 1===t.length?(e=1*t[0].longitude-.5,r=1*t[0].latitude-.5,n=1*t[0].longitude+.5,i=1*t[0].latitude+.5):t.length>1&&t.slice(0,1/0).map((function(t){var o=1*t.longitude,s=1*t.latitude;e=Math.min(e,o),r=Math.min(r,s),n=Math.max(n,o),i=Math.max(i,s)})),{minX:e,minY:r,maxX:n,maxY:i}}}},{key:"vector2Pixel",value:function(t,e,r){var n=t.project(r),i=e.width/2,o=e.height/2;return{x:Math.round(n.x*i+i),y:Math.round(-n.y*o+o)}}},{key:"generateTextureOne",value:function(t,e,r){Ht.width=e,Ht.height=r;var n=Ht.getContext("2d");n.drawImage(t,0,0,e,r);var i=new THREE.Texture(n.getImageData(0,0,Ht.width,Ht.height));return i.magFilter=THREE.LinearFilter,i.minFilter=THREE.LinearFilter,i.generateMipmaps=!1,i.needsUpdate=!0,i}},{key:"generateTexture",value:function(t){var e=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var n=Math.sqrt(t.length),i=parseInt(n);n>i&&(i+=1);for(var o=(n=i)*r+5*n,s=0,a=0;a<e.length;a++){if(o<e[a]){s=e[a];break}s=1024}Ht.width=Ht.height=s;for(var u=Ht.getContext("2d"),l=0,h=0,c=[],f=0;f<n;f++){for(var p=5*(f+1)+f*l,g=0;g<n;g++){var d=5*(g+1)+g*t[h].w;if("img"===t[h].type){var A=(t[h].w-t[h].iw)/2,y=(t[h].h-t[h].ih)/2;u.drawImage(t[h].src,d+A,p+y,t[h].iw,t[h].ih)}else if("txt"===t[h].type)u.fillStyle=t[h].color,"#fff"===t[h].color?(u.font="lighter "+t[h].size+"px Microsoft YaHei",u.fillText(t[h].src,d+t[h].offx,p+t[h].offy),u.strokeStyle=t[h].color,u.strokeText(t[h].src,d+t[h].offx,p+t[h].offy)):(u.font="normal "+t[h].size+"px Microsoft YaHei",u.fillText(t[h].src,d+t[h].offx,p+t[h].offy));else{var v=(t[h].w-t[h].iw)/2,m=(t[h].h-t[h].ih)/2,E=t[h].offx||0,_=t[h].offy||0;u.drawImage(t[h].src,d+v+E,p+m+_,t[h].iw,t[h].ih)}if(c.push({w:t[h].w,h:t[h].h,u:d/s,v:p/s}),l=Math.max(l,t[h].h),(h+=1)>=t.length)break}if(h>=t.length)break}var I=new THREE.Texture(u.getImageData(0,0,Ht.width,Ht.height));return I.minFilter=THREE.LinearFilter,I.generateMipmaps=!1,I.needsUpdate=!0,{xys:c,texture:I,textureSize:s}}},{key:"generateTextureNew",value:function(t){var e=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var n=Math.sqrt(t.length),i=parseInt(n);n>i&&(i+=1);for(var o=(n=i)*r+5*n,s=0,a=0;a<e.length;a++){if(o<e[a]){s=e[a];break}s=1024}Ht.width=Ht.height=s;for(var u=Ht.getContext("2d"),l=0,h=0,c=0,f=[],p=0;p<n;p++){for(var g=5*(p+1)+p*l,d=0;d<n;d++){var A=5*(d+1)+c;if("img"===t[h].type){var y=(t[h].w-t[h].iw)/2,v=(t[h].h-t[h].ih)/2;u.drawImage(t[h].src,A+y,g+v,t[h].iw,t[h].ih)}else if("txt"===t[h].type)u.fillStyle=t[h].color,"#fff"===t[h].color?(u.font="lighter "+t[h].size+"px Microsoft YaHei",u.fillText(t[h].src,A+t[h].offx,g+t[h].offy),u.strokeStyle=t[h].color,u.strokeText(t[h].src,A+t[h].offx,g+t[h].offy)):(u.font="normal "+t[h].size+"px Microsoft YaHei",u.fillText(t[h].src,A+t[h].offx,g+t[h].offy));else{var m=(t[h].w-t[h].iw)/2,E=(t[h].h-t[h].ih)/2,_=t[h].offx||0,I=t[h].offy||0;u.drawImage(t[h].src,A+m+_,g+E+I,t[h].iw,t[h].ih)}if(f.push({w:t[h].w,h:t[h].h,u:A/s,v:g/s}),l=Math.max(l,t[h].h),c+=t[h].w,(h+=1)>=t.length)break}if(h>=t.length)break}var x=new THREE.Texture(u.getImageData(0,0,Ht.width,Ht.height));return x.minFilter=THREE.LinearFilter,x.generateMipmaps=!1,x.needsUpdate=!0,{xys:f,texture:x,textureSize:s}}},{key:"generateGifTexture",value:(r=n(t().mark((function r(n,i,o){var s,a,u,l,h,c,f,p,g,d,A,y,v;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:s=Math.sqrt(n.length),a=parseInt(s),u=a,s>a&&(u+=1),(l=document.createElement("canvas")).width=a*i,l.height=u*o,h=l.getContext("2d"),c=0,f=0;case 10:if(!(f<s)){t.next=32;break}p=f*o,g=0,d=0;case 14:if(!(d<s)){t.next=27;break}return A=g,t.next=18,e.addImageProcessImage(n[c]);case 18:if(y=t.sent,h.drawImage(y,A,p,i,o),g+=i,!((c+=1)>=n.length)){t.next=24;break}return t.abrupt("break",27);case 24:d++,t.next=14;break;case 27:if(!(c>=n.length)){t.next=29;break}return t.abrupt("break",32);case 29:f++,t.next=10;break;case 32:return(v=new THREE.Texture(h.getImageData(0,0,l.width,l.height))).generateMipmaps=!1,v.needsUpdate=!0,t.abrupt("return",{texture:v,colNum:a,rowNum:u});case 36:case"end":return t.stop()}}),r)}))),function(t,e,n){return r.apply(this,arguments)})},{key:"generateTextureOptimize",value:function(t){var e=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var n=Math.sqrt(t.length),i=parseInt(n);n>i&&(i+=1);for(var o=(n=i)*r+5*n,s=0,a=0;a<e.length;a++){if(o<e[a]){s=e[a];break}s=1024}Ht.width=Ht.height=s;for(var u=Ht.getContext("2d"),l=0,h=0,c={},f=0;f<n;f++){for(var p=5*(f+1)+f*l,g=0,d=0;d<n;d++){var A=5*(d+1)+g,y=(t[h].w-t[h].iw)/2,v=(t[h].h-t[h].ih)/2;if(u.drawImage(t[h].src,A+y,p+v,t[h].iw,t[h].ih),c[t[h].key]={w:t[h].w,h:t[h].h,u:A/s,v:p/s},l=Math.max(l,t[h].h),g+=t[h].w,(h+=1)>=t.length)break}if(h>=t.length)break}var m=new THREE.Texture(u.getImageData(0,0,Ht.width,Ht.height));return m.minFilter=THREE.LinearFilter,m.generateMipmaps=!1,m.needsUpdate=!0,{xys:c,texture:m,textureSize:s}}},{key:"setPointEventStatus",value:function(t,e){t&&t.getMeshes().forEach((function(t){"Points"===t.type&&(t.options.interactive=e)}))}},{key:"createTextTexture",value:function(t,e){Ht.width=Ht.height=t;var r=Ht.width/2,n=Ht.height/2;if(e){var i=0;e.forEach((function(t){var e=Ht.getContext("2d");e.fillStyle=t.fontcolor,e.font="".concat(t.fontsize,"px Arial"),e.textAlign="center",e.textBaseline="middle",e.fillText(t.txt,r,n+i),i+=t.fontsize}))}var o=new THREE.Texture(Ht);return o.minFilter=THREE.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{key:"createTextAndBgTexture",value:function(t,e,r,n){var i=document.createElement("canvas");i.width=t,i.height=e;var o=i.getContext("2d");o.drawImage(r,0,0,t,e);var s=i.width/2,a=i.height/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle="#FFF",o.font="".concat(n.fontsize,"px Arial"),o.fillText(n.txt,s,a);var u=new THREE.Texture(i);return u.magFilter=THREE.NearestFilter,u.minFilter=THREE.NearestFilter,u.needsUpdate=!0,u}},{key:"getIntColor",value:function(t){var e=parseInt(255*t.r);return e=((e=(e<<8)+parseInt(255*t.g))<<8)+parseInt(255*t.b)}},{key:"colorIntToRGB",value:function(t){var e=t>>16&255,r=t>>8&255,n=255&t;return new THREE.Color("rgb(".concat(e,",").concat(r,",").concat(n,")"))}},{key:"createSimpleShader",value:function(t,e,r){return t.uniforms.texture1={value:e},t.uniforms.size1={value:r},t.uniforms.flag={value:1},t.vertexShader="uniform float size1;\n attribute float imgflag;\n varying float vimgflag;\n attribute float visibility;\n varying float vVisible;\n "+t.vertexShader,t.vertexShader=t.vertexShader.replace("#include <project_vertex>","\n #include <project_vertex>\n vimgflag = imgflag;\n vVisible = visibility;\n ").replace("gl_PointSize = size;","\n gl_PointSize = size1;\n "),t.fragmentShader="\n uniform sampler2D texture1;\n varying float vimgflag;\n varying float vVisible;\n "+t.fragmentShader,t.fragmentShader=t.fragmentShader.replace("gl_FragColor = vec4( outgoingLight, diffuseColor.a );","\n\n vec2 pUv = gl_PointCoord;\n pUv.y = 1. - pUv.y;\n\n if(vimgflag < 1.0){\n vec4 texColor = texture2D( texture1, pUv );\n outgoingLight *= texColor.xyz;\n gl_FragColor = vec4( outgoingLight, texColor.a * diffuseColor.a );\n }\n\n if (vVisible < 0.5) discard;\n "),t}},{key:"calTextWidth",value:function(t,e){var r=(t.match(/[\u4e00-\u9fa5]/g)||"").length;return r*e+.5*(t.length-r)*e}}]),e}();function qt(t,e,r,n,i,o,s,a,u,l){var h=t.split("\n"),c=[],f={positionedGlyphs:c,text:t,top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:l,lineCount:h.length};return function(t,e,r,n,i,o,s,a,u){var l=0,h=-17,c=0,f=t.positionedGlyphs,p="right"===o?1:"left"===o?0:.5,g=f.length;r.forEach((function(t){if(t.split("").forEach((function(t){var r=e[u],n=t.charCodeAt(0),i=r&&r[n];i&&(f.push({glyph:n,x:l,y:h+0,vertical:!1,scale:1,fontStack:u}),l+=i.metrics.advance+a)})),f.length!==g){var r=l-a;c=Math.max(r,c),function(t,e,r,n,i){if(i){var o=t[n],s=e[o.fontStack],a=s&&s[o.glyph];if(a)for(var u=a.metrics.advance*o.scale,l=(t[n].x+u)*i,h=r;h<=n;h++)t[h].x-=l}}(f,e,g,f.length-1,p)}l=0,h+=n}));var d=function(t){var e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}(i),A=d.horizontalAlign,y=d.verticalAlign;!function(t,e,r,n,i,o,s){for(var a=(e-r)*i,u=(-n*s+.5)*o,l=0;l<t.length;l++)t[l].x+=a,t[l].y+=u}(f,p,A,y,c,n,r.length);var v=h- -17;t.top+=-y*v,t.bottom=t.top+v,t.left+=-A*c,t.right=t.left+c}(f,e,h,i,o,s,0,a,r),!!c.length&&f}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Vt(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})})),e}var zt=Yt;function Yt(t,e){this.x=t,this.y=e}Yt.prototype={clone:function(){return new Yt(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Yt.convert=function(t){return t instanceof Yt?t:Array.isArray(t)?new Yt(t[0],t[1]):t};var Xt={radius:40,altitude:0},Jt=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s,a,u,l,h){var c;i(this,r);var f=R(t);c=e.call(this),n=maptalks.Util.extend({center:f,layer:h},Xt,n),c._initOptions(n);var p=c.getLayer().getPick();c._colorMap={},c._datas=t,c._childCount=l,c.hidePosition=n.hidePosition;var g=h.coordinateToVector3(f);c.glyphMap=a,c.glyphAtlas=u;for(var d=new THREE.InstancedBufferGeometry,A=new Uint16Array([0,1,2,2,3,0]),y=new Float32Array([0,1,-.5,-.5,1,1,.5,-.5,1,0,.5,.5,0,0,-.5,.5]),v=new THREE.InstancedBufferAttribute(new Float32Array(4*c._childCount),4,!0),m=new THREE.InstancedBufferAttribute(new Float32Array(4*c._childCount),4,!0),E=new THREE.InstancedBufferAttribute(new Float32Array(4*c._childCount),4,!0),_=new THREE.InstancedBufferAttribute(new Float32Array(4*c._childCount),4,!0),I=new THREE.InstancedBufferAttribute(new Float32Array(3*c._childCount),3,!0),x=0,C=function(e){var r=t[e],n=r.texts,i=r.markers,o=p.getColor(),s=o.getHex();c._colorMap[s]=e,c._datas[e].colorIndex=s,i&&i.forEach((function(r){if(v.setXYZW(x,r.markerWidth,r.markerHeight,r.markerDx,r.markerDy),m.setXYZW(x,r.u,r.v,-16,16),r.markerColor){var n=M(0,255);_.setXYZW(x,n,0,0,0);var i=c.getColorVector2(r.markerColor,r.markerOpacity);E.setXYZW(x,i[0],i[1],r.w,r.h)}else{var s=M(0,0);_.setXYZW(x,s,0,0,0);var a=c.getColorVector2("#fff",r.markerOpacity);E.setXYZW(x,a[0],a[1],r.w,r.h)}I.setXYZ(x,o.r,o.g,o.b),r.markerIndex=x,x+=1,t[e].childNum+=1})),n&&n.forEach((function(r){var n=c.getColorVector2(r.textColor,r.textOpacity),i=M(255,0);c.buildTextBuffers("".concat(r.text),r.textAnchor,"center",r.textSpacing).forEach((function(s){if(v.setXYZW(x,r.textSize,0,r.textDx,r.textDy),m.setXYZW(x,s[0],s[1],s[2],s[3]),r.textHaloColor){var a=c.getColorVector2(r.textHaloColor,r.textHaloOpacity);E.setXYZW(x,n[0],n[1],a[0],a[1]);var u=r.textHaloRadius;_.setXYZW(x,i,u,0,0)}else E.setXYZW(x,n[0],n[1],0,0),_.setXYZW(x,i,-1.9,0,0);I.setXYZ(x,o.r,o.g,o.b),r.textIndex.push(x),x+=1,t[e].childNum+=1}))}))},w=0;w<t.length;w++)C(w);d.setIndex(new THREE.Uint16BufferAttribute(A,1)),d.setAttribute("uv_offset",new THREE.Float32BufferAttribute(y,4,!0)),d.setAttribute("size",v),d.setAttribute("uv_image",m),d.setAttribute("color",E),d.setAttribute("util",_),d.setAttribute("pickingColor",I),c._createInstancedMesh(d,o,c._childCount),c.getObject3d().instanceMatrix.setUsage(THREE.DynamicDrawUsage);var b=new THREE.InstancedMesh(d,s,c._childCount);b.instanceMatrix.setUsage(THREE.DynamicDrawUsage);var B=p.getColor().getHex();b._colorIndex=B,c.setPickObject3d(b);var S=new THREE.Object3D;x=0,t.forEach((function(e,r){var n=h.coordinateToVector3(e.coordinate);n.sub(g),e.height&&(n.z=h.altitudeToVector3(e.height).x);for(var i=0;i<t[r].childNum;i++)!1===e.visible?S.position.set(c.hidePosition[0],c.hidePosition[1],c.hidePosition[2]):S.position.set(n.x,n.y,0),S.updateMatrix(),c.getObject3d().setMatrixAt(x,S.matrix),b.setMatrixAt(x,S.matrix),x+=1}));var T=h.altitudeToVector3(n.altitude,n.altitude).x;return g.z=T,c.getObject3d().position.copy(g),b.position.copy(c.getObject3d().position),c.parent=null,c.pickMesh=b,c.threeLayer=h,c.center=g,c._init(),c}return s(r,[{key:"_init",value:function(){var t=this,e=this.getLayer().getPick();this.on("add",(function(){e.add(t.pickObject3d)})),this.on("remove",(function(){e.remove(t.pickObject3d)}))}},{key:"getSelectMesh",value:function(){return this._datas[this.index]}},{key:"identify",value:function(t){return this.picked}},{key:"getColorVector2",value:function(t,e){var r,n=new THREE.Color(t).getHexString(),i=(r="#".concat(n),{r:parseInt(r.slice(1,3),16),g:parseInt(r.slice(3,5),16),b:parseInt(r.slice(5,7),16)}),o=i.b;return[M(i.r,i.g),M(o,void 0!==e?e:255)]}},{key:"buildTextBuffers",value:function(t,e,r,n){var i=[],o=[0,0],s=qt(t,this.glyphMap,"sans-serif",0,24,e,r,n,o,1);if(s){var a=function(t,e,r,n){for(var i=t.positionedGlyphs,o=[],s=0;s<i.length;s++){var a=i[s],u=n[a.fontStack],l=u&&u[a.glyph];if(l){var h=l.rect;if(h){var c=l.metrics.advance*a.scale/2,f=r?[a.x+c,a.y]:[0,0],p=r?[0,0]:[a.x+c+e[0],a.y+e[1]],g=(l.metrics.left-4)*a.scale-c+p[0],d=(-l.metrics.top-4)*a.scale+p[1],A=g+h.w*a.scale,y=d+h.h*a.scale,v=new zt(g,d),m=new zt(A,d),E=new zt(g,y),_=new zt(A,y);o.push({tl:v,tr:m,bl:E,br:_,tex:h,writingMode:t.writingMode,glyphOffset:f})}}}return o}(s,o,!1,this.glyphAtlas.positions);a.forEach((function(t){i.push([t.tex.x,t.tex.y+t.tex.h,t.bl.x,t.bl.y])}))}return i}},{key:"changeVisible",value:function(){var t=this,e=new THREE.Object3D;this._datas.forEach((function(r,n){var i=t.threeLayer.coordinateToVector3(r.coordinate);i.sub(t.center),r.height&&(i.z=t.threeLayer.altitudeToVector3(r.height).x),!1===r.visible?e.position.set(t.hidePosition[0],t.hidePosition[1],t.hidePosition[2]):e.position.set(i.x,i.y,0),e.updateMatrix(),r.markers&&r.markers.forEach((function(r){t.getObject3d().setMatrixAt(r.markerIndex,e.matrix),t.pickMesh.setMatrixAt(r.markerIndex,e.matrix)})),r.texts&&r.texts.forEach((function(r){r.textIndex.forEach((function(r){t.getObject3d().setMatrixAt(r,e.matrix),t.pickMesh.setMatrixAt(r,e.matrix)}))}))})),this.getObject3d().instanceMatrix.needsUpdate=!0,this.pickMesh.instanceMatrix.needsUpdate=!0}}]),r}(),Wt=function(){function t(e,r){i(this,t),this.createImage(e,1,r)}return s(t,[{key:"createImage",value:function(t,e,r){var n=t.width,i=t.height;if(r){if(r.length!==n*i*e)throw new RangeError("mismatched image size")}else r=new Uint8Array(n*i*e);this.width=n,this.height=i,this.data=r}},{key:"resize",value:function(){}}],[{key:"copy",value:function(t,e,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var s=t.data,a=e.data,u=0;u<i.height;u++)for(var l=((r.y+u)*t.width+r.x)*o,h=((n.y+u)*e.width+n.x)*o,c=0;c<i.width*o;c++)a[h+c]=s[l+c];return e}}]),t}();var Kt=s((function t(e){i(this,t);var r={},n=[];for(var o in e){var s=e[o],a=r[o]={};for(var u in s){var l=s[+u];if(l&&0!==l.bitmap.width&&0!==l.bitmap.height){var h={x:0,y:0,w:l.bitmap.width+2,h:l.bitmap.height+2};n.push(h),a[u]={rect:h,metrics:l.metrics}}}}var c=function(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,o=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,o=Math.max(o,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();t<n.length&&(n[t]=e)}else e.h===r.h?(r.x+=e.w,r.w-=e.w):e.w===r.w?(r.y+=e.h,r.h-=e.h):(n.push({x:r.x+e.w,y:r.y,w:r.w-e.w,h:e.h}),r.y+=e.h,r.h-=e.h);break}}return{w:i,h:o,fill:e/(i*o)||0}}(n),f=c.w,p=c.h,g=new Wt({width:f||1,height:p||1});for(var d in e){var A=e[d];for(var y in A){var v=A[+y];if(v&&0!==v.bitmap.width&&0!==v.bitmap.height){var m=r[d][y].rect;Wt.copy(v.bitmap,g,{x:0,y:0},{x:m.x+1,y:m.y+1},v.bitmap)}}}this.image=g,this.positions=r})),Zt={exports:{}};Zt.exports=te,Zt.exports.default=te;var $t=1e20;function te(t,e,r,n,i,o){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=n||.25,this.fontFamily=i||"sans-serif",this.fontWeight=o||"normal",this.radius=r||8;var s=this.size=this.fontSize+2*this.buffer,a=s+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=s,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textAlign="left",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a),this.useMetrics=void 0!==this.ctx.measureText("A").actualBoundingBoxLeft,this.middle=Math.round(s/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function ee(t,e,r,n,i,o){for(var s=0;s<e;s++)re(t,s,e,r,n,i,o);for(var a=0;a<r;a++)re(t,a*e,1,e,n,i,o)}function re(t,e,r,n,i,o,s){var a,u,l,h;for(o[0]=0,s[0]=-$t,s[1]=$t,a=0;a<n;a++)i[a]=t[e+a*r];for(a=1,u=0,l=0;a<n;a++){do{h=o[u],l=(i[a]-i[h]+a*a-h*h)/(a-h)/2}while(l<=s[u]&&--u>-1);o[++u]=a,s[u]=l,s[u+1]=$t}for(a=0,u=0;a<n;a++){for(;s[u+1]<a;)u++;h=o[u],t[e+a*r]=i[h]+(a-h)*(a-h)}}te.prototype._draw=function(t,e){var r,n,i,o,s,a,u,l,h,c=this.ctx.measureText(t),f=c.width,p=2*this.buffer;e&&this.useMetrics?(s=Math.floor(c.actualBoundingBoxAscent),l=this.buffer+Math.ceil(c.actualBoundingBoxAscent),a=this.buffer,u=this.buffer,r=(n=Math.min(this.size,Math.ceil(c.actualBoundingBoxRight-c.actualBoundingBoxLeft)))+p,i=(o=Math.min(this.size-a,Math.ceil(c.actualBoundingBoxAscent+c.actualBoundingBoxDescent)))+p,this.ctx.textBaseline="alphabetic"):(r=n=this.size,i=o=this.size,s=19*this.fontSize/24,a=u=0,l=this.middle,this.ctx.textBaseline="middle"),n&&o&&(this.ctx.clearRect(u,a,n,o),this.ctx.fillText(t,this.buffer,l),h=this.ctx.getImageData(u,a,n,o));var g=new Uint8ClampedArray(r*i);return function(t,e,r,n,i,o,s){o.fill($t,0,e*r),s.fill(0,0,e*r);for(var a=(e-n)/2,u=0;u<i;u++)for(var l=0;l<n;l++){var h=(u+a)*e+l+a,c=t.data[4*(u*n+l)+3]/255;if(1===c)o[h]=0,s[h]=$t;else if(0===c)o[h]=$t,s[h]=0;else{var f=Math.max(0,.5-c),p=Math.max(0,c-.5);o[h]=f*f,s[h]=p*p}}}(h,r,i,n,o,this.gridOuter,this.gridInner),ee(this.gridOuter,r,i,this.f,this.v,this.z),ee(this.gridInner,r,i,this.f,this.v,this.z),function(t,e,r,n,i,o,s){for(var a=0;a<e*r;a++){var u=Math.sqrt(n[a])-Math.sqrt(i[a]);t[a]=Math.round(255-255*(u/o+s))}}(g,r,i,this.gridOuter,this.gridInner,this.radius,this.cutoff),{data:g,metrics:{width:n,height:o,sdfWidth:r,sdfHeight:i,top:s,left:0,advance:f}}},te.prototype.draw=function(t){return this._draw(t,!1).data},te.prototype.drawWithMetrics=function(t){return this._draw(t,!0)};var ne=Zt.exports,ie={},oe={};var se=function(){function e(t,r,n,o){var s=this;i(this,e);var a=r.pointMinZoom,u=r.pointOrder;if(0!=t.length){var l=[];this.charArray="",this.imgDict={},this.threeLayer=n,this.map=n.map,this.interactive=void 0===r.interactive||r.interactive,this.beginSizeZoom=r.beginSizeZoom||3,this.endSizeZoom=r.endSizeZoom||12,this.spanSizeZoom=this.endSizeZoom-this.beginSizeZoom,this.stepSize=1/(this.endSizeZoom-this.beginSizeZoom+1),this.altitude=r.altitude||0,this.groupId=o,"EPSG:4326"===this.map.getSpatialReference().getProjection().code?this.tileResolution=.0006866455078125:this.tileResolution=76.43702828517625,this.textMinZoom=r.textMinZoom||0,this.textMaxZoom=r.textMaxZoom||30,this.textMinMaxZooms=r.textMinMaxZooms,this.hasAlign=r.hasAlign||!1,this.childCount=0,t.slice(0,1/0).map((function(t){1*t.longitude>70&&1*t.longitude<138&&1*t.latitude>0&&1*t.latitude<56&&s._bindDataItem(l,t)})),this.textures=null,this.glyphMap=null,this.glyphAtlas=null,this.dataItems=l,this.point=null,this.shader=null,this.minZoom=a||8,this.maxZoom=r.pointMaxZoom||20,this.order=u||0,this.isToolTip=r.isToolTip||!1,this.clickFunc=r.clickFunc||null,this.cFunc=r.cFunc||null,this.mouseMoveFunc=r.mouseMoveFunc||null,this.mouseOutFunc=r.mouseOutFunc||null,this.mMoveFunc=r.mMoveFunc||null,this.hasAlign=r.hasAlign||!1,this.zoomChangeCallback=r.zoomChangeCallback,this.hidePosition=r.hidePosition||[-999,-999,0]}else console.error("需要绘制的点位数量为0")}var r,o,a,u;return s(e,[{key:"_putImgToDict",value:function(t,e,r){void 0===this.imgDict[t]?this.imgDict[t]={imgSrc:t,width:e,height:r}:(this.imgDict[t].width=(this.imgDict[t].width+e)/2,this.imgDict[t].height=(this.imgDict[t].height+r)/2)}},{key:"_bindDataItem",value:function(t,e){var r={coordinate:[parseFloat(e.longitude),parseFloat(e.latitude)],height:void 0!==e.height?parseFloat(e.height):0,visible:void 0===e.visible||e.visible,code:e.code,status:void 0!==e.status?e.status:1,name:e.name,childNum:0,data:e.data},n=e.texts;if(n){r.texts=[];for(var i=0,o=0;o<n.length;o++){var s=n[o];if(s.text&&s.text.length>0){i+=s.text.length,this.charArray=T(this.charArray,s.text);var a={text:s.text,textSize:s.textSize||14,textDx:s.textDx||0,textDy:s.textDy||0,textColor:s.textColor||"#fff",textAnchor:s.textAnchor||"center",textSpacing:s.textSpacing||2,textOpacity:s.textOpacity||255,textIndex:[]};s.textHaloColor&&(a=Object.assign(a,{textHaloColor:s.textHaloColor,textHaloRadius:s.textHaloRadius||1,textHaloOpacity:void 0!==s.textHaloOpacity?s.textHaloOpacity:255})),r.texts.push(a)}}this.childCount+=i}var u=e.markers;if(u){r.markers=[];for(var l=0,h=0;h<u.length;h++){var c=u[h];c.imgSrc&&(l+=1,this._putImgToDict(c.imgSrc,c.markerWidth||40,c.markerHeight||40),r.markers.push({markerWidth:1*c.markerWidth||40,markerHeight:1*c.markerHeight||40,markerDx:1*c.markerDx||0,markerDy:1*c.markerDy||0,markerColor:c.markerColor,markerOpacity:1*c.markerOpacity||255,key:c.imgSrc,markerIndex:-1}))}this.childCount+=l}t.push(r)}},{key:"_loadTexture",value:(u=n(t().mark((function e(){var r,n,i,o,s;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],e.t0=t().keys(this.imgDict);case 2:if((e.t1=e.t0()).done){e.next=18;break}if(n=e.t1.value,i=n,!n.includes(".svg")){e.next=12;break}return e.next=8,fetch(n);case 8:return o=e.sent,e.next=11,o.text();case 11:i=e.sent;case 12:return e.next=14,jt.addImageProcess(i);case 14:s=e.sent,r.push({key:n,src:s,w:this.imgDict[n].width,h:this.imgDict[n].height,iw:this.imgDict[n].width,ih:this.imgDict[n].height}),e.next=2;break;case 18:return e.abrupt("return",jt.generateTextureOptimize(r));case 19:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"initGlyphAtlas",value:function(){var t=this.charArray.split("").map((function(t){return function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0,n=function(t){var e=t.trim().substring(0,t.lastIndexOf(" ")),r="400";return/bold/i.test(t)?r="900":/medium/i.test(t)?r="500":/light/i.test(t)&&(r="200"),{fontFamily:e,fontWeight:r}}(e),i=n.fontFamily,o=n.fontWeight,s=r.charCodeAt(0),a=ie[e];return a||(a=ie[e]=new ne(24,3,8,.25,i,o)),oe[e]||(oe[e]={}),oe[e][r]||(oe[e][r]=a.ctx.measureText(r).width),{id:s,bitmap:new Wt({width:30,height:30},a.draw(r)),metrics:{width:24,height:24,left:0,top:-5,advance:(t=s,t>=19968&&t<=40959?24:oe[e][r])}}}("",t)})).reduce((function(t,e){return t[e.id]=e,t}),{});this.glyphMap||(this.glyphMap={}),this.glyphMap["sans-serif"]=t,this.glyphAtlas=new Kt(this.glyphMap)}},{key:"addPoint",value:(a=n(t().mark((function e(){var r,n,i,o,s,a,u,l=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.dataItems){t.next=2;break}return t.abrupt("return",null);case 2:return t.next=4,this._loadTexture();case 4:return r=t.sent,this.textures||(this.textures=[]),this.textures.push(r.texture),this.initGlyphAtlas(),n=this.glyphAtlas.image,i=n.width,o=n.height,s=n.data,(a=new THREE.DataTexture(s,i,o)).needsUpdate=!0,a.magFilter=THREE.LinearFilter,a.minFilter=THREE.LinearFilter,a.format=THREE.RedFormat,this.textures.push(a),this.m=this._getRawShaderMaterial(r,a,i,o),this.m.depthTest=!1,this.hasAlign&&(this.m.vertexShader="#define HAS_ALIGN\n"+this.m.vertexShader),this.m_pick=this._getRawShaderMaterial(r,a,i,o),this.hasAlign&&(this.m_pick.vertexShader="#define HAS_ALIGN\n"+this.m_pick.vertexShader),this.m_pick.vertexShader="#define PICKING\n"+this.m_pick.vertexShader,this.m_pick.fragmentShader="#define PICKING\n"+this.m_pick.fragmentShader,this.dataItems.forEach((function(t){t.markers&&t.markers.forEach((function(t){t=Object.assign(t,r.xys[t.key])}))})),(u=new Jt(this.dataItems,{minZoom:this.minZoom,maxZoom:this.maxZoom,interactive:this.interactive,altitude:this.altitude,hidePosition:this.hidePosition},this.m,this.m_pick,this.glyphMap,this.glyphAtlas,this.childCount,this.threeLayer)).zoomChange=function(){l.m.uniforms.cameraToCenterDistance.value=l.map.cameraToCenterDistance,l.m.uniforms.zoomScale.value=l.tileResolution/l.map.getResolution(),l.m_pick.uniforms.cameraToCenterDistance.value=l.map.cameraToCenterDistance,l.m_pick.uniforms.zoomScale.value=l.tileResolution/l.map.getResolution();for(var t=l._getRate(),e=l.point.object3d.geometry.attributes.size.array,r=0,n=0;n<l.dataItems.length;n++){var i=l.dataItems[n];if(i.markers)for(var o=0;o<i.markers.length;o++)e[4*r+0]=i.markers[o].markerWidth*t,e[4*r+1]=i.markers[o].markerHeight*t,e[4*r+2]=i.markers[o].markerDx*t,e[4*r+3]=i.markers[o].markerDy*t,r+=1;if(i.texts)for(var s=function(){var n=i.texts[a].textSize,o=i.texts[a].textDx,s=i.texts[a].textDy;i.texts[a].textIndex.forEach((function(){e[4*r+0]=n*t,e[4*r+1]=0,e[4*r+2]=o*t,e[4*r+3]=s*t,r+=1}))},a=0;a<i.texts.length;a++)s()}l.point.object3d.geometry.attributes.size.needsUpdate=!0,l.zoomChangeCallback&&l.zoomChangeCallback()},this.isToolTip&&u.setToolTip("hello",{showTimeout:0,eventsPropagation:!0,dx:10}),u.object3d.renderOrder=this.order,this.point=u,this.point.parent=this,this.groupId?this.threeLayer.addMesh1(this.point,this.groupId):this.threeLayer.addMesh(this.point),this._bindMapEvents(),t.abrupt("return",this);case 32:case"end":return t.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"_getRawShaderMaterial",value:function(t,e,r,n){return new THREE.RawShaderMaterial({uniforms:{imgTexture:{type:"t",value:t.texture},imgTextureSize:{type:"f",value:t.textureSize},sdfTexture:{type:"t",value:e},sdfTextureSize:{value:[r,n]},canvasSize:{value:[this.map.width,this.map.height]},cameraToCenterDistance:{type:"f",value:this.map.cameraToCenterDistance},zoomScale:{type:"f",value:this.tileResolution/this.map.getResolution()},mapPitch:{value:this.map.getPitch()*Math.PI/180},gammaScale:{value:1}},vertexShader:"\n precision mediump float;\n\n uniform mat4 modelViewMatrix;\n uniform mat4 projectionMatrix;\n\n uniform vec2 canvasSize;\n uniform float cameraToCenterDistance;\n uniform float zoomScale;\n uniform float mapPitch;\n uniform vec2 sdfTextureSize;\n uniform float imgTextureSize;\n\n attribute mat4 instanceMatrix;\n attribute vec4 size;\n attribute vec4 uv_offset;\n attribute vec4 uv_image;\n attribute vec4 util;\n varying vec4 vColor;\n\n #ifdef PICKING\n attribute vec3 pickingColor;\n #else\n varying vec2 vUv;\n varying float vGammaScale;\n varying float vSize;\n varying vec4 vUtil;\n attribute vec4 color;\n #endif\n\n vec2 unpack_float(const float packedValue) {\n int packedIntValue = int(packedValue);\n int v0 = packedIntValue / 256;\n return vec2(v0, packedIntValue - v0 * 256);\n }\n void main()\n {\n #ifdef PICKING\n vColor = vec4(pickingColor, 1.);\n #else\n vColor = color;\n vUtil = util;\n #endif\n vec2 utils1 = unpack_float(util.x) / 255.0;\n vec2 wh1 = uv_offset.zw * 32.;\n vec2 offset = vec2(uv_image.z + wh1.x, uv_image.w - wh1.y);\n \n vec2 j = vec2(offset.x + 16., offset.y - 16.);\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(0, 0, 0, 1.);\n float camera_to_anchor_distance = gl_Position.w;\n float distance_ratio = camera_to_anchor_distance / cameraToCenterDistance;\n float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, \n 1.5);\n float m = (1. - cameraToCenterDistance / camera_to_anchor_distance) * perspective_ratio;\n float n = clamp(.5 + .5 * (1. - m), .0, 4.);\n vec3 c = vec3(0.0, 0.0, 0.0);\n\n if (utils1.x > 0.) {\n float glyphSize = 24.;\n #ifndef PICKING\n vec2 wh = uv_offset.xy / sdfTextureSize * 32.;\n vec2 xy = uv_image.xy / sdfTextureSize;\n vUv = vec2(xy.x + wh.x, xy.y - wh.y);\n #endif\n \n j = j / glyphSize * size.x;\n float B = camera_to_anchor_distance / cameraToCenterDistance;\n\n #ifndef HAS_ALIGN\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * camera_to_anchor_distance;\n #else\n vec2 C = j;\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(c + vec3(C, .0) / zoomScale * B * n, 1.);\n #endif\n gl_Position.xy += vec2(size.z, size.w) * 2. / canvasSize * camera_to_anchor_distance;\n\n #ifndef PICKING\n #ifndef HAS_ALIGN\n vGammaScale = mix(1., B, perspective_ratio);\n #else\n vGammaScale = B + mapPitch / 4.;\n #endif\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vSize = size.x;\n #endif\n } else {\n #ifndef PICKING\n float width = uv_offset.x / imgTextureSize * color.z;\n float height = uv_offset.y / imgTextureSize * color.w;\n float x = uv_image.x;\n float y = 1.0 - uv_image.y;\n vUv = vec2(x + width, y - height);\n #endif\n\n j = j * vec2(1., -1.);\n j = j / 32. * size.xy;\n #ifndef HAS_ALIGN\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * camera_to_anchor_distance;\n #else\n float C = camera_to_anchor_distance / cameraToCenterDistance;\n vec2 B = j;\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(c + vec3(B, .0) / zoomScale * C * n, 1.);\n #endif\n gl_Position.xy += vec2(size.z, size.w) * 2. / canvasSize * camera_to_anchor_distance;\n }\n }\n ",fragmentShader:"\n precision mediump float;\n #define SDF_PX 8.0\n #define DEVICE_PIXEL_RATIO 1.0\n #define EDGE_GAMMA 0.105 / DEVICE_PIXEL_RATIO\n uniform sampler2D sdfTexture;\n uniform sampler2D imgTexture;\n uniform highp float gammaScale;\n varying vec4 vColor;\n #ifndef PICKING\n varying vec2 vUv;\n varying float vSize;\n varying float vGammaScale;\n varying vec4 vUtil;\n #endif\n\n vec2 unpack_float(const float packedValue) {\n int packedIntValue = int(packedValue);\n int v0 = packedIntValue / 256;\n return vec2(v0, packedIntValue - v0 * 256);\n }\n \n vec4 decode_color(const vec2 encodedColor) {\n return vec4(\n unpack_float(encodedColor[0]) / 255.0,\n unpack_float(encodedColor[1]) / 255.0\n );\n }\n void main()\n {\n #ifdef PICKING\n gl_FragColor = vColor;\n #else\n vec4 color = decode_color(vColor.xy);\n vec2 utils1 = unpack_float(vUtil.x) / 255.0;\n if (utils1.x > 0.) {\n /*float vOpacity = 1.0;\n float d = vSize / 24.;\n lowp vec4 e = color;\n highp float f = EDGE_GAMMA / (d * gammaScale);\n lowp float h = 185. / 256.;\n float l = texture2D(texture1, vUv).a;\n highp float m = f * vGammaScale * .7;\n float n = clamp(smoothstep(h - m, h + m, l), .0, 1.);\n gl_FragColor = e * (n * 1.0 * vOpacity);*/\n\n //float dist = texture2D(sdfTexture, vUv).a;\n float dist = texture2D(sdfTexture, vUv).r;\n float fontScale = vSize / 24.0;\n\n highp float gamma = EDGE_GAMMA / (fontScale * gammaScale);\n lowp float buff = (177. + floor(fontScale)) / 256.0;\n highp float gamma_scaled = gamma * vGammaScale * 0.7;\n highp float alpha = clamp(smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist), .0, 1.);\n\n if (vUtil.y < 0.) {\n gl_FragColor = color * alpha;\n } else {\n float u_halo_width = vUtil.y;\n float u_halo_blur = 0.;\n vec4 u_halo_color = decode_color(vColor.zw);\n float radius = u_halo_width / fontScale / 10.;\n float halo_width = ceil(u_halo_width - u_halo_width / 10.);\n buff = (6.0 - halo_width / fontScale) / SDF_PX;\n gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * gammaScale);\n gamma_scaled = gamma * vGammaScale * 0.7;\n alpha = clamp(smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist), .0, 1.);\n gl_FragColor = mix(u_halo_color, color, \n smoothstep(buff + radius - gamma_scaled, buff + radius + gamma_scaled, dist)) * alpha;\n }\n } else {\n if (utils1.y > 0.) {\n gl_FragColor = color * texture2D(imgTexture, vUv);\n } else {\n gl_FragColor = texture2D(imgTexture, vUv);\n }\n }\n #endif\n }\n ",transparent:!0,side:THREE.DoubleSide})}},{key:"_bindMapEvents",value:function(){this.map.on("pitch",this._setSizeOn,this),this.point&&this.point.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.map.off("pitch",this._setSizeOn,this),this.point&&this.point.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setSizeOn",value:function(){this.m.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance,this.m_pick.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance,this.m.uniforms.mapPitch.value=this.map.getPitch()*Math.PI/180}},{key:"addContent",value:(o=n(t().mark((function e(r){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.clickFunc(r);case 2:this.iconFile&&this._addIcon(r);case 3:case"end":return t.stop()}}),e,this)}))),function(t){return o.apply(this,arguments)})},{key:"_setPointEvent",value:function(t){var e=t.selectMesh;if("mousemove"===t.type&&e){var r=e.name;if(this.isToolTip)this.point.getToolTip()._content="".concat(r)}"click"===t.type&&e&&this.clickFunc&&!this.cFunc&&this.addContent(e)}},{key:"findItemByCode",value:function(t){for(var e=0;e<this.dataItems.length;e++)if(this.dataItems[e].code===t)return e}},{key:"changeParaValue",value:(r=n(t().mark((function e(r){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),e)}))),function(t){return r.apply(this,arguments)})},{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}},{key:"show",value:function(){var t,e;null===(t=this.point)||void 0===t||t.show();for(var r=0;r<this.dataItems.length;r++){this.dataItems[r].visible=!0}null===(e=this.point)||void 0===e||e.changeVisible()}},{key:"hide",value:function(){var t;null===(t=this.point)||void 0===t||t.hide()}},{key:"setInteractiveState",value:function(t){this.point&&(this.point.options.interactive=t)}},{key:"pointShowHideByCode",value:function(t,e,r){for(var n,i=1/0,o=1/0,s=-1/0,a=-1/0,u=0;u<this.dataItems.length;u++){var l=this.dataItems[u];t.includes(l.code)?(i=Math.min(i,this.dataItems[u].coordinate[0]),o=Math.min(o,this.dataItems[u].coordinate[1]),s=Math.max(s,this.dataItems[u].coordinate[0]),a=Math.max(a,this.dataItems[u].coordinate[1]),l.visible=!0):l.visible=!1}null===(n=this.point)||void 0===n||n.changeVisible(),e&&this.map.fitExtent(new maptalks.Extent(i,o,s,a),r||0)}},{key:"updateByZoom",value:function(){var t=this,e=this.map.getZoom(),r=new THREE.Object3D,n=0;this.dataItems.forEach((function(i){var o=t.threeLayer.coordinateToVector3(i.coordinate);if(o.sub(t.point.center),i.height&&(o.z=t.threeLayer.altitudeToVector3(i.height).x),i.markers&&(n+=i.markers.length),i.value&&t.showValueFlag)for(var s=0;s<i.value.length;s++)e<t.valueMinZoom||e>t.valueMaxZoom?r.position.set(-999,-999,0):r.position.set(o.x,o.y,0),r.updateMatrix(),t.point.getObject3d().setMatrixAt(n,r.matrix),t.point.pickMesh.setMatrixAt(n,r.matrix),n+=1;if(i.name&&t.showNameFlag)for(var a=0;a<i.name.length;a++)e<t.nameMinZoom||e>t.nameMaxZoom?r.position.set(-999,-999,0):r.position.set(o.x,o.y,0),r.updateMatrix(),t.point.getObject3d().setMatrixAt(n,r.matrix),t.point.pickMesh.setMatrixAt(n,r.matrix),n+=1})),this.point.getObject3d().instanceMatrix.needsUpdate=!0,this.point.pickMesh.instanceMatrix.needsUpdate=!0}},{key:"dispose",value:function(){this.isToolTip&&this.point&&this.point.removeToolTip(),this._closeEvent(),this.point&&(this.groupId?this.threeLayer.removeMesh1(this.point,this.groupId):this.threeLayer.removeMesh(this.point),this.point.object3d.geometry&&this.point.object3d.geometry.dispose(),this.point.object3d.material&&this.point.object3d.material.dispose(),this.point.pickObject3d.geometry&&this.point.pickObject3d.geometry.dispose(),this.point.pickObject3d.material&&this.point.pickObject3d.material.dispose(),this.point._datas=[],this.point._colorMap={},delete this.point.object3d,delete this.point.pickObject3d,this.point.toolTip&&delete this.point.toolTip,delete this.point),this.textures&&this.textures.length>0&&(this.textures.forEach((function(t){t.dispose()})),delete this.textures),this.m&&(this.m.dispose(),delete this.m),this.m_pick&&(this.m_pick.dispose(),delete this.m_pick),this.glyphMap={},this.glyphAtlas&&delete this.glyphAtlas}}]),e}();function ae(t){var e;try{e=new URL(t,"http://fakehost.com/")}catch(t){return null}var r=e.pathname.split("/").pop(),n=r.lastIndexOf(".");return-1===n||n===r.length-1?null:r.substring(n+1)}var ue=function(){function t(){i(this,t),this.maxSize=800,this.minSize=600,this.unloadPercent=.05,this.itemSet=new Map,this.itemList=[],this.usedSet=new Set,this.callbacks=new Map,this.unloadPriorityCallback=null;var e=this.itemSet;this.defaultPriorityCallback=function(t){return e.get(t)}}return s(t,[{key:"isFull",value:function(){return this.itemSet.size>=this.maxSize}},{key:"add",value:function(t,e){var r=this.itemSet;if(r.has(t))return!1;if(this.isFull())return!1;var n=this.usedSet,i=this.itemList,o=this.callbacks;return i.push(t),n.add(t),r.set(t,Date.now()),o.set(t,e),!0}},{key:"remove",value:function(t){var e=this.usedSet,r=this.itemSet,n=this.itemList,i=this.callbacks;if(r.has(t)){i.get(t)(t);var o=n.indexOf(t);return n.splice(o,1),e.delete(t),r.delete(t),i.delete(t),!0}return!1}},{key:"markUsed",value:function(t){var e=this.itemSet,r=this.usedSet;e.has(t)&&!r.has(t)&&(e.set(t,Date.now()),r.add(t))}},{key:"markAllUnused",value:function(){this.usedSet.clear()}},{key:"unloadUnusedContent",value:function(){var t=this.unloadPercent,e=this.minSize,r=this.itemList,n=this.itemSet,i=this.usedSet,o=this.callbacks,s=r.length-i.size,a=r.length-e,u=this.unloadPriorityCallback||this.defaultPriorityCallback;if(a>0&&s>0){r.sort((function(t,e){var r=i.has(t),n=i.has(e);return r&&n?0:r||n?r?1:-1:u(e)-u(t)}));var l=Math.min(a,s),h=Math.max(e*t,l*t),c=Math.min(h,s);c=Math.ceil(c);for(var f=r.splice(0,c),p=0,g=f.length;p<g;p++){var d=f[p];o.get(d)(d),n.delete(d),o.delete(d)}}}},{key:"scheduleUnload",value:function(){var t,e=this,r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scheduled||(this.scheduled=!0,t=function(){e.scheduled=!1,e.unloadUnusedContent(),r&&e.markAllUnused()},Promise.resolve().then(t))}}]),t}(),le=function(){function t(){var e=this;i(this,t),this.maxJobs=6,this.items=[],this.callbacks=new Map,this.currJobs=0,this.scheduled=!1,this.autoUpdate=!0,this.priorityCallback=function(){throw new Error("PriorityQueue: PriorityCallback function not defined.")},this.schedulingCallback=function(t){requestAnimationFrame(t)},this._runjobs=function(){e.tryRunJobs(),e.scheduled=!1}}return s(t,[{key:"sort",value:function(){var t=this.priorityCallback;this.items.sort(t)}},{key:"add",value:function(t,e){var r=this;return new Promise((function(n,i){var o=r.items,s=r.callbacks;o.push(t),s.set(t,(function(){return e.apply(void 0,arguments).then(n).catch(i)})),r.autoUpdate&&r.scheduleJobRun()}))}},{key:"remove",value:function(t){var e=this.items,r=this.callbacks,n=e.indexOf(t);-1!==n&&(e.splice(n,1),r.delete(t))}},{key:"tryRunJobs",value:function(){var t=this;this.sort();for(var e=this.items,r=this.callbacks,n=this.maxJobs,i=this.currJobs;n>i&&e.length>0;){i++;var o=e.pop(),s=r.get(o);r.delete(o),s(o).then((function(){t.currJobs--,t.autoUpdate&&t.scheduleJobRun()})).catch((function(){t.currJobs--,t.autoUpdate&&t.scheduleJobRun()}))}this.currJobs=i}},{key:"scheduleJobRun",value:function(){this.scheduled||(this.schedulingCallback(this._runjobs),this.scheduled=!0)}}]),t}(),he=3,ce=4,fe=6378137,pe=6356752.314245179;function ge(t){return t===he||t===ce}function de(t,e){return t.__lastFrameVisited===e&&t.__used}function Ae(t,e){t.__lastFrameVisited!==e&&(t.__lastFrameVisited=e,t.__used=!1,t.__inFrustum=!1,t.__isLeaf=!1,t.__visible=!1,t.__active=!1,t.__error=1/0,t.__distanceFromCamera=1/0,t.__childrenWereVisible=!1,t.__allChildrenLoaded=!1)}function ye(t,e,r,n){if(n.ensureChildrenArePreprocessed(t),Ae(t,e),t.__used=!0,r.markUsed(t),t.__contentEmpty)for(var i=t.children,o=0,s=i.length;o<s;o++)ye(i[o],e,r,n)}function ve(t,e,r){if(r.ensureChildrenArePreprocessed(t),t.__contentEmpty&&(!t.__externalTileSet||ge(t.__loadingState)))for(var n=t.children,i=0,o=n.length;i<o;i++){var s=n[i];s.__depthFromRenderedParent=e,ve(s,e,r)}else r.requestTileContents(t)}function me(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(e&&e(t,n,i))r&&r(t,n,i);else{for(var o=t.children,s=0,a=o.length;s<a;s++)me(o[s],e,r,t,i+1);r&&r(t,n,i)}}function Ee(t,e){e.ensureChildrenArePreprocessed(t);var r=e.stats,n=e.frameCount,i=e.errorTarget,o=e.maxDepth,s=e.loadSiblings,a=e.lruCache,u=e.stopAtEmptyTiles;if(Ae(t,n),!1===e.tileInView(t))return!1;if(t.__used=!0,a.markUsed(t),t.__inFrustum=!0,r.inFrustum++,(u||!t.__contentEmpty)&&!t.__externalTileSet){if(e.calculateError(t),t.__error<=i)return!0;if(e.maxDepth>0&&t.__depth+1>=o)return!0}for(var l=!1,h=t.children,c=0,f=h.length;c<f;c++){var p=Ee(h[c],e);l=l||p}if(l&&s)for(var g=0,d=h.length;g<d;g++){ye(h[g],n,a,e)}return!0}function _e(t,e){var r=e.stats,n=e.frameCount;if(de(t,n)){r.used++;for(var i=t.children,o=!1,s=0,a=i.length;s<a;s++){var u=i[s];o=o||de(u,n)}if(o){for(var l=!1,h=!0,c=0,f=i.length;c<f;c++){var p=i[c];if(_e(p,e),l=l||p.__wasSetVisible||p.__childrenWereVisible,de(p,n)){var g=p.__allChildrenLoaded||!p.__contentEmpty&&ge(p.__loadingState)||p.__externalTileSet&&p.__loadingState===ce;h=h&&g}}t.__childrenWereVisible=l,t.__allChildrenLoaded=h}else t.__isLeaf=!0}}function Ie(t,e){var r=e.stats,n=e.frameCount;if(de(t,n)){var i=t.parent,o=i?i.__depthFromRenderedParent:-1;t.__depthFromRenderedParent=o;var s=e.lruCache;if(t.__isLeaf)return t.__depthFromRenderedParent++,void(t.__loadingState===he?(t.__inFrustum&&(t.__visible=!0,r.visible++),t.__active=!0,r.active++):s.isFull()||t.__contentEmpty&&!t.__externalTileSet||e.requestTileContents(t));var a=(e.errorTarget+1)*e.errorThreshold,u=t.__error<=a,l=u||"ADD"===t.refine,h=!t.__contentEmpty,c=h||t.__externalTileSet,f=ge(t.__loadingState)&&c,p=t.__childrenWereVisible,g=t.children,d=t.__allChildrenLoaded;if(l&&h&&t.__depthFromRenderedParent++,l&&!f&&!s.isFull()&&c&&e.requestTileContents(t),(u&&!d&&!p&&f||"ADD"===t.refine&&f)&&(t.__inFrustum&&(t.__visible=!0,r.visible++),t.__active=!0,r.active++),"ADD"!==t.refine&&u&&!d&&f)for(var A=0,y=g.length;A<y;A++){var v=g[A];de(v,n)&&!s.isFull()&&(v.__depthFromRenderedParent=t.__depthFromRenderedParent+1,ve(v,v.__depthFromRenderedParent,e))}else for(var m=0,E=g.length;m<E;m++){var _=g[m];de(_,n)&&Ie(_,e)}}}function xe(t,e){var r=de(t,e.frameCount);if(r||t.__usedLastFrame){var n=!1,i=!1;r&&(n=t.__active,i=e.displayActiveTiles&&t.__active||t.__visible),t.__contentEmpty||t.__loadingState!==he||(t.__wasSetActive!==n&&e.setTileActive(t,n),t.__wasSetVisible!==i&&e.setTileVisible(t,i)),t.__wasSetActive=n,t.__wasSetVisible=i,t.__usedLastFrame=r;for(var o=t.children,s=0,a=o.length;s<a;s++){xe(o[s],e)}}}var Ce=function(t,e){return t.__depth!==e.__depth?t.__depth>e.__depth?-1:1:t.__inFrustum!==e.__inFrustum?t.__inFrustum?1:-1:t.__used!==e.__used?t.__used?1:-1:t.__error!==e.__error?t.__error>e.__error?1:-1:t.__distanceFromCamera!==e.__distanceFromCamera?t.__distanceFromCamera>e.__distanceFromCamera?-1:1:0},we=function(t){return 1/(t.__depthFromRenderedParent+1)},be=function(){function t(e,r){i(this,t),this.tileSets={},this.rootURL=e,this.fetchOptions={},this.preprocessURL=null;var n=new ue;n.unloadPriorityCallback=we;var o=new le;o.maxJobs=4,o.priorityCallback=Ce;var s=new le;s.maxJobs=1,s.priorityCallback=Ce,this.lruCache=n,this.downloadQueue=o,this.parseQueue=s,this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0,this.errorTarget=6,this.errorThreshold=1/0,this.loadSiblings=!0,this.displayActiveTiles=!1,this.maxDepth=1/0,this.stopAtEmptyTiles=!0,this.threeLayer=r,this.heightOffset=0,this.xOffset=0,this.yOffset=0}return s(t,[{key:"rootTileSet",get:function(){var t=this.tileSets[this.rootURL];return!t||t instanceof Promise?null:t}},{key:"root",get:function(){var t=this.rootTileSet;return t?t.root:null}},{key:"traverse",value:function(t,e){var r=this,n=this.tileSets[this.rootURL];n&&n.root&&me(n.root,(function(e){r.ensureChildrenArePreprocessed(e);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return!!t&&t.apply(void 0,[e].concat(i))}),e)}},{key:"update",value:function(){var t=this.stats,e=this.lruCache,r=this.tileSets,n=r[this.rootURL];if(this.rootURL in r){if(n&&n.root){var i=n.root;t.inFrustum=0,t.used=0,t.active=0,t.visible=0,this.frameCount++,Ee(i,this),_e(i,this),Ie(i,this),xe(i,this),e.scheduleUnload()}}else this.loadRootTileSet(this.rootURL)}},{key:"parseTile",value:function(t,e,r){return null}},{key:"disposeTile",value:function(t){}},{key:"preprocessNode",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.content&&(!("uri"in t.content)&&"url"in t.content&&(t.content.uri=t.content.url,delete t.content.url),t.content.uri&&(t.content.uri=new URL(t.content.uri,e+"/").toString()),t.content.boundingVolume&&!("box"in t.content.boundingVolume||"sphere"in t.content.boundingVolume||"region"in t.content.boundingVolume)&&delete t.content.boundingVolume),t.parent=r,t.children=t.children||[],t.content&&t.content.uri){var n=ae(t.content.uri),i=Boolean(n&&"json"===n.toLowerCase());t.__externalTileSet=i,t.__contentEmpty=i}else t.__externalTileSet=!1,t.__contentEmpty=!0;t.__distanceFromCamera=1/0,t.__error=1/0,t.__inFrustum=!1,t.__isLeaf=!1,t.__usedLastFrame=!1,t.__used=!1,t.__wasSetVisible=!1,t.__visible=!1,t.__childrenWereVisible=!1,t.__allChildrenLoaded=!1,t.__wasSetActive=!1,t.__active=!1,t.__loadingState=0,t.__loadIndex=0,t.__loadAbort=null,t.__depthFromRenderedParent=-1,null===r?(t.__depth=0,t.refine=t.refine||"REPLACE"):(t.__depth=r.__depth+1,t.refine=t.refine||r.refine),t.__basePath=e}},{key:"setTileActive",value:function(t,e){}},{key:"setTileVisible",value:function(t,e){}},{key:"calculateError",value:function(t){return 0}},{key:"tileInView",value:function(t){return!0}},{key:"ensureChildrenArePreprocessed",value:function(t){for(var e=t.children,r=0,n=e.length;r<n;r++){var i=e[r];if("__depth"in i)break;this.preprocessNode(i,t.__basePath,t)}}},{key:"resetFailedTiles",value:function(){var t=this.stats;0!==t.failed&&(this.traverse((function(t){t.__loadingState===ce&&(t.__loadingState=0)})),t.failed=0)}},{key:"fetchTileSet",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return fetch(t,e).then((function(e){if(e.ok)return e.json();throw new Error('TilesRenderer: Failed to load tileset "'.concat(t,'" with status ').concat(e.status," : ").concat(e.statusText))})).then((function(e){var i=e.asset.version;console.assert("1.0"===i||"0.0"===i,'asset.version is expected to be a string of "1.0" or "0.0"');var o=t.replace(/\/[^\/]*\/?$/,"");return o=new URL(o,window.location.href).toString(),r.preprocessNode(e.root,o,n),e}))}},{key:"loadRootTileSet",value:function(t){var e=this.tileSets;if(t in e)return e[t]instanceof Error?Promise.reject(e[t]):Promise.resolve(e[t]);var r=this.fetchTileSet(this.preprocessURL?this.preprocessURL(t):t,this.fetchOptions).then((function(r){e[t]=r}));return r.catch((function(r){console.error(r),e[t]=r})),e[t]=r,r}},{key:"requestTileContents",value:function(t){var e=this;if(0===t.__loadingState){var r=this.stats,n=this.lruCache,i=this.downloadQueue,o=this.parseQueue,s=t.__externalTileSet;n.add(t,(function(t){1===t.__loadingState?(t.__loadAbort.abort(),t.__loadAbort=null):s?t.children.length=0:e.disposeTile(t),1===t.__loadingState?r.downloading--:2===t.__loadingState&&r.parsing--,t.__loadingState=0,t.__loadIndex++,o.remove(t),i.remove(t)})),t.__loadIndex++;var a=t.__loadIndex,u=new AbortController,l=u.signal;r.downloading++,t.__loadAbort=u,t.__loadingState=1;var h=function(e){t.__loadIndex===a&&("AbortError"!==e.name?(o.remove(t),i.remove(t),2===t.__loadingState?r.parsing--:1===t.__loadingState&&r.downloading--,r.failed++,console.error('TilesRenderer : Failed to load tile at url "'.concat(t.content.uri,'".')),console.error(e),t.__loadingState=ce):n.remove(t))};s?i.add(t,(function(t){if(t.__loadIndex!==a)return Promise.resolve();var r=e.preprocessURL?e.preprocessURL(t.content.uri):t.content.uri;return e.fetchTileSet(r,Object.assign({signal:l},e.fetchOptions),t)})).then((function(e){t.__loadIndex===a&&(r.downloading--,t.__loadAbort=null,t.__loadingState=he,t.children.push(e.root))})).catch(h):i.add(t,(function(t){if(t.__loadIndex!==a)return Promise.resolve();var r=e.preprocessURL?e.preprocessURL(t.content.uri):t.content.uri;return fetch(r,Object.assign({signal:l},e.fetchOptions))})).then((function(e){if(t.__loadIndex===a){if(e.ok)return e.arrayBuffer();throw new Error("Failed to load model with error code ".concat(e.status))}})).then((function(n){if(t.__loadIndex===a)return r.downloading--,r.parsing++,t.__loadAbort=null,t.__loadingState=2,o.add(t,(function(t){if(t.__loadIndex!==a)return Promise.resolve();var r=ae(t.content.uri);return e.parseTile(n,t,r)}))})).then((function(){t.__loadIndex===a&&(r.parsing--,t.__loadingState=he,t.__wasSetVisible&&e.setTileVisible(t,!0),t.__wasSetActive&&e.setTileActive(t,!0))})).catch(h)}}},{key:"dispose",value:function(){var t=this.lruCache,e=[];this.traverse((function(t){return e.push(t),!1}));for(var r=0,n=e.length;r<n;r++)t.remove(e[r]);this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0}}]),t}();function Be(t){return(new TextDecoder).decode(t)}var Se=function(){function t(e,r,n,o){i(this,t),this.buffer=e,this.binOffset=r+n,this.binLength=o;var s=null;if(0!==n){var a=new Uint8Array(e,r,n);s=JSON.parse(Be(a))}else s={};this.header=s}return s(t,[{key:"getKeys",value:function(){return Object.keys(this.header)}},{key:"getData",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=this.header;if(!(t in i))return null;var o=i[t];if(o instanceof Object){if(Array.isArray(o))return o;var s,a,u=this.buffer,l=this.binOffset,h=this.binLength,c=o.byteOffset||0,f=o.type||n,p=o.componentType||r;if("type"in o&&n&&o.type!==n)throw new Error("FeatureTable: Specified type does not match expected type.");switch(f){case"SCALAR":s=1;break;case"VEC2":s=2;break;case"VEC3":s=3;break;case"VEC4":s=4;break;default:throw new Error('FeatureTable : Feature type not provided for "'.concat(t,'".'))}var g=l+c,d=e*s;switch(p){case"BYTE":a=new Int8Array(u,g,d);break;case"UNSIGNED_BYTE":a=new Uint8Array(u,g,d);break;case"SHORT":a=new Int16Array(u,g,d);break;case"UNSIGNED_SHORT":a=new Uint16Array(u,g,d);break;case"INT":a=new Int32Array(u,g,d);break;case"UNSIGNED_INT":a=new Uint32Array(u,g,d);break;case"FLOAT":a=new Float32Array(u,g,d);break;case"DOUBLE":a=new Float64Array(u,g,d);break;default:throw new Error('FeatureTable : Feature component type not provided for "'.concat(t,'".'))}if(g+d*a.BYTES_PER_ELEMENT>l+h)throw new Error("FeatureTable: Feature data read outside binary body length.");return a}return o}},{key:"getBuffer",value:function(t,e){var r=this.buffer,n=this.binOffset;return r.slice(n+t,n+t+e)}}]),t}(),Te=function(t){u(r,Se);var e=f(r);function r(t,n,o,s,a){var u;return i(this,r),(u=e.call(this,t,o,s,a)).batchSize=n,u}return s(r,[{key:"getData",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return g(l(r.prototype),"getData",this).call(this,t,this.batchSize,e,n)}}]),r}(),Me=function(){function t(){i(this,t),this.fetchOptions={},this.workingPath=""}return s(t,[{key:"load",value:function(t){var e=this;return fetch(t,this.fetchOptions).then((function(e){if(!e.ok)throw new Error('Failed to load file "'.concat(t,'" with status ').concat(e.status," : ").concat(e.statusText));return e.arrayBuffer()})).then((function(r){return""===e.workingPath&&(e.workingPath=e.workingPathForURL(t)),e.parse(r)}))}},{key:"resolveExternalURL",value:function(t){return/^[^\\/]/.test(t)?this.workingPath+"/"+t:t}},{key:"workingPathForURL",value:function(t){var e=t.split(/[\\/]/g);return e.pop(),e.join("/")+"/"}},{key:"parse",value:function(t){throw new Error("LoaderBase: Parse not implemented.")}}]),t}();function Re(t){var e;if(e=t instanceof DataView?t:new DataView(t),"{"===String.fromCharCode(e.getUint8(0)))return null;for(var r="",n=0;n<4;n++)r+=String.fromCharCode(e.getUint8(n));return r}var Le=function(t){u(r,Me);var e=f(r);function r(){return i(this,r),e.apply(this,arguments)}return s(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Re(e);console.assert("b3dm"===r);var n=e.getUint32(4,!0);console.assert(1===n);var i=e.getUint32(8,!0);console.assert(i===t.byteLength);var o=e.getUint32(12,!0),s=e.getUint32(16,!0),a=e.getUint32(20,!0),u=e.getUint32(24,!0),l=t.slice(28,28+o+s),h=new Se(l,0,o,s),c=28+o+s,f=t.slice(c,c+a+u),p=new Te(f,h.getData("BATCH_LENGTH"),0,a,u),g=c+a+u;return{version:n,featureTable:h,batchTable:p,glbBytes:new Uint8Array(t,g,i-g)}}}]),r}(),Ne=function(t){u(r,THREE.Loader);var e=f(r);function r(t){var n;return i(this,r),(n=e.call(this,t)).dracoLoader=null,n.ktx2Loader=null,n.meshoptDecoder=null,n.pluginCallbacks=[],n.register((function(t){return new Fe(t)})),n.register((function(t){return new ze(t)})),n.register((function(t){return new Ye(t)})),n.register((function(t){return new Ue(t)})),n.register((function(t){return new He(t)})),n.register((function(t){return new je(t)})),n.register((function(t){return new qe(t)})),n.register((function(t){return new Oe(t)})),n.register((function(t){return new Ve(t)})),n.register((function(t){return new Ge(t)})),n.register((function(t){return new De(t)})),n.register((function(t){return new Xe(t)})),n.register((function(t){return new Je(t)})),n}return s(r,[{key:"load",value:function(t,e,r,n){var i,o=this;i=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:THREE.LoaderUtils.extractUrlBase(t),this.manager.itemStart(t);var s=function(e){n?n(e):console.error(e),o.manager.itemError(t),o.manager.itemEnd(t)},a=new THREE.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(r){try{o.parse(r,i,(function(r){e(r),o.manager.itemEnd(t)}),s)}catch(t){s(t)}}),r,s)}},{key:"setDRACOLoader",value:function(t){return this.dracoLoader=t,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(t){return this.ktx2Loader=t,this}},{key:"setMeshoptDecoder",value:function(t){return this.meshoptDecoder=t,this}},{key:"register",value:function(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}},{key:"unregister",value:function(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}},{key:"parse",value:function(t,e,r,n){var i,o={},s={};if("string"==typeof t)i=JSON.parse(t);else if(t instanceof ArrayBuffer){if(THREE.LoaderUtils.decodeText(new Uint8Array(t,0,4))===We){try{o[ke.KHR_BINARY_GLTF]=new $e(t)}catch(t){return void(n&&n(t))}i=JSON.parse(o[ke.KHR_BINARY_GLTF].content)}else i=JSON.parse(THREE.LoaderUtils.decodeText(new Uint8Array(t)))}else i=t;if(void 0===i.asset||i.asset.version[0]<2)n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var a=new xr(i,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});a.fileLoader.setRequestHeader(this.requestHeader);for(var u=0;u<this.pluginCallbacks.length;u++){var l=this.pluginCallbacks[u](a);s[l.name]=l,o[l.name]=!0}if(i.extensionsUsed)for(var h=0;h<i.extensionsUsed.length;++h){var c=i.extensionsUsed[h],f=i.extensionsRequired||[];switch(c){case ke.KHR_MATERIALS_UNLIT:o[c]=new Qe;break;case ke.KHR_DRACO_MESH_COMPRESSION:o[c]=new tr(i,this.dracoLoader);break;case ke.KHR_TEXTURE_TRANSFORM:o[c]=new er;break;case ke.KHR_MESH_QUANTIZATION:o[c]=new rr;break;default:f.indexOf(c)>=0&&void 0===s[c]&&console.warn('THREE.GLTFLoader: Unknown extension "'+c+'".')}}a.setExtensions(o),a.setPlugins(s),a.parse(r,n)}}},{key:"parseAsync",value:function(t,e){var r=this;return new Promise((function(n,i){r.parse(t,e,n,i)}))}}]),r}();function Pe(){var t={};return{get:function(e){return t[e]},add:function(e,r){t[e]=r},remove:function(e){delete t[e]},removeAll:function(){t={}}}}var ke={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},De=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return s(t,[{key:"_markDefs",value:function(){for(var t=this.parser,e=this.parser.json.nodes||[],r=0,n=e.length;r<n;r++){var i=e[r];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&t._addNodeRef(this.cache,i.extensions[this.name].light)}}},{key:"_loadLight",value:function(t){var e=this.parser,r="light:"+t,n=e.cache.get(r);if(n)return n;var i,o=e.json,s=((o.extensions&&o.extensions[this.name]||{}).lights||[])[t],a=new THREE.Color(16777215);void 0!==s.color&&a.fromArray(s.color);var u=void 0!==s.range?s.range:0;switch(s.type){case"directional":(i=new THREE.DirectionalLight(a)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new THREE.PointLight(a)).distance=u;break;case"spot":(i=new THREE.SpotLight(a)).distance=u,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,i.angle=s.spot.outerConeAngle,i.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return i.position.set(0,0,0),i.decay=2,vr(i,s),void 0!==s.intensity&&(i.intensity=s.intensity),i.name=e.createUniqueName(s.name||"light_"+t),n=Promise.resolve(i),e.cache.add(r,n),n}},{key:"getDependency",value:function(t,e){if("light"===t)return this._loadLight(e)}},{key:"createNodeAttachment",value:function(t){var e=this,r=this.parser,n=r.json.nodes[t],i=(n.extensions&&n.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then((function(t){return r._getNodeRef(e.cache,i,t)}))}}]),t}(),Qe=function(){function t(){i(this,t),this.name=ke.KHR_MATERIALS_UNLIT}return s(t,[{key:"getMaterialType",value:function(){return THREE.MeshBasicMaterial}},{key:"extendParams",value:function(t,e,r){var n=[];t.color=new THREE.Color(1,1,1),t.opacity=1;var i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){var o=i.baseColorFactor;t.color.fromArray(o),t.opacity=o[3]}void 0!==i.baseColorTexture&&n.push(r.assignTexture(t,"map",i.baseColorTexture,THREE.sRGBEncoding))}return Promise.all(n)}}]),t}(),Oe=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_EMISSIVE_STRENGTH}return s(t,[{key:"extendMaterialParams",value:function(t,e){var r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var n=r.extensions[this.name].emissiveStrength;return void 0!==n&&(e.emissiveIntensity=n),Promise.resolve()}}]),t}(),Fe=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_CLEARCOAT}return s(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?THREE.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];if(void 0!==o.clearcoatFactor&&(e.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&i.push(r.assignTexture(e,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(e.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&i.push(r.assignTexture(e,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(i.push(r.assignTexture(e,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var s=o.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new THREE.Vector2(s,s)}return Promise.all(i)}}]),t}(),Ge=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_IRIDESCENCE}return s(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?THREE.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];return void 0!==o.iridescenceFactor&&(e.iridescence=o.iridescenceFactor),void 0!==o.iridescenceTexture&&i.push(r.assignTexture(e,"iridescenceMap",o.iridescenceTexture)),void 0!==o.iridescenceIor&&(e.iridescenceIOR=o.iridescenceIor),void 0===e.iridescenceThicknessRange&&(e.iridescenceThicknessRange=[100,400]),void 0!==o.iridescenceThicknessMinimum&&(e.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),void 0!==o.iridescenceThicknessMaximum&&(e.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),void 0!==o.iridescenceThicknessTexture&&i.push(r.assignTexture(e,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(i)}}]),t}(),Ue=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_SHEEN}return s(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?THREE.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[];e.sheenColor=new THREE.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;var o=n.extensions[this.name];return void 0!==o.sheenColorFactor&&e.sheenColor.fromArray(o.sheenColorFactor),void 0!==o.sheenRoughnessFactor&&(e.sheenRoughness=o.sheenRoughnessFactor),void 0!==o.sheenColorTexture&&i.push(r.assignTexture(e,"sheenColorMap",o.sheenColorTexture,THREE.sRGBEncoding)),void 0!==o.sheenRoughnessTexture&&i.push(r.assignTexture(e,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(i)}}]),t}(),He=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_TRANSMISSION}return s(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?THREE.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];return void 0!==o.transmissionFactor&&(e.transmission=o.transmissionFactor),void 0!==o.transmissionTexture&&i.push(r.assignTexture(e,"transmissionMap",o.transmissionTexture)),Promise.all(i)}}]),t}(),je=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_VOLUME}return s(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?THREE.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];e.thickness=void 0!==o.thicknessFactor?o.thicknessFactor:0,void 0!==o.thicknessTexture&&i.push(r.assignTexture(e,"thicknessMap",o.thicknessTexture)),e.attenuationDistance=o.attenuationDistance||1/0;var s=o.attenuationColor||[1,1,1];return e.attenuationColor=new THREE.Color(s[0],s[1],s[2]),Promise.all(i)}}]),t}(),qe=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_IOR}return s(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?THREE.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var n=r.extensions[this.name];return e.ior=void 0!==n.ior?n.ior:1.5,Promise.resolve()}}]),t}(),Ve=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_SPECULAR}return s(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?THREE.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];e.specularIntensity=void 0!==o.specularFactor?o.specularFactor:1,void 0!==o.specularTexture&&i.push(r.assignTexture(e,"specularIntensityMap",o.specularTexture));var s=o.specularColorFactor||[1,1,1];return e.specularColor=new THREE.Color(s[0],s[1],s[2]),void 0!==o.specularColorTexture&&i.push(r.assignTexture(e,"specularColorMap",o.specularColorTexture,THREE.sRGBEncoding)),Promise.all(i)}}]),t}(),ze=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_TEXTURE_BASISU}return s(t,[{key:"loadTexture",value:function(t){var e=this.parser,r=e.json,n=r.textures[t];if(!n.extensions||!n.extensions[this.name])return null;var i=n.extensions[this.name],o=e.options.ktx2Loader;if(!o){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,i.source,o)}}]),t}(),Ye=function(){function t(e){i(this,t),this.parser=e,this.name=ke.EXT_TEXTURE_WEBP,this.isSupported=null}return s(t,[{key:"loadTexture",value:function(t){var e=this.name,r=this.parser,n=r.json,i=n.textures[t];if(!i.extensions||!i.extensions[e])return null;var o=i.extensions[e],s=n.images[o.source],a=r.textureLoader;if(s.uri){var u=r.options.manager.getHandler(s.uri);null!==u&&(a=u)}return this.detectSupport().then((function(i){if(i)return r.loadTextureImage(t,o.source,a);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(t)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(t){var e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}]),t}(),Xe=function(){function t(e){i(this,t),this.name=ke.EXT_MESHOPT_COMPRESSION,this.parser=e}return s(t,[{key:"loadBufferView",value:function(t){var e=this.parser.json,r=e.bufferViews[t];if(r.extensions&&r.extensions[this.name]){var n=r.extensions[this.name],i=this.parser.getDependency("buffer",n.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(t){var e=n.byteOffset||0,r=n.byteLength||0,i=n.count,s=n.byteStride,a=new Uint8Array(t,e,r);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(i,s,a,n.mode,n.filter).then((function(t){return t.buffer})):o.ready.then((function(){var t=new ArrayBuffer(i*s);return o.decodeGltfBuffer(new Uint8Array(t),i,s,a,n.mode,n.filter),t}))}))}return null}}]),t}(),Je=function(){function t(e){i(this,t),this.name=ke.EXT_MESH_GPU_INSTANCING,this.parser=e}return s(t,[{key:"createNodeMesh",value:function(t){var e=this,r=this.parser.json,n=r.nodes[t];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;var i,o=_(r.meshes[n.mesh].primitives);try{for(o.s();!(i=o.n()).done;){var s=i.value;if(s.mode!==sr.TRIANGLES&&s.mode!==sr.TRIANGLE_STRIP&&s.mode!==sr.TRIANGLE_FAN&&void 0!==s.mode)return null}}catch(t){o.e(t)}finally{o.f()}var a=n.extensions[this.name].attributes,u=[],l={},h=function(t){u.push(e.parser.getDependency("accessor",a[t]).then((function(e){return l[t]=e,l[t]})))};for(var c in a)h(c);return u.length<1?null:(u.push(this.parser.createNodeMesh(t)),Promise.all(u).then((function(t){var r,n=t.pop(),i=n.isGroup?n.children:[n],o=t[0].count,s=[],a=_(i);try{for(a.s();!(r=a.n()).done;){for(var u=r.value,h=new THREE.Matrix4,c=new THREE.Vector3,f=new THREE.Quaternion,p=new THREE.Vector3(1,1,1),g=new THREE.InstancedMesh(u.geometry,u.material,o),d=0;d<o;d++)l.TRANSLATION&&c.fromBufferAttribute(l.TRANSLATION,d),l.ROTATION&&f.fromBufferAttribute(l.ROTATION,d),l.SCALE&&p.fromBufferAttribute(l.SCALE,d),g.setMatrixAt(d,h.compose(c,f,p));for(var A in l)"TRANSLATION"!==A&&"ROTATION"!==A&&"SCALE"!==A&&u.geometry.setAttribute(A,l[A]);THREE.Object3D.prototype.copy.call(g,u),g.frustumCulled=!1,e.parser.assignFinalMaterial(g),s.push(g)}}catch(t){a.e(t)}finally{a.f()}return n.isGroup?(n.clear(),n.add.apply(n,s),n):s[0]})))}}]),t}(),We="glTF",Ke=1313821514,Ze=5130562,$e=s((function t(e){i(this,t),this.name=ke.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(e,0,12);if(this.header={magic:THREE.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==We)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var n=this.header.length-12,o=new DataView(e,12),s=0;s<n;){var a=o.getUint32(s,!0);s+=4;var u=o.getUint32(s,!0);if(s+=4,u===Ke){var l=new Uint8Array(e,12+s,a);this.content=THREE.LoaderUtils.decodeText(l)}else if(u===Ze){var h=12+s;this.body=e.slice(h,h+a)}s+=a}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),tr=function(){function t(e,r){if(i(this,t),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=ke.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=r,this.dracoLoader.preload()}return s(t,[{key:"decodePrimitive",value:function(t,e){var r=this.json,n=this.dracoLoader,i=t.extensions[this.name].bufferView,o=t.extensions[this.name].attributes,s={},a={},u={};for(var l in o){var h=cr[l]||l.toLowerCase();s[h]=o[l]}for(var c in t.attributes){var f=cr[c]||c.toLowerCase();if(void 0!==o[c]){var p=r.accessors[t.attributes[c]],g=ar[p.componentType];u[f]=g.name,a[f]=!0===p.normalized}}return e.getDependency("bufferView",i).then((function(t){return new Promise((function(e){n.decodeDracoFile(t,(function(t){for(var r in t.attributes){var n=t.attributes[r],i=a[r];void 0!==i&&(n.normalized=i)}e(t)}),s,u)}))}))}}]),t}(),er=function(){function t(){i(this,t),this.name=ke.KHR_TEXTURE_TRANSFORM}return s(t,[{key:"extendTexture",value:function(t,e){return void 0!==e.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===e.offset&&void 0===e.rotation&&void 0===e.scale||(t=t.clone(),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}]),t}(),rr=s((function t(){i(this,t),this.name=ke.KHR_MESH_QUANTIZATION})),nr=function(t){u(r,THREE.Interpolant);var e=f(r);function r(t,n,o,s){return i(this,r),e.call(this,t,n,o,s)}return s(r,[{key:"copySampleValue_",value:function(t){for(var e=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=t*n*3+n,o=0;o!==n;o++)e[o]=r[i+o];return e}},{key:"interpolate_",value:function(t,e,r,n){for(var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=2*s,u=3*s,l=n-e,h=(r-e)/l,c=h*h,f=c*h,p=t*u,g=p-u,d=-2*f+3*c,A=f-c,y=1-d,v=A-c+h,m=0;m!==s;m++){var E=o[g+m+s],_=o[g+m+a]*l,I=o[p+m+s],x=o[p+m]*l;i[m]=y*E+v*_+d*I+A*x}return i}}]),r}(),ir=new THREE.Quaternion,or=function(t){u(r,nr);var e=f(r);function r(){return i(this,r),e.apply(this,arguments)}return s(r,[{key:"interpolate_",value:function(t,e,n,i){var o=g(l(r.prototype),"interpolate_",this).call(this,t,e,n,i);return ir.fromArray(o).normalize().toArray(o),o}}]),r}(),sr={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},ar={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ur={9728:THREE.NearestFilter,9729:THREE.LinearFilter,9984:THREE.NearestMipmapNearestFilter,9985:THREE.LinearMipmapNearestFilter,9986:THREE.NearestMipmapLinearFilter,9987:THREE.LinearMipmapLinearFilter},lr={33071:THREE.ClampToEdgeWrapping,33648:THREE.MirroredRepeatWrapping,10497:THREE.RepeatWrapping},hr={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},cr={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},fr={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},pr={CUBICSPLINE:void 0,LINEAR:THREE.InterpolateLinear,STEP:THREE.InterpolateDiscrete},gr="OPAQUE",dr="MASK",Ar="BLEND";function yr(t,e,r){for(var n in r.extensions)void 0===t[n]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=r.extensions[n])}function vr(t,r){void 0!==r.extras&&("object"===e(r.extras)?Object.assign(t.userData,r.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+r.extras))}function mr(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(var r=0,n=e.weights.length;r<n;r++)t.morphTargetInfluences[r]=e.weights[r];if(e.extras&&Array.isArray(e.extras.targetNames)){var i=e.extras.targetNames;if(t.morphTargetInfluences.length===i.length){t.morphTargetDictionary={};for(var o=0,s=i.length;o<s;o++)t.morphTargetDictionary[i[o]]=o}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Er(t){for(var e="",r=Object.keys(t).sort(),n=0,i=r.length;n<i;n++)e+=r[n]+":"+t[r[n]]+";";return e}function _r(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var Ir=new THREE.Matrix4,xr=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i(this,t),this.json=e,this.extensions={},this.plugins={},this.options=r,this.cache=new Pe,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};var n=!1,o=!1,s=-1;"undefined"!=typeof navigator&&(n=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),s=(o=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||o&&s<98?this.textureLoader=new THREE.TextureLoader(this.options.manager):this.textureLoader=new THREE.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new THREE.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return s(t,[{key:"setExtensions",value:function(t){this.extensions=t}},{key:"setPlugins",value:function(t){this.plugins=t}},{key:"parse",value:function(t,e){var r=this,n=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(e){var o={scene:e[0][n.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:n.asset,parser:r,userData:{}};yr(i,o,n),vr(o,n),Promise.all(r._invokeAll((function(t){return t.afterRoot&&t.afterRoot(o)}))).then((function(){t(o)}))})).catch(e)}},{key:"_markDefs",value:function(){for(var t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[],n=0,i=e.length;n<i;n++)for(var o=e[n].joints,s=0,a=o.length;s<a;s++)t[o[s]].isBone=!0;for(var u=0,l=t.length;u<l;u++){var h=t[u];void 0!==h.mesh&&(this._addNodeRef(this.meshCache,h.mesh),void 0!==h.skin&&(r[h.mesh].isSkinnedMesh=!0)),void 0!==h.camera&&this._addNodeRef(this.cameraCache,h.camera)}}},{key:"_addNodeRef",value:function(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}},{key:"_getNodeRef",value:function(t,e,r){var n=this;if(t.refs[e]<=1)return r;var i=r.clone();return function t(e,r){var i=n.associations.get(e);null!=i&&n.associations.set(r,i);var o,s=_(e.children.entries());try{for(s.s();!(o=s.n()).done;){var a=y(o.value,2),u=a[0];t(a[1],r.children[u])}}catch(t){s.e(t)}finally{s.f()}}(r,i),i.name+="_instance_"+t.uses[e]++,i}},{key:"_invokeOne",value:function(t){var e=Object.values(this.plugins);e.push(this);for(var r=0;r<e.length;r++){var n=t(e[r]);if(n)return n}return null}},{key:"_invokeAll",value:function(t){var e=Object.values(this.plugins);e.unshift(this);for(var r=[],n=0;n<e.length;n++){var i=t(e[n]);i&&r.push(i)}return r}},{key:"getDependency",value:function(t,e){var r=t+":"+e,n=this.cache.get(r);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne((function(t){return t.loadNode&&t.loadNode(e)}));break;case"mesh":n=this._invokeOne((function(t){return t.loadMesh&&t.loadMesh(e)}));break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne((function(t){return t.loadBufferView&&t.loadBufferView(e)}));break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne((function(t){return t.loadMaterial&&t.loadMaterial(e)}));break;case"texture":n=this._invokeOne((function(t){return t.loadTexture&&t.loadTexture(e)}));break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne((function(t){return t.loadAnimation&&t.loadAnimation(e)}));break;case"camera":n=this.loadCamera(e);break;default:if(!(n=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(t,e)}))))throw new Error("Unknown type: "+t)}this.cache.add(r,n)}return n}},{key:"getDependencies",value:function(t){var e=this.cache.get(t);if(!e){var r=this,n=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(n.map((function(e,n){return r.getDependency(t,n)}))),this.cache.add(t,e)}return e}},{key:"loadBuffer",value:function(t){var e=this.json.buffers[t],r=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[ke.KHR_BINARY_GLTF].body);var n=this.options;return new Promise((function(t,i){r.load(THREE.LoaderUtils.resolveURL(e.uri,n.path),t,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))}))}))}},{key:"loadBufferView",value:function(t){var e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){var r=e.byteLength||0,n=e.byteOffset||0;return t.slice(n,n+r)}))}},{key:"loadAccessor",value:function(t){var e=this,r=this.json,n=this.json.accessors[t];if(void 0===n.bufferView&&void 0===n.sparse){var i=hr[n.type],o=ar[n.componentType],s=!0===n.normalized,a=new o(n.count*i);return Promise.resolve(new THREE.BufferAttribute(a,i,s))}var u=[];return void 0!==n.bufferView?u.push(this.getDependency("bufferView",n.bufferView)):u.push(null),void 0!==n.sparse&&(u.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),u.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(u).then((function(t){var i,o,s=t[0],a=hr[n.type],u=ar[n.componentType],l=u.BYTES_PER_ELEMENT,h=l*a,c=n.byteOffset||0,f=void 0!==n.bufferView?r.bufferViews[n.bufferView].byteStride:void 0,p=!0===n.normalized;if(f&&f!==h){var g=Math.floor(c/f),d="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+g+":"+n.count,A=e.cache.get(d);A||(i=new u(s,g*f,n.count*f/l),A=new THREE.InterleavedBuffer(i,f/l),e.cache.add(d,A)),o=new THREE.InterleavedBufferAttribute(A,a,c%f/l,p)}else i=null===s?new u(n.count*a):new u(s,c,n.count*a),o=new THREE.BufferAttribute(i,a,p);if(void 0!==n.sparse){var y=hr.SCALAR,v=ar[n.sparse.indices.componentType],m=n.sparse.indices.byteOffset||0,E=n.sparse.values.byteOffset||0,_=new v(t[1],m,n.sparse.count*y),I=new u(t[2],E,n.sparse.count*a);null!==s&&(o=new THREE.BufferAttribute(o.array.slice(),o.itemSize,o.normalized));for(var x=0,C=_.length;x<C;x++){var w=_[x];if(o.setX(w,I[x*a]),a>=2&&o.setY(w,I[x*a+1]),a>=3&&o.setZ(w,I[x*a+2]),a>=4&&o.setW(w,I[x*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o}))}},{key:"loadTexture",value:function(t){var e=this.json,r=this.options,n=e.textures[t].source,i=e.images[n],o=this.textureLoader;if(i.uri){var s=r.manager.getHandler(i.uri);null!==s&&(o=s)}return this.loadTextureImage(t,n,o)}},{key:"loadTextureImage",value:function(t,e,r){var n=this,i=this.json,o=i.textures[t],s=i.images[e],a=(s.uri||s.bufferView)+":"+o.sampler;if(this.textureCache[a])return this.textureCache[a];var u=this.loadImageSource(e,r).then((function(e){e.flipY=!1,e.name=o.name||s.name||"";var r=(i.samplers||{})[o.sampler]||{};return e.magFilter=ur[r.magFilter]||THREE.LinearFilter,e.minFilter=ur[r.minFilter]||THREE.LinearMipmapLinearFilter,e.wrapS=lr[r.wrapS]||THREE.RepeatWrapping,e.wrapT=lr[r.wrapT]||THREE.RepeatWrapping,n.associations.set(e,{textures:t}),e})).catch((function(){return null}));return this.textureCache[a]=u,u}},{key:"loadImageSource",value:function(t,e){var r=this.json,n=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then((function(t){return t.clone()}));var i=r.images[t],o=self.URL||self.webkitURL,s=i.uri||"",a=!1;if(void 0!==i.bufferView)s=this.getDependency("bufferView",i.bufferView).then((function(t){a=!0;var e=new Blob([t],{type:i.mimeType});return s=o.createObjectURL(e)}));else if(void 0===i.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");var u=Promise.resolve(s).then((function(t){return new Promise((function(r,i){var o=r;!0===e.isImageBitmapLoader&&(o=function(t){var e=new THREE.Texture(t);e.needsUpdate=!0,r(e)}),e.load(THREE.LoaderUtils.resolveURL(t,n.path),o,void 0,i)}))})).then((function(t){var e;return!0===a&&o.revokeObjectURL(s),t.userData.mimeType=i.mimeType||((e=i.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(t){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),t}));return this.sourceCache[t]=u,u}},{key:"assignTexture",value:function(t,e,r,n){var i=this;return this.getDependency("texture",r.index).then((function(o){if(!o)return null;if(void 0===r.texCoord||0==r.texCoord||"aoMap"===e&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+e+" not yet supported."),i.extensions[ke.KHR_TEXTURE_TRANSFORM]){var s=void 0!==r.extensions?r.extensions[ke.KHR_TEXTURE_TRANSFORM]:void 0;if(s){var a=i.associations.get(o);o=i.extensions[ke.KHR_TEXTURE_TRANSFORM].extendTexture(o,s),i.associations.set(o,a)}}return void 0!==n&&(o.encoding=n),t[e]=o,o}))}},{key:"assignFinalMaterial",value:function(t){var e=t.geometry,r=t.material,n=void 0===e.attributes.tangent,i=void 0!==e.attributes.color,o=void 0===e.attributes.normal;if(t.isPoints){var s="PointsMaterial:"+r.uuid,a=this.cache.get(s);a||(a=new THREE.PointsMaterial,THREE.Material.prototype.copy.call(a,r),a.color.copy(r.color),a.map=r.map,a.sizeAttenuation=!1,this.cache.add(s,a)),r=a}else if(t.isLine){var u="LineBasicMaterial:"+r.uuid,l=this.cache.get(u);l||(l=new THREE.LineBasicMaterial,THREE.Material.prototype.copy.call(l,r),l.color.copy(r.color),this.cache.add(u,l)),r=l}if(n||i||o){var h="ClonedMaterial:"+r.uuid+":";n&&(h+="derivative-tangents:"),i&&(h+="vertex-colors:"),o&&(h+="flat-shading:");var c=this.cache.get(h);c||(c=r.clone(),i&&(c.vertexColors=!0),o&&(c.flatShading=!0),n&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(h,c),this.associations.set(c,this.associations.get(r))),r=c}r.aoMap&&void 0===e.attributes.uv2&&void 0!==e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv),t.material=r}},{key:"getMaterialType",value:function(){return THREE.MeshStandardMaterial}},{key:"loadMaterial",value:function(t){var e,r=this,n=this.json,i=this.extensions,o=n.materials[t],s={},a=[];if((o.extensions||{})[ke.KHR_MATERIALS_UNLIT]){var u=i[ke.KHR_MATERIALS_UNLIT];e=u.getMaterialType(),a.push(u.extendParams(s,o,r))}else{var l=o.pbrMetallicRoughness||{};if(s.color=new THREE.Color(1,1,1),s.opacity=1,Array.isArray(l.baseColorFactor)){var h=l.baseColorFactor;s.color.fromArray(h),s.opacity=h[3]}void 0!==l.baseColorTexture&&a.push(r.assignTexture(s,"map",l.baseColorTexture,THREE.sRGBEncoding)),s.metalness=void 0!==l.metallicFactor?l.metallicFactor:1,s.roughness=void 0!==l.roughnessFactor?l.roughnessFactor:1,void 0!==l.metallicRoughnessTexture&&(a.push(r.assignTexture(s,"metalnessMap",l.metallicRoughnessTexture)),a.push(r.assignTexture(s,"roughnessMap",l.metallicRoughnessTexture))),e=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),a.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,s)}))))}!0===o.doubleSided&&(s.side=THREE.DoubleSide);var c=o.alphaMode||gr;if(c===Ar?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,c===dr&&(s.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&e!==THREE.MeshBasicMaterial&&(a.push(r.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new THREE.Vector2(1,1),void 0!==o.normalTexture.scale)){var f=o.normalTexture.scale;s.normalScale.set(f,f)}return void 0!==o.occlusionTexture&&e!==THREE.MeshBasicMaterial&&(a.push(r.assignTexture(s,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(s.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&e!==THREE.MeshBasicMaterial&&(s.emissive=(new THREE.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&e!==THREE.MeshBasicMaterial&&a.push(r.assignTexture(s,"emissiveMap",o.emissiveTexture,THREE.sRGBEncoding)),Promise.all(a).then((function(){var n=new e(s);return o.name&&(n.name=o.name),vr(n,o),r.associations.set(n,{materials:t}),o.extensions&&yr(i,n,o),n}))}},{key:"createUniqueName",value:function(t){for(var e=THREE.PropertyBinding.sanitizeNodeName(t||""),r=e,n=1;this.nodeNamesUsed[r];++n)r=e+"_"+n;return this.nodeNamesUsed[r]=!0,r}},{key:"loadGeometries",value:function(t){var e=this,r=this.extensions,n=this.primitiveCache;function i(t){return r[ke.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(r){return Cr(r,t,e)}))}for(var o,s,a=[],u=0,l=t.length;u<l;u++){var h=t[u],c=(s=void 0,(s=(o=h).extensions&&o.extensions[ke.KHR_DRACO_MESH_COMPRESSION])?"draco:"+s.bufferView+":"+s.indices+":"+Er(s.attributes):o.indices+":"+Er(o.attributes)+":"+o.mode),f=n[c];if(f)a.push(f.promise);else{var p=void 0;p=h.extensions&&h.extensions[ke.KHR_DRACO_MESH_COMPRESSION]?i(h):Cr(new THREE.BufferGeometry,h,e),n[c]={primitive:h,promise:p},a.push(p)}}return Promise.all(a)}},{key:"loadMesh",value:function(t){for(var e,r=this,n=this.json,i=this.extensions,o=n.meshes[t],s=o.primitives,a=[],u=0,l=s.length;u<l;u++){var h=void 0===s[u].material?(void 0===(e=this.cache).DefaultMaterial&&(e.DefaultMaterial=new THREE.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:THREE.FrontSide})),e.DefaultMaterial):this.getDependency("material",s[u].material);a.push(h)}return a.push(r.loadGeometries(s)),Promise.all(a).then((function(e){for(var n=e.slice(0,e.length-1),a=e[e.length-1],u=[],l=0,h=a.length;l<h;l++){var c=a[l],f=s[l],p=void 0,g=n[l];if(f.mode===sr.TRIANGLES||f.mode===sr.TRIANGLE_STRIP||f.mode===sr.TRIANGLE_FAN||void 0===f.mode)!0!==(p=!0===o.isSkinnedMesh?new THREE.SkinnedMesh(c,g):new THREE.Mesh(c,g)).isSkinnedMesh||p.geometry.attributes.skinWeight.normalized||p.normalizeSkinWeights(),f.mode===sr.TRIANGLE_STRIP?p.geometry=wr(p.geometry,THREE.TriangleStripDrawMode):f.mode===sr.TRIANGLE_FAN&&(p.geometry=wr(p.geometry,THREE.TriangleFanDrawMode));else if(f.mode===sr.LINES)p=new THREE.LineSegments(c,g);else if(f.mode===sr.LINE_STRIP)p=new THREE.Line(c,g);else if(f.mode===sr.LINE_LOOP)p=new THREE.LineLoop(c,g);else{if(f.mode!==sr.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);p=new THREE.Points(c,g)}Object.keys(p.geometry.morphAttributes).length>0&&mr(p,o),p.name=r.createUniqueName(o.name||"mesh_"+t),vr(p,o),f.extensions&&yr(i,p,f),r.assignFinalMaterial(p),u.push(p)}for(var d=0,A=u.length;d<A;d++)r.associations.set(u[d],{meshes:t,primitives:d});if(1===u.length)return u[0];var y=new THREE.Group;r.associations.set(y,{meshes:t});for(var v=0,m=u.length;v<m;v++)y.add(u[v]);return y}))}},{key:"loadCamera",value:function(t){var e,r=this.json.cameras[t],n=r[r.type];if(n)return"perspective"===r.type?e=new THREE.PerspectiveCamera(THREE.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===r.type&&(e=new THREE.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(e.name=this.createUniqueName(r.name)),vr(e,r),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(t){for(var e=this.json.skins[t],r=[],n=0,i=e.joints.length;n<i;n++)r.push(this.getDependency("node",e.joints[n]));return void 0!==e.inverseBindMatrices?r.push(this.getDependency("accessor",e.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(t){for(var r=t.pop(),n=t,i=[],o=[],s=0,a=n.length;s<a;s++){var u=n[s];if(u){i.push(u);var l=new THREE.Matrix4;null!==r&&l.fromArray(r.array,16*s),o.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[s])}return new THREE.Skeleton(i,o)}))}},{key:"loadAnimation",value:function(t){for(var e=this.json.animations[t],r=[],n=[],i=[],o=[],s=[],a=0,u=e.channels.length;a<u;a++){var l=e.channels[a],h=e.samplers[l.sampler],c=l.target,f=c.node,p=void 0!==e.parameters?e.parameters[h.input]:h.input,g=void 0!==e.parameters?e.parameters[h.output]:h.output;r.push(this.getDependency("node",f)),n.push(this.getDependency("accessor",p)),i.push(this.getDependency("accessor",g)),o.push(h),s.push(c)}return Promise.all([Promise.all(r),Promise.all(n),Promise.all(i),Promise.all(o),Promise.all(s)]).then((function(r){for(var n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],u=[],l=function(){var t,e=n[h],r=i[h],l=o[h],c=s[h],f=a[h];if(void 0===e)return 1;switch(e.updateMatrix(),fr[f.path]){case fr.weights:t=THREE.NumberKeyframeTrack;break;case fr.rotation:t=THREE.QuaternionKeyframeTrack;break;default:t=THREE.VectorKeyframeTrack}var p=e.name?e.name:e.uuid,g=void 0!==c.interpolation?pr[c.interpolation]:THREE.InterpolateLinear,d=[];fr[f.path]===fr.weights?e.traverse((function(t){t.morphTargetInfluences&&d.push(t.name?t.name:t.uuid)})):d.push(p);var A=l.array;if(l.normalized){for(var y=_r(A.constructor),v=new Float32Array(A.length),m=0,E=A.length;m<E;m++)v[m]=A[m]*y;A=v}for(var _=0,I=d.length;_<I;_++){var x=new t(d[_]+"."+fr[f.path],r.array,A,g);"CUBICSPLINE"===c.interpolation&&(x.createInterpolant=function(t){return new(this instanceof THREE.QuaternionKeyframeTrack?or:nr)(this.times,this.values,this.getValueSize()/3,t)},x.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(x)}},h=0,c=n.length;h<c;h++)l();var f=e.name?e.name:"animation_"+t;return new THREE.AnimationClip(f,void 0,u)}))}},{key:"createNodeMesh",value:function(t){var e=this.json,r=this,n=e.nodes[t];return void 0===n.mesh?null:r.getDependency("mesh",n.mesh).then((function(t){var e=r._getNodeRef(r.meshCache,n.mesh,t);return void 0!==n.weights&&e.traverse((function(t){if(t.isMesh)for(var e=0,r=n.weights.length;e<r;e++)t.morphTargetInfluences[e]=n.weights[e]})),e}))}},{key:"loadNode",value:function(t){var e=this.json,r=this.extensions,n=this,i=e.nodes[t],o=i.name?n.createUniqueName(i.name):"";return function(){var e=[],r=n._invokeOne((function(e){return e.createNodeMesh&&e.createNodeMesh(t)}));r&&e.push(r),void 0!==i.camera&&e.push(n.getDependency("camera",i.camera).then((function(t){return n._getNodeRef(n.cameraCache,i.camera,t)}))),n._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){e.push(t)}));for(var o=[],s=i.children||[],a=0,u=s.length;a<u;a++)o.push(n.getDependency("node",s[a]));var l=void 0===i.skin?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([Promise.all(e),Promise.all(o),l])}().then((function(e){var s,a=e[0],u=e[1],l=e[2];if((s=!0===i.isBone?new THREE.Bone:a.length>1?new THREE.Group:1===a.length?a[0]:new THREE.Object3D)!==a[0])for(var h=0,c=a.length;h<c;h++)s.add(a[h]);if(i.name&&(s.userData.name=i.name,s.name=o),vr(s,i),i.extensions&&yr(r,s,i),void 0!==i.matrix){var f=new THREE.Matrix4;f.fromArray(i.matrix),s.applyMatrix4(f)}else void 0!==i.translation&&s.position.fromArray(i.translation),void 0!==i.rotation&&s.quaternion.fromArray(i.rotation),void 0!==i.scale&&s.scale.fromArray(i.scale);n.associations.has(s)||n.associations.set(s,{}),n.associations.get(s).nodes=t,null!==l&&s.traverse((function(t){t.isSkinnedMesh&&t.bind(l,Ir)}));for(var p=0,g=u.length;p<g;p++)s.add(u[p]);return s}))}},{key:"loadScene",value:function(t){var e=this.extensions,r=this.json.scenes[t],n=this,i=new THREE.Group;r.name&&(i.name=n.createUniqueName(r.name)),vr(i,r),r.extensions&&yr(e,i,r);for(var o=r.nodes||[],s=[],a=0,u=o.length;a<u;a++)s.push(n.getDependency("node",o[a]));return Promise.all(s).then((function(t){for(var e=0,r=t.length;e<r;e++)i.add(t[e]);return n.associations=function(t){var e,r=new Map,i=_(n.associations);try{for(i.s();!(e=i.n()).done;){var o=y(e.value,2),s=o[0],a=o[1];(s instanceof THREE.Material||s instanceof THREE.Texture)&&r.set(s,a)}}catch(t){i.e(t)}finally{i.f()}return t.traverse((function(t){var e=n.associations.get(t);null!=e&&r.set(t,e)})),r}(i),i}))}}]),t}();function Cr(t,e,r){var n=e.attributes,i=[];function o(e,n){return r.getDependency("accessor",e).then((function(e){t.setAttribute(n,e)}))}for(var s in n){var a=cr[s]||s.toLowerCase();a in t.attributes||i.push(o(n[s],a))}if(void 0!==e.indices&&!t.index){var u=r.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));i.push(u)}return vr(t,e),function(t,e,r){var n=e.attributes,i=new THREE.Box3;if(void 0!==n.POSITION){var o=r.json.accessors[n.POSITION],s=o.min,a=o.max;if(void 0!==s&&void 0!==a){if(i.set(new THREE.Vector3(s[0],s[1],s[2]),new THREE.Vector3(a[0],a[1],a[2])),o.normalized){var u=_r(ar[o.componentType]);i.min.multiplyScalar(u),i.max.multiplyScalar(u)}var l=e.targets;if(void 0!==l){for(var h=new THREE.Vector3,c=new THREE.Vector3,f=0,p=l.length;f<p;f++){var g=l[f];if(void 0!==g.POSITION){var d=r.json.accessors[g.POSITION],A=d.min,y=d.max;if(void 0!==A&&void 0!==y){if(c.setX(Math.max(Math.abs(A[0]),Math.abs(y[0]))),c.setY(Math.max(Math.abs(A[1]),Math.abs(y[1]))),c.setZ(Math.max(Math.abs(A[2]),Math.abs(y[2]))),d.normalized){var v=_r(ar[d.componentType]);c.multiplyScalar(v)}h.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(h)}t.boundingBox=i;var m=new THREE.Sphere;i.getCenter(m.center),m.radius=i.min.distanceTo(i.max)/2,t.boundingSphere=m}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,e,r),Promise.all(i).then((function(){return void 0!==e.targets?function(t,e,r){for(var n=!1,i=!1,o=!1,s=0,a=e.length;s<a;s++){var u=e[s];if(void 0!==u.POSITION&&(n=!0),void 0!==u.NORMAL&&(i=!0),void 0!==u.COLOR_0&&(o=!0),n&&i&&o)break}if(!n&&!i&&!o)return Promise.resolve(t);for(var l=[],h=[],c=[],f=0,p=e.length;f<p;f++){var g=e[f];if(n){var d=void 0!==g.POSITION?r.getDependency("accessor",g.POSITION):t.attributes.position;l.push(d)}if(i){var A=void 0!==g.NORMAL?r.getDependency("accessor",g.NORMAL):t.attributes.normal;h.push(A)}if(o){var y=void 0!==g.COLOR_0?r.getDependency("accessor",g.COLOR_0):t.attributes.color;c.push(y)}}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(c)]).then((function(e){var r=e[0],s=e[1],a=e[2];return n&&(t.morphAttributes.position=r),i&&(t.morphAttributes.normal=s),o&&(t.morphAttributes.color=a),t.morphTargetsRelative=!0,t}))}(t,e.targets,r):t}))}function wr(t,e){var r=t.getIndex();if(null===r){var n=[],i=t.getAttribute("position");if(void 0===i)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var o=0;o<i.count;o++)n.push(o);t.setIndex(n),r=t.getIndex()}var s=r.count-2,a=[];if(e===THREE.TriangleFanDrawMode)for(var u=1;u<=s;u++)a.push(r.getX(0)),a.push(r.getX(u)),a.push(r.getX(u+1));else for(var l=0;l<s;l++)l%2==0?(a.push(r.getX(l)),a.push(r.getX(l+1)),a.push(r.getX(l+2))):(a.push(r.getX(l+2)),a.push(r.getX(l+1)),a.push(r.getX(l)));a.length/3!==s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var h=t.clone();return h.setIndex(a),h}var br=function(t){u(r,Le);var e=f(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:THREE.DefaultLoadingManager;return i(this,r),(t=e.call(this)).manager=n,t.adjustmentTransform=new THREE.Matrix4,t}return s(r,[{key:"parse",value:function(t){var e=this,n=g(l(r.prototype),"parse",this).call(this,t),i=n.glbBytes.slice().buffer;return new Promise((function(t,r){var o=e.manager,s=e.fetchOptions,a=o.getHandler("path.gltf")||new Ne(o);"include"===s.credentials&&"cors"===s.mode&&a.setCrossOrigin("use-credentials"),"credentials"in s&&a.setWithCredentials("include"===s.credentials),s.headers&&a.setRequestHeader(s.headers);var u=e.workingPath;!/[\\/]$/.test(u)&&u.length&&(u+="/");var l=e.adjustmentTransform;a.parse(i,u,(function(e){var r=n.batchTable,i=n.featureTable,o=e.scene,s=i.getData("RTC_CENTER");s&&(o.position.x+=s[0],o.position.y+=s[1],o.position.z+=s[2]),e.scene.updateMatrix(),e.scene.matrix.multiply(l),e.scene.matrix.decompose(e.scene.position,e.scene.quaternion,e.scene.scale),e.batchTable=r,e.featureTable=i,o.batchTable=r,o.featureTable=i,t(e)}),r)}))}}]),r}(),Br=function(t){u(r,Me);var e=f(r);function r(){return i(this,r),e.apply(this,arguments)}return s(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Re(e);console.assert("pnts"===r);var n=e.getUint32(4,!0);console.assert(1===n);var i=e.getUint32(8,!0);console.assert(i===t.byteLength);var o=e.getUint32(12,!0),s=e.getUint32(16,!0),a=e.getUint32(20,!0),u=e.getUint32(24,!0),l=t.slice(28,28+o+s),h=new Se(l,0,o,s),c=28+o+s,f=t.slice(c,c+a+u),p=new Te(f,h.getData("BATCH_LENGTH")||h.getData("POINTS_LENGTH"),0,a,u);return Promise.resolve({version:n,featureTable:h,batchTable:p})}}]),r}(),Sr={RGB:"color",POSITION:"position"},Tr=function(e){u(o,Br);var r=f(o);function o(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:THREE.DefaultLoadingManager;return i(this,o),(t=r.call(this)).manager=e,t}return s(o,[{key:"parse",value:function(e){var r=this;return g(l(o.prototype),"parse",this).call(this,e).then(function(){var e=n(t().mark((function e(n){var i,o,s,a,u,l,h,c,f,p,g,d,A,y,v,m,E,_,I,x,C,w,b,B,S,T;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=n.featureTable,o=new THREE.PointsMaterial,s=i.header.extensions,a=new THREE.Vector3,!s||!s["3DTILES_draco_point_compression"]){t.next=19;break}if(l=s["3DTILES_draco_point_compression"],h=l.byteOffset,c=l.byteLength,f=l.properties,null!=(p=r.manager.getHandler("draco.drc"))){t.next=9;break}throw new Error("PNTSLoader: dracoLoader not available.");case 9:for(d in g={},f)d in Sr&&d in f&&(g[Sr[d]]=f[d]);return A={attributeIDs:g,attributeTypes:{position:"Float32Array",color:"Uint8Array"},useUniqueIDs:!0},y=i.getBuffer(h,c),t.next=15,p.decodeGeometry(y,A);case 15:(u=t.sent).attributes.color&&(o.vertexColors=!0),t.next=28;break;case 19:if(v=i.getData("POINTS_LENGTH"),m=i.getData("POSITION",v,"FLOAT","VEC3"),E=i.getData("RGB",v,"UNSIGNED_BYTE","VEC3"),_=i.getData("POSITION_QUANTIZED",v,"UNSIGNED_SHORT","VEC3"),I=i.getData("QUANTIZED_VOLUME_SCALE",v,"FLOAT","VEC3"),x=i.getData("QUANTIZED_VOLUME_OFFSET",v,"FLOAT","VEC3"),u=new THREE.BufferGeometry,_){for(C=new Float32Array(3*v),w=0;w<v;w++)for(b=0;b<3;b++)C[B=3*w+b]=_[B]/65535*I[b];a.x=x[0],a.y=x[1],a.z=x[2],u.setAttribute("position",new THREE.BufferAttribute(C,3,!1))}else u.setAttribute("position",new THREE.BufferAttribute(m,3,!1));null!==E&&(u.setAttribute("color",new THREE.BufferAttribute(E,3,!0)),o.vertexColors=!0);case 28:return["CONSTANT_RGBA","BATCH_LENGTH","RGBA","RGB565","NORMAL","NORMAL_OCT16P"].forEach((function(t){t in i.header&&console.warn('PNTSLoader: Unsupported FeatureTable feature "'.concat(t,'" detected.'))})),(S=new THREE.Points(u,o)).position.copy(a),n.scene=S,n.scene.featureTable=i,(T=i.getData("RTC_CENTER"))&&(n.scene.position.x+=T[0],n.scene.position.y+=T[1],n.scene.position.z+=T[2]),t.abrupt("return",n);case 36:case"end":return t.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}}]),o}(),Mr=function(t){u(r,Me);var e=f(r);function r(){return i(this,r),e.apply(this,arguments)}return s(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Re(e);console.assert("i3dm"===r);var n=e.getUint32(4,!0);console.assert(1===n);var i=e.getUint32(8,!0);console.assert(i===t.byteLength);var o=e.getUint32(12,!0),s=e.getUint32(16,!0),a=e.getUint32(20,!0),u=e.getUint32(24,!0),l=e.getUint32(28,!0),h=t.slice(32,32+o+s),c=new Se(h,0,o,s),f=32+o+s,p=t.slice(f,f+a+u),g=new Te(p,c.getData("INSTANCES_LENGTH"),0,a,u),d=f+a+u,A=new Uint8Array(t,d,i-d),y=null,v=null;if(l)y=A,v=Promise.resolve();else{var m=this.resolveExternalURL(Be(A));v=fetch(m,this.fetchOptions).then((function(t){if(!t.ok)throw new Error('I3DMLoaderBase : Failed to load file "'.concat(m,'" with status ').concat(t.status," : ").concat(t.statusText));return t.arrayBuffer()})).then((function(t){y=new Uint8Array(t)}))}return v.then((function(){return{version:n,featureTable:c,batchTable:g,glbBytes:y}}))}}]),r}(),Rr=new THREE.Vector3,Lr=new THREE.Vector3,Nr=new THREE.Vector3,Pr=new THREE.Vector3,kr=new THREE.Quaternion,Dr=new THREE.Vector3,Qr=new THREE.Matrix4,Or=function(t){u(r,Mr);var e=f(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:THREE.DefaultLoadingManager;return i(this,r),(t=e.call(this)).manager=n,t.adjustmentTransform=new THREE.Matrix4,t}return s(r,[{key:"resolveExternalURL",value:function(t){return this.manager.resolveURL(g(l(r.prototype),"resolveExternalURL",this).call(this,t))}},{key:"parse",value:function(t){var e=this;return g(l(r.prototype),"parse",this).call(this,t).then((function(t){var r=t.featureTable,n=t.batchTable,i=t.glbBytes.slice().buffer;return new Promise((function(t,o){var s=e.fetchOptions,a=e.manager,u=a.getHandler("path.gltf")||new Ne(a);"include"===s.credentials&&"cors"===s.mode&&u.setCrossOrigin("use-credentials"),"credentials"in s&&u.setWithCredentials("include"===s.credentials),s.headers&&u.setRequestHeader(s.headers);var l=e.workingPath;/[\\/]$/.test(l)||(l+="/");var h=e.adjustmentTransform;u.parse(i,l,(function(e){var i=r.getData("INSTANCES_LENGTH"),o=r.getData("POSITION",i,"FLOAT","VEC3"),s=r.getData("NORMAL_UP",i,"FLOAT","VEC3"),a=r.getData("NORMAL_RIGHT",i,"FLOAT","VEC3"),u=r.getData("SCALE_NON_UNIFORM",i,"FLOAT","VEC3"),l=r.getData("SCALE",i,"FLOAT","SCALAR");["RTC_CENTER","QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","EAST_NORTH_UP","POSITION_QUANTIZED","NORMAL_UP_OCT32P","NORMAL_RIGHT_OCT32P"].forEach((function(t){t in r.header&&console.warn('I3DMLoader: Unsupported FeatureTable feature "'.concat(t,'" detected.'))}));var c=new Map,f=[];e.scene.traverse((function(t){if(t.isMesh){var e=t.geometry,r=t.material,n=new THREE.InstancedMesh(e,r,i);n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),f.push(n),c.set(t,n)}}));for(var p=new THREE.Vector3,g=0;g<i;g++)p.x+=o[3*g+0]/i,p.y+=o[3*g+1]/i,p.z+=o[3*g+2]/i;c.forEach((function(t,e){var r=e.parent;r&&(r.remove(e),r.add(t),t.updateMatrixWorld(),t.position.copy(p).applyMatrix4(t.matrixWorld))}));for(var d=0;d<i;d++){Pr.set(o[3*d+0]-p.x,o[3*d+1]-p.y,o[3*d+2]-p.z),s?(Lr.set(s[3*d+0],s[3*d+1],s[3*d+2]),Nr.set(a[3*d+0],a[3*d+1],a[3*d+2]),Rr.crossVectors(Nr,Lr).normalize(),Qr.makeBasis(Nr,Lr,Rr),kr.setFromRotationMatrix(Qr)):kr.set(0,0,0,1),l?Dr.setScalar(l[d]):u?Dr.set(u[3*d+0],u[3*d+1],u[3*d+2]):Dr.set(1,1,1),Qr.compose(Pr,kr,Dr).multiply(h);for(var A=0,y=f.length;A<y;A++){f[A].setMatrixAt(d,Qr)}}e.batchTable=n,e.featureTable=r,e.scene.batchTable=n,e.scene.featureTable=r,t(e)}),o)}))}))}}]),r}(),Fr=function(t){u(r,Me);var e=f(r);function r(){return i(this,r),e.apply(this,arguments)}return s(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Re(e);console.assert("cmpt"===r,'CMPTLoader: The magic bytes equal "cmpt".');var n=e.getUint32(4,!0);console.assert(1===n,'CMPTLoader: The version listed in the header is "1".');var i=e.getUint32(8,!0);console.assert(i===t.byteLength,"CMPTLoader: The contents buffer length listed in the header matches the file.");for(var o=e.getUint32(12,!0),s=[],a=16,u=0;u<o;u++){var l=new DataView(t,a,12),h=Re(l),c=l.getUint32(4,!0),f=l.getUint32(8,!0),p=new Uint8Array(t,a,f);s.push({type:h,buffer:p,version:c}),a+=f}return{version:n,tiles:s}}}]),r}(),Gr=function(t){u(r,Fr);var e=f(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:THREE.DefaultLoadingManager;return i(this,r),(t=e.call(this)).manager=n,t.adjustmentTransform=new THREE.Matrix4,t}return s(r,[{key:"parse",value:function(t){var e=g(l(r.prototype),"parse",this).call(this,t),n=this.manager,i=this.adjustmentTransform,o=[];for(var s in e.tiles){var a=e.tiles[s],u=a.type,h=a.buffer;switch(u){case"b3dm":var c=h.slice(),f=new br(n);f.workingPath=this.workingPath,f.fetchOptions=this.fetchOptions,f.adjustmentTransform.copy(i);var p=f.parse(c.buffer);o.push(p);break;case"pnts":var d=h.slice(),A=new Tr(n);A.workingPath=this.workingPath,A.fetchOptions=this.fetchOptions;var y=A.parse(d.buffer);o.push(y);break;case"i3dm":var v=h.slice(),m=new Or(n);m.workingPath=this.workingPath,m.fetchOptions=this.fetchOptions,m.adjustmentTransform.copy(i);var E=m.parse(v.buffer);o.push(E)}}return Promise.all(o).then((function(t){var e=new THREE.Group;return t.forEach((function(t){e.add(t.scene)})),{tiles:t,scene:e}}))}}]),r}(),Ur=function(){function t(){i(this,t),this.name="CESIUM_RTC"}return s(t,[{key:"afterRoot",value:function(t){if(t.parser.json.extensions&&t.parser.json.extensions.CESIUM_RTC){var e=t.parser.json.extensions.CESIUM_RTC.center;e&&(t.scene.position.x+=e[0],t.scene.position.y+=e[1],t.scene.position.z+=e[2])}}}]),t}(),Hr=function(t){u(r,Me);var e=f(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:THREE.DefaultLoadingManager;return i(this,r),(t=e.call(this)).manager=n,t}return s(r,[{key:"parse",value:function(t){var e=this;return new Promise((function(r,n){var i=e.manager,o=e.fetchOptions,s=i.getHandler("path.gltf")||i.getHandler("path.glb");s||((s=new Ne(i)).register((function(){return new Ur})),"include"===o.credentials&&"cors"===o.mode&&s.setCrossOrigin("use-credentials"),"credentials"in o&&s.setWithCredentials("include"===o.credentials),o.headers&&s.setRequestHeader(o.headers));var a=s.resourcePath||s.path||e.workingPath;!/[\\/]$/.test(a)&&a.length&&(a+="/"),s.parse(t,a,(function(t){r(t)}),n)}))}}]),r}(),jr=new THREE.Matrix4,qr=function(t){u(r,THREE.Group);var e=f(r);function r(t){var n;return i(this,r),(n=e.call(this)).name="TilesRenderer.TilesGroup",n.tilesRenderer=t,n}return s(r,[{key:"raycast",value:function(t,e){this.tilesRenderer.optimizeRaycast&&this.tilesRenderer.raycast(t,e)}},{key:"updateMatrixWorld",value:function(t){if(this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldNeedsUpdate||t){null===this.parent?jr.copy(this.matrix):jr.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1;for(var e=jr.elements,r=this.matrixWorld.elements,n=!1,i=0;i<16;i++){var o=e[i],s=r[i];if(Math.abs(o-s)>Number.EPSILON){n=!0;break}}if(n){this.matrixWorld.copy(jr);for(var a=this.children,u=0,l=a.length;u<l;u++)a[u].updateMatrixWorld()}}}}]),r}(),Vr=new THREE.Matrix4,zr=new THREE.Ray,Yr=new THREE.Vector3,Xr=[];function Jr(t,e){return t.distance-e.distance}function Wr(t,e,r){t.traverse((function(t){Object.getPrototypeOf(t).raycast.call(t,e,r)}))}function Kr(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=t.group,o=t.activeTiles;t.ensureChildrenArePreprocessed(e),null===n&&(n=zr,Vr.copy(i.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(Vr));for(var s=[],a=e.children,u=0,l=a.length;u<l;u++){var h=a[u];if(h.__used)null!==h.cached.boundingVolume.intersectRay(n,Yr)&&(Yr.applyMatrix4(i.matrixWorld),s.push({distance:Yr.distanceToSquared(r.ray.origin),tile:h}))}s.sort(Jr);var c=null,f=1/0;if(o.has(e)){var p=function(t,e){Wr(t,e,Xr),Xr.sort(Jr);var r=Xr[0]||null;return Xr.length=0,r}(e.cached.scene,r);p&&(c=p,f=p.distance*p.distance)}for(var g=0,d=s.length;g<d;g++){var A=s[g],y=A.distance,v=A.tile;if(y>f)break;var m=Kr(t,v,r,n);if(m){var E=m.distance*m.distance;E<f&&(c=m,f=E)}}return c}function Zr(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=t.group,s=t.activeTiles,a=e.cached,u=a.scene,l=a.boundingVolume;if(t.ensureChildrenArePreprocessed(e),null===i&&(i=zr,Vr.copy(o.matrixWorld).invert(),i.copy(r.ray).applyMatrix4(Vr)),e.__used&&l.intersectsRay(i)){s.has(e)&&Wr(u,r,n);for(var h=e.children,c=0,f=h.length;c<f;c++)Zr(t,h[c],r,n,i)}}var $r=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new THREE.Box3,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new THREE.Matrix4;i(this,t),this.box=e.clone(),this.transform=r.clone(),this.inverseTransform=new THREE.Matrix4,this.points=new Array(8).fill().map((function(){return new THREE.Vector3}))}return s(t,[{key:"update",value:function(){var t=this.points,e=this.inverseTransform,r=this.transform,n=this.box;e.copy(r).invert();for(var i=n.min,o=n.max,s=0,a=-1;a<=1;a+=2)for(var u=-1;u<=1;u+=2)for(var l=-1;l<=1;l+=2)t[s].set(a<0?i.x:o.x,u<0?i.y:o.y,l<0?i.z:o.z).applyMatrix4(r),s++}},{key:"intersectsFrustum",value:function(t){for(var e=this.points,r=t.planes,n=0;n<6;n++){for(var i=r[n],o=-1/0,s=0;s<8;s++){var a=e[s],u=i.distanceToPoint(a);o=o<u?u:o}if(o<0)return!1}return!0}}]),t}();new THREE.Spherical,new THREE.Vector3;var tn=new THREE.Spherical,en=new THREE.Vector3,rn=new THREE.Vector3,nn=new THREE.Vector3,on=new THREE.Vector3,sn=new THREE.Vector3,an=new THREE.Vector3,un=new THREE.Vector3,ln=new THREE.Vector3,hn=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;i(this,t),this.radius=new THREE.Vector3(e,r,n)}return s(t,[{key:"constructLatLonFrame",value:function(t,e,r){return this.getCartographicToPosition(t,e,0,ln),this.getCartographicToNormal(t,e,un),this.getNorthernTangent(t,e,an),sn.crossVectors(an,un),r.makeBasis(sn,an,un).setPosition(ln)}},{key:"getNorthernTangent",value:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:on,i=1,o=t+1e-7;t>Math.PI/4&&(i=-1,o=t-1e-7);var s=this.getCartographicToNormal(t,e,rn).normalize(),a=this.getCartographicToNormal(o,e,nn).normalize();return n.crossVectors(s,a).normalize().multiplyScalar(i),r.crossVectors(n,s).normalize()}},{key:"getCartographicToPosition",value:function(t,e,r,n){this.getCartographicToNormal(t,e,en);var i=this.radius;rn.copy(en),rn.x*=Math.pow(i.x,2),rn.y*=Math.pow(i.y,2),rn.z*=Math.pow(i.z,2);var o=Math.sqrt(en.dot(rn));return rn.divideScalar(o),n.copy(rn).addScaledVector(en,r)}},{key:"getPositionToCartographic",value:function(t,e){this.getPositionToSurfacePoint(t,rn),this.getPositionToNormal(t,en);var r=nn.subVectors(t,rn);return e.lon=Math.atan2(en.y,en.x),e.lat=Math.asin(en.z),e.height=Math.sign(r.dot(t))*r.length(),e}},{key:"getCartographicToNormal",value:function(t,e,r){return tn.set(1,-t+Math.PI/2,e),r.setFromSpherical(tn).normalize(),function(t){var e=t.x,r=t.y,n=t.z;t.x=n,t.y=e,t.z=r}(r),r}},{key:"getPositionToNormal",value:function(t,e){var r=this.radius;return e.copy(t),e.x/=Math.pow(r.x,2),e.y/=Math.pow(r.y,2),e.z/=Math.pow(r.z,2),e.normalize(),e}},{key:"getPositionToSurfacePoint",value:function(t,e){var r=this.radius,n=1/Math.pow(r.x,2),i=1/Math.pow(r.y,2),o=1/Math.pow(r.z,2),s=t.x*t.x*n,a=t.y*t.y*i,u=t.z*t.z*o,l=s+a+u,h=Math.sqrt(1/l),c=rn.copy(t).multiplyScalar(h);if(l<.1)return isFinite(h)?e.copy(c):null;var f,p,g,d,A,y,v,m=nn.set(c.x*n*2,c.y*i*2,c.z*o*2),E=(1-h)*t.length()/(.5*m.length()),_=0;do{_=(f=s*(A=(p=1/(1+(E-=_)*n))*p)+a*(y=(g=1/(1+E*i))*g)+u*(v=(d=1/(1+E*o))*d)-1)/(-2*(s*(A*p)*n+a*(y*g)*i+u*(v*d)*o))}while(Math.abs(f)>1e-12);return e.set(t.x*p,t.y*g,t.z*d)}}]),t}(),cn=Math.PI,fn=cn/2,pn=new THREE.Vector3,gn=new THREE.Vector3,dn=new THREE.Vector3,An=new THREE.Matrix4,yn=0,vn=[];function mn(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?(vn[yn]||(vn[yn]=new THREE.Vector3),yn++,vn[yn-1]):new THREE.Vector3}function En(){yn=0}var _n=function(t){u(r,hn);var e=f(r);function r(t,n,o){var s,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-fn,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:fn,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,h=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*cn,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0;return i(this,r),(s=e.call(this,t,n,o)).latStart=a,s.latEnd=u,s.lonStart=l,s.lonEnd=h,s.heightStart=c,s.heightEnd=f,s}return s(r,[{key:"_getPoints",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.latStart,r=this.latEnd,n=this.lonStart,i=this.lonEnd,o=this.heightStart,s=this.heightEnd,a=THREE.MathUtils.mapLinear(.5,0,1,e,r),u=THREE.MathUtils.mapLinear(.5,0,1,n,i),l=Math.floor(n/fn)*fn,h=[[-cn/2,0],[cn/2,0],[0,l],[0,l+cn/2],[0,l+cn],[0,l+3*cn/2],[e,i],[r,i],[e,n],[r,n],[0,n],[0,i],[a,u],[e,u],[r,u],[a,n],[a,i]],c=[],f=h.length,p=0;p<=1;p++)for(var g=THREE.MathUtils.mapLinear(p,0,1,o,s),d=0,A=f;d<A;d++){var v=y(h[d],2),m=v[0],E=v[1];if(m>=e&&m<=r&&E>=n&&E<=i){var _=mn(t);c.push(_),this.getCartographicToPosition(m,E,g,_)}}return c}},{key:"getBoundingBox",value:function(t,e){En();var r=this.latStart,n=this.latEnd,i=this.lonStart,o=this.lonEnd;if(n-r<cn/2){var s=THREE.MathUtils.mapLinear(.5,0,1,r,n),a=THREE.MathUtils.mapLinear(.5,0,1,i,o);this.getCartographicToNormal(s,a,dn),gn.set(0,0,1),pn.crossVectors(gn,dn),gn.crossVectors(pn,dn),e.makeBasis(pn,gn,dn)}else pn.set(1,0,0),gn.set(0,1,0),dn.set(0,0,1),e.makeBasis(pn,gn,dn);An.copy(e).invert();for(var u=this._getPoints(!0),l=0,h=u.length;l<h;l++)u[l].applyMatrix4(An);t.makeEmpty(),t.setFromPoints(u)}},{key:"getBoundingSphere",value:function(t,e){En();var r=this._getPoints(!0);t.makeEmpty(),t.setFromPoints(r,e)}}]),r}();function In(t){return In="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},In(t)}function xn(t){var e=function(t,e){if("object"!==In(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==In(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===In(e)?e:String(e)}function Cn(t,e,r){return(e=xn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wn(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}const bn=1/Math.PI*180,Bn=1/180*Math.PI,Sn={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function Tn(t,{precision:e=Sn.precision}={}){return t=function(t){return Math.round(t/Sn.EPSILON)*Sn.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function Mn(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Rn(t){return function(t,e){return Pn(t,(t=>t*Bn),e)}(t)}function Ln(t){return function(t,e){return Pn(t,(t=>t*bn),e)}(t)}function Nn(t,e,r){const n=Sn.EPSILON;r&&(Sn.EPSILON=r);try{if(t===e)return!0;if(Mn(t)&&Mn(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!Nn(t[r],e[r]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):"number"==typeof t&&"number"==typeof e&&Math.abs(t-e)<=Sn.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))}finally{Sn.EPSILON=n}}function Pn(t,e,r){if(Mn(t)){const n=t;r=r||function(t){return t.clone?t.clone():new Array(t.length)}(n);for(let i=0;i<r.length&&i<n.length;++i)r[i]=e(t[i],i,r);return r}return e(t)}class kn extends(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Array)){clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+e];return this.check()}toArray(t=[],e=0){for(let r=0;r<this.ELEMENTS;++r)t[e+r]=this[r];return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Mn(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Sn)}formatString(t){let e="";for(let r=0;r<this.ELEMENTS;++r)e+=(r>0?", ":"")+Tn(this[r],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(e,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(!Nn(this[e],t[e]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(this[e]!==t[e])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,e,r){if(void 0===r)return this.lerp(this,t,e);for(let n=0;n<this.ELEMENTS;++n){const i=t[n];this[n]=i+r*(e[n]-i)}return this.check()}min(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.min(t[e],this[e]);return this.check()}max(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.max(t[e],this[e]);return this.check()}clamp(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),e[r]);return this.check()}add(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]+=e[t];return this.check()}subtract(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]-=e[t];return this.check()}scale(t){if("number"==typeof t)for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;else for(let e=0;e<this.ELEMENTS&&e<t.length;++e)this[e]*=t[e];return this.check()}multiplyByScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}check(){if(Sn.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let e=0;e<this.ELEMENTS;++e)t=t&&Number.isFinite(this[e]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=t;return this.check()}addScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),e);return this.check()}get elements(){return this}}function Dn(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(t));return t}function Qn(t,e,r=""){if(Sn.debug&&!function(t,e){if(t.length!==e)return!1;for(let e=0;e<t.length;++e)if(!Number.isFinite(t[e]))return!1;return!0}(t,e))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return t}class On extends kn{get x(){return this[0]}set x(t){this[0]=Dn(t)}get y(){return this[1]}set y(t){this[1]=Dn(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let e=0;e<this.ELEMENTS;++e)t+=this[e]*this[e];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let e=0;for(let r=0;r<this.ELEMENTS;++r){const n=this[r]-t[r];e+=n*n}return Dn(e)}dot(t){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*t[r];return Dn(e)}normalize(){const t=this.magnitude();if(0!==t)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t;return this.check()}multiply(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]*=e[t];return this.check()}divide(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e[t];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return wn(t>=0&&t<this.ELEMENTS,"index is out of range"),Dn(this[t])}setComponent(t,e){return wn(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=e,this.check()}addVectors(t,e){return this.copy(t).add(e)}subVectors(t,e){return this.copy(t).subtract(e)}multiplyVectors(t,e){return this.copy(t).multiply(e)}addScaledVector(t,e){return this.add(new this.constructor(t).multiplyScalar(e))}}var Fn,Gn=1e-6,Un="undefined"!=typeof Float32Array?Float32Array:Array;function Hn(t,e,r){const n=e[0],i=e[1],o=e[2],s=r[3]*n+r[7]*i+r[11]*o||1;return t[0]=(r[0]*n+r[4]*i+r[8]*o)/s,t[1]=(r[1]*n+r[5]*i+r[9]*o)/s,t[2]=(r[2]*n+r[6]*i+r[10]*o)/s,t}function jn(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function qn(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[3]*n+r[7]*i+r[11]*o+r[15];return s=s||1,t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/s,t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/s,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/s,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),Fn=new Un(2),Un!=Float32Array&&(Fn[0]=0,Fn[1]=0),function(){var t=function(){var t=new Un(3);return Un!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}()}();const Vn=[0,0,0];let zn;class Yn extends On{static get ZERO(){return zn||(zn=new Yn(0,0,0),Object.freeze(zn)),zn}constructor(t=0,e=0,r=0){super(-0,-0,-0),1===arguments.length&&Mn(t)?this.copy(t):(Sn.debug&&(Dn(t),Dn(e),Dn(r)),this[0]=t,this[1]=e,this[2]=r)}set(t,e,r){return this[0]=t,this[1]=e,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Sn.debug&&(Dn(t.x),Dn(t.y),Dn(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=Dn(t)}angle(t){return r=t,n=(e=this)[0],i=e[1],o=e[2],s=r[0],a=r[1],u=r[2],l=Math.sqrt(n*n+i*i+o*o)*Math.sqrt(s*s+a*a+u*u),h=l&&jn(e,r)/l,Math.acos(Math.min(Math.max(h,-1),1));var e,r,n,i,o,s,a,u,l,h}cross(t){return function(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[0],a=r[1],u=r[2];t[0]=i*u-o*a,t[1]=o*s-n*u,t[2]=n*a-i*s}(this,this,t),this.check()}rotateX({radians:t,origin:e=Vn}){return function(t,e,r,n){var i=[],o=[];i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2]}(this,this,e,t),this.check()}rotateY({radians:t,origin:e=Vn}){return function(t,e,r,n){var i=[],o=[];i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2]}(this,this,e,t),this.check()}rotateZ({radians:t,origin:e=Vn}){return function(t,e,r,n){var i=[],o=[];i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2]}(this,this,e,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return qn(this,this,t),this.check()}transformAsVector(t){return Hn(this,this,t),this.check()}transformByMatrix3(t){return function(t,e,r){var n=e[0],i=e[1],o=e[2];t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8]}(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,r){const n=e[0],i=e[1];t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t[2]=e[2]}(this,this,t),this.check()}transformByQuaternion(t){return function(t,e,r){var n=r[0],i=r[1],o=r[2],s=r[3],a=e[0],u=e[1],l=e[2],h=i*l-o*u,c=o*a-n*l,f=n*u-i*a,p=i*f-o*c,g=o*h-n*f,d=n*c-i*h,A=2*s;h*=A,c*=A,f*=A,p*=2,g*=2,d*=2,t[0]=a+h+p,t[1]=u+c+g,t[2]=l+f+d}(this,this,t),this.check()}}class Xn extends kn{toString(){let t="[";if(Sn.printRowMajor){t+="row-major:";for(let e=0;e<this.RANK;++e)for(let r=0;r<this.RANK;++r)t+=" ".concat(this[r*this.RANK+e])}else{t+="column-major:";for(let e=0;e<this.ELEMENTS;++e)t+=" ".concat(this[e])}return t+="]",t}getElementIndex(t,e){return e*this.RANK+t}getElement(t,e){return this[e*this.RANK+t]}setElement(t,e,r){return this[e*this.RANK+t]=Dn(r),this}getColumn(t,e=new Array(this.RANK).fill(-0)){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)e[t]=this[r+t];return e}setColumn(t,e){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)this[r+t]=e[t];return this}}function Jn(t,e,r){var n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],l=e[6],h=e[7],c=e[8],f=e[9],p=e[10],g=e[11],d=e[12],A=e[13],y=e[14],v=e[15],m=r[0],E=r[1],_=r[2],I=r[3];return t[0]=m*n+E*a+_*c+I*d,t[1]=m*i+E*u+_*f+I*A,t[2]=m*o+E*l+_*p+I*y,t[3]=m*s+E*h+_*g+I*v,m=r[4],E=r[5],_=r[6],I=r[7],t[4]=m*n+E*a+_*c+I*d,t[5]=m*i+E*u+_*f+I*A,t[6]=m*o+E*l+_*p+I*y,t[7]=m*s+E*h+_*g+I*v,m=r[8],E=r[9],_=r[10],I=r[11],t[8]=m*n+E*a+_*c+I*d,t[9]=m*i+E*u+_*f+I*A,t[10]=m*o+E*l+_*p+I*y,t[11]=m*s+E*h+_*g+I*v,m=r[12],E=r[13],_=r[14],I=r[15],t[12]=m*n+E*a+_*c+I*d,t[13]=m*i+E*u+_*f+I*A,t[14]=m*o+E*l+_*p+I*y,t[15]=m*s+E*h+_*g+I*v,t}var Wn=function(t,e,r,n,i){var o,s=1/Math.tan(e/2);return t[0]=s/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(n-i),t[10]=(i+n)*o,t[14]=2*i*n*o):(t[10]=-1,t[14]=-2*n),t};var Kn,Zn=function(t,e,r,n,i,o,s){var a=1/(e-r),u=1/(n-i),l=1/(o-s);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+r)*a,t[13]=(i+n)*u,t[14]=(s+o)*l,t[15]=1,t};!function(){var t=function(){var t=new Un(4);return Un!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}()}(),function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"}(Kn||(Kn={}));const $n=45*Math.PI/180,ti=1,ei=.1,ri=500,ni=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class ii extends Xn{static get IDENTITY(){return function(){si||(si=new ii,Object.freeze(si));return si}()}static get ZERO(){return function(){oi||(oi=new ii([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(oi));return oi}()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Kn}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,e,r,n,i,o,s,a,u,l,h,c,f,p,g,d){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=i,this[5]=o,this[6]=s,this[7]=a,this[8]=u,this[9]=l,this[10]=h,this[11]=c,this[12]=f,this[13]=p,this[14]=g,this[15]=d,this.check()}setRowMajor(t,e,r,n,i,o,s,a,u,l,h,c,f,p,g,d){return this[0]=t,this[1]=i,this[2]=u,this[3]=f,this[4]=e,this[5]=o,this[6]=l,this[7]=p,this[8]=r,this[9]=s,this[10]=h,this[11]=g,this[12]=n,this[13]=a,this[14]=c,this[15]=d,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(ni)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],s=r+r,a=n+n,u=i+i,l=r*s,h=n*s,c=n*a,f=i*s,p=i*a,g=i*u,d=o*s,A=o*a,y=o*u;t[0]=1-c-g,t[1]=h+y,t[2]=f-A,t[3]=0,t[4]=h-y,t[5]=1-l-g,t[6]=p+d,t[7]=0,t[8]=f+A,t[9]=p-d,t[10]=1-l-c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(this,t),this.check()}frustum(t){const{left:e,right:r,bottom:n,top:i,near:o=ei,far:s=ri}=t;return s===1/0?function(t,e,r,n,i,o){const s=2*o/(r-e),a=2*o/(i-n),u=(r+e)/(r-e),l=(i+n)/(i-n),h=-1,c=-1,f=-2*o;t[0]=s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=u,t[9]=l,t[10]=h,t[11]=c,t[12]=0,t[13]=0,t[14]=f,t[15]=0}(this,e,r,n,i,o):function(t,e,r,n,i,o,s){var a=1/(r-e),u=1/(i-n),l=1/(o-s);t[0]=2*o*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*u,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(i+n)*u,t[10]=(s+o)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*o*2*l,t[15]=0}(this,e,r,n,i,o,s),this.check()}lookAt(t){const{eye:e,center:r=[0,0,0],up:n=[0,1,0]}=t;return function(t,e,r,n){var i,o,s,a,u,l,h,c,f,p,g=e[0],d=e[1],A=e[2],y=n[0],v=n[1],m=n[2],E=r[0],_=r[1],I=r[2];Math.abs(g-E)<Gn&&Math.abs(d-_)<Gn&&Math.abs(A-I)<Gn?function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t):(h=g-E,c=d-_,f=A-I,i=v*(f*=p=1/Math.hypot(h,c,f))-m*(c*=p),o=m*(h*=p)-y*f,s=y*c-v*h,(p=Math.hypot(i,o,s))?(i*=p=1/p,o*=p,s*=p):(i=0,o=0,s=0),a=c*s-f*o,u=f*i-h*s,l=h*o-c*i,(p=Math.hypot(a,u,l))?(a*=p=1/p,u*=p,l*=p):(a=0,u=0,l=0),t[0]=i,t[1]=a,t[2]=h,t[3]=0,t[4]=o,t[5]=u,t[6]=c,t[7]=0,t[8]=s,t[9]=l,t[10]=f,t[11]=0,t[12]=-(i*g+o*d+s*A),t[13]=-(a*g+u*d+l*A),t[14]=-(h*g+c*d+f*A),t[15]=1)}(this,e,r,n),this.check()}ortho(t){const{left:e,right:r,bottom:n,top:i,near:o=ei,far:s=ri}=t;return Zn(this,e,r,n,i,o,s),this.check()}orthographic(t){const{fovy:e=$n,aspect:r=ti,focalDistance:n=1,near:i=ei,far:o=ri}=t;ai(e);const s=e/2,a=n*Math.tan(s),u=a*r;return this.ortho({left:-u,right:u,bottom:-a,top:a,near:i,far:o})}perspective(t){const{fovy:e=45*Math.PI/180,aspect:r=1,near:n=.1,far:i=500}=t;return ai(e),Wn(this,e,r,n,i),this.check()}determinant(){return e=(t=this)[0],r=t[1],n=t[2],i=t[3],o=t[4],s=t[5],a=t[6],u=t[7],l=t[8],h=t[9],c=t[10],f=t[11],p=t[12],g=t[13],d=t[14],A=t[15],(e*s-r*o)*(c*A-f*d)-(e*a-n*o)*(h*A-f*g)+(e*u-i*o)*(h*d-c*g)+(r*a-n*s)*(l*A-f*p)-(r*u-i*s)*(l*d-c*p)+(n*u-i*a)*(l*g-h*p);var t,e,r,n,i,o,s,a,u,l,h,c,f,p,g,d,A}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const r=this.getScale(e),n=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*n,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*n,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const r=this.getScale(e),n=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*n,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*n,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return function(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],s=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=s,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15]}(this,this),this.check()}invert(){return function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],u=e[6],l=e[7],h=e[8],c=e[9],f=e[10],p=e[11],g=e[12],d=e[13],A=e[14],y=e[15],v=r*a-n*s,m=r*u-i*s,E=r*l-o*s,_=n*u-i*a,I=n*l-o*a,x=i*l-o*u,C=h*d-c*g,w=h*A-f*g,b=h*y-p*g,B=c*A-f*d,S=c*y-p*d,T=f*y-p*A,M=v*T-m*S+E*B+_*b-I*w+x*C;M&&(M=1/M,t[0]=(a*T-u*S+l*B)*M,t[1]=(i*S-n*T-o*B)*M,t[2]=(d*x-A*I+y*_)*M,t[3]=(f*I-c*x-p*_)*M,t[4]=(u*b-s*T-l*w)*M,t[5]=(r*T-i*b+o*w)*M,t[6]=(A*E-g*x-y*m)*M,t[7]=(h*x-f*E+p*m)*M,t[8]=(s*S-a*b+l*C)*M,t[9]=(n*b-r*S-o*C)*M,t[10]=(g*I-d*E+y*v)*M,t[11]=(c*E-h*I-p*v)*M,t[12]=(a*w-s*B-u*C)*M,t[13]=(r*B-n*w+i*C)*M,t[14]=(d*m-g*_-A*v)*M,t[15]=(h*_-c*m+f*v)*M)}(this,this),this.check()}multiplyLeft(t){return Jn(this,t,this),this.check()}multiplyRight(t){return Jn(this,this,t),this.check()}rotateX(t){return function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],s=e[5],a=e[6],u=e[7],l=e[8],h=e[9],c=e[10],f=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+l*n,t[5]=s*i+h*n,t[6]=a*i+c*n,t[7]=u*i+f*n,t[8]=l*i-o*n,t[9]=h*i-s*n,t[10]=c*i-a*n,t[11]=f*i-u*n}(this,this,t),this.check()}rotateY(t){return function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],s=e[1],a=e[2],u=e[3],l=e[8],h=e[9],c=e[10],f=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-l*n,t[1]=s*i-h*n,t[2]=a*i-c*n,t[3]=u*i-f*n,t[8]=o*n+l*i,t[9]=s*n+h*i,t[10]=a*n+c*i,t[11]=u*n+f*i}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],s=e[1],a=e[2],u=e[3],l=e[4],h=e[5],c=e[6],f=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+l*n,t[1]=s*i+h*n,t[2]=a*i+c*n,t[3]=u*i+f*n,t[4]=l*i-o*n,t[5]=h*i-s*n,t[6]=c*i-a*n,t[7]=f*i-u*n}(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,e){return function(t,e,r,n){var i,o,s,a,u,l,h,c,f,p,g,d,A,y,v,m,E,_,I,x,C,w,b,B,S=n[0],T=n[1],M=n[2],R=Math.hypot(S,T,M);R<Gn||(S*=R=1/R,T*=R,M*=R,i=Math.sin(r),s=1-(o=Math.cos(r)),a=e[0],u=e[1],l=e[2],h=e[3],c=e[4],f=e[5],p=e[6],g=e[7],d=e[8],A=e[9],y=e[10],v=e[11],m=S*S*s+o,E=T*S*s+M*i,_=M*S*s-T*i,I=S*T*s-M*i,x=T*T*s+o,C=M*T*s+S*i,w=S*M*s+T*i,b=T*M*s-S*i,B=M*M*s+o,t[0]=a*m+c*E+d*_,t[1]=u*m+f*E+A*_,t[2]=l*m+p*E+y*_,t[3]=h*m+g*E+v*_,t[4]=a*I+c*x+d*C,t[5]=u*I+f*x+A*C,t[6]=l*I+p*x+y*C,t[7]=h*I+g*x+v*C,t[8]=a*w+c*b+d*B,t[9]=u*w+f*b+A*B,t[10]=l*w+p*b+y*B,t[11]=h*w+g*b+v*B,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]))}(this,this,t,e),this.check()}scale(t){return function(t,e,r){var n=r[0],i=r[1],o=r[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return function(t,e,r){var n,i,o,s,a,u,l,h,c,f,p,g,d=r[0],A=r[1],y=r[2];e===t?(t[12]=e[0]*d+e[4]*A+e[8]*y+e[12],t[13]=e[1]*d+e[5]*A+e[9]*y+e[13],t[14]=e[2]*d+e[6]*A+e[10]*y+e[14],t[15]=e[3]*d+e[7]*A+e[11]*y+e[15]):(n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],l=e[6],h=e[7],c=e[8],f=e[9],p=e[10],g=e[11],t[0]=n,t[1]=i,t[2]=o,t[3]=s,t[4]=a,t[5]=u,t[6]=l,t[7]=h,t[8]=c,t[9]=f,t[10]=p,t[11]=g,t[12]=n*d+a*A+c*y+e[12],t[13]=i*d+u*A+f*y+e[13],t[14]=o*d+l*A+p*y+e[14],t[15]=s*d+h*A+g*y+e[15])}(this,this,t),this.check()}transform(t,e){return 4===t.length?(e=function(t,e,r){var n=e[0],i=e[1],o=e[2],s=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*s,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*s,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*s,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*s,t}(e||[-0,-0,-0,-0],t,this),Qn(e,4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:r}=t;let n;switch(r){case 2:n=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t}(e||[-0,-0],t,this);break;case 3:n=qn(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Qn(n,t.length),n}transformAsVector(t,e){let r;switch(t.length){case 2:r=function(t,e,r){const n=e[0],i=e[1],o=r[3]*n+r[7]*i||1;return t[0]=(r[0]*n+r[4]*i)/o,t[1]=(r[1]*n+r[5]*i)/o,t}(e||[-0,-0],t,this);break;case 3:r=Hn(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Qn(r,t.length),r}transformPoint(t,e){return this.transformAsPoint(t,e)}transformVector(t,e){return this.transformAsPoint(t,e)}transformDirection(t,e){return this.transformAsVector(t,e)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,r){return this.identity().translate([t,e,r])}}let oi,si;function ai(t){if(t>2*Math.PI)throw Error("expected radians")}var ui=.1,li=1e-12,hi=1e-15;Math.PI,Math.PI,Math.PI,Math.PI;function ci(t){return t}function fi(t,e=[]){return function(t,e=[],r=ci){return"longitude"in t?(e[0]=r(t.longitude),e[1]=r(t.latitude),e[2]=t.height):"x"in t?(e[0]=r(t.x),e[1]=r(t.y),e[2]=t.z):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}(t,e,Sn._cartographicRadians?ci:Rn)}function pi(t,e){return function(t,e,r=ci){return"longitude"in e?(e.longitude=r(t[0]),e.latitude=r(t[1]),e.height=t[2]):"x"in e?(e.x=r(t[0]),e.y=r(t[1]),e.z=t[2]):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}(t,e,Sn._cartographicRadians?ci:Ln)}new Yn;const gi=new Yn,di=new Yn,Ai=new Yn;const yi=new Yn,vi={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},mi={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Ei={east:new Yn,north:new Yn,up:new Yn,west:new Yn,south:new Yn,down:new Yn},_i=new Yn,Ii=new Yn,xi=new Yn;function Ci(t,e,r,n,i,o){const s=vi[e]&&vi[e][r];let a,u,l;wn(s&&(!n||n===s));const h=yi.copy(i);if(Nn(h.x,0,1e-14)&&Nn(h.y,0,1e-14)){const t=Math.sign(h.z);a=_i.fromArray(mi[e]),"east"!==e&&"west"!==e&&a.scale(t),u=Ii.fromArray(mi[r]),"east"!==r&&"west"!==r&&u.scale(t),l=xi.fromArray(mi[n]),"east"!==n&&"west"!==n&&l.scale(t)}else{const{up:i,east:o,north:s}=Ei;o.set(-h.y,h.x,0).normalize(),t.geodeticSurfaceNormal(h,i),s.copy(i).cross(o);const{down:c,west:f,south:p}=Ei;c.copy(i).scale(-1),f.copy(o).scale(-1),p.copy(s).scale(-1),a=Ei[e],u=Ei[r],l=Ei[n]}return o[0]=a.x,o[1]=a.y,o[2]=a.z,o[3]=0,o[4]=u.x,o[5]=u.y,o[6]=u.z,o[7]=0,o[8]=l.x,o[9]=l.y,o[10]=l.z,o[11]=0,o[12]=h.x,o[13]=h.y,o[14]=h.z,o[15]=1,o}const wi=new Yn,bi=new Yn,Bi=new Yn,Si=new Yn,Ti=new Yn,Mi=new Yn;class Ri{constructor(t=0,e=0,r=0){Cn(this,"radii",void 0),Cn(this,"radiiSquared",void 0),Cn(this,"radiiToTheFourth",void 0),Cn(this,"oneOverRadii",void 0),Cn(this,"oneOverRadiiSquared",void 0),Cn(this,"minimumRadius",void 0),Cn(this,"maximumRadius",void 0),Cn(this,"centerToleranceSquared",ui),Cn(this,"squaredXOverSquaredZ",void 0),wn(t>=0),wn(e>=0),wn(r>=0),this.radii=new Yn(t,e,r),this.radiiSquared=new Yn(t*t,e*e,r*r),this.radiiToTheFourth=new Yn(t*t*t*t,e*e*e*e,r*r*r*r),this.oneOverRadii=new Yn(0===t?0:1/t,0===e?0:1/e,0===r?0:1/r),this.oneOverRadiiSquared=new Yn(0===t?0:1/(t*t),0===e?0:1/(e*e),0===r?0:1/(r*r)),this.minimumRadius=Math.min(t,e,r),this.maximumRadius=Math.max(t,e,r),0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,e=[0,0,0]){const r=bi,n=Bi,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,r),n.copy(this.radiiSquared).scale(r);const o=Math.sqrt(r.dot(n));return n.scale(1/o),r.scale(i),n.add(r),n.to(e)}cartesianToCartographic(t,e=[0,0,0]){Mi.from(t);const r=this.scaleToGeodeticSurface(Mi,Si);if(!r)return;const n=this.geodeticSurfaceNormal(r,bi),i=Ti;i.copy(Mi).subtract(r);const o=Math.atan2(n.y,n.x),s=Math.asin(n.z),a=Math.sign(jn(i,Mi))*function(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}(i);return pi([o,s,a],e)}eastNorthUpToFixedFrame(t,e=new ii){return Ci(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,r,n,i=new ii){return Ci(this,t,e,r,n,i)}geocentricSurfaceNormal(t,e=[0,0,0]){return wi.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const r=fi(t),n=r[0],i=r[1],o=Math.cos(i);return wi.set(o*Math.cos(n),o*Math.sin(n),Math.sin(i)).normalize(),wi.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return wi.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,r=[]){const{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:o}=e;gi.from(t);const s=gi.x,a=gi.y,u=gi.z,l=n.x,h=n.y,c=n.z,f=s*s*l*l,p=a*a*h*h,g=u*u*c*c,d=f+p+g,A=Math.sqrt(1/d);if(!Number.isFinite(A))return;const y=di;if(y.copy(t).scale(A),d<o)return y.to(r);const v=i.x,m=i.y,E=i.z,_=Ai;_.set(y.x*v*2,y.y*m*2,y.z*E*2);let I,x,C,w,b=(1-A)*gi.len()/(.5*_.len()),B=0;do{b-=B,I=1/(1+b*v),x=1/(1+b*m),C=1/(1+b*E);const t=I*I,e=x*x,r=C*C;w=f*t+p*e+g*r-1,B=w/(-2*(f*(t*I)*v+p*(e*x)*m+g*(r*C)*E))}while(Math.abs(w)>li);return gi.scale([I,x,C]).to(r)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){Si.from(t);const r=Si.x,n=Si.y,i=Si.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(r*r*o.x+n*n*o.y+i*i*o.z);return Si.multiplyScalar(s).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return Si.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return Si.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,r=[0,0,0]){wn(Nn(this.radii.x,this.radii.y,hi)),wn(this.radii.z>0),Si.from(t);const n=Si.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-e))return Si.set(0,0,n).to(r)}}Cn(Ri,"WGS84",new Ri(6378137,6378137,6356752.314245179));var Li=new THREE.Vector3,Ni=new THREE.Vector3,Pi=new THREE.Vector3,ki=new THREE.Vector3,Di=new THREE.Vector3,Qi=new THREE.Vector3,Oi=new THREE.Ray,Fi=new THREE.Vector3,Gi=new THREE.Matrix4,Ui=new THREE.Vector3,Hi=new THREE.Vector3,ji=new THREE.Vector3,qi=new THREE.Quaternion,Vi=new THREE.Vector3,zi=new THREE.Vector3,Yi=function(){function t(e,r,n,o){i(this,t),this.sphere=null,this.obb=null,this.region=null,this.regionObb=null,this.scale=null,this.threeLayer=e,this.heightOffset=r,this.xOffset=n,this.yOffset=o}return s(t,[{key:"intersectsRay",value:function(t){var e=this.sphere,r=this.obb||this.regionObb;return!(e&&!t.intersectsSphere(e))&&!(r&&(Oi.copy(t).applyMatrix4(r.inverseTransform),!Oi.intersectsBox(r.box)))}},{key:"intersectRay",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=this.sphere,n=this.obb||this.regionObb,i=-1/0,o=-1/0;r&&t.intersectSphere(r,Di)&&(i=r.containsPoint(t.origin)?0:t.origin.distanceToSquared(Di)),n&&(Oi.copy(t).applyMatrix4(n.inverseTransform),Oi.intersectBox(n.box,Qi)&&(o=n.box.containsPoint(Oi.origin)?0:Oi.origin.distanceToSquared(Qi)));var s=Math.max(i,o);return s===-1/0?null:(t.at(Math.sqrt(s),e),e)}},{key:"distanceToPoint",value:function(t){var e=this.sphere,r=this.obb||this.regionObb,n=-1/0,i=-1/0;return e&&(n=Math.max(e.distanceToPoint(t),0)),r&&(ki.copy(t).applyMatrix4(r.inverseTransform),i=r.box.distanceToPoint(ki)),n>i?n:i}},{key:"intersectsFrustum",value:function(t){var e=this.obb||this.regionObb,r=this.sphere;return!(r&&!t.intersectsSphere(r))&&(!(e&&!e.intersectsFrustum(t))&&Boolean(r||e))}},{key:"getOBB",value:function(t,e){var r=this.obb||this.regionObb;r?(t.copy(r.box),e.copy(r.transform)):(this.getAABB(t),e.identity())}},{key:"getAABB",value:function(t){if(this.sphere)this.sphere.getBoundingBox(t);else{var e=this.obb||this.regionObb;t.copy(e.box).applyMatrix4(e.transform)}}},{key:"getSphere",value:function(t){if(this.sphere)t.copy(this.sphere);else if(this.region)this.region.getBoundingSphere(t);else{var e=this.obb||this.regionObb;e.box.getBoundingSphere(t),t.applyMatrix4(e.transform)}}},{key:"setObbData",value:function(t,e,r){var n=new $r,i=new THREE.Vector3,o=this.threeLayer.distanceToVector3(t[3],t[3]).x,s=this.threeLayer.distanceToVector3(t[4],t[4]).x,a=this.threeLayer.distanceToVector3(t[5],t[5]).x;Li.set(o,s,a);var u=this.threeLayer.distanceToVector3(t[6],t[6]).x,l=this.threeLayer.distanceToVector3(t[7],t[7]).x,h=this.threeLayer.distanceToVector3(t[8],t[8]).x;Ni.set(u,l,h);var c=this.threeLayer.distanceToVector3(t[9],t[9]).x,f=this.threeLayer.distanceToVector3(t[10],t[10]).x,p=this.threeLayer.distanceToVector3(t[11],t[11]).x;Pi.set(c,f,p),Ui.set(t[3],t[4],t[5]),Hi.set(t[6],t[7],t[8]),ji.set(t[9],t[10],t[11]);var g=Li.length(),d=Ni.length(),A=Pi.length(),y=Ui.length(),v=Hi.length(),m=ji.length();if(i.set(g/y,d/v,A/m),this.scale=i,Li.normalize(),Ni.normalize(),Pi.normalize(),0===g&&Li.crossVectors(Ni,Pi),0===d&&Ni.crossVectors(Li,Pi),0===A&&Pi.crossVectors(Li,Ni),n.transform.set(Li.x,Ni.x,Pi.x,t[0],Li.y,Ni.y,Pi.y,t[1],Li.z,Ni.z,Pi.z,t[2],0,0,0,1).premultiply(e),r){r.decompose(zi,qi,Vi);var E=Gi.makeRotationFromQuaternion(qi);n.transform.multiply(E)}var _=Ri.WGS84.cartesianToCartographic([n.transform.elements[12],n.transform.elements[13],n.transform.elements[14]],Fi),I=this.threeLayer.coordinateToVector3([_.x,_.y],_.z),x=this.threeLayer.distanceToVector3(I.z+this.heightOffset,I.z+this.heightOffset).x;n.transform.elements[12]=I.x+this.xOffset,n.transform.elements[13]=I.y+this.yOffset,n.transform.elements[14]=x,n.box.min.set(-g,-d,-A),n.box.max.set(g,d,A),n.update(),this.obb=n}},{key:"setSphereData",value:function(t,e,r,n,i){var o=new THREE.Sphere;o.center.set(t,e,r),o.radius=n,o.applyMatrix4(i),this.sphere=o}},{key:"setRegionData",value:function(t,e,r,n,i,o){var s=new _n(fe,fe,pe,e,n,t,r,i,o),a=new $r;s.getBoundingBox(a.box,a.transform),a.update(),this.region=s,this.regionObb=a}}]),t}(),Xi=Symbol("INITIAL_FRUSTUM_CULLED"),Ji=new THREE.Matrix4,Wi=new THREE.Matrix4,Ki=new THREE.Vector3,Zi=new THREE.Vector3,$i=new THREE.Vector3,to=new THREE.Quaternion,eo=new THREE.Vector3(1,0,0),ro=new THREE.Vector3(0,1,0);function no(t,e){t.traverse((function(t){t.frustumCulled=t[Xi]&&e}))}var io=function(t){u(r,be);var e=f(r);function r(){var t;i(this,r);for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];(t=e.call.apply(e,[this].concat(o))).group=new qr(c(t)),t.cameras=[],t.cameraMap=new Map,t.cameraInfo=[],t.activeTiles=new Set,t.visibleTiles=new Set,t._autoDisableRendererCulling=!0,t.optimizeRaycast=!0,t.onLoadTileSet=null,t.onLoadModel=null,t.onDisposeModel=null,t.onTileVisibilityChange=null;var a=new THREE.LoadingManager;a.setURLModifier((function(e){return t.preprocessURL?t.preprocessURL(e):e})),t.manager=a;var u=c(t);return t._overridenRaycast=function(t,e){u.optimizeRaycast||Object.getPrototypeOf(this).raycast.call(this,t,e)},t}return s(r,[{key:"autoDisableRendererCulling",get:function(){return this._autoDisableRendererCulling},set:function(t){this._autoDisableRendererCulling!==t&&(A(l(r.prototype),"_autoDisableRendererCulling",t,this,!0),this.forEachLoadedModel((function(e){no(e,!t)})))}},{key:"getBounds",value:function(t){if(!this.root)return!1;var e=this.root.cached.boundingVolume;return!e||(e.getAABB(t),!0)}},{key:"getOrientedBounds",value:function(t,e){if(!this.root)return!1;var r=this.root.cached.boundingVolume;return!r||(r.getOBB(t,e),!0)}},{key:"getBoundingSphere",value:function(t){if(!this.root)return!1;var e=this.root.cached.boundingVolume;return!!e&&(e.getSphere(t),!0)}},{key:"forEachLoadedModel",value:function(t){this.traverse((function(e){var r=e.cached.scene;r&&t(r,e)}))}},{key:"raycast",value:function(t,e){if(this.root)if(t.firstHitOnly){var r=Kr(this,this.root,t);r&&e.push(r)}else Zr(this,this.root,t,e)}},{key:"hasCamera",value:function(t){return this.cameraMap.has(t)}},{key:"setCamera",value:function(t){var e=this.cameras,r=this.cameraMap;return!r.has(t)&&(r.set(t,new THREE.Vector2),e.push(t),!0)}},{key:"setResolution",value:function(t,e,r){var n=this.cameraMap;return!!n.has(t)&&(e instanceof THREE.Vector2?n.get(t).copy(e):n.get(t).set(e,r),!0)}},{key:"setResolutionFromRenderer",value:function(t,e){var r=this.cameraMap;if(!r.has(t))return!1;var n=r.get(t);return e.getSize(n),n.multiplyScalar(e.getPixelRatio()),!0}},{key:"deleteCamera",value:function(t){var e=this.cameras,r=this.cameraMap;if(r.has(t)){var n=e.indexOf(t);return e.splice(n,1),r.delete(t),!0}return!1}},{key:"fetchTileSet",value:function(t){for(var e,n=this,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];var a=(e=g(l(r.prototype),"fetchTileSet",this)).call.apply(e,[this,t].concat(o));return a.then((function(e){n.onLoadTileSet&&Promise.resolve().then((function(){n.onLoadTileSet(e,t)}))})),a}},{key:"update",value:function(){var t=this.group,e=this.cameras,n=this.cameraMap,i=this.cameraInfo;if(0!==e.length){for(;i.length>e.length;)i.pop();for(;i.length<e.length;)i.push({frustum:new THREE.Frustum,isOrthographic:!1,sseDenominator:-1,position:new THREE.Vector3,invScale:-1,pixelSize:0});Wi.copy(t.matrixWorld).invert(),Ki.setFromMatrixScale(Wi);var o=Ki.x;Math.abs(Math.max(Ki.x-Ki.y,Ki.x-Ki.z))>1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when calculating screen space error.");for(var s=0,a=i.length;s<a;s++){var u=e[s],h=i[s],c=h.frustum,f=h.position,p=n.get(u);0!==p.width&&0!==p.height||console.warn("TilesRenderer: resolution for camera error calculation is not set.");var d=u.projectionMatrix.elements;if(h.isOrthographic=1===d[15],h.isOrthographic){var A=2/d[0],y=2/d[5];h.pixelSize=Math.max(y/p.height,A/p.width)}else h.sseDenominator=2/d[5]/p.height;h.invScale=o,Ji.copy(t.matrixWorld),Ji.premultiply(u.matrixWorldInverse),Ji.premultiply(u.projectionMatrix),c.setFromProjectionMatrix(Ji),f.set(0,0,0),f.applyMatrix4(u.matrixWorld),f.applyMatrix4(Wi)}g(l(r.prototype),"update",this).call(this)}else console.warn("TilesRenderer: no cameras defined. Cannot update 3d tiles.")}},{key:"preprocessNode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;g(l(r.prototype),"preprocessNode",this).call(this,t,e,n);var i=new THREE.Matrix4;if(t.transform)for(var o=t.transform,s=0;s<16;s++)i.elements[s]=o[s];else i.identity();n&&i.premultiply(n.cached.transform);var a=(new THREE.Matrix4).copy(i).invert(),u=new Yi(this.threeLayer,this.heightOffset,this.xOffset,this.yOffset);"sphere"in t.boundingVolume&&u.setSphereData.apply(u,v(t.boundingVolume.sphere).concat([i])),"box"in t.boundingVolume&&u.setObbData(t.boundingVolume.box,i,a),"region"in t.boundingVolume&&u.setRegionData.apply(u,v(t.boundingVolume.region)),t.cached={loadIndex:0,transform:i,transformInverse:a,active:!1,inFrustum:[],boundingVolume:u,scene:null,geometry:null,material:null}}},{key:"parseTile",value:function(t,e,r){var n=this;e._loadIndex=e._loadIndex||0,e._loadIndex++;var i=e.content.uri.split(/[\\\/]/g);i.pop();var o=i.join("/"),s=this.fetchOptions,a=this.manager,u=e._loadIndex,l=null,h=this.rootTileSet.asset&&this.rootTileSet.asset.gltfUpAxis||"y",c=e.cached,f=c.transform,p=c.boundingVolume.scale,g=c.transformInverse,d=new THREE.Matrix4;switch(h.toLowerCase()){case"x":d.makeRotationAxis(ro,-Math.PI/2);break;case"y":d.makeRotationAxis(eo,Math.PI/2);break;case"z":d.identity()}var A=(Re(t)||r).toLowerCase();switch(A){case"b3dm":var y=new br(a);y.workingPath=o,y.fetchOptions=s,y.adjustmentTransform.copy(d),l=y.parse(t);break;case"pnts":var v=new Tr(a);v.workingPath=o,v.fetchOptions=s,l=v.parse(t);break;case"i3dm":var m=new Or(a);m.workingPath=o,m.fetchOptions=s,m.adjustmentTransform.copy(d),l=m.parse(t);break;case"cmpt":var E=new Gr(a);E.workingPath=o,E.fetchOptions=s,E.adjustmentTransform.copy(d),l=E.parse(t).then((function(t){return t.scene}));break;case"gltf":case"glb":var _=new Hr(a);_.workingPath=o,_.fetchOptions=s,l=_.parse(t);break;default:console.warn('TilesRenderer: Content type "'.concat(A,'" not supported.')),l=Promise.resolve(null)}return l.then((function(t){var r,i;if(t.isObject3D?(r=t,i=null):(r=t.scene,i=t),e._loadIndex===u){r.updateMatrix(),"glb"!==A&&"gltf"!==A||r.matrix.multiply(d),r.matrix.premultiply(f);var o=Ri.WGS84.cartesianToCartographic([r.matrix.elements[12],r.matrix.elements[13],r.matrix.elements[14]],Ki),s=n.threeLayer.coordinateToVector3([o.x,o.y],o.z),a=n.threeLayer.distanceToVector3(s.z+n.heightOffset,s.z+n.heightOffset).x;r.matrix.elements[12]=s.x+n.xOffset,r.matrix.elements[13]=s.y+n.yOffset,r.matrix.elements[14]=a,r.matrix.decompose(r.position,r.quaternion,r.scale),g.decompose(Zi,to,$i),r.applyQuaternion(to),r.scale.copy(p),r.traverse((function(t){t[Xi]=t.frustumCulled})),no(r,!n.autoDisableRendererCulling),r.traverse((function(t){t.raycast=n._overridenRaycast}));var l=[],h=[],y=[];r.traverse((function(t){if(t.geometry&&h.push(t.geometry),t.material){var e=t.material;for(var r in l.push(t.material),e){var n=e[r];n&&n.isTexture&&y.push(n)}}})),c.materials=l,c.geometry=h,c.textures=y,c.scene=r,c.metadata=i,n.onLoadModel&&n.onLoadModel(r,e)}}))}},{key:"disposeTile",value:function(t){var e=t.cached;if(e.scene){for(var r=e.materials,n=e.geometry,i=e.textures,o=e.scene.parent,s=0,a=n.length;s<a;s++)n[s].dispose();for(var u=0,l=r.length;u<l;u++)r[u].dispose();for(var h=0,c=i.length;h<c;h++){i[h].dispose()}o&&o.remove(e.scene),this.onDisposeModel&&this.onDisposeModel(e.scene,t),e.scene=null,e.materials=null,e.textures=null,e.geometry=null,e.metadata=null}this.activeTiles.delete(t),this.visibleTiles.delete(t),t._loadIndex++}},{key:"setTileVisible",value:function(t,e){var r=t.cached.scene,n=this.visibleTiles,i=this.group;e?(i.add(r),n.add(t),r.updateMatrixWorld(!0)):(i.remove(r),n.delete(t)),this.onTileVisibilityChange&&this.onTileVisibilityChange(r,t,e)}},{key:"setTileActive",value:function(t,e){var r=this.activeTiles;e?r.add(t):r.delete(t)}},{key:"calculateError",value:function(t){for(var e=t.cached,r=e.inFrustum,n=this.cameras,i=this.cameraInfo,o=e.boundingVolume,s=-1/0,a=1/0,u=0,l=n.length;u<l;u++)if(r[u]){var h=i[u],c=h.invScale,f=void 0;if(h.isOrthographic){var p=h.pixelSize;f=t.geometricError/(p*c)}else{var g=o.distanceToPoint(h.position)*c,d=h.sseDenominator;f=t.geometricError/(g*d),a=Math.min(a,g)}s=Math.max(s,f)}t.__distanceFromCamera=a,t.__error=s}},{key:"tileInView",value:function(t){for(var e=t.cached,r=e.boundingVolume,n=e.inFrustum,i=this.cameraInfo,o=!1,s=0,a=i.length;s<a;s++){var u=i[s].frustum;r.intersectsFrustum(u)?(o=!0,n[s]=!0):n[s]=!1}return o}}]),r}();new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3;new THREE.Sphere,new hn(fe,fe,pe),new THREE.Matrix4,new THREE.Euler;var oo=new WeakMap,so=function(t){u(n,THREE.Loader);var r=f(n);function n(t){var e;return i(this,n),(e=r.call(this,t)).decoderPath="",e.decoderConfig={},e.decoderBinary=null,e.decoderPending=null,e.workerLimit=4,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},e.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},e}return s(n,[{key:"setDecoderPath",value:function(t){return this.decoderPath=t,this}},{key:"setDecoderConfig",value:function(t){return this.decoderConfig=t,this}},{key:"setWorkerLimit",value:function(t){return this.workerLimit=t,this}},{key:"load",value:function(t,e,r,n){var i=this,o=new THREE.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(t){i.decodeDracoFile(t,e).catch(n)}),r,n)}},{key:"decodeDracoFile",value:function(t,e,r,n){var i={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r};return this.decodeGeometry(t,i).then(e)}},{key:"decodeGeometry",value:function(t,e){var r,n=this,i=JSON.stringify(e);if(oo.has(t)){var o=oo.get(t);if(o.key===i)return o.promise;if(0===t.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var s=this.workerNextTaskID++,a=t.byteLength,u=this._getWorker(s,a).then((function(n){return r=n,new Promise((function(n,i){r._callbacks[s]={resolve:n,reject:i},r.postMessage({type:"decode",id:s,taskConfig:e,buffer:t},[t])}))})).then((function(t){return n._createGeometry(t.geometry)}));return u.catch((function(){return!0})).then((function(){r&&s&&n._releaseTask(r,s)})),oo.set(t,{key:i,promise:u}),u}},{key:"_createGeometry",value:function(t){var e=new THREE.BufferGeometry;t.index&&e.setIndex(new THREE.BufferAttribute(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var n=t.attributes[r],i=n.name,o=n.array,s=n.itemSize;e.setAttribute(i,new THREE.BufferAttribute(o,s))}return e}},{key:"_loadLibrary",value:function(t,e){var r=new THREE.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(e),r.setWithCredentials(this.withCredentials),new Promise((function(e,n){r.load(t,e,void 0,n)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var t=this;if(this.decoderPending)return this.decoderPending;var r="object"!==("undefined"==typeof WebAssembly?"undefined":e(WebAssembly))||"js"===this.decoderConfig.type,n=[];return r?n.push(this._loadLibrary("draco_decoder.js","text")):(n.push(this._loadLibrary("draco_wasm_wrapper.js","text")),n.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(n).then((function(e){var n=e[0];r||(t.decoderConfig.wasmBinary=e[1]);var i=ao.toString(),o=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([o]))})),this.decoderPending}},{key:"_getWorker",value:function(t,e){var r=this;return this._initDecoder().then((function(){if(r.workerPool.length<r.workerLimit){var n=new Worker(r.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:r.decoderConfig}),n.onmessage=function(t){var e=t.data;switch(e.type){case"decode":n._callbacks[e.id].resolve(e);break;case"error":n._callbacks[e.id].reject(e);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+e.type+'"')}},r.workerPool.push(n)}else r.workerPool.sort((function(t,e){return t._taskLoad>e._taskLoad?-1:1}));var i=r.workerPool[r.workerPool.length-1];return i._taskCosts[t]=e,i._taskLoad+=e,i}))}},{key:"_releaseTask",value:function(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(t){return t._taskLoad})))}},{key:"dispose",value:function(){for(var t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this}}]),n}();function ao(){var t,e;function r(t,e,r,n,i,o){var s=o.num_components(),a=r.num_points()*s,u=a*i.BYTES_PER_ELEMENT,l=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32}}(t,i),h=t._malloc(u);e.GetAttributeDataArrayForAllPoints(r,o,l,u,h);var c=new i(t.HEAPF32.buffer,h,a).slice();return t._free(h),{name:n,array:c,itemSize:s}}onmessage=function(n){var i=n.data;switch(i.type){case"init":t=i.decoderConfig,e=new Promise((function(e){t.onModuleLoaded=function(t){e({draco:t})},DracoDecoderModule(t)}));break;case"decode":var o=i.buffer,s=i.taskConfig;e.then((function(t){var e=t.draco,n=new e.Decoder,a=new e.DecoderBuffer;a.Init(new Int8Array(o),o.byteLength);try{var u=function(t,e,n,i){var o,s,a=i.attributeIDs,u=i.attributeTypes,l=e.GetEncodedGeometryType(n);if(l===t.TRIANGULAR_MESH)o=new t.Mesh,s=e.DecodeBufferToMesh(n,o);else{if(l!==t.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new t.PointCloud,s=e.DecodeBufferToPointCloud(n,o)}if(!s.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+s.error_msg());var h={index:null,attributes:[]};for(var c in a){var f=self[u[c]],p=void 0,g=void 0;if(i.useUniqueIDs)g=a[c],p=e.GetAttributeByUniqueId(o,g);else{if(-1===(g=e.GetAttributeId(o,t[a[c]])))continue;p=e.GetAttribute(o,g)}h.attributes.push(r(t,e,o,c,f,p))}l===t.TRIANGULAR_MESH&&(h.index=function(t,e,r){var n=r.num_faces(),i=3*n,o=4*i,s=t._malloc(o);e.GetTrianglesUInt32Array(r,o,s);var a=new Uint32Array(t.HEAPF32.buffer,s,i).slice();return t._free(s),{array:a,itemSize:1}}(t,e,o));return t.destroy(o),h}(e,n,a,s),l=u.attributes.map((function(t){return t.array.buffer}));u.index&&l.push(u.index.array.buffer),self.postMessage({type:"decode",id:i.id,geometry:u},l)}catch(t){console.error(t),self.postMessage({type:"error",id:i.id,error:t.message})}finally{e.destroy(a),e.destroy(n)}}))}}}var uo,lo,ho,co=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4;i(this,t),this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}return s(t,[{key:"_initWorker",value:function(t){if(!this.workers[t]){var e=this.workerCreator();e.addEventListener("message",this._onMessage.bind(this,t)),this.workers[t]=e}}},{key:"_getIdleWorker",value:function(){for(var t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1}},{key:"_onMessage",value:function(t,e){var r=this.workersResolve[t];if(r&&r(e),this.queue.length){var n=this.queue.shift(),i=n.resolve,o=n.msg,s=n.transfer;this.workersResolve[t]=i,this.workers[t].postMessage(o,s)}else this.workerStatus^=1<<t}},{key:"setWorkerCreator",value:function(t){this.workerCreator=t}},{key:"setWorkerLimit",value:function(t){this.pool=t}},{key:"postMessage",value:function(t,e){var r=this;return new Promise((function(n){var i=r._getIdleWorker();-1!==i?(r._initWorker(i),r.workerStatus|=1<<i,r.workersResolve[i]=n,r.workers[i].postMessage(t,e)):r.queue.push({resolve:n,msg:t,transfer:e})}))}},{key:"dispose",value:function(){this.workers.forEach((function(t){return t.terminate()})),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}]),t}(),fo=0,po=2,go=s((function t(){i(this,t),this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null})),Ao=function(){function t(e,r,n,o){i(this,t),this._dataView=new DataView(e.buffer,e.byteOffset+r,n),this._littleEndian=o,this._offset=0}return s(t,[{key:"_nextUint8",value:function(){var t=this._dataView.getUint8(this._offset);return this._offset+=1,t}},{key:"_nextUint16",value:function(){var t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}},{key:"_nextUint32",value:function(){var t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}},{key:"_nextUint64",value:function(){var t=this._dataView.getUint32(this._offset,this._littleEndian)+Math.pow(2,32)*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,t}},{key:"_nextInt32",value:function(){var t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}},{key:"_skip",value:function(t){return this._offset+=t,this}},{key:"_scan",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this._offset,n=0;this._dataView.getUint8(this._offset)!==e&&n<t;)n++,this._offset++;return n<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}}]),t}(),yo=[171,75,84,88,32,50,48,187,13,10,26,10];function vo(t){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(t):Buffer.from(t).toString("utf8")}function mo(t){var e=new Uint8Array(t.buffer,t.byteOffset,yo.length);if(e[0]!==yo[0]||e[1]!==yo[1]||e[2]!==yo[2]||e[3]!==yo[3]||e[4]!==yo[4]||e[5]!==yo[5]||e[6]!==yo[6]||e[7]!==yo[7]||e[8]!==yo[8]||e[9]!==yo[9]||e[10]!==yo[10]||e[11]!==yo[11])throw new Error("Missing KTX 2.0 identifier.");var r=new go,n=17*Uint32Array.BYTES_PER_ELEMENT,i=new Ao(t,yo.length,n,!0);r.vkFormat=i._nextUint32(),r.typeSize=i._nextUint32(),r.pixelWidth=i._nextUint32(),r.pixelHeight=i._nextUint32(),r.pixelDepth=i._nextUint32(),r.layerCount=i._nextUint32(),r.faceCount=i._nextUint32();var o=i._nextUint32();r.supercompressionScheme=i._nextUint32();for(var s=i._nextUint32(),a=i._nextUint32(),u=i._nextUint32(),l=i._nextUint32(),h=i._nextUint64(),c=i._nextUint64(),f=new Ao(t,yo.length+n,3*o*8,!0),p=0;p<o;p++)r.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+f._nextUint64(),f._nextUint64()),uncompressedByteLength:f._nextUint64()});for(var g=new Ao(t,s,a,!0),d={vendorId:g._skip(4)._nextUint16(),descriptorType:g._nextUint16(),versionNumber:g._nextUint16(),descriptorBlockSize:g._nextUint16(),colorModel:g._nextUint8(),colorPrimaries:g._nextUint8(),transferFunction:g._nextUint8(),flags:g._nextUint8(),texelBlockDimension:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],bytesPlane:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],samples:[]},A=(d.descriptorBlockSize/4-6)/4,y=0;y<A;y++){var v={bitOffset:g._nextUint16(),bitLength:g._nextUint8(),channelType:g._nextUint8(),samplePosition:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&v.channelType?(v.sampleLower=g._nextInt32(),v.sampleUpper=g._nextInt32()):(v.sampleLower=g._nextUint32(),v.sampleUpper=g._nextUint32()),d.samples[y]=v}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(d);for(var m=new Ao(t,u,l,!0);m._offset<l;){var E=m._nextUint32(),_=m._scan(E),I=vo(_),x=m._scan(E-_.byteLength);r.keyValue[I]=I.match(/^ktx/i)?vo(x):x,m._offset%4&&m._skip(4-m._offset%4)}if(c<=0)return r;for(var C=new Ao(t,h,c,!0),w=C._nextUint16(),b=C._nextUint16(),B=C._nextUint32(),S=C._nextUint32(),T=C._nextUint32(),M=C._nextUint32(),R=[],L=0;L<o;L++)R.push({imageFlags:C._nextUint32(),rgbSliceByteOffset:C._nextUint32(),rgbSliceByteLength:C._nextUint32(),alphaSliceByteOffset:C._nextUint32(),alphaSliceByteLength:C._nextUint32()});var N=h+C._offset,P=N+B,k=P+S,D=k+T,Q=new Uint8Array(t.buffer,t.byteOffset+N,B),O=new Uint8Array(t.buffer,t.byteOffset+P,S),F=new Uint8Array(t.buffer,t.byteOffset+k,T),G=new Uint8Array(t.buffer,t.byteOffset+D,M);return r.globalData={endpointCount:w,selectorCount:b,imageDescs:R,endpointsData:Q,selectorsData:O,tablesData:F,extendedData:G},r}var Eo,_o,Io,xo,Co={env:{emscripten_notify_memory_growth:function(t){ho=new Uint8Array(lo.exports.memory.buffer)}}},wo=function(){function t(){i(this,t)}return s(t,[{key:"init",value:function(){return uo||(uo="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+bo).then((function(t){return t.arrayBuffer()})).then((function(t){return WebAssembly.instantiate(t,Co)})).then(this._init):WebAssembly.instantiate(Buffer.from(bo,"base64"),Co).then(this._init))}},{key:"_init",value:function(t){lo=t.instance,Co.env.emscripten_notify_memory_growth(0)}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!lo)throw new Error("ZSTDDecoder: Await .init() before decoding.");var r=t.byteLength,n=lo.exports.malloc(r);ho.set(t,n),e=e||Number(lo.exports.ZSTD_findDecompressedSize(n,r));var i=lo.exports.malloc(e),o=lo.exports.ZSTD_decompress(i,e,n,r),s=ho.slice(i,i+o);return lo.exports.free(n),lo.exports.free(i),s}}]),t}(),bo="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgw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IQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE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AAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAg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0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcg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IAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAF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Qn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgA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hQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",Bo=new WeakMap,So=0,To=function(e){u(a,THREE.Loader);var r,o=f(a);function a(t){var e;return i(this,a),(e=o.call(this,t)).transcoderPath="",e.transcoderBinary=null,e.transcoderPending=null,e.workerPool=new co,e.workerSourceURL="",e.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.'),e}return s(a,[{key:"setTranscoderPath",value:function(t){return this.transcoderPath=t,this}},{key:"setWorkerLimit",value:function(t){return this.workerPool.setWorkerLimit(t),this}},{key:"detectSupport",value:function(t){return this.workerConfig={astcSupported:t.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:t.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:t.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:t.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:t.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:t.extensions.has("WEBGL_compressed_texture_pvrtc")||t.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},t.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1),this}},{key:"init",value:function(){var t=this;if(!this.transcoderPending){var e=new THREE.FileLoader(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);var r=e.loadAsync("basis_transcoder.js"),n=new THREE.FileLoader(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);var i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([r,i]).then((function(e){var r=y(e,2),n=r[0],i=r[1],o=a.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(a.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(a.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(a.BasisFormat),"/* basis_transcoder.js */",n,"/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([s])),t.transcoderBinary=i,t.workerPool.setWorkerCreator((function(){var e=new Worker(t.workerSourceURL),r=t.transcoderBinary.slice(0);return e.postMessage({type:"init",config:t.workerConfig,transcoderBinary:r},[r]),e}))})),So>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),So++}return this.transcoderPending}},{key:"load",value:function(t,e,r,n){var i=this;if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");var o=new THREE.FileLoader(this.manager);o.setResponseType("arraybuffer"),o.setWithCredentials(this.withCredentials),o.load(t,(function(t){if(Bo.has(t))return Bo.get(t).promise.then(e).catch(n);i._createTexture(t).then((function(t){return e?e(t):null})).catch(n)}),r,n)}},{key:"_createTextureFrom",value:function(t,e){var r=t.mipmaps,n=t.width,i=t.height,o=t.format,s=t.type,a=t.error,u=t.dfdTransferFn,l=t.dfdFlags;if("error"===s)return Promise.reject(a);var h=e.layerCount>1?new THREE.CompressedArrayTexture(r,n,i,e.layerCount,o,THREE.UnsignedByteType):new THREE.CompressedTexture(r,n,i,o,THREE.UnsignedByteType);return h.minFilter=1===r.length?THREE.LinearFilter:THREE.LinearMipmapLinearFilter,h.magFilter=THREE.LinearFilter,h.generateMipmaps=!1,h.needsUpdate=!0,h.encoding=2===u?THREE.sRGBEncoding:THREE.LinearEncoding,h.premultiplyAlpha=!!(1&l),h}},{key:"_createTexture",value:(r=n(t().mark((function e(r){var n,i,o,s,a=this,u=arguments;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=u.length>1&&void 0!==u[1]?u[1]:{},0===(i=mo(new Uint8Array(r))).vkFormat){t.next=4;break}return t.abrupt("return",No(i));case 4:return o=n,s=this.init().then((function(){return a.workerPool.postMessage({type:"transcode",buffer:r,taskConfig:o},[r])})).then((function(t){return a._createTextureFrom(t.data,i)})),Bo.set(r,{promise:s}),t.abrupt("return",s);case 8:case"end":return t.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"dispose",value:function(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),So--,this}}]),a}();To.BasisFormat={ETC1S:0,UASTC_4x4:1},To.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},To.EngineFormat={RGBAFormat:THREE.RGBAFormat,RGBA_ASTC_4x4_Format:THREE.RGBA_ASTC_4x4_Format,RGBA_BPTC_Format:THREE.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:THREE.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:THREE.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:THREE.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:THREE.RGB_ETC1_Format,RGB_ETC2_Format:THREE.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:THREE.RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format:THREE.RGB_S3TC_DXT1_Format},To.BasisWorker=function(){var t,e,r,n=_EngineFormat,i=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",(function(s){var c,f=s.data;switch(f.type){case"init":t=f.config,c=f.transcoderBinary,e=new Promise((function(t){r={wasmBinary:c,onRuntimeInitialized:t},BASIS(r)})).then((function(){r.initializeBasis(),void 0===r.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}));break;case"transcode":e.then((function(){try{for(var e=function(e){var s=new r.KTX2File(new Uint8Array(e));function c(){s.close(),s.delete()}if(!s.isValid())throw c(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");var f=s.isUASTC()?o.UASTC_4x4:o.ETC1S,p=s.getWidth(),g=s.getHeight(),d=s.getLayers()||1,A=s.getLevels(),y=s.getHasAlpha(),v=s.getDFDTransferFunc(),m=s.getDFDFlags(),E=function(e,r,s,h){for(var c,f,p=e===o.ETC1S?a:u,g=0;g<p.length;g++){var d=p[g];if(t[d.if]&&(d.basisFormat.includes(e)&&!(h&&d.transcoderFormat.length<2)&&(!d.needsPowerOfTwo||l(r)&&l(s))))return{transcoderFormat:c=d.transcoderFormat[h?1:0],engineFormat:f=d.engineFormat[h?1:0]}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),c=i.RGBA32,f=n.RGBAFormat,{transcoderFormat:c,engineFormat:f}}(f,p,g,y),_=E.transcoderFormat,I=E.engineFormat;if(!p||!g||!A)throw c(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!s.startTranscoding())throw c(),new Error("THREE.KTX2Loader: .startTranscoding failed");for(var x=[],C=0;C<A;C++){for(var w=[],b=void 0,B=void 0,S=0;S<d;S++){var T=s.getImageLevelInfo(C,S,0);b=T.origWidth,B=T.origHeight;var M=new Uint8Array(s.getImageTranscodedSizeInBytes(C,S,0,_));if(!s.transcodeImage(M,C,S,0,_,0,-1,-1))throw c(),new Error("THREE.KTX2Loader: .transcodeImage failed.");w.push(M)}x.push({data:h(w),width:b,height:B})}return c(),{width:p,height:g,hasAlpha:y,mipmaps:x,format:I,dfdTransferFn:v,dfdFlags:m}}(f.buffer),s=e.width,c=e.height,p=e.hasAlpha,g=e.mipmaps,d=e.format,A=e.dfdTransferFn,y=e.dfdFlags,v=[],m=0;m<g.length;++m)v.push(g[m].data.buffer);self.postMessage({type:"transcode",id:f.id,width:s,height:c,hasAlpha:p,mipmaps:g,format:d,dfdTransferFn:A,dfdFlags:y},v)}catch(t){console.error(t),self.postMessage({type:"error",id:f.id,error:t.message})}}))}}));var s=[{if:"astcSupported",basisFormat:[o.UASTC_4x4],transcoderFormat:[i.ASTC_4x4,i.ASTC_4x4],engineFormat:[n.RGBA_ASTC_4x4_Format,n.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.BC7_M5,i.BC7_M5],engineFormat:[n.RGBA_BPTC_Format,n.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.BC1,i.BC3],engineFormat:[n.RGB_S3TC_DXT1_Format,n.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.ETC1,i.ETC2],engineFormat:[n.RGB_ETC2_Format,n.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.ETC1],engineFormat:[n.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.PVRTC1_4_RGB,i.PVRTC1_4_RGBA],engineFormat:[n.RGB_PVRTC_4BPPV1_Format,n.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],a=s.sort((function(t,e){return t.priorityETC1S-e.priorityETC1S})),u=s.sort((function(t,e){return t.priorityUASTC-e.priorityUASTC}));function l(t){return t<=2||0==(t&t-1)&&0!==t}function h(t){var e,r=0,n=_(t);try{for(n.s();!(e=n.n()).done;){r+=e.value.byteLength}}catch(t){n.e(t)}finally{n.f()}var i,o=new Uint8Array(r),s=0,a=_(t);try{for(a.s();!(i=a.n()).done;){var u=i.value;o.set(u,s),s+=u.byteLength}}catch(t){a.e(t)}finally{a.f()}return o}};var Mo=(a(Eo={},109,THREE.RGBAFormat),a(Eo,97,THREE.RGBAFormat),a(Eo,37,THREE.RGBAFormat),a(Eo,43,THREE.RGBAFormat),a(Eo,103,THREE.RGFormat),a(Eo,83,THREE.RGFormat),a(Eo,16,THREE.RGFormat),a(Eo,22,THREE.RGFormat),a(Eo,100,THREE.RedFormat),a(Eo,76,THREE.RedFormat),a(Eo,15,THREE.RedFormat),a(Eo,9,THREE.RedFormat),Eo),Ro=(a(_o={},109,THREE.FloatType),a(_o,97,THREE.HalfFloatType),a(_o,37,THREE.UnsignedByteType),a(_o,43,THREE.UnsignedByteType),a(_o,103,THREE.FloatType),a(_o,83,THREE.HalfFloatType),a(_o,16,THREE.UnsignedByteType),a(_o,22,THREE.UnsignedByteType),a(_o,100,THREE.FloatType),a(_o,76,THREE.HalfFloatType),a(_o,15,THREE.UnsignedByteType),a(_o,9,THREE.UnsignedByteType),_o),Lo=(a(Io={},43,THREE.sRGBEncoding),a(Io,22,THREE.sRGBEncoding),a(Io,15,THREE.sRGBEncoding),Io);function No(t){return Po.apply(this,arguments)}function Po(){return Po=n(t().mark((function e(r){var i,o,s,a,u,l,h,c;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=r.vkFormat,o=r.pixelWidth,s=r.pixelHeight,a=r.pixelDepth,void 0!==Mo[i]){e.next=3;break}throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");case 3:if(u=r.levels[0],r.supercompressionScheme!==fo){e.next=8;break}l=u.levelData,e.next=16;break;case 8:if(r.supercompressionScheme!==po){e.next=15;break}return xo||(xo=new Promise(function(){var e=n(t().mark((function e(r){var n;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new wo,t.next=3,n.init();case 3:r(n);case 4:case"end":return t.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())),e.next=12,xo;case 12:l=e.sent.decode(u.levelData,u.uncompressedByteLength),e.next=16;break;case 15:throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");case 16:return h=Ro[i]===THREE.FloatType?new Float32Array(l.buffer,l.byteOffset,l.byteLength/Float32Array.BYTES_PER_ELEMENT):Ro[i]===THREE.HalfFloatType?new Uint16Array(l.buffer,l.byteOffset,l.byteLength/Uint16Array.BYTES_PER_ELEMENT):l,(c=0===a?new THREE.DataTexture(h,o,s):new THREE.Data3DTexture(h,o,s,a)).type=Ro[i],c.format=Mo[i],c.encoding=Lo[i]||THREE.LinearEncoding,c.needsUpdate=!0,e.abrupt("return",Promise.resolve(c));case 23:case"end":return e.stop()}}),e)}))),Po.apply(this,arguments)}var ko={altitude:0},Do=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n){var o;return i(this,r),(o=e.call(this))._initOptions(ko),o.object3d=t,o.object3d.__parent=c(o),o._raycaster=new THREE.Raycaster,o._mouse=new THREE.Vector2,o.camera=n,o.selectMesh=null,o}return s(r,[{key:"getSelectMesh",value:function(){return this.selectMesh}},{key:"identify",value:function(t){var e=this.getMap().coordToContainerPoint(t),r=e.x,n=e.y,i=this._raycaster,o=this._mouse,s=this.camera,a=this.getMap().getSize(),u=a.width,l=a.height;o.x=r/u*2-1,o.y=-n/l*2+1,i.setFromCamera(o,s);var h=i.intersectObject(this.object3d,!0);return h.length?(this.selectMesh=h[0],!0):(this.selectMesh=null,!1)}}]),r}(),Qo=6,Oo=!1,Fo=!1,Go=0,Uo=function(){function t(e,r,n,o){var s=this;i(this,t),this.threelayer=n,this.map=n.map,this.layerClass=o,this.statsUpdate=r.statsUpdate;var a=n.getScene(),u=n.getRenderer().context;u.outputEncoding=THREE.sRGBEncoding;var l=n.getCamera();this.scene=a,this.renderer=u,this.camera=l,this.multiles=[],this.meshs=[];var h=new so;h.setDecoderPath(r.decoderPath);var c=new To;c.setTranscoderPath(r.transcoderPath),c.detectSupport(u),e.forEach((function(t){var e=new io(t.url,n);if(e.errorTarget=Qo,e.displayBoxBounds=Oo,e.displaySphereBounds=Fo,e.colorMode=parseFloat(Go),e.heightOffset=t.heightOffset||0,e.xOffset=t.xOffset||0,e.yOffset=t.yOffset||0,e.setCamera(l),e.setResolutionFromRenderer(l,u),s.multiles.length>0){var r=s.multiles[0];e.lruCache=r.lruCache,e.downloadQueue=r.downloadQueue}e.fetchOptions.mode="cors";var i=new Ne(e.manager);i.setDRACOLoader(h),i.setKTX2Loader(c),e.manager.addHandler(/\.gltf$/,i);var o=new Do(e.group,l);s.meshs.push(o),s.multiles.push(e)})),this.threelayer.addMesh(this.meshs),this.layerClass.updatables.push(this),this._bindMapEvents()}return s(t,[{key:"tick",value:function(t){this.multiles.forEach((function(t){t.update()})),this.statsUpdate&&this.statsUpdate()}},{key:"_bindMapEvents",value:function(){var t=this;this.meshs.forEach((function(e){e.on("click empty mousemove mouseout",t._setPointEvent,t)}))}},{key:"_setPointEvent",value:function(t){var e=t.selectMesh;if("click"===t.type&&e){console.log(e);var r=e.object;if(r.geometry.getAttribute("_batchid")){for(var n=r;!n.batchTable;)n=n.parent;var i=n.batchTable;console.log(i.header)}}}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.threelayer.removeMesh(this.meshs),this.multiles.forEach((function(t){t.dispose()})),this.removeAnimation()}}]),t}(),Ho={radius:100,altitude:0},jo=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),o=maptalks.Util.extend({},Ho,o,{layer:s,coordinate:t}),(a=e.call(this))._initOptions(o);var u=o.altitude;a._createGroup(),a.getObject3d().add(n);var l=s.distanceToVector3(u,u).x,h=s.coordinateToVector3(t,l);return a.getObject3d().position.copy(h),a}return s(r)}(),qo=function(){function e(t,r,n){i(this,e),this.threeLayer=r,this.groupId=n;var o=new THREE.LoadingManager,s=new Ne(o),a=new so(o);a.setDecoderPath(t),s.setDRACOLoader(a),o.addHandler(/\.gltf$/,s),o.addHandler(/\.glb$/,s),this.loader=new Hr(o)}var r;return s(e,[{key:"addModel",value:(r=n(t().mark((function e(r,n,i){var o,s,a=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loader.workingPath=this.loader.workingPathForURL(r),t.next=3,this.loader.load(r);case 3:return o=t.sent,(s=new jo([parseFloat(n.longitude),parseFloat(n.latitude)],o.scene,i,this.threeLayer)).setProperties(n),this.groupId?this.threeLayer.addMesh1(s,this.groupId):this.threeLayer.addMesh(s),this.clickFunc=i.clickFunc,this.model=s,i.zoomChange&&(this.model.zoomChange=function(){i.zoomChange(a.model)}),this._bindMapEvents(),t.abrupt("return",this);case 12:case"end":return t.stop()}}),e,this)}))),function(t,e,n){return r.apply(this,arguments)})},{key:"_bindMapEvents",value:function(){this.model&&this.model.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.model&&this.model.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setPointEvent",value:function(t){var e=t.target.getProperties();"click"===t.type&&e&&this.clickFunc&&this.clickFunc(e)}},{key:"hide",value:function(){this.model.hide()}},{key:"show",value:function(){this.model.show()}},{key:"dispose",value:function(){if(this._closeEvent(),this.model){this.groupId?this.threeLayer.removeMesh1(this.model,this.groupId):this.threeLayer.removeMesh(this.model);var t=this.model.object3d.children[0];t.traverse((function(e){"Mesh"===e.type&&(e.geometry.dispose(),e.material.dispose(),t.remove(e))}))}}}]),e}(),Vo=function(t){u(r,THREE.Group);var e=f(r);function r(t,n){var o;return i(this,r),(o=e.call(this)).name=n,o.customId=B(),t.add(c(o)),o.customType="layer",o}return s(r)}(),zo=function(t){return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};try{URL.revokeObjectURL(zo(""))}catch(t){zo=function(t){return"data:application/javascript;charset=UTF-8,"+encodeURI(t)}}var Yo=Uint8Array,Xo=Uint16Array,Jo=Uint32Array,Wo=new Yo([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,0,0,0]),Ko=new Yo([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,0,0]),Zo=new Yo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$o=function(t,e){for(var r=new Xo(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];var i=new Jo(r[30]);for(n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return[r,i]},ts=$o(Wo,2),es=ts[0],rs=ts[1];es[28]=258,rs[258]=28;for(var ns=$o(Ko,0)[0],is=new Xo(32768),os=0;os<32768;++os){var ss=(43690&os)>>>1|(21845&os)<<1;ss=(61680&(ss=(52428&ss)>>>2|(13107&ss)<<2))>>>4|(3855&ss)<<4,is[os]=((65280&ss)>>>8|(255&ss)<<8)>>>1}var as=function(t,e,r){for(var n=t.length,i=0,o=new Xo(e);i<n;++i)++o[t[i]-1];var s,a=new Xo(e);for(i=0;i<e;++i)a[i]=a[i-1]+o[i-1]<<1;if(r){s=new Xo(1<<e);var u=15-e;for(i=0;i<n;++i)if(t[i])for(var l=i<<4|t[i],h=e-t[i],c=a[t[i]-1]++<<h,f=c|(1<<h)-1;c<=f;++c)s[is[c]>>>u]=l}else for(s=new Xo(n),i=0;i<n;++i)t[i]&&(s[i]=is[a[t[i]-1]++]>>>15-t[i]);return s},us=new Yo(288);for(os=0;os<144;++os)us[os]=8;for(os=144;os<256;++os)us[os]=9;for(os=256;os<280;++os)us[os]=7;for(os=280;os<288;++os)us[os]=8;var ls=new Yo(32);for(os=0;os<32;++os)ls[os]=5;var hs=as(us,9,1),cs=as(ls,5,1),fs=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},ps=function(t,e,r){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(7&e)&r},gs=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(7&e)},ds=function(t){return(t/8|0)+(7&t&&1)},As=function(t,e,r){var n=t.length;if(!n||r&&!r.l&&n<5)return e||new Yo(0);var i=!e||r,o=!r||r.i;r||(r={}),e||(e=new Yo(3*n));var s=function(t){var r=e.length;if(t>r){var n=new Yo(Math.max(2*r,t));n.set(e),e=n}},a=r.f||0,u=r.p||0,l=r.b||0,h=r.l,c=r.d,f=r.m,p=r.n,g=8*n;do{if(!h){r.f=a=ps(t,u,1);var d=ps(t,u+1,3);if(u+=3,!d){var A=t[(B=ds(u)+4)-4]|t[B-3]<<8,y=B+A;if(y>n){if(o)throw"unexpected EOF";break}i&&s(l+A),e.set(t.subarray(B,y),l),r.b=l+=A,r.p=u=8*y;continue}if(1==d)h=hs,c=cs,f=9,p=5;else{if(2!=d)throw"invalid block type";var v=ps(t,u,31)+257,m=ps(t,u+10,15)+4,E=v+ps(t,u+5,31)+1;u+=14;for(var _=new Yo(E),I=new Yo(19),x=0;x<m;++x)I[Zo[x]]=ps(t,u+3*x,7);u+=3*m;var C=fs(I),w=(1<<C)-1,b=as(I,C,1);for(x=0;x<E;){var B,S=b[ps(t,u,w)];if(u+=15&S,(B=S>>>4)<16)_[x++]=B;else{var T=0,M=0;for(16==B?(M=3+ps(t,u,3),u+=2,T=_[x-1]):17==B?(M=3+ps(t,u,7),u+=3):18==B&&(M=11+ps(t,u,127),u+=7);M--;)_[x++]=T}}var R=_.subarray(0,v),L=_.subarray(v);f=fs(R),p=fs(L),h=as(R,f,1),c=as(L,p,1)}if(u>g){if(o)throw"unexpected EOF";break}}i&&s(l+131072);for(var N=(1<<f)-1,P=(1<<p)-1,k=u;;k=u){var D=(T=h[gs(t,u)&N])>>>4;if((u+=15&T)>g){if(o)throw"unexpected EOF";break}if(!T)throw"invalid length/literal";if(D<256)e[l++]=D;else{if(256==D){k=u,h=null;break}var Q=D-254;if(D>264){var O=Wo[x=D-257];Q=ps(t,u,(1<<O)-1)+es[x],u+=O}var F=c[gs(t,u)&P],G=F>>>4;if(!F)throw"invalid distance";u+=15&F;L=ns[G];if(G>3){O=Ko[G];L+=gs(t,u)&(1<<O)-1,u+=O}if(u>g){if(o)throw"unexpected EOF";break}i&&s(l+131072);for(var U=l+Q;l<U;l+=4)e[l]=e[l-L],e[l+1]=e[l+1-L],e[l+2]=e[l+2-L],e[l+3]=e[l+3-L];l=U}}r.l=h,r.p=k,r.b=l,h&&(a=1,r.m=f,r.d=c,r.n=p)}while(!a);return l==e.length?e:function(t,e,r){(null==e||e<0)&&(e=0),(null==r||r>t.length)&&(r=t.length);var n=new(t instanceof Xo?Xo:t instanceof Jo?Jo:Yo)(r-e);return n.set(t.subarray(e,r)),n}(e,0,l)},ys=new Yo(0);var vs="undefined"!=typeof TextDecoder&&new TextDecoder;try{vs.decode(ys,{stream:!0}),1}catch(t){}function ms(t,e,r){var n=r.length-t-1;if(e>=r[n])return n-1;if(e<=r[t])return t;for(var i=t,o=n,s=Math.floor((i+o)/2);e<r[s]||e>=r[s+1];)e<r[s]?o=s:i=s,s=Math.floor((i+o)/2);return s}function Es(t,e){for(var r=1,n=2;n<=t;++n)r*=n;for(var i=1,o=2;o<=e;++o)i*=o;for(var s=2;s<=t-e;++s)i*=s;return r/i}function _s(t,e,r,n,i){var o=function(t,e,r,n,i){for(var o=i<t?i:t,s=[],a=ms(t,n,e),u=function(t,e,r,n,i){for(var o=[],s=0;s<=r;++s)o[s]=0;for(var a=[],u=0;u<=n;++u)a[u]=o.slice(0);for(var l=[],h=0;h<=r;++h)l[h]=o.slice(0);l[0][0]=1;for(var c=o.slice(0),f=o.slice(0),p=1;p<=r;++p){c[p]=e-i[t+1-p],f[p]=i[t+p]-e;for(var g=0,d=0;d<p;++d){var A=f[d+1],y=c[p-d];l[p][d]=A+y;var v=l[d][p-1]/l[p][d];l[d][p]=g+A*v,g=y*v}l[p][p]=g}for(var m=0;m<=r;++m)a[0][m]=l[m][r];for(var E=0;E<=r;++E){for(var _=0,I=1,x=[],C=0;C<=r;++C)x[C]=o.slice(0);x[0][0]=1;for(var w=1;w<=n;++w){var b=0,B=E-w,S=r-w;E>=w&&(x[I][0]=x[_][0]/l[S+1][B],b=x[I][0]*l[B][S]);for(var T=E-1<=S?w-1:r-E,M=B>=-1?1:-B;M<=T;++M)x[I][M]=(x[_][M]-x[_][M-1])/l[S+1][B+M],b+=x[I][M]*l[B+M][S];E<=S&&(x[I][w]=-x[_][w-1]/l[S+1][E],b+=x[I][w]*l[E][S]),a[w][E]=b;var R=_;_=I,I=R}}for(var L=r,N=1;N<=n;++N){for(var P=0;P<=r;++P)a[N][P]*=L;L*=r-N}return a}(a,n,t,o,e),l=[],h=0;h<r.length;++h){var c=r[h].clone(),f=c.w;c.x*=f,c.y*=f,c.z*=f,l[h]=c}for(var p=0;p<=o;++p){for(var g=l[a-t].clone().multiplyScalar(u[p][0]),d=1;d<=t;++d)g.add(l[a-t+d].clone().multiplyScalar(u[p][d]));s[p]=g}for(var A=o+1;A<=i+1;++A)s[A]=new THREE.Vector4(0,0,0);return s}(t,e,r,n,i);return function(t){for(var e=t.length,r=[],n=[],i=0;i<e;++i){var o=t[i];r[i]=new THREE.Vector3(o.x,o.y,o.z),n[i]=o.w}for(var s=[],a=0;a<e;++a){for(var u=r[a].clone(),l=1;l<=a;++l)u.sub(s[a-l].clone().multiplyScalar(Es(a,l)*n[l]));s[a]=u.divideScalar(n[0])}return s}(o)}var Is,xs,Cs,ws=function(t){u(r,THREE.Curve);var e=f(r);function r(t,n,o,s,a){var u;i(this,r),(u=e.call(this)).degree=t,u.knots=n,u.controlPoints=[],u.startKnot=s||0,u.endKnot=a||u.knots.length-1;for(var l=0;l<o.length;++l){var h=o[l];u.controlPoints[l]=new THREE.Vector4(h.x,h.y,h.z,h.w)}return u}return s(r,[{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new THREE.Vector3,r=this.knots[this.startKnot]+t*(this.knots[this.endKnot]-this.knots[this.startKnot]),n=function(t,e,r,n){for(var i=ms(t,n,e),o=function(t,e,r,n){var i=[],o=[],s=[];i[0]=1;for(var a=1;a<=r;++a){o[a]=e-n[t+1-a],s[a]=n[t+a]-e;for(var u=0,l=0;l<a;++l){var h=s[l+1],c=o[a-l],f=i[l]/(h+c);i[l]=u+h*f,u=c*f}i[a]=u}return i}(i,n,t,e),s=new THREE.Vector4(0,0,0,0),a=0;a<=t;++a){var u=r[i-t+a],l=o[a],h=u.w*l;s.x+=u.x*h,s.y+=u.y*h,s.z+=u.z*h,s.w+=u.w*l}return s}(this.degree,this.knots,this.controlPoints,r);return 1!==n.w&&n.divideScalar(n.w),e.set(n.x,n.y,n.z)}},{key:"getTangent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new THREE.Vector3,r=this.knots[0]+t*(this.knots[this.knots.length-1]-this.knots[0]),n=_s(this.degree,this.knots,this.controlPoints,r,1);return e.copy(n[1]).normalize(),e}}]),r}(),bs=function(t){u(r,THREE.Loader);var e=f(r);function r(t){return i(this,r),e.call(this,t)}return s(r,[{key:"load",value:function(t,e,r,n){var i=this,o=""===i.path?THREE.LoaderUtils.extractUrlBase(t):i.path,s=new THREE.FileLoader(this.manager);s.setPath(i.path),s.setResponseType("arraybuffer"),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(t,(function(r){try{e(i.parse(r,o))}catch(e){n?n(e):console.error(e),i.manager.itemError(t)}}),r,n)}},{key:"parse",value:function(t,e){if(function(t){var e="Kaydara FBX Binary \0";return t.byteLength>=e.length&&e===js(t,0,e.length)}(t))Is=(new Rs).parse(t);else{var r=js(t);if(!function(t){var e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0;function n(e){var n=t[e-1];return t=t.slice(r+e),r++,n}for(var i=0;i<e.length;++i){if(n(1)===e[i])return!1}return!0}(r))throw new Error("THREE.FBXLoader: Unknown format.");if(Ps(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Ps(r));Is=(new Ms).parse(r)}var n=new THREE.TextureLoader(this.manager).setPath(this.resourcePath||e).setCrossOrigin(this.crossOrigin);return new Bs(n,this.manager).parse(Is)}}]),r}(),Bs=function(){function t(e,r){i(this,t),this.textureLoader=e,this.manager=r}return s(t,[{key:"parse",value:function(){xs=this.parseConnections();var t=this.parseImages(),e=this.parseTextures(t),r=this.parseMaterials(e),n=this.parseDeformers(),i=(new Ss).parse(n);return this.parseScene(n,i,r),Cs}},{key:"parseConnections",value:function(){var t=new Map;"Connections"in Is&&Is.Connections.connections.forEach((function(e){var r=e[0],n=e[1],i=e[2];t.has(r)||t.set(r,{parents:[],children:[]});var o={ID:n,relationship:i};t.get(r).parents.push(o),t.has(n)||t.set(n,{parents:[],children:[]});var s={ID:r,relationship:i};t.get(n).children.push(s)}));return t}},{key:"parseImages",value:function(){var t={},e={};if("Video"in Is.Objects){var r=Is.Objects.Video;for(var n in r){var i=r[n];if(t[parseInt(n)]=i.RelativeFilename||i.Filename,"Content"in i){var o=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,s="string"==typeof i.Content&&""!==i.Content;if(o||s){var a=this.parseImage(r[n]);e[i.RelativeFilename||i.Filename]=a}}}}for(var u in t){var l=t[u];void 0!==e[l]?t[u]=e[l]:t[u]=t[u].split("\\").pop()}return t}},{key:"parseImage",value:function(t){var e,r=t.Content,n=t.RelativeFilename||t.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":e="image/bmp";break;case"jpg":case"jpeg":e="image/jpeg";break;case"png":e="image/png";break;case"tif":e="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),e="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof r)return"data:"+e+";base64,"+r;var o=new Uint8Array(r);return window.URL.createObjectURL(new Blob([o],{type:e}))}},{key:"parseTextures",value:function(t){var e=new Map;if("Texture"in Is.Objects){var r=Is.Objects.Texture;for(var n in r){var i=this.parseTexture(r[n],t);e.set(parseInt(n),i)}}return e}},{key:"parseTexture",value:function(t,e){var r=this.loadTexture(t,e);r.ID=t.id,r.name=t.attrName;var n=t.WrapModeU,i=t.WrapModeV,o=void 0!==n?n.value:0,s=void 0!==i?i.value:0;if(r.wrapS=0===o?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,r.wrapT=0===s?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,"Scaling"in t){var a=t.Scaling.value;r.repeat.x=a[0],r.repeat.y=a[1]}if("Translation"in t){var u=t.Translation.value;r.offset.x=u[0],r.offset.y=u[1]}return r}},{key:"loadTexture",value:function(t,e){var r,n,i=this.textureLoader.path,o=xs.get(t.id).children;void 0!==o&&o.length>0&&void 0!==e[o[0].ID]&&(0!==(r=e[o[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0));var s=t.FileName.slice(-3).toLowerCase();if("tga"===s){var a=this.manager.getHandler(".tga");null===a?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),n=new THREE.Texture):(a.setPath(this.textureLoader.path),n=a.load(r))}else"psd"===s?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),n=new THREE.Texture):n=this.textureLoader.load(r);return this.textureLoader.setPath(i),n}},{key:"parseMaterials",value:function(t){var e=new Map;if("Material"in Is.Objects){var r=Is.Objects.Material;for(var n in r){var i=this.parseMaterial(r[n],t);null!==i&&e.set(parseInt(n),i)}}return e}},{key:"parseMaterial",value:function(t,r){var n=t.id,i=t.attrName,o=t.ShadingModel;if("object"===e(o)&&(o=o.value),!xs.has(n))return null;var s,a=this.parseParameters(t,r,n);switch(o.toLowerCase()){case"phong":s=new THREE.MeshPhongMaterial;break;case"lambert":s=new THREE.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),s=new THREE.MeshPhongMaterial}return s.setValues(a),s.name=i,s}},{key:"parseParameters",value:function(t,e,r){var n={};t.BumpFactor&&(n.bumpScale=t.BumpFactor.value),t.Diffuse?n.color=(new THREE.Color).fromArray(t.Diffuse.value):!t.DiffuseColor||"Color"!==t.DiffuseColor.type&&"ColorRGB"!==t.DiffuseColor.type||(n.color=(new THREE.Color).fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(n.displacementScale=t.DisplacementFactor.value),t.Emissive?n.emissive=(new THREE.Color).fromArray(t.Emissive.value):!t.EmissiveColor||"Color"!==t.EmissiveColor.type&&"ColorRGB"!==t.EmissiveColor.type||(n.emissive=(new THREE.Color).fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(n.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(n.opacity=parseFloat(t.Opacity.value)),n.opacity<1&&(n.transparent=!0),t.ReflectionFactor&&(n.reflectivity=t.ReflectionFactor.value),t.Shininess&&(n.shininess=t.Shininess.value),t.Specular?n.specular=(new THREE.Color).fromArray(t.Specular.value):t.SpecularColor&&"Color"===t.SpecularColor.type&&(n.specular=(new THREE.Color).fromArray(t.SpecularColor.value));var i=this;return xs.get(r).children.forEach((function(t){var r=t.relationship;switch(r){case"Bump":n.bumpMap=i.getTexture(e,t.ID);break;case"Maya|TEX_ao_map":n.aoMap=i.getTexture(e,t.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=i.getTexture(e,t.ID),void 0!==n.map&&(n.map.encoding=THREE.sRGBEncoding);break;case"DisplacementColor":n.displacementMap=i.getTexture(e,t.ID);break;case"EmissiveColor":n.emissiveMap=i.getTexture(e,t.ID),void 0!==n.emissiveMap&&(n.emissiveMap.encoding=THREE.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=i.getTexture(e,t.ID);break;case"ReflectionColor":n.envMap=i.getTexture(e,t.ID),void 0!==n.envMap&&(n.envMap.mapping=THREE.EquirectangularReflectionMapping,n.envMap.encoding=THREE.sRGBEncoding);break;case"SpecularColor":n.specularMap=i.getTexture(e,t.ID),void 0!==n.specularMap&&(n.specularMap.encoding=THREE.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=i.getTexture(e,t.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),n}},{key:"getTexture",value:function(t,e){return"LayeredTexture"in Is.Objects&&e in Is.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),e=xs.get(e).children[0].ID),t.get(e)}},{key:"parseDeformers",value:function(){var t={},e={};if("Deformer"in Is.Objects){var r=Is.Objects.Deformer;for(var n in r){var i=r[n],o=xs.get(parseInt(n));if("Skin"===i.attrType){var s=this.parseSkeleton(o,r);s.ID=n,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),s.geometryID=o.parents[0].ID,t[n]=s}else if("BlendShape"===i.attrType){var a={id:n};a.rawTargets=this.parseMorphTargets(o,r),a.id=n,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),e[n]=a}}}return{skeletons:t,morphTargets:e}}},{key:"parseSkeleton",value:function(t,e){var r=[];return t.children.forEach((function(t){var n=e[t.ID];if("Cluster"===n.attrType){var i={ID:t.ID,indices:[],weights:[],transformLink:(new THREE.Matrix4).fromArray(n.TransformLink.a)};"Indexes"in n&&(i.indices=n.Indexes.a,i.weights=n.Weights.a),r.push(i)}})),{rawBones:r,bones:[]}}},{key:"parseMorphTargets",value:function(t,e){for(var r=[],n=0;n<t.children.length;n++){var i=t.children[n],o=e[i.ID],s={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if("BlendShapeChannel"!==o.attrType)return;s.geoID=xs.get(parseInt(i.ID)).children.filter((function(t){return void 0===t.relationship}))[0].ID,r.push(s)}return r}},{key:"parseScene",value:function(t,e,r){Cs=new THREE.Group;var n=this.parseModels(t.skeletons,e,r),i=Is.Objects.Model,o=this;n.forEach((function(t){var e=i[t.ID];o.setLookAtProperties(t,e),xs.get(t.ID).parents.forEach((function(e){var r=n.get(e.ID);void 0!==r&&r.add(t)})),null===t.parent&&Cs.add(t)})),this.bindSkeleton(t.skeletons,e,n),this.createAmbientLight(),Cs.traverse((function(t){if(t.userData.transformData){t.parent&&(t.userData.transformData.parentMatrix=t.parent.matrix,t.userData.transformData.parentMatrixWorld=t.parent.matrixWorld);var e=Gs(t.userData.transformData);t.applyMatrix4(e),t.updateWorldMatrix()}}));var s=(new Ts).parse();1===Cs.children.length&&Cs.children[0].isGroup&&(Cs.children[0].animations=s,Cs=Cs.children[0]),Cs.animations=s}},{key:"parseModels",value:function(t,e,r){var n=new Map,i=Is.Objects.Model;for(var o in i){var s=parseInt(o),a=i[o],u=xs.get(s),l=this.buildSkeleton(u,t,s,a.attrName);if(!l){switch(a.attrType){case"Camera":l=this.createCamera(u);break;case"Light":l=this.createLight(u);break;case"Mesh":l=this.createMesh(u,e,r);break;case"NurbsCurve":l=this.createCurve(u,e);break;case"LimbNode":case"Root":l=new THREE.Bone;break;default:l=new THREE.Group}l.name=a.attrName?THREE.PropertyBinding.sanitizeNodeName(a.attrName):"",l.ID=s}this.getTransformData(l,a),n.set(s,l)}return n}},{key:"buildSkeleton",value:function(t,e,r,n){var i=null;return t.parents.forEach((function(t){var o=function(){var o=e[s];o.rawBones.forEach((function(e,s){if(e.ID===t.ID){var a=i;(i=new THREE.Bone).matrixWorld.copy(e.transformLink),i.name=n?THREE.PropertyBinding.sanitizeNodeName(n):"",i.ID=r,o.bones[s]=i,null!==a&&i.add(a)}}))};for(var s in e)o()})),i}},{key:"createCamera",value:function(t){var e,r;if(t.children.forEach((function(t){var e=Is.Objects.NodeAttribute[t.ID];void 0!==e&&(r=e)})),void 0===r)e=new THREE.Object3D;else{var n=0;void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(n=1);var i=1;void 0!==r.NearPlane&&(i=r.NearPlane.value/1e3);var o=1e3;void 0!==r.FarPlane&&(o=r.FarPlane.value/1e3);var s=window.innerWidth,a=window.innerHeight;void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(s=r.AspectWidth.value,a=r.AspectHeight.value);var u=s/a,l=45;void 0!==r.FieldOfView&&(l=r.FieldOfView.value);var h=r.FocalLength?r.FocalLength.value:null;switch(n){case 0:e=new THREE.PerspectiveCamera(l,u,i,o),null!==h&&e.setFocalLength(h);break;case 1:e=new THREE.OrthographicCamera(-s/2,s/2,a/2,-a/2,i,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),e=new THREE.Object3D}}return e}},{key:"createLight",value:function(t){var e,r;if(t.children.forEach((function(t){var e=Is.Objects.NodeAttribute[t.ID];void 0!==e&&(r=e)})),void 0===r)e=new THREE.Object3D;else{var n;n=void 0===r.LightType?0:r.LightType.value;var i=16777215;void 0!==r.Color&&(i=(new THREE.Color).fromArray(r.Color.value));var o=void 0===r.Intensity?1:r.Intensity.value/100;void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(o=0);var s=0;void 0!==r.FarAttenuationEnd&&(s=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value);switch(n){case 0:e=new THREE.PointLight(i,o,s,1);break;case 1:e=new THREE.DirectionalLight(i,o);break;case 2:var a=Math.PI/3;void 0!==r.InnerAngle&&(a=THREE.MathUtils.degToRad(r.InnerAngle.value));var u=0;void 0!==r.OuterAngle&&(u=THREE.MathUtils.degToRad(r.OuterAngle.value),u=Math.max(u,1)),e=new THREE.SpotLight(i,o,s,a,u,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),e=new THREE.PointLight(i,o)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(e.castShadow=!0)}return e}},{key:"createMesh",value:function(t,e,r){var n,i=null,o=null,s=[];return t.children.forEach((function(t){e.has(t.ID)&&(i=e.get(t.ID)),r.has(t.ID)&&s.push(r.get(t.ID))})),s.length>1?o=s:s.length>0?o=s[0]:(o=new THREE.MeshPhongMaterial({color:13421772}),s.push(o)),"color"in i.attributes&&s.forEach((function(t){t.vertexColors=!0})),i.FBX_Deformer?(n=new THREE.SkinnedMesh(i,o)).normalizeSkinWeights():n=new THREE.Mesh(i,o),n}},{key:"createCurve",value:function(t,e){var r=t.children.reduce((function(t,r){return e.has(r.ID)&&(t=e.get(r.ID)),t}),null),n=new THREE.LineBasicMaterial({color:3342591,linewidth:1});return new THREE.Line(r,n)}},{key:"getTransformData",value:function(t,e){var r={};"InheritType"in e&&(r.inheritType=parseInt(e.InheritType.value)),r.eulerOrder="RotationOrder"in e?Us(e.RotationOrder.value):"ZYX","Lcl_Translation"in e&&(r.translation=e.Lcl_Translation.value),"PreRotation"in e&&(r.preRotation=e.PreRotation.value),"Lcl_Rotation"in e&&(r.rotation=e.Lcl_Rotation.value),"PostRotation"in e&&(r.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(r.scale=e.Lcl_Scaling.value),"ScalingOffset"in e&&(r.scalingOffset=e.ScalingOffset.value),"ScalingPivot"in e&&(r.scalingPivot=e.ScalingPivot.value),"RotationOffset"in e&&(r.rotationOffset=e.RotationOffset.value),"RotationPivot"in e&&(r.rotationPivot=e.RotationPivot.value),t.userData.transformData=r}},{key:"setLookAtProperties",value:function(t,e){"LookAtProperty"in e&&xs.get(t.ID).children.forEach((function(e){if("LookAtProperty"===e.relationship){var r=Is.Objects.Model[e.ID];if("Lcl_Translation"in r){var n=r.Lcl_Translation.value;void 0!==t.target?(t.target.position.fromArray(n),Cs.add(t.target)):t.lookAt((new THREE.Vector3).fromArray(n))}}}))}},{key:"bindSkeleton",value:function(t,e,r){var n=this.parsePoseNodes(),i=function(){var i=t[o];xs.get(parseInt(i.ID)).parents.forEach((function(t){if(e.has(t.ID)){var o=t.ID;xs.get(o).parents.forEach((function(t){r.has(t.ID)&&r.get(t.ID).bind(new THREE.Skeleton(i.bones),n[t.ID])}))}}))};for(var o in t)i()}},{key:"parsePoseNodes",value:function(){var t={};if("Pose"in Is.Objects){var e=Is.Objects.Pose;for(var r in e)if("BindPose"===e[r].attrType&&e[r].NbPoseNodes>0){var n=e[r].PoseNode;Array.isArray(n)?n.forEach((function(e){t[e.Node]=(new THREE.Matrix4).fromArray(e.Matrix.a)})):t[n.Node]=(new THREE.Matrix4).fromArray(n.Matrix.a)}}return t}},{key:"createAmbientLight",value:function(){if("GlobalSettings"in Is&&"AmbientColor"in Is.GlobalSettings){var t=Is.GlobalSettings.AmbientColor.value,e=t[0],r=t[1],n=t[2];if(0!==e||0!==r||0!==n){var i=new THREE.Color(e,r,n);Cs.add(new THREE.AmbientLight(i,1))}}}}]),t}(),Ss=function(){function t(){i(this,t),this.negativeMaterialIndices=!1}return s(t,[{key:"parse",value:function(t){var e=new Map;if("Geometry"in Is.Objects){var r=Is.Objects.Geometry;for(var n in r){var i=xs.get(parseInt(n)),o=this.parseGeometry(i,r[n],t);e.set(parseInt(n),o)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),e}},{key:"parseGeometry",value:function(t,e,r){switch(e.attrType){case"Mesh":return this.parseMeshGeometry(t,e,r);case"NurbsCurve":return this.parseNurbsGeometry(e)}}},{key:"parseMeshGeometry",value:function(t,e,r){var n=r.skeletons,i=[],o=t.parents.map((function(t){return Is.Objects.Model[t.ID]}));if(0!==o.length){var s=t.children.reduce((function(t,e){return void 0!==n[e.ID]&&(t=n[e.ID]),t}),null);t.children.forEach((function(t){void 0!==r.morphTargets[t.ID]&&i.push(r.morphTargets[t.ID])}));var a=o[0],u={};"RotationOrder"in a&&(u.eulerOrder=Us(a.RotationOrder.value)),"InheritType"in a&&(u.inheritType=parseInt(a.InheritType.value)),"GeometricTranslation"in a&&(u.translation=a.GeometricTranslation.value),"GeometricRotation"in a&&(u.rotation=a.GeometricRotation.value),"GeometricScaling"in a&&(u.scale=a.GeometricScaling.value);var l=Gs(u);return this.genGeometry(e,s,i,l)}}},{key:"genGeometry",value:function(t,e,r,n){var i=new THREE.BufferGeometry;t.attrName&&(i.name=t.attrName);var o=this.parseGeoNode(t,e),s=this.genBuffers(o),a=new THREE.Float32BufferAttribute(s.vertex,3);if(a.applyMatrix4(n),i.setAttribute("position",a),s.colors.length>0&&i.setAttribute("color",new THREE.Float32BufferAttribute(s.colors,3)),e&&(i.setAttribute("skinIndex",new THREE.Uint16BufferAttribute(s.weightsIndices,4)),i.setAttribute("skinWeight",new THREE.Float32BufferAttribute(s.vertexWeights,4)),i.FBX_Deformer=e),s.normal.length>0){var u=(new THREE.Matrix3).getNormalMatrix(n),l=new THREE.Float32BufferAttribute(s.normal,3);l.applyNormalMatrix(u),i.setAttribute("normal",l)}if(s.uvs.forEach((function(t,e){var r="uv"+(e+1).toString();0===e&&(r="uv"),i.setAttribute(r,new THREE.Float32BufferAttribute(s.uvs[e],2))})),o.material&&"AllSame"!==o.material.mappingType){var h=s.materialIndex[0],c=0;if(s.materialIndex.forEach((function(t,e){t!==h&&(i.addGroup(c,e-c,h),h=t,c=e)})),i.groups.length>0){var f=i.groups[i.groups.length-1],p=f.start+f.count;p!==s.materialIndex.length&&i.addGroup(p,s.materialIndex.length-p,h)}0===i.groups.length&&i.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(i,t,r,n),i}},{key:"parseGeoNode",value:function(t,e){var r={};if(r.vertexPositions=void 0!==t.Vertices?t.Vertices.a:[],r.vertexIndices=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(r.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(r.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(r.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){r.uv=[];for(var n=0;t.LayerElementUV[n];)t.LayerElementUV[n].UV&&r.uv.push(this.parseUVs(t.LayerElementUV[n])),n++}return r.weightTable={},null!==e&&(r.skeleton=e,e.rawBones.forEach((function(t,e){t.indices.forEach((function(n,i){void 0===r.weightTable[n]&&(r.weightTable[n]=[]),r.weightTable[n].push({id:e,weight:t.weights[i]})}))}))),r}},{key:"genBuffers",value:function(t){var e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,n=0,i=!1,o=[],s=[],a=[],u=[],l=[],h=[],c=this;return t.vertexIndices.forEach((function(f,p){var g,d=!1;f<0&&(f^=-1,d=!0);var A=[],y=[];if(o.push(3*f,3*f+1,3*f+2),t.color){var v=Qs(p,r,f,t.color);a.push(v[0],v[1],v[2])}if(t.skeleton){if(void 0!==t.weightTable[f]&&t.weightTable[f].forEach((function(t){y.push(t.weight),A.push(t.id)})),y.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);var m=[0,0,0,0],E=[0,0,0,0];y.forEach((function(t,e){var r=t,n=A[e];E.forEach((function(t,e,i){if(r>t){i[e]=r,r=t;var o=m[e];m[e]=n,n=o}}))})),A=m,y=E}for(;y.length<4;)y.push(0),A.push(0);for(var _=0;_<4;++_)l.push(y[_]),h.push(A[_])}if(t.normal){var I=Qs(p,r,f,t.normal);s.push(I[0],I[1],I[2])}t.material&&"AllSame"!==t.material.mappingType&&(g=Qs(p,r,f,t.material)[0])<0&&(c.negativeMaterialIndices=!0,g=0),t.uv&&t.uv.forEach((function(t,e){var n=Qs(p,r,f,t);void 0===u[e]&&(u[e]=[]),u[e].push(n[0]),u[e].push(n[1])})),n++,d&&(n>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),c.genFace(e,t,o,g,s,a,u,l,h,n),r++,n=0,o=[],s=[],a=[],u=[],l=[],h=[])})),e}},{key:"genFace",value:function(t,e,r,n,i,o,s,a,u,l){for(var h=function(l){t.vertex.push(e.vertexPositions[r[0]]),t.vertex.push(e.vertexPositions[r[1]]),t.vertex.push(e.vertexPositions[r[2]]),t.vertex.push(e.vertexPositions[r[3*(l-1)]]),t.vertex.push(e.vertexPositions[r[3*(l-1)+1]]),t.vertex.push(e.vertexPositions[r[3*(l-1)+2]]),t.vertex.push(e.vertexPositions[r[3*l]]),t.vertex.push(e.vertexPositions[r[3*l+1]]),t.vertex.push(e.vertexPositions[r[3*l+2]]),e.skeleton&&(t.vertexWeights.push(a[0]),t.vertexWeights.push(a[1]),t.vertexWeights.push(a[2]),t.vertexWeights.push(a[3]),t.vertexWeights.push(a[4*(l-1)]),t.vertexWeights.push(a[4*(l-1)+1]),t.vertexWeights.push(a[4*(l-1)+2]),t.vertexWeights.push(a[4*(l-1)+3]),t.vertexWeights.push(a[4*l]),t.vertexWeights.push(a[4*l+1]),t.vertexWeights.push(a[4*l+2]),t.vertexWeights.push(a[4*l+3]),t.weightsIndices.push(u[0]),t.weightsIndices.push(u[1]),t.weightsIndices.push(u[2]),t.weightsIndices.push(u[3]),t.weightsIndices.push(u[4*(l-1)]),t.weightsIndices.push(u[4*(l-1)+1]),t.weightsIndices.push(u[4*(l-1)+2]),t.weightsIndices.push(u[4*(l-1)+3]),t.weightsIndices.push(u[4*l]),t.weightsIndices.push(u[4*l+1]),t.weightsIndices.push(u[4*l+2]),t.weightsIndices.push(u[4*l+3])),e.color&&(t.colors.push(o[0]),t.colors.push(o[1]),t.colors.push(o[2]),t.colors.push(o[3*(l-1)]),t.colors.push(o[3*(l-1)+1]),t.colors.push(o[3*(l-1)+2]),t.colors.push(o[3*l]),t.colors.push(o[3*l+1]),t.colors.push(o[3*l+2])),e.material&&"AllSame"!==e.material.mappingType&&(t.materialIndex.push(n),t.materialIndex.push(n),t.materialIndex.push(n)),e.normal&&(t.normal.push(i[0]),t.normal.push(i[1]),t.normal.push(i[2]),t.normal.push(i[3*(l-1)]),t.normal.push(i[3*(l-1)+1]),t.normal.push(i[3*(l-1)+2]),t.normal.push(i[3*l]),t.normal.push(i[3*l+1]),t.normal.push(i[3*l+2])),e.uv&&e.uv.forEach((function(e,r){void 0===t.uvs[r]&&(t.uvs[r]=[]),t.uvs[r].push(s[r][0]),t.uvs[r].push(s[r][1]),t.uvs[r].push(s[r][2*(l-1)]),t.uvs[r].push(s[r][2*(l-1)+1]),t.uvs[r].push(s[r][2*l]),t.uvs[r].push(s[r][2*l+1])}))},c=2;c<l;c++)h(c)}},{key:"addMorphTargets",value:function(t,e,r,n){if(0!==r.length){t.morphTargetsRelative=!0,t.morphAttributes.position=[];var i=this;r.forEach((function(r){r.rawTargets.forEach((function(r){var o=Is.Objects.Geometry[r.geoID];void 0!==o&&i.genMorphGeometry(t,e,o,n,r.name)}))}))}}},{key:"genMorphGeometry",value:function(t,e,r,n,i){for(var o=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],s=void 0!==r.Vertices?r.Vertices.a:[],a=void 0!==r.Indexes?r.Indexes.a:[],u=3*t.attributes.position.count,l=new Float32Array(u),h=0;h<a.length;h++){var c=3*a[h];l[c]=s[3*h],l[c+1]=s[3*h+1],l[c+2]=s[3*h+2]}var f={vertexIndices:o,vertexPositions:l},p=this.genBuffers(f),g=new THREE.Float32BufferAttribute(p.vertex,3);g.name=i||r.attrName,g.applyMatrix4(n),t.morphAttributes.position.push(g)}},{key:"parseNormals",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,n=t.Normals.a,i=[];return"IndexToDirect"===r&&("NormalIndex"in t?i=t.NormalIndex.a:"NormalsIndex"in t&&(i=t.NormalsIndex.a)),{dataSize:3,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseUVs",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,n=t.UV.a,i=[];return"IndexToDirect"===r&&(i=t.UVIndex.a),{dataSize:2,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseVertexColors",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,n=t.Colors.a,i=[];return"IndexToDirect"===r&&(i=t.ColorIndex.a),{dataSize:4,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseMaterialIndices",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType;if("NoMappingInformation"===e)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=t.Materials.a,i=[],o=0;o<n.length;++o)i.push(o);return{dataSize:1,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseNurbsGeometry",value:function(t){var e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new THREE.BufferGeometry;for(var r,n,i=e-1,o=t.KnotVector.a,s=[],a=t.Points.a,u=0,l=a.length;u<l;u+=4)s.push((new THREE.Vector4).fromArray(a,u));if("Closed"===t.Form)s.push(s[0]);else if("Periodic"===t.Form){r=i,n=o.length-1-r;for(var h=0;h<i;++h)s.push(s[h])}var c=new ws(i,o,s,r,n).getPoints(12*s.length);return(new THREE.BufferGeometry).setFromPoints(c)}}]),t}(),Ts=function(){function t(){i(this,t)}return s(t,[{key:"parse",value:function(){var t=[],e=this.parseClips();if(void 0!==e)for(var r in e){var n=e[r],i=this.addClip(n);t.push(i)}return t}},{key:"parseClips",value:function(){if(void 0!==Is.Objects.AnimationCurve){var t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);var e=this.parseAnimationLayers(t);return this.parseAnimStacks(e)}}},{key:"parseAnimationCurveNodes",value:function(){var t=Is.Objects.AnimationCurveNode,e=new Map;for(var r in t){var n=t[r];if(null!==n.attrName.match(/S|R|T|DeformPercent/)){var i={id:n.id,attr:n.attrName,curves:{}};e.set(i.id,i)}}return e}},{key:"parseAnimationCurves",value:function(t){var e=Is.Objects.AnimationCurve;for(var r in e){var n={id:e[r].id,times:e[r].KeyTime.a.map(ks),values:e[r].KeyValueFloat.a},i=xs.get(n.id);if(void 0!==i){var o=i.parents[0].ID,s=i.parents[0].relationship;s.match(/X/)?t.get(o).curves.x=n:s.match(/Y/)?t.get(o).curves.y=n:s.match(/Z/)?t.get(o).curves.z=n:s.match(/d|DeformPercent/)&&t.has(o)&&(t.get(o).curves.morph=n)}}}},{key:"parseAnimationLayers",value:function(t){var e=Is.Objects.AnimationLayer,r=new Map,n=function(){var e=[],n=xs.get(parseInt(i));void 0!==n&&(n.children.forEach((function(r,n){if(t.has(r.ID)){var i=t.get(r.ID);if(void 0!==i.curves.x||void 0!==i.curves.y||void 0!==i.curves.z){if(void 0===e[n]){var o=xs.get(r.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID;if(void 0!==o){var s=Is.Objects.Model[o.toString()];if(void 0===s)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",r);var a={modelName:s.attrName?THREE.PropertyBinding.sanitizeNodeName(s.attrName):"",ID:s.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Cs.traverse((function(t){t.ID===s.id&&(a.transform=t.matrix,t.userData.transformData&&(a.eulerOrder=t.userData.transformData.eulerOrder))})),a.transform||(a.transform=new THREE.Matrix4),"PreRotation"in s&&(a.preRotation=s.PreRotation.value),"PostRotation"in s&&(a.postRotation=s.PostRotation.value),e[n]=a}}e[n]&&(e[n][i.attr]=i)}else if(void 0!==i.curves.morph){if(void 0===e[n]){var u=xs.get(r.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID,l=xs.get(u).parents[0].ID,h=xs.get(l).parents[0].ID,c=xs.get(h).parents[0].ID,f=Is.Objects.Model[c],p={modelName:f.attrName?THREE.PropertyBinding.sanitizeNodeName(f.attrName):"",morphName:Is.Objects.Deformer[u].attrName};e[n]=p}e[n][i.attr]=i}}})),r.set(parseInt(i),e))};for(var i in e)n();return r}},{key:"parseAnimStacks",value:function(t){var e=Is.Objects.AnimationStack,r={};for(var n in e){var i=xs.get(parseInt(n)).children;i.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var o=t.get(i[0].ID);r[n]={name:e[n].attrName,layer:o}}return r}},{key:"addClip",value:function(t){var e=[],r=this;return t.layer.forEach((function(t){e=e.concat(r.generateTracks(t))})),new THREE.AnimationClip(t.name,-1,e)}},{key:"generateTracks",value:function(t){var e=[],r=new THREE.Vector3,n=new THREE.Quaternion,i=new THREE.Vector3;if(t.transform&&t.transform.decompose(r,n,i),r=r.toArray(),n=(new THREE.Euler).setFromQuaternion(n,t.eulerOrder).toArray(),i=i.toArray(),void 0!==t.T&&Object.keys(t.T.curves).length>0){var o=this.generateVectorTrack(t.modelName,t.T.curves,r,"position");void 0!==o&&e.push(o)}if(void 0!==t.R&&Object.keys(t.R.curves).length>0){var s=this.generateRotationTrack(t.modelName,t.R.curves,n,t.preRotation,t.postRotation,t.eulerOrder);void 0!==s&&e.push(s)}if(void 0!==t.S&&Object.keys(t.S.curves).length>0){var a=this.generateVectorTrack(t.modelName,t.S.curves,i,"scale");void 0!==a&&e.push(a)}if(void 0!==t.DeformPercent){var u=this.generateMorphTrack(t);void 0!==u&&e.push(u)}return e}},{key:"generateVectorTrack",value:function(t,e,r,n){var i=this.getTimesForAllAxes(e),o=this.getKeyframeTrackValues(i,e,r);return new THREE.VectorKeyframeTrack(t+"."+n,i,o)}},{key:"generateRotationTrack",value:function(t,e,r,n,i,o){void 0!==e.x&&(this.interpolateRotations(e.x),e.x.values=e.x.values.map(THREE.MathUtils.degToRad)),void 0!==e.y&&(this.interpolateRotations(e.y),e.y.values=e.y.values.map(THREE.MathUtils.degToRad)),void 0!==e.z&&(this.interpolateRotations(e.z),e.z.values=e.z.values.map(THREE.MathUtils.degToRad));var s=this.getTimesForAllAxes(e),a=this.getKeyframeTrackValues(s,e,r);void 0!==n&&((n=n.map(THREE.MathUtils.degToRad)).push(o),n=(new THREE.Euler).fromArray(n),n=(new THREE.Quaternion).setFromEuler(n)),void 0!==i&&((i=i.map(THREE.MathUtils.degToRad)).push(o),i=(new THREE.Euler).fromArray(i),i=(new THREE.Quaternion).setFromEuler(i).invert());for(var u=new THREE.Quaternion,l=new THREE.Euler,h=[],c=0;c<a.length;c+=3)l.set(a[c],a[c+1],a[c+2],o),u.setFromEuler(l),void 0!==n&&u.premultiply(n),void 0!==i&&u.multiply(i),u.toArray(h,c/3*4);return new THREE.QuaternionKeyframeTrack(t+".quaternion",s,h)}},{key:"generateMorphTrack",value:function(t){var e=t.DeformPercent.curves.morph,r=e.values.map((function(t){return t/100})),n=Cs.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new THREE.NumberKeyframeTrack(t.modelName+".morphTargetInfluences["+n+"]",e.times,r)}},{key:"getTimesForAllAxes",value:function(t){var e=[];if(void 0!==t.x&&(e=e.concat(t.x.times)),void 0!==t.y&&(e=e.concat(t.y.times)),void 0!==t.z&&(e=e.concat(t.z.times)),(e=e.sort((function(t,e){return t-e}))).length>1){for(var r=1,n=e[0],i=1;i<e.length;i++){var o=e[i];o!==n&&(e[r]=o,n=o,r++)}e=e.slice(0,r)}return e}},{key:"getKeyframeTrackValues",value:function(t,e,r){var n=r,i=[],o=-1,s=-1,a=-1;return t.forEach((function(t){if(e.x&&(o=e.x.times.indexOf(t)),e.y&&(s=e.y.times.indexOf(t)),e.z&&(a=e.z.times.indexOf(t)),-1!==o){var r=e.x.values[o];i.push(r),n[0]=r}else i.push(n[0]);if(-1!==s){var u=e.y.values[s];i.push(u),n[1]=u}else i.push(n[1]);if(-1!==a){var l=e.z.values[a];i.push(l),n[2]=l}else i.push(n[2])})),i}},{key:"interpolateRotations",value:function(t){for(var e=1;e<t.values.length;e++){var r=t.values[e-1],n=t.values[e]-r,i=Math.abs(n);if(i>=180){for(var o=i/180,s=n/o,a=r+s,u=t.times[e-1],l=(t.times[e]-u)/o,h=u+l,c=[],f=[];h<t.times[e];)c.push(h),h+=l,f.push(a),a+=s;t.times=qs(t.times,e,c),t.values=qs(t.values,e,f)}}}}]),t}(),Ms=function(){function t(){i(this,t)}return s(t,[{key:"getPrevNode",value:function(){return this.nodeStack[this.currentIndent-2]}},{key:"getCurrentNode",value:function(){return this.nodeStack[this.currentIndent-1]}},{key:"getCurrentProp",value:function(){return this.currentProp}},{key:"pushStack",value:function(t){this.nodeStack.push(t),this.currentIndent+=1}},{key:"popStack",value:function(){this.nodeStack.pop(),this.currentIndent-=1}},{key:"setCurrentProp",value:function(t,e){this.currentProp=t,this.currentPropName=e}},{key:"parse",value:function(t){this.currentIndent=0,this.allNodes=new Ns,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var e=this,r=t.split(/[\r\n]+/);return r.forEach((function(t,n){var i=t.match(/^[\s\t]*;/),o=t.match(/^[\s\t]*$/);if(!i&&!o){var s=t.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){",""),a=t.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),u=t.match("^\\t{"+(e.currentIndent-1)+"}}");s?e.parseNodeBegin(t,s):a?e.parseNodeProperty(t,a,r[++n]):u?e.popStack():t.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(t)}})),this.allNodes}},{key:"parseNodeBegin",value:function(t,e){var r=e[1].trim().replace(/^"/,"").replace(/"$/,""),n=e[2].split(",").map((function(t){return t.trim().replace(/^"/,"").replace(/"$/,"")})),i={name:r},o=this.parseNodeAttr(n),s=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(r,i):r in s?("PoseNode"===r?s.PoseNode.push(i):void 0!==s[r].id&&(s[r]={},s[r][s[r].id]=s[r]),""!==o.id&&(s[r][o.id]=i)):"number"==typeof o.id?(s[r]={},s[r][o.id]=i):"Properties70"!==r&&(s[r]="PoseNode"===r?[i]:i),"number"==typeof o.id&&(i.id=o.id),""!==o.name&&(i.attrName=o.name),""!==o.type&&(i.attrType=o.type),this.pushStack(i)}},{key:"parseNodeAttr",value:function(t){var e=t[0];""!==t[0]&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));var r="",n="";return t.length>1&&(r=t[1].replace(/^(\w+)::/,""),n=t[2]),{id:e,name:r,type:n}}},{key:"parseNodeProperty",value:function(t,e,r){var n=e[1].replace(/^"/,"").replace(/"$/,"").trim(),i=e[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===n&&","===i&&(i=r.replace(/"/g,"").replace(/,$/,"").trim());var o=this.getCurrentNode();if("Properties70"!==o.name){if("C"===n){var s=i.split(",").slice(1),a=parseInt(s[0]),u=parseInt(s[1]),l=i.split(",").slice(3);n="connections",function(t,e){for(var r=0,n=t.length,i=e.length;r<i;r++,n++)t[n]=e[r]}(i=[a,u],l=l.map((function(t){return t.trim().replace(/^"/,"")}))),void 0===o[n]&&(o[n]=[])}"Node"===n&&(o.id=i),n in o&&Array.isArray(o[n])?o[n].push(i):"a"!==n?o[n]=i:o.a=i,this.setCurrentProp(o,n),"a"===n&&","!==i.slice(-1)&&(o.a=Hs(i))}else this.parseNodeSpecialProperty(t,n,i)}},{key:"parseNodePropertyContinued",value:function(t){var e=this.getCurrentNode();e.a+=t,","!==t.slice(-1)&&(e.a=Hs(e.a))}},{key:"parseNodeSpecialProperty",value:function(t,e,r){var n=r.split('",').map((function(t){return t.trim().replace(/^\"/,"").replace(/\s/,"_")})),i=n[0],o=n[1],s=n[2],a=n[3],u=n[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":u=parseFloat(u);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":u=Hs(u)}this.getPrevNode()[i]={type:o,type2:s,flag:a,value:u},this.setCurrentProp(this.getPrevNode(),i)}}]),t}(),Rs=function(){function t(){i(this,t)}return s(t,[{key:"parse",value:function(t){var e=new Ls(t);e.skip(23);var r=e.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var n=new Ns;!this.endOfContent(e);){var i=this.parseNode(e,r);null!==i&&n.add(i.name,i)}return n}},{key:"endOfContent",value:function(t){return t.size()%16==0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()}},{key:"parseNode",value:function(t,e){var r={},n=e>=7500?t.getUint64():t.getUint32(),i=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();var o=t.getUint8(),s=t.getString(o);if(0===n)return null;for(var a=[],u=0;u<i;u++)a.push(this.parseProperty(t));var l=a.length>0?a[0]:"",h=a.length>1?a[1]:"",c=a.length>2?a[2]:"";for(r.singleProperty=1===i&&t.getOffset()===n;n>t.getOffset();){var f=this.parseNode(t,e);null!==f&&this.parseSubNode(s,r,f)}return r.propertyList=a,"number"==typeof l&&(r.id=l),""!==h&&(r.attrName=h),""!==c&&(r.attrType=c),""!==s&&(r.name=s),r}},{key:"parseSubNode",value:function(t,e,r){if(!0===r.singleProperty){var n=r.propertyList[0];Array.isArray(n)?(e[r.name]=r,r.a=n):e[r.name]=n}else if("Connections"===t&&"C"===r.name){var i=[];r.propertyList.forEach((function(t,e){0!==e&&i.push(t)})),void 0===e.connections&&(e.connections=[]),e.connections.push(i)}else if("Properties70"===r.name){Object.keys(r).forEach((function(t){e[t]=r[t]}))}else if("Properties70"===t&&"P"===r.name){var o,s=r.propertyList[0],a=r.propertyList[1],u=r.propertyList[2],l=r.propertyList[3];0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),o="Color"===a||"ColorRGB"===a||"Vector"===a||"Vector3D"===a||0===a.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],e[s]={type:a,type2:u,flag:l,value:o}}else void 0===e[r.name]?"number"==typeof r.id?(e[r.name]={},e[r.name][r.id]=r):e[r.name]=r:"PoseNode"===r.name?(Array.isArray(e[r.name])||(e[r.name]=[e[r.name]]),e[r.name].push(r)):void 0===e[r.name][r.id]&&(e[r.name][r.id]=r)}},{key:"parseProperty",value:function(t){var e,r=t.getString(1);switch(r){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return e=t.getUint32(),t.getArrayBuffer(e);case"S":return e=t.getUint32(),t.getString(e);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var n=t.getUint32(),i=t.getUint32(),o=t.getUint32();if(0===i)switch(r){case"b":case"c":return t.getBooleanArray(n);case"d":return t.getFloat64Array(n);case"f":return t.getFloat32Array(n);case"i":return t.getInt32Array(n);case"l":return t.getInt64Array(n)}var s=function(t,e){return As((function(t){if(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"}(t),t.subarray(2,-4)),e)}(new Uint8Array(t.getArrayBuffer(o))),a=new Ls(s.buffer);switch(r){case"b":case"c":return a.getBooleanArray(n);case"d":return a.getFloat64Array(n);case"f":return a.getFloat32Array(n);case"i":return a.getInt32Array(n);case"l":return a.getInt64Array(n)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+r)}}}]),t}(),Ls=function(){function t(e,r){i(this,t),this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===r||r}return s(t,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(t){this.offset+=t}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getBoolean());return e}},{key:"getUint8",value:function(){var t=this.dv.getUint8(this.offset);return this.offset+=1,t}},{key:"getInt16",value:function(){var t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}},{key:"getInt32",value:function(){var t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}},{key:"getInt32Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt32());return e}},{key:"getUint32",value:function(){var t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}},{key:"getInt64",value:function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),2147483648&e?(e=4294967295&~e,4294967295===(t=4294967295&~t)&&(e=e+1&4294967295),-(4294967296*e+(t=t+1&4294967295))):4294967296*e+t}},{key:"getInt64Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt64());return e}},{key:"getUint64",value:function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),4294967296*e+t}},{key:"getFloat32",value:function(){var t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}},{key:"getFloat32Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat32());return e}},{key:"getFloat64",value:function(){var t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}},{key:"getFloat64Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat64());return e}},{key:"getArrayBuffer",value:function(t){var e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}},{key:"getString",value:function(t){for(var e=[],r=0;r<t;r++)e[r]=this.getUint8();var n=e.indexOf(0);return n>=0&&(e=e.slice(0,n)),THREE.LoaderUtils.decodeText(new Uint8Array(e))}}]),t}(),Ns=function(){function t(){i(this,t)}return s(t,[{key:"add",value:function(t,e){this[t]=e}}]),t}();function Ps(t){var e=t.match(/FBXVersion: (\d+)/);if(e)return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function ks(t){return t/46186158e3}var Ds=[];function Qs(t,e,r,n){var i;switch(n.mappingType){case"ByPolygonVertex":i=t;break;case"ByPolygon":i=e;break;case"ByVertice":i=r;break;case"AllSame":i=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}"IndexToDirect"===n.referenceType&&(i=n.indices[i]);var o=i*n.dataSize,s=o+n.dataSize;return function(t,e,r,n){for(var i=r,o=0;i<n;i++,o++)t[o]=e[i];return t}(Ds,n.buffer,o,s)}var Os=new THREE.Euler,Fs=new THREE.Vector3;function Gs(t){var e=new THREE.Matrix4,r=new THREE.Matrix4,n=new THREE.Matrix4,i=new THREE.Matrix4,o=new THREE.Matrix4,s=new THREE.Matrix4,a=new THREE.Matrix4,u=new THREE.Matrix4,l=new THREE.Matrix4,h=new THREE.Matrix4,c=new THREE.Matrix4,f=new THREE.Matrix4,p=t.inheritType?t.inheritType:0;if(t.translation&&e.setPosition(Fs.fromArray(t.translation)),t.preRotation){var g=t.preRotation.map(THREE.MathUtils.degToRad);g.push(t.eulerOrder||THREE.Euler.DefaultOrder),r.makeRotationFromEuler(Os.fromArray(g))}if(t.rotation){var d=t.rotation.map(THREE.MathUtils.degToRad);d.push(t.eulerOrder||THREE.Euler.DefaultOrder),n.makeRotationFromEuler(Os.fromArray(d))}if(t.postRotation){var A=t.postRotation.map(THREE.MathUtils.degToRad);A.push(t.eulerOrder||THREE.Euler.DefaultOrder),i.makeRotationFromEuler(Os.fromArray(A)),i.invert()}t.scale&&o.scale(Fs.fromArray(t.scale)),t.scalingOffset&&a.setPosition(Fs.fromArray(t.scalingOffset)),t.scalingPivot&&s.setPosition(Fs.fromArray(t.scalingPivot)),t.rotationOffset&&u.setPosition(Fs.fromArray(t.rotationOffset)),t.rotationPivot&&l.setPosition(Fs.fromArray(t.rotationPivot)),t.parentMatrixWorld&&(c.copy(t.parentMatrix),h.copy(t.parentMatrixWorld));var y=r.clone().multiply(n).multiply(i),v=new THREE.Matrix4;v.extractRotation(h);var m=new THREE.Matrix4;m.copyPosition(h);var E=m.clone().invert().multiply(h),_=v.clone().invert().multiply(E),I=o,x=new THREE.Matrix4;if(0===p)x.copy(v).multiply(y).multiply(_).multiply(I);else if(1===p)x.copy(v).multiply(_).multiply(y).multiply(I);else{var C=(new THREE.Matrix4).scale((new THREE.Vector3).setFromMatrixScale(c)).clone().invert(),w=_.clone().multiply(C);x.copy(v).multiply(y).multiply(w).multiply(I)}var b=l.clone().invert(),B=s.clone().invert(),S=e.clone().multiply(u).multiply(l).multiply(r).multiply(n).multiply(i).multiply(b).multiply(a).multiply(s).multiply(o).multiply(B),T=(new THREE.Matrix4).copyPosition(S),M=h.clone().multiply(T);return f.copyPosition(M),(S=f.clone().multiply(x)).premultiply(h.invert()),S}function Us(t){var e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(t=t||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[t]}function Hs(t){return t.split(",").map((function(t){return parseFloat(t)}))}function js(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=t.byteLength),THREE.LoaderUtils.decodeText(new Uint8Array(t,e,r))}function qs(t,e,r){return t.slice(0,e).concat(r).concat(t.slice(e))}var Vs=function(){function t(e,r,n,o,s){i(this,t),this.threelayer=o,this.map=o.map,this.groupId=s,this.loader=new bs,this.loader.load(e,(function(t){t.traverse((function(t){t instanceof THREE.Mesh&&(t.geometry.computeVertexNormals(),t.scale.set(.04,.04,.04),t.rotation.set(1*Math.PI/2,1*-Math.PI/2,0))}));var e=o.toModel(t,{coordinate:r,altitude:n.altitude||0});s?o.addMesh1(e,s):o.addMesh(e),e.object3d.rotation.z=Math.PI/2}))}return s(t,[{key:"dispose",value:function(){}}]),t}(),zs={altitude:0,speed:.015,height:10},Ys=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s,a){var u;i(this,r),Array.isArray(t)&&(t=new maptalks.Polygon([t])),n=maptalks.Util.extend({},zs,n,{layer:s,polygon:t}),(u=e.call(this)).parent=a,u._initOptions(n);var l=n,h=l.altitude,c=l.height,f=u.createGeometry(t,s,c);u._createMesh(f,o);var p=s.altitudeToVector3(h,h).x,g=s.coordinateToVector3(t.getCenter(),p);return u.getObject3d().position.copy(g),u}return s(r,[{key:"createGeometry",value:function(t,e,r){r=e.altitudeToVector3(r,r).x;var n=e.coordinateToVector3(t.getCenter()),i=t.getShell(),o=[],s=[];i.forEach((function(t){var r=e.coordinateToVector3(t).sub(n);o.push(r),s.push(r.x),s.push(r.y)}));for(var a=s,u=[],l=0,h=0;l<a.length-2;l+=2,h++)0===l?u[0]=Math.sqrt((a[2]-a[0])*(a[2]-a[0])+(a[3]-a[1])*(a[3]-a[1])):u[h]=u[h-1]+Math.sqrt((a[l+2]-a[l])*(a[l+2]-a[l])+(a[l+3]-a[l+1])*(a[l+3]-a[l+1]));for(var c=[],f=[],p=u[u.length-1],g=0,d=c.length,A=f.length;g<o.length-1;g++){var y=o[g],v=o[g+1],m=u[g];c[d++]=y.x,c[d++]=y.y,c[d++]=0,f[A++]=0===g?0:u[g-1]/p,f[A++]=0,c[d++]=v.x,c[d++]=v.y,c[d++]=0,f[A++]=m/p,f[A++]=0,c[d++]=y.x,c[d++]=y.y,c[d++]=r,f[A++]=0===g?0:u[g-1]/p,f[A++]=1,c[d++]=y.x,c[d++]=y.y,c[d++]=r,f[A++]=0===g?0:u[g-1]/p,f[A++]=1,c[d++]=v.x,c[d++]=v.y,c[d++]=0,f[A++]=m/p,f[A++]=0,c[d++]=v.x,c[d++]=v.y,c[d++]=r,f[A++]=m/p,f[A++]=1}var E=new THREE.BufferGeometry;return E.setAttribute("position",new THREE.BufferAttribute(new Float32Array(c),3)),E.setAttribute("uv",new THREE.BufferAttribute(new Float32Array(f),2)),E}}]),r}(),Xs=function(){function t(e,r,n,o,s){i(this,t),this.threelayer=n,this.map=n.map,this.groupId=o,this.layerClass=s,this.opacity=r.opacity||.8,this.fadeOpacity=r.fadeOpacity||.65,this.color=r.color||"#0099FF",this.fadeColor=r.fadeColor||"#000",this.num=r.num||5,this.hiz=r.hiz||.15,this.data=e.data,this.coords=e.coords,this._uniforms={time:{type:"pv2",value:0},color:{type:"uvs",value:new THREE.Color(this.color)},fadeColor:{type:"uvs",value:new THREE.Color(this.fadeColor)},opacity:{type:"pv2",value:this.opacity},num:{type:"pv2",value:this.num},hiz:{type:"pv2",value:this.hiz},fadeOpacity:{value:this.fadeOpacity}};var a=new THREE.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n precision lowp float;\n precision lowp int;\n #ifdef USE_FOG\n varying float vFogDepth;\n #endif\n varying vec2 vUv;\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n #ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n #endif\n }\n ",fragmentShader:"\n precision lowp float;\n precision lowp int;\n uniform float time;\n uniform float opacity;\n uniform vec3 color;\n uniform vec3 fadeColor;\n uniform float fadeOpacity;\n uniform float num;\n uniform float hiz;\n varying vec2 vUv;\n void main() {\n vec4 fragColor = vec4(0.);\n float sin = sin((vUv.y - time * hiz) * 10. * num);\n float high = 0.92;\n float medium = 0.4;\n if (sin > high) {\n fragColor = vec4(mix(vec3(.8, 1., 1.), color, (1. - sin) / (1. - high)), 1.);\n } else if(sin > medium) {\n fragColor = vec4(color, mix(1., 0., 1.-(sin - medium) / (high - medium)));\n } else {\n fragColor = vec4(color, 0.);\n }\n //vec3 fade = mix(color, vec3(0., 0., 0.), vUv.y);\n vec3 fade = mix(color, fadeColor, vUv.y);\n //fragColor = mix(fragColor, vec4(fade, 1.), 0.85);\n fragColor = mix(fragColor, vec4(fade, 1.), fadeOpacity);\n gl_FragColor = vec4(fragColor.rgb, fragColor.a * opacity * (1. - vUv.y));\n }\n ",blending:THREE.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:THREE.DoubleSide});this.interactive=void 0===r.interactive||r.interactive,this.groundWall=new Ys(this.coords,{height:r.height||1e3,interactive:this.interactive},a,n,this),o?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this),this.clickFunc=r.clickFunc,this._bindMapEvents()}return s(t,[{key:"_bindMapEvents",value:function(){this.groundWall&&this.groundWall.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.groundWall&&this.groundWall.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setPointEvent",value:function(t){var e=t.target.parent.data;"click"===t.type&&e&&this.clickFunc&&this.clickFunc(e)}},{key:"tick",value:function(t){this._uniforms.time.value+=this.hiz/10*60*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this._closeEvent(),this.groundWall&&(this.groupId?this.threelayer.removeMesh1(this.groundWall,this.groupId):this.threelayer.removeMesh(this.groundWall),this.groundWall.object3d.geometry&&this.groundWall.object3d.geometry.dispose(),this.groundWall.object3d.material&&(this.groundWall.object3d.material.dispose(),delete this.m))}}]),t}(),Js=function(){function t(e,r,n,o,s){if(i(this,t),this.threelayer=n,this.map=n.map,this.layerClass=s,this.opacity=r.opacity||.8,this.color=r.color||"#0099FF",this.fadeColor=r.fadeColor||"#000",this.repeatX=r.repeatX||10,this.speed=r.speed||.01,r.imgUrl){this.loader=new THREE.TextureLoader,this.texture=this.loader.load(r.imgUrl),this._uniforms={time:{type:"pv2",value:0},map:{value:this.texture},repeatX:{value:this.repeatX},uvTransform:{value:this.elements}};var a=new THREE.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n #ifdef USE_FOG\n varying float vFogDepth;\n #endif\n uniform mat3 uvTransform;\n varying vec2 vUv;\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n vUv = uv;\n //vUv = (uvTransform * vec3(uv,1.0) ).xy;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n #ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n #endif\n }\n ",fragmentShader:"\n uniform float time;\n varying vec2 vUv;\n uniform sampler2D map;\n uniform float repeatX;\n void main() {\n vec4 fragColor = texture2D(map, vec2(1.0 - fract(vUv.x * repeatX + time * 2.), vUv.y));\n //vec4 fragColor = texture2D(map, vUv.x, vec2(fract(vUv.y * repeatX + time * 2.));\n //vec4 fragColor = texture2D(map, vec2(vUv.x, fract(vUv.y * repeatX + time * 2.)));\n gl_FragColor = fragColor;\n }\n ",transparent:!0,depthWrite:!1,depthTest:!1,side:THREE.DoubleSide});this.groundWall=new Ys(e,{height:r.height||1e3},a,n),o?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this)}}return s(t,[{key:"setUvTransform",value:function(t,e,r,n,i,o,s){this.elements=1}},{key:"tick",value:function(t){this._uniforms.time.value+=60*this.speed*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this.groundWall&&(groupId?this.threelayer.removeMesh1(this.groundWall,this.groupId):this.threelayer.removeMesh(this.groundWall),this.groundWall.object3d.geometry&&this.groundWall.object3d.geometry.dispose(),this.groundWall.object3d.material&&(this.groundWall.object3d.material.dispose(),delete this.m),this.texture&&this.texture.dispose())}}]),t}();THREE.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new THREE.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},THREE.ShaderLib.line={uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var Ws,Ks,Zs=function(t){u(r,THREE.ShaderMaterial);var e=f(r);function r(t){var n;return i(this,r),(n=e.call(this,{type:"LineMaterial",uniforms:THREE.UniformsUtils.clone(THREE.ShaderLib.line.uniforms),vertexShader:THREE.ShaderLib.line.vertexShader,fragmentShader:THREE.ShaderLib.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(c(n),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){!0===t?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===t?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===t?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),n.setValues(t),n}return s(r)}(),$s=function(){function e(t,r,n,o){i(this,e),this.map=n.map,this.threeLayer=n,this.groupId=o,this.dashed=void 0!==r.dashed&&r.dashed,this.dashScale=void 0!==r.dashScale?r.dashScale:2,this.dashSize=void 0!==r.dashSize?r.dashSize:1,this.gapSize=void 0!==r.gapSize?r.gapSize:1,this.dashed?this.lineMaterial=new Zs({color:r.lineColor||"rgb(15,159,190)",transparent:!0,linewidth:r.linewidth||1,dashed:!0,defines:{USE_DASH:""},dashScale:this.dashScale,dashSize:this.dashSize,gapSize:this.gapSize}):this.lineMaterial=new Zs({color:r.lineColor||"rgb(15,159,190)",transparent:!0,linewidth:r.linewidth||1});var s=[];t.features.forEach((function(t){var e=t.geometry;s.push(e)})),this.lineItems=s}var r;return s(e,[{key:"addLine",value:(r=n(t().mark((function e(){var r,n,i=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[],this.lineItems.forEach((function(t){"Polygon"===t.type?t.coordinates.forEach((function(t){var e=new maptalks.LineString(t);r.push(e)})):t.coordinates.forEach((function(t){var e=new maptalks.LineString(t[0]);r.push(e)}))})),r.length>0&&(n=this.threeLayer.toFatLines(r,{altitude:1,interactive:!1},this.lineMaterial),this.dashed&&(n.zoomChange=function(){if(i.map){var t=i.map.pixelToDistance(1,0);i.lineMaterial.dashScale=18.93/t}}),this.groupId?this.threeLayer.addMesh1(n,this.groupId):this.threeLayer.addMesh(n),this.line=n),t.abrupt("return",this);case 4:case"end":return t.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"dispose",value:function(){this.groupId?this.threeLayer.removeMesh1(this.line,this.groupId):this.threeLayer.removeMesh(this.line),this.line.object3d.geometry&&this.line.object3d.geometry.dispose(),this.line.object3d.material&&this.line.object3d.material.dispose(),this.lineMaterial&&this.lineMaterial.dispose()}}]),e}(),ta={altitude:0},ea=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),n=maptalks.Util.extend({layer:s},ta,n),(a=e.call(this))._initOptions(n),a.height=n.height||50;for(var u=1/0,l=1/0,h=-1/0,c=-1/0,f=0;f<t.length;f++){var p=t[f].getCenter();u=Math.min(u,p.x),l=Math.min(l,p.y),h=Math.max(h,p.x),c=Math.max(c,p.y)}var g=new maptalks.Coordinate((u+h)/2,(l+c)/2),d=s.coordinateToVector3(g),A=s.altitudeToVector3(a.height,a.height).x,y=[];a._geometriesAttributes=[],a._colorMap={};for(var v=0;v<t.length;v++){var m=L(d,t[v],s,A),E=m.attributes.position.array;a._geometriesAttributes[v]={position:{count:E.length/3}},y.push(m)}a._datas=t,a._uniforms={time:{type:"pv2",value:0},color:{type:"uvs",value:new THREE.Color("#0099FF")},fadeColor:{type:"uvs",value:new THREE.Color("#000")},opacity:{type:"pv2",value:a.opacity},num:{type:"pv2",value:5},hiz:{type:"pv2",value:.15}},new THREE.ShaderMaterial({uniforms:a._uniforms,vertexShader:"\n precision lowp float;\n precision lowp int;\n #ifdef USE_FOG\n varying float vFogDepth;\n #endif\n varying vec2 vUv;\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n #ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n #endif\n }\n ",fragmentShader:"\n precision lowp float;\n precision lowp int;\n uniform float time;\n uniform float opacity;\n uniform vec3 color;\n uniform vec3 fadeColor;\n uniform float num;\n uniform float hiz;\n varying vec2 vUv;\n void main() {\n vec4 fragColor = vec4(0.);\n float sin = sin((vUv.y - time * hiz) * 10. * num);\n float high = 0.92;\n float medium = 0.4;\n if (sin > high) {\n fragColor = vec4(mix(vec3(.8, 1., 1.), color, (1. - sin) / (1. - high)), 1.);\n } else if(sin > medium) {\n fragColor = vec4(color, mix(1., 0., 1.-(sin - medium) / (high - medium)));\n } else {\n fragColor = vec4(color, 0.);\n }\n //vec3 fade = mix(color, vec3(0., 0., 0.), vUv.y);\n vec3 fade = mix(color, fadeColor, vUv.y);\n //fragColor = mix(fragColor, vec4(fade, 1.), 0.85);\n fragColor = mix(fragColor, vec4(fade, 1.), 0.65);\n gl_FragColor = vec4(fragColor.rgb, fragColor.a * opacity * (1. - vUv.y));\n }\n ",blending:THREE.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:THREE.DoubleSide});var _=new THREE.MeshBasicMaterial({side:THREE.DoubleSide,transparent:!0,opacity:.5,depthTest:!1,color:"blue"});a._createMesh(y[0],_);var I=s.coordinateToVector3(g,0);return a.getObject3d().position.copy(I),a._setPickObject3d(),a._init(),a}return s(r,[{key:"_init",value:function(){var t=this,e=this.getLayer().getPick();this.on("add",(function(){e.add(t.pickObject3d)})),this.on("remove",(function(){e.remove(t.pickObject3d)}))}},{key:"_setPickObject3d",value:function(){if(this._colorMap){for(var t=this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),r=this._geometriesAttributes.length,n=N(this._geometriesAttributes),i=0,o=0;o<r;o++){var s=e.getColor(),a=s.getHex();this._colorMap[a]=o;var u=this._geometriesAttributes[o].position.count;this._datas[o].colorIndex=a;for(var l=0;l<u;l++)n[i]=s.r,n[i+1]=s.g,n[i+2]=s.b,i+=3}t.setAttribute("pickColor",new THREE.BufferAttribute(n,3,!0));var h=new THREE.ShaderMaterial({vertexShader:"\n attribute vec3 pickColor;\n varying vec3 vPickColor;\n void main(){\n vPickColor = pickColor;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n varying vec3 vPickColor;\n void main() {\n gl_FragColor = vec4(vPickColor, 1.0);\n }",side:THREE.DoubleSide,transparent:!0}),c=e.getColor().getHex(),f=new THREE.Mesh(t,h);f.position.copy(this.getObject3d().position),f._colorIndex=c,this.setPickObject3d(f)}}},{key:"getSelectMesh",value:function(){return console.log(this._datas[this.index]),this._datas[this.index]}},{key:"identify",value:function(t){return this.picked}}]),r}(),ra=function(){function e(t,r,n,o,s){i(this,e),this.map=n.map,this.threeLayer=n,this.groupId=o,this.layerClass=s;var a=[];t.features.forEach((function(t){var e=t.geometry;a.push(e)})),this.lineItems=a}var r;return s(e,[{key:"addLine",value:(r=n(t().mark((function e(){var r,n;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=[],this.lineItems.forEach((function(t){"Polygon"===t.type?r.push(t):t.coordinates.forEach((function(t){var e=new maptalks.Polygon(t);r.push(e)}))})),n=new ea(r,{},null,this.threeLayer),this.groupId?this.threeLayer.addMesh1(n,this.groupId):this.threeLayer.addMesh(n);case 4:case"end":return t.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})}]),e}(),na=new THREE.Box3,ia=new THREE.Vector3,oa=function(t){u(r,THREE.InstancedBufferGeometry);var e=f(r);function r(){var t;i(this,r),(t=e.call(this)).isLineSegmentsGeometry=!0,t.type="LineSegmentsGeometry";return t.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),t.setAttribute("position",new THREE.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),t.setAttribute("uv",new THREE.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),t}return s(r,[{key:"applyMatrix4",value:function(t){var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),r.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var r=new THREE.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceStart",new THREE.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceEnd",new THREE.InterleavedBufferAttribute(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var r=new THREE.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceColorStart",new THREE.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceColorEnd",new THREE.InterleavedBufferAttribute(r,3,3)),this}},{key:"fromWireframeGeometry",value:function(t){return this.setPositions(t.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(t){return this.setPositions(t.attributes.position.array),this}},{key:"fromMesh",value:function(t){return this.fromWireframeGeometry(new THREE.WireframeGeometry(t.geometry)),this}},{key:"fromLineSegments",value:function(t){var e=t.geometry;return this.setPositions(e.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),na.setFromBufferAttribute(e),this.boundingBox.union(na))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var r=this.boundingSphere.center;this.boundingBox.getCenter(r);for(var n=0,i=0,o=t.count;i<o;i++)ia.fromBufferAttribute(t,i),n=Math.max(n,r.distanceToSquared(ia)),ia.fromBufferAttribute(e,i),n=Math.max(n,r.distanceToSquared(ia));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}}]),r}(),sa=new THREE.Vector3,aa=new THREE.Vector3,ua=new THREE.Vector4,la=new THREE.Vector4,ha=new THREE.Vector4,ca=new THREE.Vector3,fa=new THREE.Matrix4,pa=new THREE.Line3,ga=new THREE.Vector3,da=new THREE.Box3,Aa=new THREE.Sphere,ya=new THREE.Vector4;function va(t,e,r){return ya.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),ya.multiplyScalar(1/ya.w),ya.x=Ks/r.width,ya.y=Ks/r.height,ya.applyMatrix4(t.projectionMatrixInverse),ya.multiplyScalar(1/ya.w),Math.abs(Math.max(ya.x,ya.y))}var ma=function(t){u(r,THREE.Mesh);var e=f(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new oa,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zs({color:16777215*Math.random()});return i(this,r),(t=e.call(this,n,o)).isLineSegments2=!0,t.type="LineSegments2",t}return s(r,[{key:"computeLineDistances",value:function(){for(var t=this.geometry,e=t.attributes.instanceStart,r=t.attributes.instanceEnd,n=new Float32Array(2*e.count),i=0,o=0,s=e.count;i<s;i++,o+=2)sa.fromBufferAttribute(e,i),aa.fromBufferAttribute(r,i),n[o]=0===o?0:n[o-1],n[o+1]=n[o]+sa.distanceTo(aa);var a=new THREE.InstancedInterleavedBuffer(n,2,1);return t.setAttribute("instanceDistanceStart",new THREE.InterleavedBufferAttribute(a,1,0)),t.setAttribute("instanceDistanceEnd",new THREE.InterleavedBufferAttribute(a,1,1)),this}},{key:"raycast",value:function(t,e){var r=this.material.worldUnits,n=t.camera;null!==n||r||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');var i=void 0!==t.params.Line2&&t.params.Line2.threshold||0;Ws=t.ray;var o,s=this.matrixWorld,a=this.geometry,u=this.material;(Ks=u.linewidth+i,null===a.boundingSphere&&a.computeBoundingSphere(),Aa.copy(a.boundingSphere).applyMatrix4(s),r)?o=.5*Ks:o=va(n,Math.max(n.near,Aa.distanceToPoint(Ws.origin)),u.resolution);if(Aa.radius+=o,!1!==Ws.intersectsSphere(Aa)){var l;if(null===a.boundingBox&&a.computeBoundingBox(),da.copy(a.boundingBox).applyMatrix4(s),r)l=.5*Ks;else l=va(n,Math.max(n.near,da.distanceToPoint(Ws.origin)),u.resolution);da.expandByScalar(l),!1!==Ws.intersectsBox(da)&&(r?function(t,e){for(var r=t.matrixWorld,n=t.geometry,i=n.attributes.instanceStart,o=n.attributes.instanceEnd,s=0,a=Math.min(n.instanceCount,i.count);s<a;s++){pa.start.fromBufferAttribute(i,s),pa.end.fromBufferAttribute(o,s),pa.applyMatrix4(r);var u=new THREE.Vector3,l=new THREE.Vector3;Ws.distanceSqToSegment(pa.start,pa.end,l,u),l.distanceTo(u)<.5*Ks&&e.push({point:l,pointOnLine:u,distance:Ws.origin.distanceTo(l),object:t,face:null,faceIndex:s,uv:null,uv2:null})}}(this,e):function(t,e,r){var n=e.projectionMatrix,i=t.material.resolution,o=t.matrixWorld,s=t.geometry,a=s.attributes.instanceStart,u=s.attributes.instanceEnd,l=Math.min(s.instanceCount,a.count),h=-e.near;Ws.at(1,ha),ha.w=1,ha.applyMatrix4(e.matrixWorldInverse),ha.applyMatrix4(n),ha.multiplyScalar(1/ha.w),ha.x*=i.x/2,ha.y*=i.y/2,ha.z=0,ca.copy(ha),fa.multiplyMatrices(e.matrixWorldInverse,o);for(var c=0,f=l;c<f;c++)if(ua.fromBufferAttribute(a,c),la.fromBufferAttribute(u,c),ua.w=1,la.w=1,ua.applyMatrix4(fa),la.applyMatrix4(fa),!(ua.z>h&&la.z>h)){if(ua.z>h){var p=ua.z-la.z,g=(ua.z-h)/p;ua.lerp(la,g)}else if(la.z>h){var d=la.z-ua.z,A=(la.z-h)/d;la.lerp(ua,A)}ua.applyMatrix4(n),la.applyMatrix4(n),ua.multiplyScalar(1/ua.w),la.multiplyScalar(1/la.w),ua.x*=i.x/2,ua.y*=i.y/2,la.x*=i.x/2,la.y*=i.y/2,pa.start.copy(ua),pa.start.z=0,pa.end.copy(la),pa.end.z=0;var y=pa.closestPointToPointParameter(ca,!0);pa.at(y,ga);var v=THREE.MathUtils.lerp(ua.z,la.z,y),m=v>=-1&&v<=1,E=ca.distanceTo(ga)<.5*Ks;if(m&&E){pa.start.fromBufferAttribute(a,c),pa.end.fromBufferAttribute(u,c),pa.start.applyMatrix4(o),pa.end.applyMatrix4(o);var _=new THREE.Vector3,I=new THREE.Vector3;Ws.distanceSqToSegment(pa.start,pa.end,I,_),r.push({point:I,pointOnLine:_,distance:Ws.origin.distanceTo(I),object:t,face:null,faceIndex:c,uv:null,uv2:null})}}}(this,n,e))}}}]),r}(),Ea=function(t){u(r,oa);var e=f(r);function r(){var t;return i(this,r),(t=e.call(this)).isLineGeometry=!0,t.type="LineGeometry",t}return s(r,[{key:"setPositions",value:function(t){for(var e=t.length-3,n=new Float32Array(2*e),i=0;i<e;i+=3)n[2*i]=t[i],n[2*i+1]=t[i+1],n[2*i+2]=t[i+2],n[2*i+3]=t[i+3],n[2*i+4]=t[i+4],n[2*i+5]=t[i+5];return g(l(r.prototype),"setPositions",this).call(this,n),this}},{key:"setColors",value:function(t){for(var e=t.length-3,n=new Float32Array(2*e),i=0;i<e;i+=3)n[2*i]=t[i],n[2*i+1]=t[i+1],n[2*i+2]=t[i+2],n[2*i+3]=t[i+3],n[2*i+4]=t[i+4],n[2*i+5]=t[i+5];return g(l(r.prototype),"setColors",this).call(this,n),this}},{key:"fromLine",value:function(t){var e=t.geometry;return this.setPositions(e.attributes.position.array),this}}]),r}(),_a=function(t){u(r,ma);var e=f(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ea,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zs({color:16777215*Math.random()});return i(this,r),(t=e.call(this,n,o)).isLine2=!0,t.type="Line2",t}return s(r)}(),Ia={altitude:0,height:10},xa=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),n=maptalks.Util.extend({},Ia,n,{layer:s,coordinate:t}),a=e.call(this);var u=n,l=u.altitude,h=u.height;a._initOptions(n),a.map=s.map;var f=s.altitudeToVector3(h,h).x;a.beginSizeZoom=n.beginSizeZoom||3,a.endSizeZoom=n.endSizeZoom||12,a.spanSizeZoom=a.endSizeZoom-a.beginSizeZoom,a.stepSize=1/(a.endSizeZoom-a.beginSizeZoom+1);var p=[];p.push(0,0,f),p.push(0,0,0);var g=new Ea;g.setPositions(p),a.object3d=new _a(g,o),a.object3d.computeLineDistances(),a.object3d.scale.set(1,1,1),a.object3d.__parent=c(a);var d=s.distanceToVector3(l,l).x,A=s.coordinateToVector3(t,d);return a.getObject3d().position.copy(A),n.closeZoomChange||(a.zoomChange=function(){var t=a.getMap();if(t){var e=t.pixelToDistance(1,0);g.attributes.instanceStart.data.array[2]=f*e*a._getRate(),g.attributes.instanceStart.needsUpdate=!0}}),a}return s(r,[{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}}]),r}(),Ca=function(){function t(e,r,n,o){var s=this;i(this,t),0!=e.length?(this.map=n.map,this.threeLayer=n,this.groupId=o,this.height=r.height||50,this.renderOrder=r.renderOrder||0,this.isGradient=void 0===r.isGradient||r.isGradient,this.closeZoomChange=r.closeZoomChange||!1,this.dashed=void 0!==r.dashed&&r.dashed,this.dashScale=void 0!==r.dashScale?r.dashScale:2,this.dashSize=void 0!==r.dashSize?r.dashSize:1,this.gapSize=void 0!==r.gapSize?r.gapSize:1,this.meshs=[],e.forEach((function(t){var e;e=s.dashed?new Zs({color:t.color||"#35FFAC",transparent:!0,linewidth:r.linewidth||4,dashed:!0,defines:{USE_DASH:""},dashScale:s.dashScale,dashSize:s.dashSize,gapSize:s.gapSize}):new Zs({color:t.color||"#35FFAC",linewidth:r.lineWidth||4,dashed:!1,transparent:!0,opacity:r.opacity||1}),s._setMaterialRes(n,e);var i=new xa([t.longitude,t.latitude],{height:t.height||s.height,interactive:!1,beginSizeZoom:r.beginSizeZoom||9,endSizeZoom:r.endSizeZoom||16,closeZoomChange:s.closeZoomChange},e,n);i.object3d.renderOrder=s.renderOrder,s.dashed&&(i.zoomChange=function(){if(s.map){var t=s.map.pixelToDistance(1,0);e.dashScale=18.93/t}}),s.isGradient&&(e.onBeforeCompile=function(t){t.vertexShader=t.vertexShader.replace("uniform float linewidth;","\n varying vec3 vPos;\n uniform float linewidth;\n "),t.vertexShader=t.vertexShader.replace("void main() {","\n void main() {\n vPos = position;\n "),t.fragmentShader=t.fragmentShader.replace("#include <common>","\n varying vec3 vPos;\n #include <common>\n "),t.fragmentShader=t.fragmentShader.replace("gl_FragColor = vec4( diffuseColor.rgb, alpha );","\n vec3 origin = vec3(0., 0., 0.);\n vec3 dis = vec3(0.,vPos.y, 0.);\n float distance = clamp(length(dis - origin), 0., 1.0);\n float opacity = 1. - distance / 1.;\n //float opacity = 1.;\n gl_FragColor = vec4( diffuseColor.rgb, alpha * opacity );\n ")}),void 0!==t.visible&&!1===t.visible&&i.hide(),s.meshs.push(i)})),o?this.threeLayer.addMesh1(this.meshs,this.groupId):this.threeLayer.addMesh(this.meshs),this.dataItems=e):console.error("需要绘制的点位数量为0")}return s(t,[{key:"_setMaterialRes",value:function(t,e){var r=t.getMap().getSize(),n=r.width,i=r.height;e.resolution.set(n,i)}},{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}},{key:"_bindMapEvents",value:function(t){t&&t.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setPointEvent",value:function(t){"click"===t.type&&this.callback&&this.callback(t.target.data)}},{key:"show",value:function(){this.meshs.forEach((function(t){t.show()}))}},{key:"hide",value:function(){this.meshs.forEach((function(t){t.hide()}))}},{key:"pointShowHideByCode",value:function(t,e,r){for(var n=1/0,i=1/0,o=-1/0,s=-1/0,a=0;a<this.dataItems.length;a++){var u=this.dataItems[a];t.includes(u.code)?(n=Math.min(n,this.dataItems[a].longitude),i=Math.min(i,this.dataItems[a].latitude),o=Math.max(o,this.dataItems[a].longitude),s=Math.max(s,this.dataItems[a].latitude),u.visibility=1):u.visibility=.1}this.updateByVisibility(),e&&this.map.fitExtent(new maptalks.Extent(n,i,o,s),r||0)}},{key:"updateByVisibility",value:function(){var t=this;this.meshs.forEach((function(e,r){.1===t.dataItems[r].visibility?e.hide():e.show()}))}},{key:"dispose",value:function(){var t=this;this.meshs.forEach((function(e){t.groupId?t.threeLayer.removeMesh1(e,t.groupId):t.threeLayer.removeMesh(e),e.object3d.geometry&&e.object3d.geometry.dispose(),e.object3d.material&&e.object3d.material.dispose()}))}}]),t}(),wa={altitude:0,height:0},ba=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),o=maptalks.Util.extend({},wa,o,{layer:s}),a=e.call(this);var u=o,l=u.width,h=u.height,c=u.altitude;a._initOptions(o);var f=new THREE.PlaneGeometry(l,h);a._createMesh(f,n);var p=s.distanceToVector3(c,c).x,g=s.coordinateToVector3(t,p);return a.getObject3d().position.copy(g),a}return s(r)}(),Ba=function(){function t(e,r,n,o,s,a,u){var l=this;i(this,t),this.threelayer=s,this.map=s.map,this.layerClass=a,this.groupId=u,this.millsec=o.millsec||1e3,this.duration=o.duration||75;var h=e.split(","),c=r.split(","),f=parseFloat(h[0]),p=parseFloat(h[1]),g=parseFloat(c[0]),d=parseFloat(c[1]),A=new maptalks.Extent(f,p,g,d),y=1/0,v=1/0,m=-1/0,E=-1/0;[[f,p],[f,d],[g,d],[g,p]].forEach((function(t){var e=l.threelayer.coordinateToVector3(t),r=e.x,n=e.y;y=Math.min(r,y),v=Math.min(n,v),m=Math.max(r,m),E=Math.max(n,E)}));var _=Math.abs(m-y),I=Math.abs(E-v);n.length>1&&jt.generateGifTexture(n,o.width,o.height).then((function(t){l.texture=t.texture,l.annie=new X(t.texture,t.colNum,t.rowNum,n.length,l.duration,t.colNum==t.rowNum);var e=new THREE.MeshBasicMaterial({map:t.texture,transparent:!0,opacity:void 0!==o.opacity?parseFloat(o.opacity):1}),r=new ba(A.getCenter(),e,{width:_,height:I,interactive:!1},s);l.groupId?l.threelayer.addMesh1(r,l.groupId):l.threelayer.addMesh(r),l.imgObj=r,l.layerClass.updatables.push(l)}))}return s(t,[{key:"show",value:function(){var t;null===(t=this.imgObj)||void 0===t||t.show()}},{key:"hide",value:function(){var t;null===(t=this.imgObj)||void 0===t||t.hide()}},{key:"tick",value:function(t){var e;null===(e=this.annie)||void 0===e||e.update(this.millsec*t)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.groupId?this.threelayer.removeMesh1(this.imgObj,this.groupId):this.threelayer.removeMesh(this.imgObj),this.imgObj.object3d.geometry&&this.imgObj.object3d.geometry.dispose(),this.imgObj.object3d.material&&this.imgObj.object3d.material.dispose(),null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),Sa={radius:50,altitude:0},Ta=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),n=maptalks.Util.extend({},Sa,n,{layer:s}),a=e.call(this),n.altitude,a._initOptions(n);var u=R(t),l=s.coordinateToVector3(u),h=[];t.forEach((function(t){var e=s.coordinateToVector3(t);e.sub(l),h.push(e)}));var c=new THREE.CatmullRomCurve3(h),f=s.distanceToVector3(n.radius,n.radius).x,p=new THREE.TubeGeometry(c,2,f,20,!1);return a._createMesh(p,o),a.parent=null,a.getObject3d().position.set(l.x,l.y,f/2),a}return s(r)}(),Ma=function(){function t(e,r,n,o){i(this,t),this.threelayer=n,this.map=n.map,this.groupId=o;var s=new THREE.MeshMatcapMaterial({color:r.color||"red",side:THREE.DoubleSide});this.m=s;var a=new Ta(e,{radius:r.radius||2},s,n);a.parent=this,this.groupId?this.threelayer.addMesh1(a,this.groupId):this.threelayer.addMesh(a),this.mesh=a}return s(t,[{key:"dispose",value:function(){this.groupId?this.threelayer.removeMesh1(this.mesh,this.groupId):this.threelayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose(),this.mesh.object3d.material&&(this.mesh.object3d.material.dispose(),delete this.m)}}]),t}(),Ra={radius:100,altitude:0},La=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s,a){var u;i(this,r),n=maptalks.Util.extend({},Ra,n,{layer:a,coordinate:t}),(u=e.call(this))._initOptions(n);var l=n.altitude;u.object3d=new _a(o,s),u.object3d.computeLineDistances(),u.object3d.scale.set(1,1,1),u.object3d.__parent=c(u);var h=a.distanceToVector3(l,l).x,f=a.coordinateToVector3(t,h);return u.getObject3d().position.copy(f),u}return s(r)}(),Na={altitude:0,height:0},Pa=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),o=maptalks.Util.extend({},Na,o,{layer:s}),a=e.call(this);var u=o.altitude;a._initOptions(o);var l=o.scaleFactor||1,h=[],c=new THREE.ConeGeometry(1*l,2*l,10);c.translate(0,2.5*l,0),h.push(c);var f=new THREE.CylinderGeometry(.4*l,.6*l,3*l,10);h.push(f);var p=x(h);p.computeVertexNormals(),a._createMesh(p,n);var g=s.distanceToVector3(u,u).x,d=s.coordinateToVector3(t,g);return a.getObject3d().position.copy(d),a}return s(r)}(),ka=function(){function e(t,r,n,o,s){i(this,e),this.threelayer=n,this.map=n.map,this.layerClass=o,this.groupId=s;var a=void 0===r.lineFlag||!1!==r.lineFlag,u=r.heightDiv||4,l=r.pointsLen||20,h=r.arrowColor||"rgb(0,255,255)",c=r.arrowNum||5;this.speedFactor=r.speedFactor||2e-4,this.material=null,this.curve=null,this.meshs=[],this.arrows=[],this.up=new THREE.Vector3(0,1,0),this.axis=new THREE.Vector3,a&&(this.lineMaterial=new Zs({color:r.lineColor||"red",transparent:!0,linewidth:r.linewidth||4}),this._setMaterialRes(n,this.lineMaterial));var f=new THREE.MeshBasicMaterial({color:h,side:THREE.DoubleSide,transparent:!0});this.material=f;var p=new maptalks.LineString(t),g=D(p)/u,d=n.distanceToVector3(g,g).x,A=t[0],y=t[1],v=[A[0]/2+y[0]/2,A[1]/2+y[1]/2],m=n.coordinateToVector3(p.getCenter()),E=n.coordinateToVector3(A).sub(m),_=n.coordinateToVector3(y).sub(m),I=n.coordinateToVector3(v,d).sub(m),x=new THREE.CatmullRomCurve3([E,I,_],!1,"catmullrom");this.curve=x,this.centerPt=m;var C=x.getPoints(l),w=[];C.forEach((function(t){w.push(t.x,t.y,t.z)}));var b=new Ea;b.setPositions(w);var B=new La(p.getCenter(),{interactive:!1},b,this.lineMaterial,n);this.meshs.push(B),this.ArrowNum=c;var S=1/this.ArrowNum;this.addSpan=Math.floor(100*S)/100;for(var T=0;T<this.ArrowNum;T++){var M=new Pa(t[0],f,{scaleFactor:r.scaleFactor||1},n);M.object3d.renderOrder=r.arrowOrder||1,this.arrows.push(M)}this.groupId?(this.threelayer.addMesh1(B,this.groupId),this.threelayer.addMesh1(this.arrows,this.groupId)):(this.threelayer.addMesh(B),this.threelayer.addMesh(this.arrows)),this.layerClass.updatables.push(this)}var r;return s(e,[{key:"tick",value:function(t){if(this.curve)for(var e=this.speedFactor*performance.now(),r=0;r<this.ArrowNum;r++){var n=(e+this.addSpan*r)%1,i=this.curve.getPointAt(n).add(this.centerPt);this.arrows[r].getObject3d().position.copy(i);var o=this.curve.getTangentAt(n);this.axis.crossVectors(this.up,o).normalize();var s=Math.acos(this.up.dot(o));this.arrows[r].getObject3d().quaternion.setFromAxisAngle(this.axis,s)}}},{key:"_setMaterialRes",value:function(t,e){var r=t.getMap().getSize(),n=r.width,i=r.height;e.resolution.set(n,i)}},{key:"loadTexture",value:(r=n(t().mark((function e(r){var n;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.promiseToDoSomething(r);case 2:return n=t.sent,this.texture=new THREE.CanvasTexture(n.canvas),this.material=new THREE.MeshBasicMaterial({map:this.texture,side:THREE.DoubleSide,transparent:!0}),t.abrupt("return",this.material);case 6:case"end":return t.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"promiseToDoSomething",value:function(t){return new Promise((function(e){var r=document.createElement("canvas").getContext("2d");r.canvas.width=64,r.canvas.height=64,r.translate(35,32),r.rotate(.5*-Math.PI),r.fillStyle=t,r.textAlign="center",r.textBaseline="middle",r.font="48px sans-serif",r.fillText("➡︎",0,0),setTimeout((function(){return e(r)}),4)}))}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this.meshs&&(this.groupId?this.threelayer.removeMesh1(this.meshs,this.groupId):this.threelayer.removeMesh(this.meshs),this.meshs.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()}))),this.arrows&&(this.groupId?this.threelayer.removeMesh1(this.arrows,this.groupId):this.threelayer.removeMesh(this.arrows),this.arrows.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()}))),this.material&&this.material.dispose(),this.lineMaterial&&this.lineMaterial.dispose(),this.texture&&this.texture.dispose(),this.curve&&delete this.curve}}]),e}(),Da=function(){function t(e,r,n,o,s){var a=this;i(this,t),this.threelayer=n,this.map=n.map,this.layerClass=o,this.groupId=s;var u=r.heightDiv||4,l=r.pointsLen||20;this.speedFactor=r.speedFactor||.01,this.sum=0,this.meshs=[];var h=new maptalks.LineString(e),c=D(h)/u,f=n.distanceToVector3(c,c).x,p=e[0],g=e[1],d=[p[0]/2+g[0]/2,p[1]/2+g[1]/2],A=n.coordinateToVector3(h.getCenter()),y=n.coordinateToVector3(p).sub(A),v=n.coordinateToVector3(g).sub(A),m=n.coordinateToVector3(d,f).sub(A);this.lineMaterialDash=new Zs({color:r.lineDashColor||"red",transparent:!0,linewidth:r.lineDashWidth||4,dashed:!0,defines:{USE_DASH:""},dashScale:1,dashSize:r.dashSize||20,gapSize:1}),this.lineMaterial=new Zs({color:r.lineColor||"red",transparent:!0,linewidth:r.lineWidth||2,opacity:r.lineOpacity||.4}),this._setMaterialRes(n,this.lineMaterialDash),this._setMaterialRes(n,this.lineMaterial);var E=new THREE.CatmullRomCurve3([y,m,v],!1,"catmullrom").getPoints(l),_=[];E.forEach((function(t){_.push(t.x,t.y,t.z)}));var I=new Ea;I.setPositions(_);var x=new La(h.getCenter(),{interactive:!1},I,this.lineMaterialDash,n),C=new La(h.getCenter(),{interactive:!1},I,this.lineMaterial,n),w=C.object3d.geometry.attributes.instanceDistanceEnd.array;this.len=w[w.length-1],this.dur=this.len/3,this.lineMaterialDash.onBeforeCompile=function(t){t.uniforms.actionRatio={value:0},t.uniforms.lineLength={value:a.len},t.fragmentShader=t.fragmentShader.replace("#include <common>","\n uniform float actionRatio;\n uniform float lineLength;\n #include <common>\n "),t.fragmentShader=t.fragmentShader.replace("if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard;","\n float halfDash = dashSize * 0.5;\n float currPos = (lineLength + dashSize) * actionRatio;\n float d = (vLineDistance + halfDash) - currPos;\n if (abs(d) > halfDash ) discard;\n \n float grad = ((vLineDistance + halfDash) - (currPos - halfDash)) / halfDash;\n ").replace("gl_FragColor = vec4( diffuseColor.rgb, alpha );","\n gl_FragColor = vec4( diffuseColor.rgb, alpha * grad);\n "),a.shaderDash=t},this.groupId?(this.threelayer.addMesh1(C,this.groupId),this.threelayer.addMesh1(x,this.groupId)):(this.threelayer.addMesh(C),this.threelayer.addMesh(x)),this.meshs.push(C),this.meshs.push(x),this.layerClass.updatables.push(this)}return s(t,[{key:"tick",value:function(t){this.shaderDash&&(this.sum+=this.dur*t*this.speedFactor,this.sum%=1,this.shaderDash.uniforms.actionRatio.value=this.sum)}},{key:"setPath",value:function(t,e,r,n){for(var i=t.geometry.attributes.position,o=new THREE.CatmullRomCurve3([e,n,r],!1,"catmullrom").getPoints(20),s=0;s<=19;s++){var a=o[s];i.setXYZ(s,a.x,a.y,a.z)}i.needsUpdate=!0,t.computeLineDistances(),t.geometry.attributes.lineDistance.needsUpdate=!0,t.material.dashSize=20}},{key:"_setMaterialRes",value:function(t,e){var r=t.getMap().getSize(),n=r.width,i=r.height;e.resolution.set(n,i)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this.meshs&&(this.groupId?this.threelayer.removeMesh1(this.meshs,this.groupId):this.threelayer.removeMesh(this.meshs),this.meshs.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()}))),this.lineMaterialDash&&this.lineMaterialDash.dispose(),this.lineMaterial&&this.lineMaterial.dispose()}}]),t}();function Qa(t,e){void 0===e&&(e={});var r="object"==typeof e?e.mutate:e;if(!t)throw new Error("geojson is required");var n=Qt(t),i=[];switch(n){case"LineString":i=Oa(t);break;case"MultiLineString":case"Polygon":Rt(t).forEach((function(t){i.push(Oa(t))}));break;case"MultiPolygon":Rt(t).forEach((function(t){var e=[];t.forEach((function(t){e.push(Oa(t))})),i.push(e)}));break;case"Point":return t;case"MultiPoint":var o={};Rt(t).forEach((function(t){var e=t.join("-");Object.prototype.hasOwnProperty.call(o,e)||(i.push(t),o[e]=!0)}));break;default:throw new Error(n+" geometry not supported")}return t.coordinates?!0===r?(t.coordinates=i,t):{type:n,coordinates:i}:!0===r?(t.geometry.coordinates=i,t):nt({type:n,coordinates:i},t.properties,{bbox:t.bbox,id:t.id})}function Oa(t){var e=Rt(t);if(2===e.length&&!Fa(e[0],e[1]))return e;var r=[],n=e.length-1,i=r.length;r.push(e[0]);for(var o=1;o<n;o++){var s=r[r.length-1];e[o][0]===s[0]&&e[o][1]===s[1]||(r.push(e[o]),(i=r.length)>2&&Ga(r[i-3],r[i-1],r[i-2])&&r.splice(r.length-2,1))}if(r.push(e[e.length-1]),i=r.length,Fa(e[0],e[e.length-1])&&i<4)throw new Error("invalid polygon");return Ga(r[i-3],r[i-1],r[i-2])&&r.splice(r.length-2,1),r}function Fa(t,e){return t[0]===e[0]&&t[1]===e[1]}function Ga(t,e,r){var n=r[0],i=r[1],o=t[0],s=t[1],a=e[0],u=e[1],l=a-o,h=u-s;return 0===(n-o)*h-(i-s)*l&&(Math.abs(l)>=Math.abs(h)?l>0?o<=n&&n<=a:a<=n&&n<=o:h>0?s<=i&&i<=u:u<=i&&i<=s)}function Ua(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Ha(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(r){switch(r){case"type":case"features":return;default:e[r]=t[r]}})),e.features=t.features.map((function(t){return Ha(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return qa(t);default:throw new Error("unknown GeoJSON type")}}function Ha(t){var e={type:"Feature"};return Object.keys(t).forEach((function(r){switch(r){case"type":case"properties":case"geometry":return;default:e[r]=t[r]}})),e.properties=ja(t.properties),e.geometry=qa(t.geometry),e}function ja(t){var e={};return t?(Object.keys(t).forEach((function(r){var n=t[r];"object"==typeof n?null===n?e[r]=null:Array.isArray(n)?e[r]=n.map((function(t){return t})):e[r]=ja(n):e[r]=n})),e):e}function qa(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return qa(t)})),e):(e.coordinates=Va(t.coordinates),e)}function Va(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Va(t)}))}function za(t,e,r){if(null!==t)for(var n,i,o,s,a,u,l,h,c=0,f=0,p=t.type,g="FeatureCollection"===p,d="Feature"===p,A=g?t.features.length:1,y=0;y<A;y++){a=(h=!!(l=g?t.features[y].geometry:d?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var v=0;v<a;v++){var m=0,E=0;if(null!==(s=h?l.geometries[v]:l)){u=s.coordinates;var _=s.type;switch(c=!r||"Polygon"!==_&&"MultiPolygon"!==_?0:1,_){case null:break;case"Point":if(!1===e(u,f,y,m,E))return!1;f++,m++;break;case"LineString":case"MultiPoint":for(n=0;n<u.length;n++){if(!1===e(u[n],f,y,m,E))return!1;f++,"MultiPoint"===_&&m++}"LineString"===_&&m++;break;case"Polygon":case"MultiLineString":for(n=0;n<u.length;n++){for(i=0;i<u[n].length-c;i++){if(!1===e(u[n][i],f,y,m,E))return!1;f++}"MultiLineString"===_&&m++,"Polygon"===_&&E++}"Polygon"===_&&m++;break;case"MultiPolygon":for(n=0;n<u.length;n++){for(E=0,i=0;i<u[n].length;i++){for(o=0;o<u[n][i].length-c;o++){if(!1===e(u[n][i][o],f,y,m,E))return!1;f++}E++}m++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(!1===za(s.geometries[n],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Ya(t,e,r,n){var i=r;return za(t,(function(t,n,o,s,a){i=0===n&&void 0===r?t:e(i,t,n,o,s,a)}),n),i}function Xa(t,e){var r;switch(t.type){case"FeatureCollection":for(r=0;r<t.features.length&&!1!==e(t.features[r].properties,r);r++);break;case"Feature":e(t.properties,0)}}function Ja(t,e,r){var n=r;return Xa(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n}function Wa(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var r=0;r<t.features.length&&!1!==e(t.features[r],r);r++);}function Ka(t,e,r){var n=r;return Wa(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n}function Za(t){var e=[];return za(t,(function(t){e.push(t)})),e}function $a(t,e){var r,n,i,o,s,a,u,l,h,c,f=0,p="FeatureCollection"===t.type,g="Feature"===t.type,d=p?t.features.length:1;for(r=0;r<d;r++){for(a=p?t.features[r].geometry:g?t.geometry:t,l=p?t.features[r].properties:g?t.properties:{},h=p?t.features[r].bbox:g?t.bbox:void 0,c=p?t.features[r].id:g?t.id:void 0,s=(u=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=u?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,f,l,h,c))return!1;break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===e(o.geometries[n],f,l,h,c))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,f,l,h,c))return!1;f++}}function tu(t,e,r){var n=r;return $a(t,(function(t,i,o,s,a){n=0===i&&void 0===r?t:e(n,t,i,o,s,a)})),n}function eu(t,e){$a(t,(function(t,r,n,i,o){var s,a=null===t?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==e(nt(t,n,{bbox:i,id:o}),r,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var u=0;u<t.coordinates.length;u++){var l=t.coordinates[u];if(!1===e(nt({type:s,coordinates:l},n),r,u))return!1}}))}function ru(t,e,r){var n=r;return eu(t,(function(t,i,o){n=0===i&&0===o&&void 0===r?t:e(n,t,i,o)})),n}function nu(t,e){eu(t,(function(t,r,n){var i=0;if(t.geometry){var o=t.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var s,a=0,u=0,l=0;return!1!==za(t,(function(o,h,c,f,p){if(void 0===s||r>a||f>u||p>l)return s=o,a=r,u=f,l=p,void(i=0);var g=lt([s,o],t.properties);if(!1===e(g,r,n,p,i))return!1;i++,s=o}))&&void 0}}}))}function iu(t,e,r){var n=r,i=!1;return nu(t,(function(t,o,s,a,u){n=!1===i&&void 0===r?t:e(n,t,o,s,a,u),i=!0})),n}function ou(t,e){if(!t)throw new Error("geojson is required");eu(t,(function(t,r,n){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,r,n,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===e(lt(o[s],t.properties),r,n,s))return!1}}}))}function su(t,e,r){var n=r;return ou(t,(function(t,i,o,s){n=0===i&&void 0===r?t:e(n,t,i,o,s)})),n}function au(t,e){if(!bt(e=e||{}))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),a=a||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":a=a||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var u=r.coordinates;switch(r.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=u.length+s-1),lt([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),lt([u[o][s],u[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s-1),lt([u[i][s],u[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s-1),lt([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")}function uu(t,e){if(!bt(e=e||{}))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),a=a||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":a=a||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var u=r.coordinates;switch(r.type){case"Point":return ot(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),ot(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),ot(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),ot(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),ot(u[i][s],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s),ot(u[i][o][s],a,e)}throw new Error("geojson is invalid")}var lu=Object.freeze({__proto__:null,coordAll:Za,coordEach:za,coordReduce:Ya,featureEach:Wa,featureReduce:Ka,findPoint:uu,findSegment:au,flattenEach:eu,flattenReduce:ru,geomEach:$a,geomReduce:tu,lineEach:ou,lineReduce:su,propEach:Xa,propReduce:Ja,segmentEach:nu,segmentReduce:iu});function hu(t,e,r){var n=e.x,i=e.y,o=r.x-n,s=r.y-i;if(0!==o||0!==s){var a=((t.x-n)*o+(t.y-i)*s)/(o*o+s*s);a>1?(n=r.x,i=r.y):a>0&&(n+=o*a,i+=s*a)}return(o=t.x-n)*o+(s=t.y-i)*s}function cu(t,e,r,n,i){for(var o,s=n,a=e+1;a<r;a++){var u=hu(t[a],t[e],t[r]);u>s&&(o=a,s=u)}s>n&&(o-e>1&&cu(t,e,o,n,i),i.push(t[o]),r-o>1&&cu(t,o,r,n,i))}function fu(t,e){var r=t.length-1,n=[t[0]];return cu(t,0,r,e,n),n.push(t[r]),n}function pu(t,e,r){if(t.length<=2)return t;var n=void 0!==e?e*e:1;return t=r?t:function(t,e){for(var r,n,i,o,s,a=t[0],u=[a],l=1,h=t.length;l<h;l++)r=t[l],i=a,o=void 0,s=void 0,o=(n=r).x-i.x,s=n.y-i.y,o*o+s*s>e&&(u.push(r),a=r);return a!==r&&u.push(r),u}(t,n),t=fu(t,n)}function gu(t,e){if(!bt(e=e||{}))throw new Error("options is invalid");var r=void 0!==e.tolerance?e.tolerance:1,n=e.highQuality||!1,i=e.mutate||!1;if(!t)throw new Error("geojson is required");if(r&&r<0)throw new Error("invalid tolerance");return!0!==i&&(t=Ua(t)),$a(t,(function(t){!function(t,e,r){var n=t.type;if("Point"===n||"MultiPoint"===n)return t;Qa(t,!0);var i=t.coordinates;switch(n){case"LineString":t.coordinates=du(i,e,r);break;case"MultiLineString":t.coordinates=i.map((function(t){return du(t,e,r)}));break;case"Polygon":t.coordinates=Au(i,e,r);break;case"MultiPolygon":t.coordinates=i.map((function(t){return Au(t,e,r)}))}}(t,r,n)})),t}function du(t,e,r){return pu(t.map((function(t){return{x:t[0],y:t[1],z:t[2]}})),e,r).map((function(t){return t.z?[t.x,t.y,t.z]:[t.x,t.y]}))}function Au(t,e,r){return t.map((function(t){var n=t.map((function(t){return{x:t[0],y:t[1]}}));if(n.length<4)throw new Error("invalid polygon");for(var i=pu(n,e,r).map((function(t){return[t.x,t.y]}));!yu(i);)i=pu(n,e-=.01*e,r).map((function(t){return[t.x,t.y]}));return i[i.length-1][0]===i[0][0]&&i[i.length-1][1]===i[0][1]||i.push(i[0]),i}))}function yu(t){return!(t.length<3)&&!(3===t.length&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}var vu={exports:{}};function mu(t,e,r){r=r||2;var n,i,o,s,a,u,l,h=e&&e.length,c=h?e[0]*r:t.length,f=Eu(t,0,c,r,!0),p=[];if(!f||f.next===f.prev)return p;if(h&&(f=function(t,e,r,n){var i,o,s,a=[];for(i=0,o=e.length;i<o;i++)(s=Eu(t,e[i]*n,i<o-1?e[i+1]*n:t.length,n,!1))===s.next&&(s.steiner=!0),a.push(Ru(s));for(a.sort(Bu),i=0;i<a.length;i++)r=Su(a[i],r);return r}(t,e,f,r)),t.length>80*r){n=o=t[0],i=s=t[1];for(var g=r;g<c;g+=r)(a=t[g])<n&&(n=a),(u=t[g+1])<i&&(i=u),a>o&&(o=a),u>s&&(s=u);l=0!==(l=Math.max(o-n,s-i))?32767/l:0}return Iu(f,p,r,n,i,l,0),p}function Eu(t,e,r,n,i){var o,s;if(i===qu(t,e,r,n)>0)for(o=e;o<r;o+=n)s=Uu(o,t[o],t[o+1],s);else for(o=r-n;o>=e;o-=n)s=Uu(o,t[o],t[o+1],s);return s&&ku(s,s.next)&&(Hu(s),s=s.next),s}function _u(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!ku(n,n.next)&&0!==Pu(n.prev,n,n.next))n=n.next;else{if(Hu(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function Iu(t,e,r,n,i,o,s){if(t){!s&&o&&function(t,e,r,n){var i=t;do{0===i.z&&(i.z=Mu(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,o,s,a,u,l=1;do{for(r=t,t=null,o=null,s=0;r;){for(s++,n=r,a=0,e=0;e<l&&(a++,n=n.nextZ);e++);for(u=l;a>0||u>0&&n;)0!==a&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,a--):(i=n,n=n.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,l*=2}while(s>1)}(i)}(t,n,i,o);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,o?Cu(t,n,i,o):xu(t))e.push(a.i/r|0),e.push(t.i/r|0),e.push(u.i/r|0),Hu(t),t=u.next,l=u.next;else if((t=u)===l){s?1===s?Iu(t=wu(_u(t),e,r),e,r,n,i,o,2):2===s&&bu(t,e,r,n,i,o):Iu(_u(t),e,r,n,i,o,1);break}}}function xu(t){var e=t.prev,r=t,n=t.next;if(Pu(e,r,n)>=0)return!1;for(var i=e.x,o=r.x,s=n.x,a=e.y,u=r.y,l=n.y,h=i<o?i<s?i:s:o<s?o:s,c=a<u?a<l?a:l:u<l?u:l,f=i>o?i>s?i:s:o>s?o:s,p=a>u?a>l?a:l:u>l?u:l,g=n.next;g!==e;){if(g.x>=h&&g.x<=f&&g.y>=c&&g.y<=p&&Lu(i,a,o,u,s,l,g.x,g.y)&&Pu(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function Cu(t,e,r,n){var i=t.prev,o=t,s=t.next;if(Pu(i,o,s)>=0)return!1;for(var a=i.x,u=o.x,l=s.x,h=i.y,c=o.y,f=s.y,p=a<u?a<l?a:l:u<l?u:l,g=h<c?h<f?h:f:c<f?c:f,d=a>u?a>l?a:l:u>l?u:l,A=h>c?h>f?h:f:c>f?c:f,y=Mu(p,g,e,r,n),v=Mu(d,A,e,r,n),m=t.prevZ,E=t.nextZ;m&&m.z>=y&&E&&E.z<=v;){if(m.x>=p&&m.x<=d&&m.y>=g&&m.y<=A&&m!==i&&m!==s&&Lu(a,h,u,c,l,f,m.x,m.y)&&Pu(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,E.x>=p&&E.x<=d&&E.y>=g&&E.y<=A&&E!==i&&E!==s&&Lu(a,h,u,c,l,f,E.x,E.y)&&Pu(E.prev,E,E.next)>=0)return!1;E=E.nextZ}for(;m&&m.z>=y;){if(m.x>=p&&m.x<=d&&m.y>=g&&m.y<=A&&m!==i&&m!==s&&Lu(a,h,u,c,l,f,m.x,m.y)&&Pu(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;E&&E.z<=v;){if(E.x>=p&&E.x<=d&&E.y>=g&&E.y<=A&&E!==i&&E!==s&&Lu(a,h,u,c,l,f,E.x,E.y)&&Pu(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function wu(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!ku(i,o)&&Du(i,n,n.next,o)&&Fu(i,o)&&Fu(o,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(o.i/r|0),Hu(n),Hu(n.next),n=t=o),n=n.next}while(n!==t);return _u(n)}function bu(t,e,r,n,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&Nu(s,a)){var u=Gu(s,a);return s=_u(s,s.next),u=_u(u,u.next),Iu(s,e,r,n,i,o,0),void Iu(u,e,r,n,i,o,0)}a=a.next}s=s.next}while(s!==t)}function Bu(t,e){return t.x-e.x}function Su(t,e){var r=function(t,e){var r,n=e,i=t.x,o=t.y,s=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>s&&(s=a,r=n.x<n.next.x?n:n.next,a===i))return r}n=n.next}while(n!==e);if(!r)return null;var u,l=r,h=r.x,c=r.y,f=1/0;n=r;do{i>=n.x&&n.x>=h&&i!==n.x&&Lu(o<c?i:s,o,h,c,o<c?s:i,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(i-n.x),Fu(n,t)&&(u<f||u===f&&(n.x>r.x||n.x===r.x&&Tu(r,n)))&&(r=n,f=u)),n=n.next}while(n!==l);return r}(t,e);if(!r)return e;var n=Gu(r,t);return _u(n,n.next),_u(r,r.next)}function Tu(t,e){return Pu(t.prev,t,e.prev)<0&&Pu(e.next,t,t.next)<0}function Mu(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ru(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function Lu(t,e,r,n,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(n-a)>=(r-s)*(e-a)&&(r-s)*(o-a)>=(i-s)*(n-a)}function Nu(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Du(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Fu(t,e)&&Fu(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Pu(t.prev,t,e.prev)||Pu(t,e.prev,e))||ku(t,e)&&Pu(t.prev,t,t.next)>0&&Pu(e.prev,e,e.next)>0)}function Pu(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function ku(t,e){return t.x===e.x&&t.y===e.y}function Du(t,e,r,n){var i=Ou(Pu(t,e,r)),o=Ou(Pu(t,e,n)),s=Ou(Pu(r,n,t)),a=Ou(Pu(r,n,e));return i!==o&&s!==a||(!(0!==i||!Qu(t,r,e))||(!(0!==o||!Qu(t,n,e))||(!(0!==s||!Qu(r,t,n))||!(0!==a||!Qu(r,e,n)))))}function Qu(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Ou(t){return t>0?1:t<0?-1:0}function Fu(t,e){return Pu(t.prev,t,t.next)<0?Pu(t,e,t.next)>=0&&Pu(t,t.prev,e)>=0:Pu(t,e,t.prev)<0||Pu(t,t.next,e)<0}function Gu(t,e){var r=new ju(t.i,t.x,t.y),n=new ju(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Uu(t,e,r,n){var i=new ju(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Hu(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function ju(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function qu(t,e,r,n){for(var i=0,o=e,s=r-n;o<r;o+=n)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}vu.exports=mu,vu.exports.default=mu,mu.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,s=Math.abs(qu(t,0,o,r));if(i)for(var a=0,u=e.length;a<u;a++){var l=e[a]*r,h=a<u-1?e[a+1]*r:t.length;s-=Math.abs(qu(t,l,h,r))}var c=0;for(a=0;a<n.length;a+=3){var f=n[a]*r,p=n[a+1]*r,g=n[a+2]*r;c+=Math.abs((t[f]-t[g])*(t[p+1]-t[f+1])-(t[f]-t[p])*(t[g+1]-t[f+1]))}return 0===s&&0===c?0:Math.abs((c-s)/s)},mu.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)r.vertices.push(t[i][o][s]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r};var Vu=vu.exports,zu={altitude:0},Yu=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),n=maptalks.Util.extend({},zu,n,{layer:s}),(a=e.call(this))._initOptions(n),n.altitude;var u=t.length;0===u&&console.error("polygons is empty");for(var l=1/0,h=1/0,c=-1/0,f=-1/0,p=0;p<u;p++){var g=t[p],d=g.getCenter?g.getCenter():getGeoJSONCenter(g),A=void 0,y=void 0;Array.isArray(d)?(A=d[0],y=d[1]):d instanceof maptalks.Coordinate&&(A=d.x,y=d.y),l=Math.min(l,A),h=Math.min(h,y),c=Math.max(c,A),f=Math.max(f,y)}var v=new maptalks.Coordinate((l+c)/2,(h+f)/2);a.centerPt=s.coordinateToVector3(v,0);var m=[];a._geometriesAttributes=[],a._colorMap={};for(var E=0;E<t.length;E++){var _=a.getGeometry(t[E],s),I=_.attributes.position.array;a._geometriesAttributes[E]={position:{count:I.length/3}};for(var C=new THREE.Color(t[E].properties.color),w=new Float32Array(I.length),b=0;b<I.length;b++)w[3*b]=C.r,w[3*b+1]=C.g,w[3*b+2]=C.b;_.setAttribute("color1",new THREE.Float32BufferAttribute(w,3)),console.log(_),m.push(_)}a._datas=t;var B=x(m);return a._createMesh(B,o),a.getObject3d().position.copy(a.centerPt),a._setPickObject3d(),a._init(),a}return s(r,[{key:"_init",value:function(){var t=this,e=this.getLayer().getPick();this.on("add",(function(){e.add(t.pickObject3d)})),this.on("remove",(function(){e.remove(t.pickObject3d)}))}},{key:"_setPickObject3d",value:function(){if(this._colorMap){for(var t=this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),r=this._geometriesAttributes.length,n=N(this._geometriesAttributes),i=0,o=0;o<r;o++){var s=e.getColor(),a=s.getHex();this._colorMap[a]=o;var u=this._geometriesAttributes[o].position.count;this._datas[o].colorIndex=a;for(var l=0;l<u;l++)n[i]=s.r,n[i+1]=s.g,n[i+2]=s.b,i+=3}t.setAttribute("pickColor",new THREE.BufferAttribute(n,3,!0));var h=new THREE.ShaderMaterial({vertexShader:"\n attribute vec3 pickColor;\n varying vec3 vPickColor;\n void main(){\n vPickColor = pickColor;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n varying vec3 vPickColor;\n void main() {\n gl_FragColor = vec4(vPickColor, 1.0);\n }",side:THREE.DoubleSide,transparent:!0}),c=e.getColor().getHex(),f=new THREE.Mesh(t,h);f.position.copy(this.getObject3d().position),f._colorIndex=c,this.setPickObject3d(f)}}},{key:"getSelectMesh",value:function(){return this._datas[this.index]}},{key:"identify",value:function(t){return this.picked}},{key:"getGeometry",value:function(t,e){var r=[],n=[];if(t instanceof maptalks.MultiPolygon)for(var i=t.getCoordinates(),o=0,s=i.length;o<s;o++){var a=this.getSingleGeometry(i[o],e,this.centerPt),u=a.positionsV,l=a.faces;if(o>0)for(var h=r.length,c=0,f=l.length;c<f;c++)l[c]+=h;u.forEach((function(t){r.push(t)})),l.forEach((function(t){n.push(t)}))}else{var p=this.getSingleGeometry(t,e,this.centerPt),g=p.positionsV,d=p.faces;r=g,n=d}var A=(new THREE.BufferGeometry).setFromPoints(r);return A.setIndex(n),A}},{key:"getSingleGeometry",value:function(t,e,r){Array.isArray(t)&&(t=new maptalks.Polygon(t));var n=t.getShell(),i=t.getHoles(),o=[],s=[],a=[];n.forEach((function(t){var n=e.coordinateToVector3(t).sub(r);o.push(n.x,n.y,n.z),a.push(n)})),i&&i.length>0&&i.forEach((function(t){s.push(a.length),t.forEach((function(t){var n=e.coordinateToVector3(t).sub(r);o.push(n.x,n.y,n.z),a.push(n)}))}));var u=s.length>0?s:void 0,l=Vu(o,u,3);return{positionsV:a,faces:l}}}]),r}(),Xu=function(){function e(t,r,n,o){var s=this;i(this,e),this.map=n.map,this.threeLayer=n,this.groupId=o,this.isToolTip=void 0!==r.isToolTip&&r.isToolTip,this.interactive=void 0!==r.interactive&&r.interactive,this.isSimplify=void 0!==r.isSimplify&&r.isSimplify;var a={tolerance:r.tolerance||.01,highQuality:!0};if(this.oricolors={},this.colorItems=[],this.meshs=[],this.dataItemsIndex={},this.codeField=r.codeField||"id",this.clickFunc=r.clickFunc||null,this.cFunc=r.cFunc||null,this.mouseMoveFunc=r.mouseMoveFunc||null,this.clickInfoFlag=void 0!==r.clickInfoFlag&&r.clickInfoFlag,this.clickInfoFlag){var u={custom:!0,dy:r.infoDy||-48,content:"",animation:!1,autoOpenOn:null};this.infoWindow=new maptalks.ui.InfoWindow(u).addTo(this.map)}var l=[];t.features.forEach((function(t){if(s.isSimplify){var e=gu(t,a),r=e.geometry.type;if(["Polygon","MultiPolygon"].includes(r)){var n=e.properties,i=maptalks.GeoJSON.toGeometry(e);i.setProperties(n),l.push(i)}}else{var o=t.geometry.type;if(["Polygon","MultiPolygon"].includes(o)){var u=t.properties,h=maptalks.GeoJSON.toGeometry(t);h.setProperties(u),l.push(h)}}})),this.material=new THREE.MeshBasicMaterial({vertexColors:!0,transparent:!0,opacity:void 0!==r.opacity?r.opacity:1}),this.dataItems=l}var r,o;return s(e,[{key:"generatePolygon",value:(o=n(t().mark((function e(){var r,n,i=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.dataItems){t.next=2;break}return t.abrupt("return",null);case 2:return this.material.onBeforeCompile=function(t){r=i._createMergePolygonShaderPol(t),i.shader=r},(n=new Yu(this.dataItems,{interactive:this.interactive},this.material,this.threeLayer)).parent=this,this.groupId?this.threeLayer.addMesh1(n,this.groupId):this.threeLayer.addMesh(n),this.mesh=n,this.isToolTip&&n.setToolTip("hello",{showTimeout:0,eventsPropagation:!0,dx:10}),this._bindMapEvents(n),t.abrupt("return",this);case 10:case"end":return t.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"_bindMapEvents",value:function(t){t&&t.on("click empty mousemove",this._setEvent,this)}},{key:"_closeEvent",value:function(){this.polygonMeshs&&this.polygonMeshs.off("click empty mousemove",this._setEvent,this)}},{key:"addContent",value:(r=n(t().mark((function e(r){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.clickFunc(r);case 2:case"end":return t.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"_setEvent",value:function(t){var e=t.selectMesh;if("mousemove"===t.type&&e){var r=e.properties.name;if(this.isToolTip)this.mesh.getToolTip()._content="".concat(r)}"click"===t.type&&e&&this.clickFunc&&!this.cFunc&&this.addContent(e)}},{key:"dispose",value:function(){this.isToolTip&&this.mesh&&this.mesh.removeToolTip(),this.mesh&&(this.groupId?this.threeLayer.removeMesh1(this.mesh,this.groupId):this.threeLayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose(),this.mesh.object3d.material&&(this.mesh.object3d.material.userData&&delete this.mesh.object3d.material.userData,this.mesh.object3d.material.dispose()))}},{key:"_createMergePolygonShaderPol",value:function(t){return t.vertexShader="\n attribute vec3 color1;\n ".concat(t.vertexShader,"\n ").replace("#include <color_vertex>","#include <color_vertex>\n //vColor = texture(colors, vec2(colorIdx / 7., 0.)).rgb; // divide colorIdx by (amount of colors (3) - 1, thus 2)\n vColor = color1; // divide colorIdx by (amount of colors (3) - 1, thus 2)\n "),t}}]),e}(),Ju={altitude:0,height:0},Wu=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),o=maptalks.Util.extend({},Ju,o,{layer:s}),a=e.call(this);var u=o,l=u.width,h=u.height,c=u.triW,f=u.triH,p=u.altitude;a._initOptions(o);var g=[],d=new THREE.BufferGeometry,A=new Float32Array([-c/2,-f/2,0,0,f/2,0,c/2,-f/2,0]),y=new Float32Array([0,0,1]),v=new Float32Array([0,1,.5,.5,1,1]);d.setIndex(new THREE.Uint16BufferAttribute([0,1,2],1)),d.setAttribute("position",new THREE.BufferAttribute(A,3)),d.setAttribute("normal",new THREE.BufferAttribute(y,3)),d.setAttribute("uv",new THREE.BufferAttribute(v,2)),d.computeBoundingBox(),d.translate(0,-d.boundingBox.max.y,0),g.push(d);var m=new THREE.PlaneGeometry(l,h);m.computeBoundingBox(),m.translate(0,-m.boundingBox.max.y-f,0),g.push(m);var E=x(g);E.computeVertexNormals(),a._createMesh(E,n);var _=s.distanceToVector3(p,p).x,I=s.coordinateToVector3(t,_);return a.getObject3d().position.copy(I),a}return s(r)}(),Ku=function(){function e(t,r,n,o){i(this,e),this.threelayer=n,this.map=n.map,this.groupId=o,r.lineImgSrc,r.arrowImgSrc,this.imgWidth=r.imgWidth||80,this.imgHeight=r.imgHeight||160;var s=r.rotation||0,a=r.width||20,u=r.height||10,l=n.distanceToVector3(a,a).x,h=n.distanceToVector3(u,u).x;r.anchor;var c=-(s+180)*Math.PI/180;this.material=new THREE.MeshBasicMaterial({color:r.color||"white",side:THREE.DoubleSide,depthTest:!1,transparent:!0}),this.mesh=new Wu(t,this.material,{width:l,height:h,triW:r.triW||1.6,triH:r.triH||2},n),this.mesh.object3d.renderOrder=r.renderOrder||0,this.mesh.object3d.rotation.z=c,this.groupId?this.threelayer.addMesh1(this.mesh,this.groupId):this.threelayer.addMesh(this.mesh)}var r;return s(e,[{key:"loadTexture",value:(r=n(t().mark((function e(r){var n,i,o,s;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r,!r.includes(".svg")){t.next=8;break}return t.next=4,fetch(r);case 4:return i=t.sent,t.next=7,i.text();case 7:n=t.sent;case 8:return new DOMParser,t.next=11,jt.addImageProcess(n);case 11:return o=t.sent,s=jt.generateTextureOne(o,this.imgWidth,this.imgHeight),t.abrupt("return",s);case 14:case"end":return t.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"dispose",value:function(){this.mesh&&(this.groupId?this.threelayer.removeMesh1(this.mesh,this.groupId):this.threelayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose()),this.material&&this.material.dispose()}}]),e}(),Zu=function(){function t(e,r,n,o){var s=this;i(this,t),this.map=n.map,this.threeLayer=n,this.groupId=o,this.meshs=[],this.lineStrings=[];var a=r.lineColor||"#377EE8",u=r.lineWidth||1;this.fatLineMaterial=new Zs({color:new THREE.Color(a),transparent:!0,linewidth:u,blending:THREE.AdditiveBlending}),e.features.forEach((function(t){var e=t.geometry;maptalks.GeoJSON.toGeometry(t);var r=t.properties,i=.1;s.isExtrusion&&(i=r.height?200*r.height:.1),e.coordinates.forEach((function(e){var r=new maptalks.LineString(e[0]),o=n.toFatLine(r,{altitude:.1===i?1:i,interactive:!1},s.fatLineMaterial);o.setProperties(t.properties),o.getObject3d().layers.enable(1),s.meshs.push(o),s.lineStrings.push(r)}))})),this.groupId?n.addMesh1(this.meshs,this.groupId):n.addMesh(this.meshs)}return s(t,[{key:"dispose",value:function(){this.meshs&&(this.groupId?this.threeLayer.removeMesh1(this.meshs,this.groupId):this.threeLayer.removeMesh(this.meshs),this.meshs.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()})),this.meshs=[]),this.fatLineMaterial&&this.fatLineMaterial.dispose()}}]),t}();maptalks.ThreeLayer.prototype._recursionMesh=function(t){for(;t&&t.parent!==this.getScene()&&!t.parent.customType;)t=t.parent;return t},maptalks.ThreeLayer.prototype.identify=function(t,e){var r=this;if(!t)return console.error("coordinate is null,it should be Coordinate"),[];if(Array.isArray(t)&&(t=new maptalks.Coordinate(t)),!(t instanceof maptalks.Coordinate))return console.error("coordinate type is error,it should be Coordinate"),[];var n=this.getMap().coordToContainerPoint(t);this._containerPoint=n;var i=n.x,o=n.y;this._initRaycaster(),this.fire("identify",{coordinate:t,options:e});var s=this._raycaster,a=this._mouse,u=this.getCamera(),l=this.getScene(),h=this.getMap().getSize();if(!l)return[];var c=h.width,f=h.height;a.x=i/c*2-1,a.y=-o/f*2+1,s.setFromCamera(a,u),s.layers&&s.layers.enableAll&&s.layers.enableAll(),function(t,e){t.linePrecision=e}(s,this._getLinePrecision(this.getMap().getResolution()));var p=[],g=[];l.children.forEach((function(t){var e=t.__parent;if(e&&e.getOptions){var r=e;r.getOptions().interactive&&r.isVisible()&&(r.identify&&maptalks.Util.isFunction(r.identify)?g.push(r):p.push(t))}else(t instanceof THREE.Mesh||t instanceof THREE.Group)&&(t.customType?t.children.forEach((function(t){var e=t.__parent;if(e&&e.getOptions){var r=e;r.getOptions().interactive&&r.isVisible()&&(r.identify&&maptalks.Util.isFunction(r.identify)?g.push(r):p.push(t))}})):p.push(t))}));var d=[],A=s.intersectObjects(p,!0);A&&Array.isArray(A)&&A.length&&(d=A.map((function(t){var e=t.object,n=t.instanceId,i=(e=r._recursionMesh(e)||{}).__parent||e;return i.faceIndex=t.faceIndex,i.index=t.index,i.intersect=t,maptalks.Util.isNumber(n)&&(i.instanceId=n),i}))),this.renderPickScene(),g.length&&g.forEach((function(e){e.identify(t)&&d.push(e)}));for(var y=d.length,v=0;v<y;v++)if(d[v])for(var m=v+1;m<y;m++)d[v]===d[m]&&d.splice(m,1);var E=(e=maptalks.Util.extend({},e)).count;return maptalks.Util.isNumber(E)&&E>0?d.slice(0,E):d},maptalks.ThreeLayer.prototype._zoomend=function(){var t=this.getScene();if(t){var e=this.getMap().getZoom();t.children.forEach((function(t){if(t.customType)t.children.forEach((function(t){var r=t.__parent;if(r&&r.getOptions){var n=r;n.zoomChange&&maptalks.Util.isFunction(n.zoomChange)&&n.zoomChange(e);var i=n.getMinZoom(),o=n.getMaxZoom();e<i||e>o?(n.isVisible()&&(n.getObject3d().visible=!1),n._zoomVisible=!1):i<=e&&e<=o&&(n._visible&&(n.getObject3d().visible=!0),n._zoomVisible=!0)}}));else{var r=t.__parent;if(r&&r.getOptions){var n=r;n.zoomChange&&maptalks.Util.isFunction(n.zoomChange)&&n.zoomChange(e);var i=n.getMinZoom(),o=n.getMaxZoom();e<i||e>o?(n.isVisible()&&(n.getObject3d().visible=!1),n._zoomVisible=!1):i<=e&&e<=o&&(n._visible&&(n.getObject3d().visible=!0),n._zoomVisible=!0)}}}))}},maptalks.ThreeLayer.prototype.addMesh1=function(t,e){var r=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)return this;Array.isArray(t)||(t=[t]);var i=this.getScene(),o=void 0;if(e&&(o=i.getObjectByProperty("customId",e)),t.forEach((function(t){if(t instanceof maptalks.BaseObject){var e;if(o)o.add(t.getObject3d());else console.log("组不存在,销毁创建的对象"),null===(e=t.parent)||void 0===e||e.dispose();t.isAdd||(t.isAdd=!0,t.options.layer=r,t._fire("add",{target:t}))}})),this._zoomend(),n){var s=this._getRenderer();s&&s.setToRedraw()}return this},maptalks.ThreeLayer.prototype.removeMesh1=function(t,e){var r=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)return this;Array.isArray(t)||(t=[t]);var i=this.getScene(),o=i.getObjectByProperty("customId",e);if(t.forEach((function(t){if(t instanceof maptalks.BaseObject){o?o.remove(t.getObject3d()):i.remove(t.getObject3d()),t.isAdd&&(t.isAdd=!1,t._fire("remove",{target:t})),t._animation&&maptalks.Util.isFunction(t._animation)&&delete r._animationBaseObjectMap[t.getObject3d().uuid];var e=r._delayMeshes;if(e.length)for(var n=0,s=e.length;n<s;n++)if(e[n]===t){e.splice(n,1);break}}else t instanceof THREE.Object3D&&i.remove(t)})),n){var s=this._getRenderer();s&&s.setToRedraw()}return this};var $u=function(){function e(t,r,n){var o=this;i(this,e),this.map=r,this.animationId=null,this.updatables=[];var s=B();this.threeLayer=new maptalks.ThreeLayer(s,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new THREE.Clock;var a=function t(){var e;(o.threeLayer._needsUpdate=!o.threeLayer._needsUpdate,o.threeLayer._needsUpdate)&&(null===(e=o.threeLayer)||void 0===e||null===(e=e.getRenderer())||void 0===e||e.clearCanvas(),o.threeLayer.renderScene());var r,n=o.clock.getDelta(),i=_(o.updatables);try{for(i.s();!(r=i.n()).done;){r.value.tick(n)}}catch(t){i.e(t)}finally{i.f()}o.animationId=requestAnimationFrame(t)};this.threeLayer.prepareToDraw=function(t,e,r){var n=new THREE.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),e.add(n),a()},this.threeLayer.addTo(r),this.layerId=s,this.layerName=t,this.dirty=!1,this.initFlag=!1,this.bloomFlag=n||!1,this.bloomStrength=null==n?void 0:n.bloomStrength,this.bloomThreshold=null==n?void 0:n.bloomThreshold,this.bloomRadius=null==n?void 0:n.bloomRadius}var r;return s(e,[{key:"createGroup",value:(r=n(t().mark((function e(r){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),r));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,S(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),r));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var r=t.getObjectByName(e);return r||(r=new Vo(t,e)),r.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=B();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function e(){var r;(t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate)&&(null===(r=t.threeLayer)||void 0===r||null===(r=r.getRenderer())||void 0===r||r.clearCanvas(),t.threeLayer.renderScene());var n,i=t.clock.getDelta(),o=_(t.updatables);try{for(o.s();!(n=o.n()).done;){n.value.tick(i)}}catch(t){o.e(t)}finally{o.f()}t.animationId=requestAnimationFrame(e)};return new Promise((function(r){t.threeLayer.prepareToDraw=function(t,n,i){var o=new THREE.DirectionalLight(16777215);o.position.set(0,-10,10).normalize(),n.add(o),n.add(new THREE.AmbientLight(16777215)),e(),r()}}))}},{key:"drawRadar",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new H(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new H(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSector",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new V(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new V(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSectorImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new J(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new J(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawImage",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new F(t,e,r,n,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new F(t,e,r,n,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new shockEffect(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new shockEffect(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneMarker",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=null;t.length>0?(o=new se(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=null;t.length>0?(o=new se(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new Uo(t,e,r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new Uo(t,e,r.threeLayer,r);n(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new qo(t,e.threeLayer);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new qo(t,e.threeLayer);r(n)}))}))}},{key:"drawFbxModel",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new Vs(t,e,r,i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new Vs(t,e,r,i.threeLayer,n);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Xs(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Xs(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Js(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Js(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawBloomLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Zu(t,e,n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Zu(t,e,n.threeLayer,r);i(o)}))}))}},{key:"drawPolyline",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new $s(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new $s(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Xu(t,e,n.threeLayer,r);o.generatePolygon().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Xu(t,e,n.threeLayer,r);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new ra(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new ra(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Ca(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Ca(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawTube",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Ma(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Ma(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new Ba(t,e,r,n||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new Ba(t,e,r,n||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new ka(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new ka(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Da(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Da(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Ku(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Ku(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),n=this.threeLayer.getPick(),i=n.pickingTexture;n.pickingScene;var o=this.threeLayer.getRenderer();r.remove(e),e=null,r=null,i.dispose(),i=null,o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer)}}]),e}(),tl=function(){function e(t,r){var n=this;i(this,e),this.map=r,this.animationId=null,this.updatables=[];var o=B();this.threeLayer=new maptalks.ThreeLayer(o,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new THREE.Clock;var s=function t(){var e;(n.threeLayer._needsUpdate=!n.threeLayer._needsUpdate,n.threeLayer._needsUpdate)&&(null===(e=n.threeLayer)||void 0===e||null===(e=e.getRenderer())||void 0===e||e.clearCanvas(),n.threeLayer.renderScene());var r,i=n.clock.getDelta(),o=_(n.updatables);try{for(o.s();!(r=o.n()).done;){r.value.tick(i)}}catch(t){o.e(t)}finally{o.f()}n.animationId=requestAnimationFrame(t)};this.threeLayer.prepareToDraw=function(t,e,r){var n=new THREE.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),e.add(n),s()},this.threeLayer.addTo(r),this.layerId=o,this.layerName=t,this.dirty=!1,this.initFlag=!1}var r;return s(e,[{key:"createGroup",value:(r=n(t().mark((function e(r){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),r));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,S(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),r));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var r=t.getObjectByName(e);return r||(r=new Vo(t,e)),r.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=B();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function e(){var r;(t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate)&&(null===(r=t.threeLayer)||void 0===r||null===(r=r.getRenderer())||void 0===r||r.clearCanvas(),t.threeLayer.renderScene());var n,i=t.clock.getDelta(),o=_(t.updatables);try{for(o.s();!(n=o.n()).done;){n.value.tick(i)}}catch(t){o.e(t)}finally{o.f()}t.animationId=requestAnimationFrame(e)};return new Promise((function(r){t.threeLayer.prepareToDraw=function(t,n,i){var o=new THREE.DirectionalLight(16777215);o.position.set(0,-10,10).normalize(),n.add(o),n.add(new THREE.AmbientLight(16777215)),e(),r()}}))}},{key:"drawRadar",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new H(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new H(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSector",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new V(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new V(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSectorImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new J(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new J(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawImage",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new F(t,e,r,n,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new F(t,e,r,n,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new Z(t,e||{},r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new Z(t,e||{},r.threeLayer,r);n(i)}))}))}},{key:"drawPlaneMarker",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=null;t.length>0?(o=new se(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=null;t.length>0?(o=new se(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new Uo(t,e,r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new Uo(t,e,r.threeLayer,r);n(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new qo(t,e.threeLayer);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new qo(t,e.threeLayer);r(n)}))}))}},{key:"drawFbxModel",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new Vs(t,e,r,i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new Vs(t,e,r,i.threeLayer,n);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Xs(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Xs(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Js(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Js(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawPolyline",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new $s(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new $s(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Xu(t,e,n.threeLayer,r);o.generatePolygon().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Xu(t,e,n.threeLayer,r);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new ra(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new ra(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Ca(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Ca(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawTube",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Ma(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Ma(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new Ba(t,e,r,n||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new Ba(t,e,r,n||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new ka(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new ka(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Da(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Da(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Ku(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Ku(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),n=this.threeLayer.getPick(),i=n.pickingTexture;n.pickingScene;var o=this.threeLayer.getRenderer();r.remove(e),e=null,r=null,i.dispose(),i=null,o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer)}}]),e}(),el=function(){function t(e,r,n,o){i(this,t),this.map=o,this.geometry=null,this.selectGeometry=null,this.isEndSelect=!1,this.drawTool=new maptalks.DrawTool({mode:e,symbol:{lineColor:n.lineColor||"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:n.polygonFill||"#E40D56",polygonOpacity:.2}}).addTo(this.map).enable(),this._bindEvent(),this._drawEnd=r,this.mode=e,this.toolLayer=new maptalks.VectorLayer(maptalks.Util.GUID(),{geometryEvents:!1,hitDetect:!1}).addTo(this.map),this.geometry&&(this.toolLayer.addGeometry(this.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(this.geometry.getCoordinates(),this.geometry.getRadius()):this._drawEnd(this.geometry.getCoordinates()))),n.zIndex&&this.toolLayer.setZIndex(n.zIndex),this.type="drawTool"}return s(t,[{key:"getZIndex",value:function(){this.toolLayer&&this.toolLayer.getZIndex()}},{key:"setZIndex",value:function(t){this.toolLayer&&this.toolLayer.setZIndex(t)}},{key:"selectGeometryByPoint",value:function(){this.map.on("click",this._selectGeometry,this)}},{key:"endSelect",value:function(){this.toolLayer&&this.selectGeometry&&(this._changeSymbol(!1),this.selectGeometry.endEdit(),this.selectGeometry=null),this.map.off("click",this._selectGeometry,this)}},{key:"_selectGeometry",value:function(t){if(this.disableTool(),this.toolLayer){var e=this.toolLayer.identify(t.coordinate);this.selectGeometry&&(this.selectGeometry.endEdit(),this._changeSymbol(!1)),e&&(this.selectGeometry=e[0]),this.selectGeometry&&this._changeSymbol(!0)}}},{key:"_closeMapEvent",value:function(){this.map.off("click",this._selectGeometry,this)}},{key:"_changeSymbol",value:function(t){t?this.selectGeometry.setSymbol({lineColor:"#00ffff",lineWidth:2,lineDasharray:[5,5],polygonFill:"#00ffff",polygonOpacity:.2}):this.selectGeometry.setSymbol({lineColor:"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:"#E40D56",polygonOpacity:.2})}},{key:"deleteGeometry",value:function(){this.toolLayer&&this.selectGeometry&&(this.selectGeometry.endEdit(),this.toolLayer.removeGeometry(this.selectGeometry))}},{key:"undoDrawGeometry",value:function(){if(this.toolLayer){var t=this.toolLayer.getGeometries();if(t.length<1)return;this.toolLayer.removeGeometry(t[t.length-1])}}},{key:"_bindEvent",value:function(){this.drawTool.on("drawend",this.drawEnd,this)}},{key:"_closeEvent",value:function(){this.drawTool.off("drawend",this.drawEnd,this)}},{key:"drawEnd",value:function(t){this.toolLayer&&this.toolLayer.addGeometry(t.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(t.geometry.getCoordinates(),t.geometry.getRadius()):this._drawEnd(t.geometry.getCoordinates())),this.geometry=t.geometry}},{key:"disableTool",value:function(){this.drawTool.disable()}},{key:"clearGeometry",value:function(){this.toolLayer&&this.toolLayer.clear()}},{key:"setMode",value:function(t,e){this._drawEnd&&delete this._drawEnd,this._drawEnd=e,this.drawTool.setMode(t).enable(),this.mode=t}},{key:"startEdit",value:function(){this.disableTool(),this.selectGeometry&&this.selectGeometry.startEdit()}},{key:"endEdit",value:function(t){this.selectGeometry&&(this.selectGeometry.endEdit(),t&&("Circle"===this.mode?t(this.selectGeometry.getCoordinates(),this.geometry.getRadius()):t(this.selectGeometry.getCoordinates())))}},{key:"dispose",value:function(){this.drawTool&&(this._closeEvent(),this.endEdit(),this.disableTool(),delete this.drawTool),this._drawEnd&&delete this._drawEnd,this.geometry&&delete this.geometry,this.selectGeometry&&delete this.selectGeometry,this.map&&this._closeMapEvent(),this.map.removeLayer(this.toolLayer),delete this.toolLayer}}]),t}();function rl(){this.PI=3.141592653589793,this.x_PI=52.35987755982988,this.a=6378245,this.ee=.006693421622965943,this.EARTHRADIUS=6370996.81,this.MCBAND=[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],this.LLBAND=[75,60,45,30,15,0],this.MC2LL=[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],this.LL2MC=[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]],this._transformlat=function(t,e){var r=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,r+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3},this._transformlng=function(t,e){var r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,r+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3},this._out_of_china=function(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271||!1},this._getLoop=function(t,e,r){for(;t>r;)t-=r-e;for(;t<e;)t+=r-e;return t},this._getRange=function(t,e,r){return null!=e&&(t=Math.max(t,e)),null!=r&&(t=Math.min(t,r)),t}}rl.prototype.BD2GCJ=function(t,e){var r=t-.0065,n=e-.006,i=Math.sqrt(r*r+n*n)-2e-5*Math.sin(n*this.x_PI),o=Math.atan2(n,r)-3e-6*Math.cos(r*this.x_PI);return[i*Math.cos(o),i*Math.sin(o)]},rl.prototype.GCJ2BD=function(t,e){var r=Math.sqrt(t*t+e*e)+2e-5*Math.sin(e*this.x_PI),n=Math.atan2(e,t)+3e-6*Math.cos(t*this.x_PI);return[r*Math.cos(n)+.0065,r*Math.sin(n)+.006]},rl.prototype.WGS2GCJ=function(t,e){if(this._out_of_china(t,e))return[t,e];var r=this._transformlat(t-105,e-35),n=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.PI),[t+(n=180*n/(this.a/s*Math.cos(i)*this.PI)),e+r]},rl.prototype.GCJ2WGS=function(t,e){if(this._out_of_china(t,e))return[t,e];var r=this._transformlat(t-105,e-35),n=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.PI),[2*t-(t+(n=180*n/(this.a/s*Math.cos(i)*this.PI))),2*e-(e+r)]},rl.prototype.WGS2BD=function(t,e){var r=this.WGS2GCJ(t,e);return r=this.GCJ2BD(r[0],r[1])},rl.prototype.BD2WGS=function(t,e){var r=this.BD2GCJ(t,e);return r=this.GCJ2WGS(r[0],r[1])},rl.prototype.BD_MKT2WGS=function(t,e){var r=null;t=Math.abs(t),e=Math.abs(e);for(var n=0;n<this.MCBAND.length;n++)if(e>=this.MCBAND[n]){r=this.MC2LL[n];break}t=r[0]+r[1]*Math.abs(t);var i=Math.abs(e)/r[9];return e=r[2]+r[3]*i+r[4]*i*i+r[5]*i*i*i+r[6]*i*i*i*i+r[7]*i*i*i*i*i+r[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]},rl.prototype.BD_WGS2MKT=function(t,e){var r=null;t=this._getLoop(t,-180,180),e=this._getRange(e,-74,74);for(var n=0;n<this.LLBAND.length;n++)if(e>=this.LLBAND[n]){r=this.LL2MC[n];break}if(null!=r)for(n=this.LLBAND.length-1;n>=0;n--)if(e<=-this.LLBAND[n]){r=this.LL2MC[n];break}t=r[0]+r[1]*Math.abs(t);var i=Math.abs(e)/r[9];return e=r[2]+r[3]*i+r[4]*i*i+r[5]*i*i*i+r[6]*i*i*i*i+r[7]*i*i*i*i*i+r[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]};var nl=function(t){u(r,maptalks.Layer);var e=f(r);function r(t,n,o){var s;return i(this,r),(s=e.call(this,t,o)).data=n,s}return s(r,[{key:"setData",value:function(t){return this.data=t,this}},{key:"getData",value:function(){return this.data}}]),r}();nl.mergeOptions({color:"rgba(135,196,240,0.6)",font:"30px san-serif",hitDetect:!1});var il=function(t){u(r,maptalks.renderer.CanvasRenderer);var e=f(r);function r(){return i(this,r),e.apply(this,arguments)}return s(r,[{key:"checkResources",value:function(){return[]}},{key:"needToRedraw",value:function(){return!0}},{key:"draw",value:function(){this._drawData(this.layer.getData(),this.layer.options.color),this.completeRender()}},{key:"drawOnInteracting",value:function(t){this._drawData(this._drawnData,this.layer.options.color),this.completeRender()}},{key:"_drawData",value:function(t,e){this.getMap(),this.prepareCanvas();var r=this.context;r.fillStyle=e;var n=r.canvas;r.rect(0,0,n.width,n.height),r.fill()}}]),r}();function ol(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function sl(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function al(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):
|
|
1
|
+
function t(){t=function(){return r};var e,r={},n=Object.prototype,i=n.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",u=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function h(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(e){h=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,s=Object.create(i.prototype),a=new R(n||[]);return o(s,"_invoke",{value:B(t,r,a)}),s}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=c;var p="suspendedStart",g="suspendedYield",d="executing",A="completed",y={};function v(){}function m(){}function E(){}var _={};h(_,a,(function(){return this}));var I=Object.getPrototypeOf,x=I&&I(I(L([])));x&&x!==n&&i.call(x,a)&&(_=x);var C=E.prototype=v.prototype=Object.create(_);function w(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(n,o,s,a){var u=f(t[n],t,o);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&i.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,s,a)}),(function(t){r("throw",t,s,a)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,a)}))}a(u.arg)}var n;o(this,"_invoke",{value:function(t,i){function o(){return new e((function(e,n){r(t,i,e,n)}))}return n=n?n.then(o,o):o()}})}function B(t,r,n){var i=p;return function(o,s){if(i===d)throw new Error("Generator is already running");if(i===A){if("throw"===o)throw s;return{value:e,done:!0}}for(n.method=o,n.arg=s;;){var a=n.delegate;if(a){var u=S(a,n);if(u){if(u===y)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===p)throw i=A,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=d;var l=f(t,r,n);if("normal"===l.type){if(i=n.done?A:g,l.arg===y)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=A,n.method="throw",n.arg=l.arg)}}}function S(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var o=f(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var s=o.arg;return s?s.done?(r[t.resultName]=s.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function L(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n<t.length;)if(i.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=e,r.done=!0,r};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return m.prototype=E,o(C,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:m,configurable:!0}),m.displayName=h(E,l,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,h(t,l,"GeneratorFunction")),t.prototype=Object.create(C),t},r.awrap=function(t){return{__await:t}},w(b.prototype),h(b.prototype,u,(function(){return this})),r.AsyncIterator=b,r.async=function(t,e,n,i,o){void 0===o&&(o=Promise);var s=new b(c(t,e,n,i),o);return r.isGeneratorFunction(e)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},w(C),h(C,l,"Generator"),h(C,a,(function(){return this})),h(C,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=L,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(M),!t)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,i){return a.type="throw",a.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var u=i.call(s,"catchLoc"),l=i.call(s,"finallyLoc");if(u&&l){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(s)},complete:function(t,e){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&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),M(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;M(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},r}function e(t){return e="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},e(t)}function r(t,e,r,n,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,i)}function n(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var s=t.apply(e,n);function a(t){r(s,i,o,a,u,"next",t)}function u(t){r(s,i,o,a,u,"throw",t)}a(void 0)}))}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,I(n.key),n)}}function s(t,e,r){return e&&o(t.prototype,e),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function a(t,e,r){return(e=I(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var i=l(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return c(t)}(this,r)}}function p(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}function g(){return g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=p(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},g.apply(this,arguments)}function d(t,e,r,n){return d="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,r,n){var i,o=p(t,e);if(o){if((i=Object.getOwnPropertyDescriptor(o,e)).set)return i.set.call(n,r),!0;if(!i.writable)return!1}if(i=Object.getOwnPropertyDescriptor(n,e)){if(!i.writable)return!1;i.value=r,Object.defineProperty(n,e,i)}else a(n,e,r);return!0},d(t,e,r,n)}function A(t,e,r,n,i){if(!d(t,e,r,n||t)&&i)throw new TypeError("failed to set property");return r}function y(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o,s,a=[],u=!0,l=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(a.push(n.value),a.length!==e);u=!0);}catch(t){l=!0,i=t}finally{try{if(!u&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}(t,e)||m(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t){return function(t){if(Array.isArray(t))return E(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||m(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){if(t){if("string"==typeof t)return E(t,e);var r=Object.prototype.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)?E(t,e):void 0}}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=m(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function I(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function x(t){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=null!==t[0].index,n=new Set(Object.keys(t[0].attributes)),i=new Set(Object.keys(t[0].morphAttributes)),o={},s={},a=t[0].morphTargetsRelative,u=new THREE.BufferGeometry,l=0,h=0;h<t.length;++h){var c=t[h],f=0;if(r!==(null!==c.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(var p in c.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;void 0===o[p]&&(o[p]=[]),o[p].push(c.attributes[p]),f++}if(f!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==c.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(var g in c.morphAttributes){if(!i.has(g))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;void 0===s[g]&&(s[g]=[]),s[g].push(c.morphAttributes[g])}if(e){var d=void 0;if(r)d=c.index.count;else{if(void 0===c.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;d=c.attributes.position.count}u.addGroup(l,d,h),l+=d}}if(r){for(var A=0,y=[],v=0;v<t.length;++v){for(var m=t[v].index,E=0;E<m.count;++E)y.push(m.getX(E)+A);A+=t[v].attributes.position.count}u.setIndex(y)}for(var _ in o){var I=C(o[_]);if(!I)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+_+" attribute."),null;u.setAttribute(_,I)}for(var x in s){var w=s[x][0].length;if(0===w)break;u.morphAttributes=u.morphAttributes||{},u.morphAttributes[x]=[];for(var b=0;b<w;++b){for(var B=[],S=0;S<s[x].length;++S)B.push(s[x][S][b]);var T=C(B);if(!T)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+x+" morphAttribute."),null;u.morphAttributes[x].push(T)}}return u}function C(t){for(var e,r,n,i=0,o=0;o<t.length;++o){var s=t[o];if(s.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(void 0===e&&(e=s.array.constructor),e!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===r&&(r=s.itemSize),r!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===n&&(n=s.normalized),n!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=s.array.length}for(var a=new e(i),u=0,l=0;l<t.length;++l)a.set(t[l].array,u),u+=t[l].array.length;return new THREE.BufferAttribute(a,r,n)}var w=Math.PI/180,b=6378137;function B(){var t="xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}));return"iep".concat(t,"layer")}function S(t){return new Promise((function(e){return setTimeout(e,t)}))}function T(t,e){return e.split("").forEach((function(e){-1===t.indexOf(e)&&(t+=e)})),t}function M(t,e){return 256*(t=THREE.MathUtils.clamp(Math.floor(t),0,255))+(e=THREE.MathUtils.clamp(Math.floor(e),0,255))}function R(t){for(var e=1/0,r=1/0,n=-1/0,i=-1/0,o=0,s=t.length;o<s;o++){var a=t[o],u=a.coordinate,l=a.lnglat,h=a.lnglats,c=a.xy,f=a.xys,p=u||l||h||c||f||t[o],g=void 0,d=void 0;Array.isArray(p)?(g=p[0],d=p[1]):p instanceof maptalks.Coordinate&&(g=p.x,d=p.y),e=Math.min(e,g),r=Math.min(r,d),n=Math.max(n,g),i=Math.max(i,d)}return new maptalks.Coordinate((e+n)/2,(r+i)/2)}function L(t,e,r,n){var i=t,o=e.getShell(),s=[];o.forEach((function(t){var e=r.coordinateToVector3(t).sub(i);s.push(e)}));for(var a=[],u=0,l=s.length;u<l;u++)if(u!==s.length-1){var h=new Float32Array(12),c=s[u],f=s[u+1];h[0]=c.x,h[1]=c.y,h[2]=n,h[6]=c.x,h[7]=c.y,h[8]=0,h[3]=f.x,h[4]=f.y,h[5]=n,h[9]=f.x,h[10]=f.y,h[11]=0;var p=new THREE.BufferGeometry;p.setAttribute("position",new THREE.BufferAttribute(h,3)),p.setIndex([0,2,1,2,3,1]),a.push(p)}var g=new Float32Array(12),d=s[s.length-1],A=s[0];g[0]=d.x,g[1]=d.y,g[2]=n,g[6]=d.x,g[7]=d.y,g[8]=0,g[3]=A.x,g[4]=A.y,g[5]=n,g[9]=A.x,g[10]=A.y,g[11]=0;var y=new THREE.BufferGeometry;y.setAttribute("position",new THREE.BufferAttribute(g,3)),y.setIndex([0,2,1,2,3,1]),a.push(y);var v=x(a);return v.computeVertexNormals(),v}function N(t){for(var e=t.length,r=0,n=0;n<e;n++){r+=t[n].position.count}return new Float32Array(3*r)}function P(t){return t*w}function k(t,e){if(!t||!e)return 0;Array.isArray(t)||(t=t.toArray()),Array.isArray(e)||(e=e.toArray());var r=P(t[1]),n=P(e[1]),i=r-n,o=P(t[0])-P(e[0]);return r=2*Math.asin(Math.sqrt(Math.pow(Math.sin(i/2),2)+Math.cos(r)*Math.cos(n)*Math.pow(Math.sin(o/2),2))),r*=b,Math.round(1e5*r)/1e5}function D(t){for(var e=function(t){return t.getCoordinates().map((function(t){return t.toArray()}))}(t),r=0,n=0,i=e.length;n<i-1;n++)r+=k(e[n],e[n+1]);return r}var Q={altitude:0,imageWidth:512,imageHeight:512,texture:null},O=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r);var u=n=maptalks.Util.extend({},Q,n),l=u.altitude;u.imageHeight,u.imageWidth,t instanceof maptalks.Extent||(t=new maptalks.Extent(t));var h=t,c=h.xmin,f=h.ymin,p=h.xmax,g=h.ymax,d=1/0,A=1/0,y=-1/0,v=-1/0;[[c,f],[c,g],[p,g],[p,f]].forEach((function(t){var e=s.coordinateToVector3(t),r=e.x,n=e.y;d=Math.min(r,d),A=Math.min(n,A),y=Math.max(r,y),v=Math.max(n,v)}));var m=Math.abs(y-d),E=Math.abs(v-A),_=new THREE.PlaneGeometry(m,E);(a=e.call(this))._initOptions(n),a._createMesh(_,o);var I=s.distanceToVector3(l,l).x,x=s.coordinateToVector3(t.getCenter(),I);return a.getObject3d().position.copy(x),a.parent=null,a.type="Image",a}return s(r)}(),F=function(){function t(e,r,n,o,s,a){var u=this;i(this,t),this.threelayer=s,this.map=s.map,this.groupId=a,this.textureLoader=new THREE.TextureLoader;var l=e.split(","),h=r.split(","),c=parseFloat(l[0]),f=parseFloat(l[1]),p=parseFloat(h[0]),g=parseFloat(h[1]),d=o.maxZoom||11,A=o.renderOrder||0,y=o.opacity||1,v=o.minZoom||3,m=new maptalks.Extent(c,f,p,g);this.xmin_g=c,this.ymin_g=f,this.xmax_g=p,this.ymax_g=g,this.cacheTextureFlag=o.cacheTextureFlag,this.cacheTexture={},this.textureLoader.load(n,(function(t){var e=new THREE.MeshBasicMaterial({map:t,transparent:!0,opacity:y}),r=new O(m,{imageWidth:512,imageHeight:512,maxZoom:d,minZoom:v,interactive:void 0!==o.interactive&&o.interactive},e,u.threelayer);r.object3d.renderOrder=A,u.imgMesh=r,u.imgMesh.parent=u,u.m=e,u.texture=t,u.groupId?u.threelayer.addMesh1(u.imgMesh,u.groupId):u.threelayer.addMesh(u.imgMesh),o.opacityItems&&o.opacityItems.length>0&&!isNaN(o.opacityItems[0])&&!isNaN(o.opacityItems[1])&&o.opacityItems[0]>3&&o.opacityItems[0]<=18&&o.opacityItems[1]>=0&&o.opacityItems[1]<=1&&(u.opacityItems=o.opacityItems,u._bindMapEvents(),u._viewChange()),u.cacheTextureFlag&&void 0===u.cacheTexture[n]&&(u.cacheTexture[n]=t)}))}return s(t,[{key:"_bindMapEvents",value:function(){this.map.on("viewchange",this._viewChange,this)}},{key:"_viewChange",value:function(){this.opacityItems[0]<=this.map.getZoom()?this.imgMesh.object3d.material.opacity=this.opacityItems[1]:this.imgMesh.object3d.material.opacity=1}},{key:"_closeEvent",value:function(){this.map.off("viewchange",this._viewChange,this)}},{key:"updateImage",value:function(t,e){var r=this;if(e&&e.leftbottom&&e.righttop){var n=parseFloat(e.leftbottom[0]),i=parseFloat(e.leftbottom[1]),o=parseFloat(e.righttop[0]),s=parseFloat(e.righttop[1]);if(n!==this.xmin_g||i!==this.ymin_g||o!==this.xmax_g||s!==this.ymax_g){var a=new maptalks.Extent(n,i,o,s),u=1/0,l=1/0,h=-1/0,c=-1/0;[[n,i],[n,s],[o,s],[o,i]].forEach((function(t){var e=r.threelayer.coordinateToVector3(t),n=e.x,i=e.y;u=Math.min(n,u),l=Math.min(i,l),h=Math.max(n,h),c=Math.max(i,c)}));for(var f=Math.abs(h-u),p=Math.abs(c-l),g=new THREE.PlaneBufferGeometry(f,p),d=g.attributes.position.array,A=this.imgMesh.object3d.geometry.attributes.position.array,y=0;y<A.length;y++)A[y]=d[y];this.imgMesh.object3d.geometry.attributes.position.needsUpdate=!0;var v=this.threelayer.coordinateToVector3(a.getCenter(),0);this.imgMesh.getObject3d().position.copy(v),g.dispose(),this.xmin_g=n,this.ymin_g=i,this.xmax_g=o,this.ymax_g=s}}this.cacheTextureFlag?void 0===this.cacheTexture[t]?this.textureLoader.load(t,(function(e){e.magFilter=THREE.NearestFilter,e.minFilter=THREE.NearestFilter,r.imgMesh.object3d.material.map=e,r.imgMesh.object3d.material.map.needsUpdate=!0,r.cacheTexture[t]=e})):(this.imgMesh.object3d.material.map=this.cacheTexture[t],this.imgMesh.object3d.material.map.needsUpdate=!0):this.textureLoader.load(t,(function(t){r.texture&&r.texture.dispose(),delete r.texture,t.magFilter=THREE.NearestFilter,t.minFilter=THREE.NearestFilter,r.imgMesh.object3d.material.map=t,r.imgMesh.object3d.material.map.needsUpdate=!0,r.texture=t})),!1===this.imgMesh.isAdd&&(this.threelayer?(this.groupId?this.threelayer.addMesh1(this.imgMesh,this.groupId):this.threelayer.addMesh(this.imgMesh),this.opacityItems&&this._bindMapEvents()):this.dispose())}},{key:"clearImage",value:function(){this.imgMesh&&(this.groupId?this.threelayer.removeMesh1(this.imgMesh,this.groupId):this.threelayer.removeMesh(this.imgMesh),this.opacityItems&&this._closeEvent())}},{key:"show",value:function(){this.imgMesh&&(this.threelayer.addMesh(this.imgMesh),this.opacityItems&&this._bindMapEvents())}},{key:"dispose",value:function(){var t;for(var e in this.imgMesh&&(!0===this.imgMesh.isAdd&&(this.groupId?this.threelayer.removeMesh1(this.imgMesh,this.groupId):this.threelayer.removeMesh(this.imgMesh)),this.imgMesh.object3d.geometry&&this.imgMesh.object3d.geometry.dispose(),this.imgMesh.object3d.material&&(this.imgMesh.object3d.material.dispose(),delete this.m)),this.cacheTexture)this.cacheTexture[e].dispose(),delete this.cacheTexture[e];null===(t=this.texture)||void 0===t||t.dispose(),this.texture=null,this.opacityItems&&(this._closeEvent(),delete this.opacityItems),this.threelayer=null,this.textureLoader&&delete this.textureLoader}}]),t}(),G={interactive:!1,altitude:0,imageWidth:512,imageHeight:512,texture:null},U=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s,a){var u;i(this,r);var l=(o=maptalks.Util.extend({},G,o)).altitude,h=a.distanceToVector3(n,n).x,c=new THREE.CircleGeometry(h,32);(u=e.call(this))._initOptions(o),u._createMesh(c,s);var f=a.distanceToVector3(l,l).x,p=a.coordinateToVector3(t,f);return u.getObject3d().position.copy(p),u.parent=null,u.type="radarObject",u}return s(r)}(),H=function(){function t(e,r,n,o,s,a){i(this,t),this.threelayer=o,this.map=o.map,this.layerClass=s,this.groupId=a,this.imgUrl=n.imgUrl,this.loader=new THREE.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var u=new THREE.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n const float PI = 3.14159265359;\n const float TWO_PI = 6.28318530718;\n const int N = 3;\n const float r0 = 0.01;\n const float r_blue = 0.025;\n const float r_red = 0.015;\n const float edge = 0.95;\n const float offset = 0.05;\n\n uniform float time;\n varying vec2 vUv;\n uniform sampler2D map;\n float plot(const vec2 st, const float pct, const float width)\n {\n return smoothstep(pct - width, pct, st.y) -\n smoothstep(pct, pct + width, st.y);\n }\n float drawPolygon(const vec2 polygonCenter, const int N, const float radius, vec2 pos)\n {\n pos = pos - polygonCenter;\n float d = 0.0;\n float a = atan(pos.x, pos.y);\n float r = TWO_PI / float(N);\n d = cos(floor(0.5 + a / r)*r - a)*length(pos);\n return (1.0 - smoothstep(radius, radius + radius/10.0, d));\n }\n float gradations(const float a, const float gradNum, const float outRad, const float tickLen, const float tickWidth, const float r, const float move)\n {\n float f = step(0.0, cos((a + move)*gradNum) - tickWidth)*tickLen + (outRad - tickLen);\n return 1.0 - step(f, r) * 1.0 - step(r, outRad - tickLen);\n }\n void main() {\n // Normalized pixel coordinates (from 0 to 1)\n vec2 uv = vUv;\n vec2 pos = uv.xy - vec2(0.5, 0.5) ; // center what being drawn\n vec4 grndSpd = vec4(0.0, time/5.0, 0.0, 0.0);\n vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.85, 0.0, 1.0);\n //vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.58, 1.0, 1.0);\n //vec3 color = vec3(0.0, 0.0, 0.0);\n vec3 color = vec3(0.0, 147. / 255., 1.0);\n float r = length(pos) * 2.0;\n float a = atan(pos.y, pos.x); // angle of pixel\n float an = PI - mod(time/ 1.0, TWO_PI); // angle of radar sweep\n float blipSpd = 3.0; // Blip / Trace speed\n vec2 translate1 = vec2(cos(time/ blipSpd), sin(time/ blipSpd));\n vec2 translate2 = vec2(sin(time/ blipSpd), cos(time/ blipSpd));\n vec2 left1 = translate1 * 0.35;\n vec2 right1 = -translate1 * 0.30;\n vec2 left2 = translate2 * 0.15;\n vec2 right2 = -translate2 * 0.25;\n // Radar Sweep\n float sn = step(PI/2.0, an) * step(-PI/2.0, (a + an)) * step(r, edge) * (1.0 - 0.55 * (a + (TWO_PI) - an));\n float sw = step(an, a) * step(r, edge);\n float s_blade = sw * (1.0 - (a - an) * 20.0);\n float s = sw * (1.0 - 0.55 * (a - an));\n s = max(sn,s);\n float se = step(r, edge - 0.05);\n // Center point\n float s1 = smoothstep(edge - 0.00, edge + 0.01, r)* smoothstep(edge + 0.02, edge + 0.01, r);\n // Circular concentric rings\n float s0 = 1.0 - smoothstep(r0 / 2.0, r0, length(pos));\n float smb = (1.0 - smoothstep(0.2, 0.2 + 0.01, length(pos))) * (1.0 - smoothstep(0.2 +0.01, 0.2, length(pos)));\n float smr = (1.0 - smoothstep(0.3, 0.3 + 0.01, length(pos))) * (1.0 - smoothstep(0.3 +0.01, 0.3, length(pos)));\n // Circular concentric gradations\n float gradNum = 120.0;\n float tickWidth = 0.9;\n const float tickLen = 0.04;\n float outRad = edge;\n float move = 0.0;\n float sm = 0.75*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n gradNum = 36.0;\n tickWidth = 0.95;\n outRad = 0.6;\n move = sin(time/10.0);\n smr += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n outRad = 0.4;\n move = cos(time/10.0);\n smb += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n // Radial spoke gradations\n float sr = plot(pos, pos.x, 0.003) * step(r, edge - 0.06);\n sr += plot(vec2(0.0, 0.0), pos.x, 0.002) * step(r, edge - 0.06);\n sr += plot(vec2(0.0, 0.0), pos.y, 0.003) * step(r, edge - 0.06);\n sr += plot(-pos, pos.x, 0.003) * step(r, edge - 0.06);\n sr *= 0.75;\n // Blue circular radar blip traces\n vec2 st_trace1 = left2;\n float s_trace1 = s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1)));\n s_trace1 += s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1 + vec2(+offset, +offset))));\n s_trace1 += s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1 + vec2(+2.0 *offset, +2.0 *offset))));\n\n vec2 st_trace2 = right1;\n float s_trace2 = s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace2)));\n // Red Trianglular radar flight blip trace\n vec2 st_trace3 = left1;\n float st1 = s * (drawPolygon(st_trace3, N, r_red , pos));\n st1 += s * (drawPolygon(st_trace3 + vec2(-offset, -offset), N, r_red, pos));\n st1 += s * (drawPolygon(st_trace3 + vec2(+offset, -offset), N, r_red, pos));\n\n vec2 st_trace4 = right2;\n float st2 = s * (drawPolygon(st_trace4, N, r_red, pos)); \n // Lets add all the bits together and send them to screen\n float s_grn = max(s * mapcol.y, s_blade);\n s_grn = max(s_grn, (s0 + sr + sm));\n s_grn += s1 / 1.5 + smb + smr;\n\n float s_red = st1*2.0 + st2*2.0 + smr;\n \n float s_blue = max(s_trace1 + s_trace2, s_blade) + smb;\n\n if (s_trace1 > 0.0 || s_trace2 > 0.0) { s_blue = max(s, s_blue); s_grn = max(s_grn, s_blue); }\n\n color += vec3(s_red , s_grn, s_blue); \n vec4 texColor = mapcol * s;\n // Output to screen \n gl_FragColor = vec4(color, 0.5);//Set the screen pixel to that color\n }",side:THREE.DoubleSide,transparent:!0});this.radar=new U(e,r,{},u,o),this.radar.parent=this,this.groupId?this.threelayer.addMesh1(this.radar,this.groupId):this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return s(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.groupId?this.threelayer.removeMesh1(this.radar,this.groupId):this.threelayer.removeMesh(this.radar),this.radar.object3d.geometry&&this.radar.object3d.geometry.dispose(),this.radar.object3d.material&&this.radar.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),j={radius:100,altitude:0},q=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),n=maptalks.Util.extend({},j,n,{layer:s,coordinate:t}),(a=e.call(this))._initOptions(n);var u=n,l=u.altitude,h=u.radius,c=s.distanceToVector3(h,h).x,f=n.thetaStart||0,p=n.thetaLength||90,g=new THREE.CircleGeometry(c,128,f*Math.PI/180,p*Math.PI/180);a._createMesh(g,o);var d=s.distanceToVector3(l,l).x,A=s.coordinateToVector3(t,d);return a.getObject3d().position.copy(A),a}return s(r)}(),V=function(){function t(e,r,n,o,s){i(this,t),this.threeLayer=o,this.map=o.map,this.groupId=s;var a=n.thetaLength||90,u=n.rotation||0,l=a/2,h=void 0!==n.gradientFlag&&n.gradientFlag,c=n.color||"#FF0000",f=n.opacity||1,p=u-l;p=p<0?p+360:p,this._uniforms={color:{value:new THREE.Color(c)}},this.material=null,this.material=h?new THREE.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n varying vec2 vUv;\n uniform vec3 color;\n void main() {\n vec2 uv = vUv;\n //vec2 pos = uv.xy - vec2(0.5, 0.5);\n float distance1 = clamp(length(uv - vec2(0.5, 0.5)) * 2., 0., 0.9);\n //vec2 pos = uv.xy - vec2(0.5, 0.5) * 2.;\n //float distance = clamp(length(pos), 0., 0.9);\n float opacity = 1. - distance1 / 1.;\n //gl_FragColor = vec4(1.0, 0.0, 0.0, opacity);\n gl_FragColor = vec4(color, opacity);\n\n }",side:THREE.DoubleSide,transparent:!0}):new THREE.MeshBasicMaterial({color:c,side:THREE.DoubleSide,transparent:!0,opacity:f}),console.log(this.material),this.sector=new q(e,{thetaStart:p,thetaLength:n.thetaLength,radius:r},this.material,o),this.groupId?this.threeLayer.addMesh1(this.sector,this.groupId):this.threeLayer.addMesh(this.sector)}return s(t,[{key:"hide",value:function(){this.sector.hide()}},{key:"show",value:function(){this.sector.show()}},{key:"dispose",value:function(){this.groupId?this.threeLayer.removeMesh1(this.sector,this.groupId):this.threeLayer.removeMesh(this.sector),this.sector.object3d.geometry&&this.sector.object3d.geometry.dispose(),this.sector.object3d.material&&this.sector.object3d.material.dispose()}}]),t}(),z={altitude:0,height:0},Y=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),o=maptalks.Util.extend({},z,o,{layer:s}),a=e.call(this);var u=o,l=u.width,h=u.height,c=u.altitude;a._initOptions(o);var f=new THREE.PlaneGeometry(l,h);f.computeBoundingBox();var p=new THREE.Mesh(f,n);a._createGroup(),a.getObject3d().add(p);var g=s.distanceToVector3(c,c).x,d=s.coordinateToVector3(t,g);return p.position.set(0,f.boundingBox.max.y,0),a.getObject3d().position.copy(d),a}return s(r)}();function X(t,e,r,n,i,o){this.tilesHorizontal=e,this.tilesVertical=r,this.numberOfTiles=n,t.wrapS=t.wrapT=THREE.RepeatWrapping,t.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=i,this.currentDisplayTime=0,this.currentTile=0,this.flag=o,this.update=function(e){for(this.currentDisplayTime+=e;this.currentDisplayTime>this.tileDisplayDuration;){this.currentDisplayTime-=this.tileDisplayDuration,this.currentTile++,this.currentTile==this.numberOfTiles&&(this.currentTile=0);var r=this.currentTile%this.tilesHorizontal;t.offset.x=r/this.tilesHorizontal;var n=Math.floor(this.currentTile/this.tilesHorizontal);this.flag?t.offset.y=this.tilesVertical-n/this.tilesVertical:t.offset.y=1-n/this.tilesVertical-1/this.tilesVertical}}}var J=function(){function t(e,r,n,o,s){var a=this;i(this,t),this.threelayer=o,this.map=o.map,this.layerClass=s;var u=n.thetaLength||45;this.millsec=n.millsec||1e3,this.duration=n.duration||75,this.tilesHoriz=n.tilesHoriz||12,this.tilesVert=n.tilesVert||5,this.numTiles=n.numTiles||49;var l=n.rotation||0,h=u/2,c=o.distanceToVector3(r,r).x,f=Math.sin(h*Math.PI/180)*c*2,p=void 0===n.flag;this.imgUrl=n.imgUrl,this.textureLoader=new THREE.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){a.texture=t,a.annie=new X(t,a.tilesHoriz,a.tilesVert,a.numTiles,a.duration,p);var r=new THREE.MeshBasicMaterial({transparent:!0,map:t,side:THREE.DoubleSide,depthTest:!1});a.imgObj=new Y(e,r,{width:f,height:c},o),a.imgObj.object3d.renderOrder=1,a.imgObj.object3d.rotation.z=l*Math.PI/180,a.threelayer.addMesh(a.imgObj),a.layerClass.updatables.push(a)}))}return s(t,[{key:"tick",value:function(t){var e;null===(e=this.annie)||void 0===e||e.update(this.millsec*t)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.threelayer.removeMesh(this.imgObj),this.imgObj.object3d.geometry&&this.imgObj.object3d.geometry.dispose(),this.imgObj.object3d.material&&this.imgObj.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),W={radius:100,altitude:0},K=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),n=maptalks.Util.extend({},W,n,{layer:s}),a=e.call(this);var u=n,l=u.width;u.height;var h=u.altitude;a._initOptions(n);var c=new THREE.CircleGeometry(l,32);a._createMesh(c,o);var f=s.distanceToVector3(h,h).x,p=s.coordinateToVector3(t,f);return a.getObject3d().position.copy(p),a}return s(r)}(),Z=function(){function t(e,r,n,o){var s=this;i(this,t),this.threelayer=n,this.map=n.map,this.layerClass=o,this.time=0,n.coordinateToVector3(e,0),this.imgUrl=r.imgUrl,this.textureLoader=new THREE.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){s.texture=t,s._uniforms={impactPosition:{value:new THREE.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:s.texture}};var r=new THREE.ShaderMaterial({uniforms:s._uniforms,vertexShader:"\n varying vec3 vPosition;\n varying vec2 vUv;\n void main(){\n vUv = uv;\n vPosition = position;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D map;\n uniform vec3 impactPosition;\n uniform float impactMaxRadius;\n uniform float impactRatio;\n varying vec3 vPosition;\n varying vec2 vUv;\n void main() {\n float dist = distance(vPosition, impactPosition);\n float curRadius = impactMaxRadius * impactRatio;\n float sstep = smoothstep(0., curRadius, dist) - smoothstep(curRadius - ( 0.25 * impactRatio ), curRadius, dist);\n sstep = 1. - sstep * (1. - impactRatio);\n vec3 col = mix(vec3(1., 0.5, 0.0625), vec3(1., 0.25, 0.125), impactRatio);\n gl_FragColor = texture2D(map, vUv);\n gl_FragColor = vec4( mix( col, gl_FragColor.rgb, sstep), 1.0 );\n }",side:THREE.DoubleSide,transparent:!0,depthTest:!1}),i=new K(e,{width:2,height:2},r,n);s.threelayer.addMesh(i),s.layerClass.updatables.push(s)}))}return s(t,[{key:"tick",value:function(t){this.time+=.2*t,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),t}(),$=6371008.8,tt={centimeters:100*$,centimetres:100*$,degrees:$/111325,feet:3.28084*$,inches:39.37*$,kilometers:$/1e3,kilometres:$/1e3,meters:$,metres:$,miles:$/1609.344,millimeters:1e3*$,millimetres:1e3*$,nauticalmiles:$/1852,radians:1,yards:1.0936*$},et={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/$,yards:1.0936133},rt={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function nt(t,e,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function it(t,e,r){switch(t){case"Point":return ot(e).geometry;case"LineString":return lt(e).geometry;case"Polygon":return at(e).geometry;case"MultiPoint":return pt(e).geometry;case"MultiLineString":return ft(e).geometry;case"MultiPolygon":return gt(e).geometry;default:throw new Error(t+" is invalid")}}function ot(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!wt(t[0])||!wt(t[1]))throw new Error("coordinates must contain numbers");return nt({type:"Point",coordinates:t},e,r)}function st(t,e,r){return void 0===r&&(r={}),ct(t.map((function(t){return ot(t,e)})),r)}function at(t,e,r){void 0===r&&(r={});for(var n=0,i=t;n<i.length;n++){var o=i[n];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return nt({type:"Polygon",coordinates:t},e,r)}function ut(t,e,r){return void 0===r&&(r={}),ct(t.map((function(t){return at(t,e)})),r)}function lt(t,e,r){if(void 0===r&&(r={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return nt({type:"LineString",coordinates:t},e,r)}function ht(t,e,r){return void 0===r&&(r={}),ct(t.map((function(t){return lt(t,e)})),r)}function ct(t,e){void 0===e&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function ft(t,e,r){return void 0===r&&(r={}),nt({type:"MultiLineString",coordinates:t},e,r)}function pt(t,e,r){return void 0===r&&(r={}),nt({type:"MultiPoint",coordinates:t},e,r)}function gt(t,e,r){return void 0===r&&(r={}),nt({type:"MultiPolygon",coordinates:t},e,r)}function dt(t,e,r){return void 0===r&&(r={}),nt({type:"GeometryCollection",geometries:t},e,r)}function At(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r}function yt(t,e){void 0===e&&(e="kilometers");var r=tt[e];if(!r)throw new Error(e+" units is invalid");return t*r}function vt(t,e){void 0===e&&(e="kilometers");var r=tt[e];if(!r)throw new Error(e+" units is invalid");return t/r}function mt(t,e){return _t(vt(t,e))}function Et(t){var e=t%360;return e<0&&(e+=360),e}function _t(t){return 180*(t%(2*Math.PI))/Math.PI}function It(t){return t%360*Math.PI/180}function xt(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return yt(vt(t,e),r)}function Ct(t,e,r){if(void 0===e&&(e="meters"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("area must be a positive number");var n=rt[e];if(!n)throw new Error("invalid original units");var i=rt[r];if(!i)throw new Error("invalid final units");return t/n*i}function wt(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function bt(t){return!!t&&t.constructor===Object}function Bt(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!wt(t))throw new Error("bbox must only contain numbers")}))}function St(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}var Tt=Object.freeze({__proto__:null,earthRadius:$,factors:tt,unitsFactors:et,areaFactors:rt,feature:nt,geometry:it,point:ot,points:st,polygon:at,polygons:ut,lineString:lt,lineStrings:ht,featureCollection:ct,multiLineString:ft,multiPoint:pt,multiPolygon:gt,geometryCollection:dt,round:At,radiansToLength:yt,lengthToRadians:vt,lengthToDegrees:mt,bearingToAzimuth:Et,radiansToDegrees:_t,degreesToRadians:It,convertLength:xt,convertArea:Ct,isNumber:wt,isObject:bt,validateBBox:Bt,validateId:St});function Mt(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Rt(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Lt(t){if(t.length>1&&wt(t[0])&&wt(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return Lt(t[0]);throw new Error("coordinates must only contain numbers")}function Nt(t,e,r){if(!e||!r)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.type)}function Pt(t,e,r){if(!t)throw new Error("No feature passed");if(!r)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.geometry.type)}function kt(t,e,r){if(!t)throw new Error("No featureCollection passed");if(!r)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+r+", FeatureCollection required");for(var n=0,i=t.features;n<i.length;n++){var o=i[n];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+o.geometry.type)}}function Dt(t){return"Feature"===t.type?t.geometry:t}function Qt(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}var Ot=Object.freeze({__proto__:null,getCoord:Mt,getCoords:Rt,containsNumber:Lt,geojsonType:Nt,featureOf:Pt,collectionOf:kt,getGeom:Dt,getType:Qt});function Ft(t,e,r){void 0===r&&(r={});var n=Mt(t),i=Mt(e),o=It(i[1]-n[1]),s=It(i[0]-n[0]),a=It(n[1]),u=It(i[1]),l=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(u);return yt(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),r.units)}function Gt(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var n=Mt(t),i=Dt(e),o=i.type,s=e.bbox,a=i.coordinates;if(s&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(n,s))return!1;"Polygon"===o&&(a=[a]);for(var u=!1,l=0;l<a.length&&!u;l++)if(Ut(n,a[l][0],r.ignoreBoundary)){for(var h=!1,c=1;c<a[l].length&&!h;)Ut(n,a[l][c],!r.ignoreBoundary)&&(h=!0),c++;h||(u=!0)}return u}function Ut(t,e,r){var n=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var i=0,o=e.length-1;i<e.length;o=i++){var s=e[i][0],a=e[i][1],u=e[o][0],l=e[o][1];if(t[1]*(s-u)+a*(u-t[0])+l*(t[0]-s)==0&&(s-t[0])*(u-t[0])<=0&&(a-t[1])*(l-t[1])<=0)return!r;a>t[1]!=l>t[1]&&t[0]<(u-s)*(t[1]-a)/(l-a)+s&&(n=!n)}return n}var Ht=document.createElement("canvas"),jt=function(){function e(){i(this,e),this.type="gisCommon"}var r;return s(e,null,[{key:"getTexture",value:function(t,e,r,n){var i=t.getContext("2d");i.drawImage(e,r,n);var o=new THREE.Texture(i.getImageData(0,0,t.width,t.height));return o.minFilter=THREE.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{key:"getTexture1",value:function(t,e,r,n,i){Ht.width=Ht.height=128;var o=Ht.getContext("2d");o.drawImage(t,e,r,n,i);var s=new THREE.Texture(o.getImageData(0,0,Ht.width,Ht.height));return s.minFilter=THREE.LinearFilter,s.generateMipmaps=!1,s.needsUpdate=!0,s}},{key:"addImageProcessImage",value:function(t){return new Promise((function(e,r){var n=document.createElement("img");n&&!n.crossOrigin&&(n.crossOrigin="Anonymous"),n.onload=function(){return e(n)},n.onerror=r,n.setAttribute("src",t)}))}},{key:"addImageProcess",value:function(t){return new Promise((function(e,r){var n=document.createElement("img");n.onload=function(){return e(n)},n.onerror=r,n.setAttribute("src","data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(t))))}))}},{key:"containsCoordinate3",value:function(t,e,r){if(1e3*Ft({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[e.x,e.y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t}},"kilometers")<e.radius){var n=r.coordinateToVector3([e.x,e.y],0),i=r.coordinateToVector3(t,0).sub(n).normalize(),o=r.distanceToVector3(e.radius,e.radius).x,s=new THREE.Vector3(n.x,n.y+o,0).sub(n).normalize(),a=((i.clone().cross(s).z<0?-1:1)*Math.acos(i.dot(s))*180/Math.PI).toFixed(2);(a=parseFloat(a))<0&&(a=a+180+180);var u=parseFloat(e.begin),l=parseFloat(e.end);if(u>l){if(a>=u||a<=l)return!0}else if(a>=u&&a<=l)return!0;return!1}return!1}},{key:"containsCoordinate1",value:function(t,e){return 1e3*Ft({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[e.getCenter().x,e.getCenter().y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t}},"kilometers")<e.getRadius()}},{key:"containsCoordinate2",value:function(t,e){return Gt({type:"Feature",geometry:{type:"Point",coordinates:t}},{type:"Feature",geometry:{type:"Polygon",coordinates:e.geometry.coordinates[0]}})}},{key:"containsCoordinate",value:function(t,e){var r,n;Array.isArray(t)?(r=t[0],n=t[1]):t instanceof maptalks.Coordinate&&(r=t.x,n=t.y);var i=e.xmin,o=e.ymin,s=e.xmax,a=e.ymax;return i<=r&&r<=s&&o<=n&&n<=a}},{key:"isInLevels",value:function(t,e){for(var r=!1,n=0;n<t.rangeArr.length;n+=2){var i=1*t.rangeArr[n],o=1*t.rangeArr[n+1];if(e>i&&e<=o){r=!0;break}}return r}},{key:"getExtent",value:function(t){if(0!==t.length){var e=1/0,r=1/0,n=-1/0,i=-1/0;return 1===t.length?(e=1*t[0].longitude-.5,r=1*t[0].latitude-.5,n=1*t[0].longitude+.5,i=1*t[0].latitude+.5):t.length>1&&t.slice(0,1/0).map((function(t){var o=1*t.longitude,s=1*t.latitude;e=Math.min(e,o),r=Math.min(r,s),n=Math.max(n,o),i=Math.max(i,s)})),{minX:e,minY:r,maxX:n,maxY:i}}}},{key:"vector2Pixel",value:function(t,e,r){var n=t.project(r),i=e.width/2,o=e.height/2;return{x:Math.round(n.x*i+i),y:Math.round(-n.y*o+o)}}},{key:"generateTextureOne",value:function(t,e,r){Ht.width=e,Ht.height=r;var n=Ht.getContext("2d");n.drawImage(t,0,0,e,r);var i=new THREE.Texture(n.getImageData(0,0,Ht.width,Ht.height));return i.magFilter=THREE.LinearFilter,i.minFilter=THREE.LinearFilter,i.generateMipmaps=!1,i.needsUpdate=!0,i}},{key:"generateTexture",value:function(t){var e=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var n=Math.sqrt(t.length),i=parseInt(n);n>i&&(i+=1);for(var o=(n=i)*r+5*n,s=0,a=0;a<e.length;a++){if(o<e[a]){s=e[a];break}s=1024}Ht.width=Ht.height=s;for(var u=Ht.getContext("2d"),l=0,h=0,c=[],f=0;f<n;f++){for(var p=5*(f+1)+f*l,g=0;g<n;g++){var d=5*(g+1)+g*t[h].w;if("img"===t[h].type){var A=(t[h].w-t[h].iw)/2,y=(t[h].h-t[h].ih)/2;u.drawImage(t[h].src,d+A,p+y,t[h].iw,t[h].ih)}else if("txt"===t[h].type)u.fillStyle=t[h].color,"#fff"===t[h].color?(u.font="lighter "+t[h].size+"px Microsoft YaHei",u.fillText(t[h].src,d+t[h].offx,p+t[h].offy),u.strokeStyle=t[h].color,u.strokeText(t[h].src,d+t[h].offx,p+t[h].offy)):(u.font="normal "+t[h].size+"px Microsoft YaHei",u.fillText(t[h].src,d+t[h].offx,p+t[h].offy));else{var v=(t[h].w-t[h].iw)/2,m=(t[h].h-t[h].ih)/2,E=t[h].offx||0,_=t[h].offy||0;u.drawImage(t[h].src,d+v+E,p+m+_,t[h].iw,t[h].ih)}if(c.push({w:t[h].w,h:t[h].h,u:d/s,v:p/s}),l=Math.max(l,t[h].h),(h+=1)>=t.length)break}if(h>=t.length)break}var I=new THREE.Texture(u.getImageData(0,0,Ht.width,Ht.height));return I.minFilter=THREE.LinearFilter,I.generateMipmaps=!1,I.needsUpdate=!0,{xys:c,texture:I,textureSize:s}}},{key:"generateTextureNew",value:function(t){var e=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var n=Math.sqrt(t.length),i=parseInt(n);n>i&&(i+=1);for(var o=(n=i)*r+5*n,s=0,a=0;a<e.length;a++){if(o<e[a]){s=e[a];break}s=1024}Ht.width=Ht.height=s;for(var u=Ht.getContext("2d"),l=0,h=0,c=0,f=[],p=0;p<n;p++){for(var g=5*(p+1)+p*l,d=0;d<n;d++){var A=5*(d+1)+c;if("img"===t[h].type){var y=(t[h].w-t[h].iw)/2,v=(t[h].h-t[h].ih)/2;u.drawImage(t[h].src,A+y,g+v,t[h].iw,t[h].ih)}else if("txt"===t[h].type)u.fillStyle=t[h].color,"#fff"===t[h].color?(u.font="lighter "+t[h].size+"px Microsoft YaHei",u.fillText(t[h].src,A+t[h].offx,g+t[h].offy),u.strokeStyle=t[h].color,u.strokeText(t[h].src,A+t[h].offx,g+t[h].offy)):(u.font="normal "+t[h].size+"px Microsoft YaHei",u.fillText(t[h].src,A+t[h].offx,g+t[h].offy));else{var m=(t[h].w-t[h].iw)/2,E=(t[h].h-t[h].ih)/2,_=t[h].offx||0,I=t[h].offy||0;u.drawImage(t[h].src,A+m+_,g+E+I,t[h].iw,t[h].ih)}if(f.push({w:t[h].w,h:t[h].h,u:A/s,v:g/s}),l=Math.max(l,t[h].h),c+=t[h].w,(h+=1)>=t.length)break}if(h>=t.length)break}var x=new THREE.Texture(u.getImageData(0,0,Ht.width,Ht.height));return x.minFilter=THREE.LinearFilter,x.generateMipmaps=!1,x.needsUpdate=!0,{xys:f,texture:x,textureSize:s}}},{key:"generateGifTexture",value:(r=n(t().mark((function r(n,i,o){var s,a,u,l,h,c,f,p,g,d,A,y,v;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:s=Math.sqrt(n.length),a=parseInt(s),u=a,s>a&&(u+=1),(l=document.createElement("canvas")).width=a*i,l.height=u*o,h=l.getContext("2d"),c=0,f=0;case 10:if(!(f<s)){t.next=32;break}p=f*o,g=0,d=0;case 14:if(!(d<s)){t.next=27;break}return A=g,t.next=18,e.addImageProcessImage(n[c]);case 18:if(y=t.sent,h.drawImage(y,A,p,i,o),g+=i,!((c+=1)>=n.length)){t.next=24;break}return t.abrupt("break",27);case 24:d++,t.next=14;break;case 27:if(!(c>=n.length)){t.next=29;break}return t.abrupt("break",32);case 29:f++,t.next=10;break;case 32:return(v=new THREE.Texture(h.getImageData(0,0,l.width,l.height))).generateMipmaps=!1,v.needsUpdate=!0,t.abrupt("return",{texture:v,colNum:a,rowNum:u});case 36:case"end":return t.stop()}}),r)}))),function(t,e,n){return r.apply(this,arguments)})},{key:"generateTextureOptimize",value:function(t){var e=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var n=Math.sqrt(t.length),i=parseInt(n);n>i&&(i+=1);for(var o=(n=i)*r+5*n,s=0,a=0;a<e.length;a++){if(o<e[a]){s=e[a];break}s=1024}Ht.width=Ht.height=s;for(var u=Ht.getContext("2d"),l=0,h=0,c={},f=0;f<n;f++){for(var p=5*(f+1)+f*l,g=0,d=0;d<n;d++){var A=5*(d+1)+g,y=(t[h].w-t[h].iw)/2,v=(t[h].h-t[h].ih)/2;if(u.drawImage(t[h].src,A+y,p+v,t[h].iw,t[h].ih),c[t[h].key]={w:t[h].w,h:t[h].h,u:A/s,v:p/s},l=Math.max(l,t[h].h),g+=t[h].w,(h+=1)>=t.length)break}if(h>=t.length)break}var m=new THREE.Texture(u.getImageData(0,0,Ht.width,Ht.height));return m.minFilter=THREE.LinearFilter,m.generateMipmaps=!1,m.needsUpdate=!0,{xys:c,texture:m,textureSize:s}}},{key:"setPointEventStatus",value:function(t,e){t&&t.getMeshes().forEach((function(t){"Points"===t.type&&(t.options.interactive=e)}))}},{key:"createTextTexture",value:function(t,e){Ht.width=Ht.height=t;var r=Ht.width/2,n=Ht.height/2;if(e){var i=0;e.forEach((function(t){var e=Ht.getContext("2d");e.fillStyle=t.fontcolor,e.font="".concat(t.fontsize,"px Arial"),e.textAlign="center",e.textBaseline="middle",e.fillText(t.txt,r,n+i),i+=t.fontsize}))}var o=new THREE.Texture(Ht);return o.minFilter=THREE.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{key:"createTextAndBgTexture",value:function(t,e,r,n){var i=document.createElement("canvas");i.width=t,i.height=e;var o=i.getContext("2d");o.drawImage(r,0,0,t,e);var s=i.width/2,a=i.height/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle="#FFF",o.font="".concat(n.fontsize,"px Arial"),o.fillText(n.txt,s,a);var u=new THREE.Texture(i);return u.magFilter=THREE.NearestFilter,u.minFilter=THREE.NearestFilter,u.needsUpdate=!0,u}},{key:"getIntColor",value:function(t){var e=parseInt(255*t.r);return e=((e=(e<<8)+parseInt(255*t.g))<<8)+parseInt(255*t.b)}},{key:"colorIntToRGB",value:function(t){var e=t>>16&255,r=t>>8&255,n=255&t;return new THREE.Color("rgb(".concat(e,",").concat(r,",").concat(n,")"))}},{key:"createSimpleShader",value:function(t,e,r){return t.uniforms.texture1={value:e},t.uniforms.size1={value:r},t.uniforms.flag={value:1},t.vertexShader="uniform float size1;\n attribute float imgflag;\n varying float vimgflag;\n attribute float visibility;\n varying float vVisible;\n "+t.vertexShader,t.vertexShader=t.vertexShader.replace("#include <project_vertex>","\n #include <project_vertex>\n vimgflag = imgflag;\n vVisible = visibility;\n ").replace("gl_PointSize = size;","\n gl_PointSize = size1;\n "),t.fragmentShader="\n uniform sampler2D texture1;\n varying float vimgflag;\n varying float vVisible;\n "+t.fragmentShader,t.fragmentShader=t.fragmentShader.replace("gl_FragColor = vec4( outgoingLight, diffuseColor.a );","\n\n vec2 pUv = gl_PointCoord;\n pUv.y = 1. - pUv.y;\n\n if(vimgflag < 1.0){\n vec4 texColor = texture2D( texture1, pUv );\n outgoingLight *= texColor.xyz;\n gl_FragColor = vec4( outgoingLight, texColor.a * diffuseColor.a );\n }\n\n if (vVisible < 0.5) discard;\n "),t}},{key:"calTextWidth",value:function(t,e){var r=(t.match(/[\u4e00-\u9fa5]/g)||"").length;return r*e+.5*(t.length-r)*e}}]),e}();function qt(t,e,r,n,i,o,s,a,u,l){var h=t.split("\n"),c=[],f={positionedGlyphs:c,text:t,top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:l,lineCount:h.length};return function(t,e,r,n,i,o,s,a,u){var l=0,h=-17,c=0,f=t.positionedGlyphs,p="right"===o?1:"left"===o?0:.5,g=f.length;r.forEach((function(t){if(t.split("").forEach((function(t){var r=e[u],n=t.charCodeAt(0),i=r&&r[n];i&&(f.push({glyph:n,x:l,y:h+0,vertical:!1,scale:1,fontStack:u}),l+=i.metrics.advance+a)})),f.length!==g){var r=l-a;c=Math.max(r,c),function(t,e,r,n,i){if(i){var o=t[n],s=e[o.fontStack],a=s&&s[o.glyph];if(a)for(var u=a.metrics.advance*o.scale,l=(t[n].x+u)*i,h=r;h<=n;h++)t[h].x-=l}}(f,e,g,f.length-1,p)}l=0,h+=n}));var d=function(t){var e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}(i),A=d.horizontalAlign,y=d.verticalAlign;!function(t,e,r,n,i,o,s){for(var a=(e-r)*i,u=(-n*s+.5)*o,l=0;l<t.length;l++)t[l].x+=a,t[l].y+=u}(f,p,A,y,c,n,r.length);var v=h- -17;t.top+=-y*v,t.bottom=t.top+v,t.left+=-A*c,t.right=t.left+c}(f,e,h,i,o,s,0,a,r),!!c.length&&f}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Vt(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})})),e}var zt=Yt;function Yt(t,e){this.x=t,this.y=e}Yt.prototype={clone:function(){return new Yt(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Yt.convert=function(t){return t instanceof Yt?t:Array.isArray(t)?new Yt(t[0],t[1]):t};var Xt={radius:40,altitude:0},Jt=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s,a,u,l,h){var c;i(this,r);var f=R(t);c=e.call(this),n=maptalks.Util.extend({center:f,layer:h},Xt,n),c._initOptions(n);var p=c.getLayer().getPick();c._colorMap={},c._datas=t,c._childCount=l,c.hidePosition=n.hidePosition;var g=h.coordinateToVector3(f);c.glyphMap=a,c.glyphAtlas=u;for(var d=new THREE.InstancedBufferGeometry,A=new Uint16Array([0,1,2,2,3,0]),y=new Float32Array([0,1,-.5,-.5,1,1,.5,-.5,1,0,.5,.5,0,0,-.5,.5]),v=new THREE.InstancedBufferAttribute(new Float32Array(4*c._childCount),4,!0),m=new THREE.InstancedBufferAttribute(new Float32Array(4*c._childCount),4,!0),E=new THREE.InstancedBufferAttribute(new Float32Array(4*c._childCount),4,!0),_=new THREE.InstancedBufferAttribute(new Float32Array(4*c._childCount),4,!0),I=new THREE.InstancedBufferAttribute(new Float32Array(3*c._childCount),3,!0),x=0,C=function(e){var r=t[e],n=r.texts,i=r.markers,o=p.getColor(),s=o.getHex();c._colorMap[s]=e,c._datas[e].colorIndex=s,i&&i.forEach((function(r){if(v.setXYZW(x,r.markerWidth,r.markerHeight,r.markerDx,r.markerDy),m.setXYZW(x,r.u,r.v,-16,16),r.markerColor){var n=M(0,255);_.setXYZW(x,n,0,0,0);var i=c.getColorVector2(r.markerColor,r.markerOpacity);E.setXYZW(x,i[0],i[1],r.w,r.h)}else{var s=M(0,0);_.setXYZW(x,s,0,0,0);var a=c.getColorVector2("#fff",r.markerOpacity);E.setXYZW(x,a[0],a[1],r.w,r.h)}I.setXYZ(x,o.r,o.g,o.b),r.markerIndex=x,x+=1,t[e].childNum+=1})),n&&n.forEach((function(r){var n=c.getColorVector2(r.textColor,r.textOpacity),i=M(255,0);c.buildTextBuffers("".concat(r.text),r.textAnchor,"center",r.textSpacing).forEach((function(s){if(v.setXYZW(x,r.textSize,0,r.textDx,r.textDy),m.setXYZW(x,s[0],s[1],s[2],s[3]),r.textHaloColor){var a=c.getColorVector2(r.textHaloColor,r.textHaloOpacity);E.setXYZW(x,n[0],n[1],a[0],a[1]);var u=r.textHaloRadius;_.setXYZW(x,i,u,0,0)}else E.setXYZW(x,n[0],n[1],0,0),_.setXYZW(x,i,-1.9,0,0);I.setXYZ(x,o.r,o.g,o.b),r.textIndex.push(x),x+=1,t[e].childNum+=1}))}))},w=0;w<t.length;w++)C(w);d.setIndex(new THREE.Uint16BufferAttribute(A,1)),d.setAttribute("uv_offset",new THREE.Float32BufferAttribute(y,4,!0)),d.setAttribute("size",v),d.setAttribute("uv_image",m),d.setAttribute("color",E),d.setAttribute("util",_),d.setAttribute("pickingColor",I),c._createInstancedMesh(d,o,c._childCount),c.getObject3d().instanceMatrix.setUsage(THREE.DynamicDrawUsage);var b=new THREE.InstancedMesh(d,s,c._childCount);b.instanceMatrix.setUsage(THREE.DynamicDrawUsage);var B=p.getColor().getHex();b._colorIndex=B,c.setPickObject3d(b);var S=new THREE.Object3D;x=0,t.forEach((function(e,r){var n=h.coordinateToVector3(e.coordinate);n.sub(g),e.height&&(n.z=h.altitudeToVector3(e.height).x);for(var i=0;i<t[r].childNum;i++)!1===e.visible?S.position.set(c.hidePosition[0],c.hidePosition[1],c.hidePosition[2]):S.position.set(n.x,n.y,0),S.updateMatrix(),c.getObject3d().setMatrixAt(x,S.matrix),b.setMatrixAt(x,S.matrix),x+=1}));var T=h.altitudeToVector3(n.altitude,n.altitude).x;return g.z=T,c.getObject3d().position.copy(g),b.position.copy(c.getObject3d().position),c.parent=null,c.pickMesh=b,c.threeLayer=h,c.center=g,c._init(),c}return s(r,[{key:"_init",value:function(){var t=this,e=this.getLayer().getPick();this.on("add",(function(){e.add(t.pickObject3d)})),this.on("remove",(function(){e.remove(t.pickObject3d)}))}},{key:"getSelectMesh",value:function(){return this._datas[this.index]}},{key:"identify",value:function(t){return this.picked}},{key:"getColorVector2",value:function(t,e){var r,n=new THREE.Color(t).getHexString(),i=(r="#".concat(n),{r:parseInt(r.slice(1,3),16),g:parseInt(r.slice(3,5),16),b:parseInt(r.slice(5,7),16)}),o=i.b;return[M(i.r,i.g),M(o,void 0!==e?e:255)]}},{key:"buildTextBuffers",value:function(t,e,r,n){var i=[],o=[0,0],s=qt(t,this.glyphMap,"sans-serif",0,24,e,r,n,o,1);if(s){var a=function(t,e,r,n){for(var i=t.positionedGlyphs,o=[],s=0;s<i.length;s++){var a=i[s],u=n[a.fontStack],l=u&&u[a.glyph];if(l){var h=l.rect;if(h){var c=l.metrics.advance*a.scale/2,f=r?[a.x+c,a.y]:[0,0],p=r?[0,0]:[a.x+c+e[0],a.y+e[1]],g=(l.metrics.left-4)*a.scale-c+p[0],d=(-l.metrics.top-4)*a.scale+p[1],A=g+h.w*a.scale,y=d+h.h*a.scale,v=new zt(g,d),m=new zt(A,d),E=new zt(g,y),_=new zt(A,y);o.push({tl:v,tr:m,bl:E,br:_,tex:h,writingMode:t.writingMode,glyphOffset:f})}}}return o}(s,o,!1,this.glyphAtlas.positions);a.forEach((function(t){i.push([t.tex.x,t.tex.y+t.tex.h,t.bl.x,t.bl.y])}))}return i}},{key:"changeVisible",value:function(){var t=this,e=new THREE.Object3D;this._datas.forEach((function(r,n){var i=t.threeLayer.coordinateToVector3(r.coordinate);i.sub(t.center),r.height&&(i.z=t.threeLayer.altitudeToVector3(r.height).x),!1===r.visible?e.position.set(t.hidePosition[0],t.hidePosition[1],t.hidePosition[2]):e.position.set(i.x,i.y,0),e.updateMatrix(),r.markers&&r.markers.forEach((function(r){t.getObject3d().setMatrixAt(r.markerIndex,e.matrix),t.pickMesh.setMatrixAt(r.markerIndex,e.matrix)})),r.texts&&r.texts.forEach((function(r){r.textIndex.forEach((function(r){t.getObject3d().setMatrixAt(r,e.matrix),t.pickMesh.setMatrixAt(r,e.matrix)}))}))})),this.getObject3d().instanceMatrix.needsUpdate=!0,this.pickMesh.instanceMatrix.needsUpdate=!0}}]),r}(),Wt=function(){function t(e,r){i(this,t),this.createImage(e,1,r)}return s(t,[{key:"createImage",value:function(t,e,r){var n=t.width,i=t.height;if(r){if(r.length!==n*i*e)throw new RangeError("mismatched image size")}else r=new Uint8Array(n*i*e);this.width=n,this.height=i,this.data=r}},{key:"resize",value:function(){}}],[{key:"copy",value:function(t,e,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var s=t.data,a=e.data,u=0;u<i.height;u++)for(var l=((r.y+u)*t.width+r.x)*o,h=((n.y+u)*e.width+n.x)*o,c=0;c<i.width*o;c++)a[h+c]=s[l+c];return e}}]),t}();var Kt=s((function t(e){i(this,t);var r={},n=[];for(var o in e){var s=e[o],a=r[o]={};for(var u in s){var l=s[+u];if(l&&0!==l.bitmap.width&&0!==l.bitmap.height){var h={x:0,y:0,w:l.bitmap.width+2,h:l.bitmap.height+2};n.push(h),a[u]={rect:h,metrics:l.metrics}}}}var c=function(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,o=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,o=Math.max(o,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();t<n.length&&(n[t]=e)}else e.h===r.h?(r.x+=e.w,r.w-=e.w):e.w===r.w?(r.y+=e.h,r.h-=e.h):(n.push({x:r.x+e.w,y:r.y,w:r.w-e.w,h:e.h}),r.y+=e.h,r.h-=e.h);break}}return{w:i,h:o,fill:e/(i*o)||0}}(n),f=c.w,p=c.h,g=new Wt({width:f||1,height:p||1});for(var d in e){var A=e[d];for(var y in A){var v=A[+y];if(v&&0!==v.bitmap.width&&0!==v.bitmap.height){var m=r[d][y].rect;Wt.copy(v.bitmap,g,{x:0,y:0},{x:m.x+1,y:m.y+1},v.bitmap)}}}this.image=g,this.positions=r})),Zt={exports:{}};Zt.exports=te,Zt.exports.default=te;var $t=1e20;function te(t,e,r,n,i,o){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=n||.25,this.fontFamily=i||"sans-serif",this.fontWeight=o||"normal",this.radius=r||8;var s=this.size=this.fontSize+2*this.buffer,a=s+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=s,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textAlign="left",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a),this.useMetrics=void 0!==this.ctx.measureText("A").actualBoundingBoxLeft,this.middle=Math.round(s/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function ee(t,e,r,n,i,o){for(var s=0;s<e;s++)re(t,s,e,r,n,i,o);for(var a=0;a<r;a++)re(t,a*e,1,e,n,i,o)}function re(t,e,r,n,i,o,s){var a,u,l,h;for(o[0]=0,s[0]=-$t,s[1]=$t,a=0;a<n;a++)i[a]=t[e+a*r];for(a=1,u=0,l=0;a<n;a++){do{h=o[u],l=(i[a]-i[h]+a*a-h*h)/(a-h)/2}while(l<=s[u]&&--u>-1);o[++u]=a,s[u]=l,s[u+1]=$t}for(a=0,u=0;a<n;a++){for(;s[u+1]<a;)u++;h=o[u],t[e+a*r]=i[h]+(a-h)*(a-h)}}te.prototype._draw=function(t,e){var r,n,i,o,s,a,u,l,h,c=this.ctx.measureText(t),f=c.width,p=2*this.buffer;e&&this.useMetrics?(s=Math.floor(c.actualBoundingBoxAscent),l=this.buffer+Math.ceil(c.actualBoundingBoxAscent),a=this.buffer,u=this.buffer,r=(n=Math.min(this.size,Math.ceil(c.actualBoundingBoxRight-c.actualBoundingBoxLeft)))+p,i=(o=Math.min(this.size-a,Math.ceil(c.actualBoundingBoxAscent+c.actualBoundingBoxDescent)))+p,this.ctx.textBaseline="alphabetic"):(r=n=this.size,i=o=this.size,s=19*this.fontSize/24,a=u=0,l=this.middle,this.ctx.textBaseline="middle"),n&&o&&(this.ctx.clearRect(u,a,n,o),this.ctx.fillText(t,this.buffer,l),h=this.ctx.getImageData(u,a,n,o));var g=new Uint8ClampedArray(r*i);return function(t,e,r,n,i,o,s){o.fill($t,0,e*r),s.fill(0,0,e*r);for(var a=(e-n)/2,u=0;u<i;u++)for(var l=0;l<n;l++){var h=(u+a)*e+l+a,c=t.data[4*(u*n+l)+3]/255;if(1===c)o[h]=0,s[h]=$t;else if(0===c)o[h]=$t,s[h]=0;else{var f=Math.max(0,.5-c),p=Math.max(0,c-.5);o[h]=f*f,s[h]=p*p}}}(h,r,i,n,o,this.gridOuter,this.gridInner),ee(this.gridOuter,r,i,this.f,this.v,this.z),ee(this.gridInner,r,i,this.f,this.v,this.z),function(t,e,r,n,i,o,s){for(var a=0;a<e*r;a++){var u=Math.sqrt(n[a])-Math.sqrt(i[a]);t[a]=Math.round(255-255*(u/o+s))}}(g,r,i,this.gridOuter,this.gridInner,this.radius,this.cutoff),{data:g,metrics:{width:n,height:o,sdfWidth:r,sdfHeight:i,top:s,left:0,advance:f}}},te.prototype.draw=function(t){return this._draw(t,!1).data},te.prototype.drawWithMetrics=function(t){return this._draw(t,!0)};var ne=Zt.exports,ie={},oe={};var se=function(){function e(t,r,n,o){var s=this;i(this,e);var a=r.pointMinZoom,u=r.pointOrder;if(0!=t.length){var l=[];this.charArray="",this.imgDict={},this.threeLayer=n,this.map=n.map,this.interactive=void 0===r.interactive||r.interactive,this.beginSizeZoom=r.beginSizeZoom||3,this.endSizeZoom=r.endSizeZoom||12,this.spanSizeZoom=this.endSizeZoom-this.beginSizeZoom,this.stepSize=1/(this.endSizeZoom-this.beginSizeZoom+1),this.altitude=r.altitude||0,this.groupId=o,"EPSG:4326"===this.map.getSpatialReference().getProjection().code?this.tileResolution=.0006866455078125:this.tileResolution=76.43702828517625,this.textMinZoom=r.textMinZoom||0,this.textMaxZoom=r.textMaxZoom||30,this.textMinMaxZooms=r.textMinMaxZooms,this.hasAlign=r.hasAlign||!1,this.childCount=0,t.slice(0,1/0).map((function(t){1*t.longitude>70&&1*t.longitude<138&&1*t.latitude>0&&1*t.latitude<56&&s._bindDataItem(l,t)})),this.textures=null,this.glyphMap=null,this.glyphAtlas=null,this.dataItems=l,this.point=null,this.shader=null,this.minZoom=a||8,this.maxZoom=r.pointMaxZoom||20,this.order=u||0,this.isToolTip=r.isToolTip||!1,this.clickFunc=r.clickFunc||null,this.cFunc=r.cFunc||null,this.mouseMoveFunc=r.mouseMoveFunc||null,this.mouseOutFunc=r.mouseOutFunc||null,this.mMoveFunc=r.mMoveFunc||null,this.hasAlign=r.hasAlign||!1,this.zoomChangeCallback=r.zoomChangeCallback,this.hidePosition=r.hidePosition||[-999,-999,0]}else console.error("需要绘制的点位数量为0")}var r,o,a,u;return s(e,[{key:"_putImgToDict",value:function(t,e,r){void 0===this.imgDict[t]?this.imgDict[t]={imgSrc:t,width:e,height:r}:(this.imgDict[t].width=(this.imgDict[t].width+e)/2,this.imgDict[t].height=(this.imgDict[t].height+r)/2)}},{key:"_bindDataItem",value:function(t,e){var r={coordinate:[parseFloat(e.longitude),parseFloat(e.latitude)],height:void 0!==e.height?parseFloat(e.height):0,visible:void 0===e.visible||e.visible,code:e.code,status:void 0!==e.status?e.status:1,name:e.name,childNum:0,data:e.data},n=e.texts;if(n){r.texts=[];for(var i=0,o=0;o<n.length;o++){var s=n[o];if(s.text&&s.text.length>0){i+=s.text.length,this.charArray=T(this.charArray,s.text);var a={text:s.text,textSize:s.textSize||14,textDx:s.textDx||0,textDy:s.textDy||0,textColor:s.textColor||"#fff",textAnchor:s.textAnchor||"center",textSpacing:s.textSpacing||2,textOpacity:s.textOpacity||255,textIndex:[]};s.textHaloColor&&(a=Object.assign(a,{textHaloColor:s.textHaloColor,textHaloRadius:s.textHaloRadius||1,textHaloOpacity:void 0!==s.textHaloOpacity?s.textHaloOpacity:255})),r.texts.push(a)}}this.childCount+=i}var u=e.markers;if(u){r.markers=[];for(var l=0,h=0;h<u.length;h++){var c=u[h];c.imgSrc&&(l+=1,this._putImgToDict(c.imgSrc,c.markerWidth||40,c.markerHeight||40),r.markers.push({markerWidth:1*c.markerWidth||40,markerHeight:1*c.markerHeight||40,markerDx:1*c.markerDx||0,markerDy:1*c.markerDy||0,markerColor:c.markerColor,markerOpacity:1*c.markerOpacity||255,key:c.imgSrc,markerIndex:-1}))}this.childCount+=l}t.push(r)}},{key:"_loadTexture",value:(u=n(t().mark((function e(){var r,n,i,o,s;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],e.t0=t().keys(this.imgDict);case 2:if((e.t1=e.t0()).done){e.next=18;break}if(n=e.t1.value,i=n,!n.includes(".svg")){e.next=12;break}return e.next=8,fetch(n);case 8:return o=e.sent,e.next=11,o.text();case 11:i=e.sent;case 12:return e.next=14,jt.addImageProcess(i);case 14:s=e.sent,r.push({key:n,src:s,w:this.imgDict[n].width,h:this.imgDict[n].height,iw:this.imgDict[n].width,ih:this.imgDict[n].height}),e.next=2;break;case 18:return e.abrupt("return",jt.generateTextureOptimize(r));case 19:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"initGlyphAtlas",value:function(){var t=this.charArray.split("").map((function(t){return function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0,n=function(t){var e=t.trim().substring(0,t.lastIndexOf(" ")),r="400";return/bold/i.test(t)?r="900":/medium/i.test(t)?r="500":/light/i.test(t)&&(r="200"),{fontFamily:e,fontWeight:r}}(e),i=n.fontFamily,o=n.fontWeight,s=r.charCodeAt(0),a=ie[e];return a||(a=ie[e]=new ne(24,3,8,.25,i,o)),oe[e]||(oe[e]={}),oe[e][r]||(oe[e][r]=a.ctx.measureText(r).width),{id:s,bitmap:new Wt({width:30,height:30},a.draw(r)),metrics:{width:24,height:24,left:0,top:-5,advance:(t=s,t>=19968&&t<=40959?24:oe[e][r])}}}("",t)})).reduce((function(t,e){return t[e.id]=e,t}),{});this.glyphMap||(this.glyphMap={}),this.glyphMap["sans-serif"]=t,this.glyphAtlas=new Kt(this.glyphMap)}},{key:"addPoint",value:(a=n(t().mark((function e(){var r,n,i,o,s,a,u,l=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.dataItems){t.next=2;break}return t.abrupt("return",null);case 2:return t.next=4,this._loadTexture();case 4:return r=t.sent,this.textures||(this.textures=[]),this.textures.push(r.texture),this.initGlyphAtlas(),n=this.glyphAtlas.image,i=n.width,o=n.height,s=n.data,(a=new THREE.DataTexture(s,i,o)).needsUpdate=!0,a.magFilter=THREE.LinearFilter,a.minFilter=THREE.LinearFilter,a.format=THREE.RedFormat,this.textures.push(a),this.m=this._getRawShaderMaterial(r,a,i,o),this.m.depthTest=!1,this.hasAlign&&(this.m.vertexShader="#define HAS_ALIGN\n"+this.m.vertexShader),this.m_pick=this._getRawShaderMaterial(r,a,i,o),this.hasAlign&&(this.m_pick.vertexShader="#define HAS_ALIGN\n"+this.m_pick.vertexShader),this.m_pick.vertexShader="#define PICKING\n"+this.m_pick.vertexShader,this.m_pick.fragmentShader="#define PICKING\n"+this.m_pick.fragmentShader,this.dataItems.forEach((function(t){t.markers&&t.markers.forEach((function(t){t=Object.assign(t,r.xys[t.key])}))})),(u=new Jt(this.dataItems,{minZoom:this.minZoom,maxZoom:this.maxZoom,interactive:this.interactive,altitude:this.altitude,hidePosition:this.hidePosition},this.m,this.m_pick,this.glyphMap,this.glyphAtlas,this.childCount,this.threeLayer)).zoomChange=function(){l.m.uniforms.cameraToCenterDistance.value=l.map.cameraToCenterDistance,l.m.uniforms.zoomScale.value=l.tileResolution/l.map.getResolution(),l.m_pick.uniforms.cameraToCenterDistance.value=l.map.cameraToCenterDistance,l.m_pick.uniforms.zoomScale.value=l.tileResolution/l.map.getResolution();for(var t=l._getRate(),e=l.point.object3d.geometry.attributes.size.array,r=0,n=0;n<l.dataItems.length;n++){var i=l.dataItems[n];if(i.markers)for(var o=0;o<i.markers.length;o++)e[4*r+0]=i.markers[o].markerWidth*t,e[4*r+1]=i.markers[o].markerHeight*t,e[4*r+2]=i.markers[o].markerDx*t,e[4*r+3]=i.markers[o].markerDy*t,r+=1;if(i.texts)for(var s=function(){var n=i.texts[a].textSize,o=i.texts[a].textDx,s=i.texts[a].textDy;i.texts[a].textIndex.forEach((function(){e[4*r+0]=n*t,e[4*r+1]=0,e[4*r+2]=o*t,e[4*r+3]=s*t,r+=1}))},a=0;a<i.texts.length;a++)s()}l.point.object3d.geometry.attributes.size.needsUpdate=!0,l.zoomChangeCallback&&l.zoomChangeCallback()},this.isToolTip&&u.setToolTip("hello",{showTimeout:0,eventsPropagation:!0,dx:10}),u.object3d.renderOrder=this.order,this.point=u,this.point.parent=this,this.groupId?this.threeLayer.addMesh1(this.point,this.groupId):this.threeLayer.addMesh(this.point),this._bindMapEvents(),t.abrupt("return",this);case 32:case"end":return t.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"_getRawShaderMaterial",value:function(t,e,r,n){return new THREE.RawShaderMaterial({uniforms:{imgTexture:{type:"t",value:t.texture},imgTextureSize:{type:"f",value:t.textureSize},sdfTexture:{type:"t",value:e},sdfTextureSize:{value:[r,n]},canvasSize:{value:[this.map.width,this.map.height]},cameraToCenterDistance:{type:"f",value:this.map.cameraToCenterDistance},zoomScale:{type:"f",value:this.tileResolution/this.map.getResolution()},mapPitch:{value:this.map.getPitch()*Math.PI/180},gammaScale:{value:1}},vertexShader:"\n precision mediump float;\n\n uniform mat4 modelViewMatrix;\n uniform mat4 projectionMatrix;\n\n uniform vec2 canvasSize;\n uniform float cameraToCenterDistance;\n uniform float zoomScale;\n uniform float mapPitch;\n uniform vec2 sdfTextureSize;\n uniform float imgTextureSize;\n\n attribute mat4 instanceMatrix;\n attribute vec4 size;\n attribute vec4 uv_offset;\n attribute vec4 uv_image;\n attribute vec4 util;\n varying vec4 vColor;\n\n #ifdef PICKING\n attribute vec3 pickingColor;\n #else\n varying vec2 vUv;\n varying float vGammaScale;\n varying float vSize;\n varying vec4 vUtil;\n attribute vec4 color;\n #endif\n\n vec2 unpack_float(const float packedValue) {\n int packedIntValue = int(packedValue);\n int v0 = packedIntValue / 256;\n return vec2(v0, packedIntValue - v0 * 256);\n }\n void main()\n {\n #ifdef PICKING\n vColor = vec4(pickingColor, 1.);\n #else\n vColor = color;\n vUtil = util;\n #endif\n vec2 utils1 = unpack_float(util.x) / 255.0;\n vec2 wh1 = uv_offset.zw * 32.;\n vec2 offset = vec2(uv_image.z + wh1.x, uv_image.w - wh1.y);\n \n vec2 j = vec2(offset.x + 16., offset.y - 16.);\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(0, 0, 0, 1.);\n float camera_to_anchor_distance = gl_Position.w;\n float distance_ratio = camera_to_anchor_distance / cameraToCenterDistance;\n float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, \n 1.5);\n float m = (1. - cameraToCenterDistance / camera_to_anchor_distance) * perspective_ratio;\n float n = clamp(.5 + .5 * (1. - m), .0, 4.);\n vec3 c = vec3(0.0, 0.0, 0.0);\n\n if (utils1.x > 0.) {\n float glyphSize = 24.;\n #ifndef PICKING\n vec2 wh = uv_offset.xy / sdfTextureSize * 32.;\n vec2 xy = uv_image.xy / sdfTextureSize;\n vUv = vec2(xy.x + wh.x, xy.y - wh.y);\n #endif\n \n j = j / glyphSize * size.x;\n float B = camera_to_anchor_distance / cameraToCenterDistance;\n\n #ifndef HAS_ALIGN\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * camera_to_anchor_distance;\n #else\n vec2 C = j;\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(c + vec3(C, .0) / zoomScale * B * n, 1.);\n #endif\n gl_Position.xy += vec2(size.z, size.w) * 2. / canvasSize * camera_to_anchor_distance;\n\n #ifndef PICKING\n #ifndef HAS_ALIGN\n vGammaScale = mix(1., B, perspective_ratio);\n #else\n vGammaScale = B + mapPitch / 4.;\n #endif\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vSize = size.x;\n #endif\n } else {\n #ifndef PICKING\n float width = uv_offset.x / imgTextureSize * color.z;\n float height = uv_offset.y / imgTextureSize * color.w;\n float x = uv_image.x;\n float y = 1.0 - uv_image.y;\n vUv = vec2(x + width, y - height);\n #endif\n\n j = j * vec2(1., -1.);\n j = j / 32. * size.xy;\n #ifndef HAS_ALIGN\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * camera_to_anchor_distance;\n #else\n float C = camera_to_anchor_distance / cameraToCenterDistance;\n vec2 B = j;\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(c + vec3(B, .0) / zoomScale * C * n, 1.);\n #endif\n gl_Position.xy += vec2(size.z, size.w) * 2. / canvasSize * camera_to_anchor_distance;\n }\n }\n ",fragmentShader:"\n precision mediump float;\n #define SDF_PX 8.0\n #define DEVICE_PIXEL_RATIO 1.0\n #define EDGE_GAMMA 0.105 / DEVICE_PIXEL_RATIO\n uniform sampler2D sdfTexture;\n uniform sampler2D imgTexture;\n uniform highp float gammaScale;\n varying vec4 vColor;\n #ifndef PICKING\n varying vec2 vUv;\n varying float vSize;\n varying float vGammaScale;\n varying vec4 vUtil;\n #endif\n\n vec2 unpack_float(const float packedValue) {\n int packedIntValue = int(packedValue);\n int v0 = packedIntValue / 256;\n return vec2(v0, packedIntValue - v0 * 256);\n }\n \n vec4 decode_color(const vec2 encodedColor) {\n return vec4(\n unpack_float(encodedColor[0]) / 255.0,\n unpack_float(encodedColor[1]) / 255.0\n );\n }\n void main()\n {\n #ifdef PICKING\n gl_FragColor = vColor;\n #else\n vec4 color = decode_color(vColor.xy);\n vec2 utils1 = unpack_float(vUtil.x) / 255.0;\n if (utils1.x > 0.) {\n /*float vOpacity = 1.0;\n float d = vSize / 24.;\n lowp vec4 e = color;\n highp float f = EDGE_GAMMA / (d * gammaScale);\n lowp float h = 185. / 256.;\n float l = texture2D(texture1, vUv).a;\n highp float m = f * vGammaScale * .7;\n float n = clamp(smoothstep(h - m, h + m, l), .0, 1.);\n gl_FragColor = e * (n * 1.0 * vOpacity);*/\n\n //float dist = texture2D(sdfTexture, vUv).a;\n float dist = texture2D(sdfTexture, vUv).r;\n float fontScale = vSize / 24.0;\n\n highp float gamma = EDGE_GAMMA / (fontScale * gammaScale);\n lowp float buff = (177. + floor(fontScale)) / 256.0;\n highp float gamma_scaled = gamma * vGammaScale * 0.7;\n highp float alpha = clamp(smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist), .0, 1.);\n\n if (vUtil.y < 0.) {\n gl_FragColor = color * alpha;\n } else {\n float u_halo_width = vUtil.y;\n float u_halo_blur = 0.;\n vec4 u_halo_color = decode_color(vColor.zw);\n float radius = u_halo_width / fontScale / 10.;\n float halo_width = ceil(u_halo_width - u_halo_width / 10.);\n buff = (6.0 - halo_width / fontScale) / SDF_PX;\n gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * gammaScale);\n gamma_scaled = gamma * vGammaScale * 0.7;\n alpha = clamp(smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist), .0, 1.);\n gl_FragColor = mix(u_halo_color, color, \n smoothstep(buff + radius - gamma_scaled, buff + radius + gamma_scaled, dist)) * alpha;\n }\n } else {\n if (utils1.y > 0.) {\n gl_FragColor = color * texture2D(imgTexture, vUv);\n } else {\n gl_FragColor = texture2D(imgTexture, vUv);\n }\n }\n #endif\n }\n ",transparent:!0,side:THREE.DoubleSide})}},{key:"_bindMapEvents",value:function(){this.map.on("pitch",this._setSizeOn,this),this.point&&this.point.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.map.off("pitch",this._setSizeOn,this),this.point&&this.point.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setSizeOn",value:function(){this.m.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance,this.m_pick.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance,this.m.uniforms.mapPitch.value=this.map.getPitch()*Math.PI/180}},{key:"addContent",value:(o=n(t().mark((function e(r){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.clickFunc(r);case 2:this.iconFile&&this._addIcon(r);case 3:case"end":return t.stop()}}),e,this)}))),function(t){return o.apply(this,arguments)})},{key:"_setPointEvent",value:function(t){var e=t.selectMesh;if("mousemove"===t.type&&e){var r=e.name;if(this.isToolTip)this.point.getToolTip()._content="".concat(r)}"click"===t.type&&e&&this.clickFunc&&!this.cFunc&&this.addContent(e)}},{key:"findItemByCode",value:function(t){for(var e=0;e<this.dataItems.length;e++)if(this.dataItems[e].code===t)return e}},{key:"changeParaValue",value:(r=n(t().mark((function e(r){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),e)}))),function(t){return r.apply(this,arguments)})},{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}},{key:"show",value:function(){var t,e;null===(t=this.point)||void 0===t||t.show();for(var r=0;r<this.dataItems.length;r++){this.dataItems[r].visible=!0}null===(e=this.point)||void 0===e||e.changeVisible()}},{key:"hide",value:function(){var t;null===(t=this.point)||void 0===t||t.hide()}},{key:"setInteractiveState",value:function(t){this.point&&(this.point.options.interactive=t)}},{key:"pointShowHideByCode",value:function(t,e,r){for(var n,i=1/0,o=1/0,s=-1/0,a=-1/0,u=0;u<this.dataItems.length;u++){var l=this.dataItems[u];t.includes(l.code)?(i=Math.min(i,this.dataItems[u].coordinate[0]),o=Math.min(o,this.dataItems[u].coordinate[1]),s=Math.max(s,this.dataItems[u].coordinate[0]),a=Math.max(a,this.dataItems[u].coordinate[1]),l.visible=!0):l.visible=!1}null===(n=this.point)||void 0===n||n.changeVisible(),e&&this.map.fitExtent(new maptalks.Extent(i,o,s,a),r||0)}},{key:"updateByZoom",value:function(){var t=this,e=this.map.getZoom(),r=new THREE.Object3D,n=0;this.dataItems.forEach((function(i){var o=t.threeLayer.coordinateToVector3(i.coordinate);if(o.sub(t.point.center),i.height&&(o.z=t.threeLayer.altitudeToVector3(i.height).x),i.markers&&(n+=i.markers.length),i.value&&t.showValueFlag)for(var s=0;s<i.value.length;s++)e<t.valueMinZoom||e>t.valueMaxZoom?r.position.set(-999,-999,0):r.position.set(o.x,o.y,0),r.updateMatrix(),t.point.getObject3d().setMatrixAt(n,r.matrix),t.point.pickMesh.setMatrixAt(n,r.matrix),n+=1;if(i.name&&t.showNameFlag)for(var a=0;a<i.name.length;a++)e<t.nameMinZoom||e>t.nameMaxZoom?r.position.set(-999,-999,0):r.position.set(o.x,o.y,0),r.updateMatrix(),t.point.getObject3d().setMatrixAt(n,r.matrix),t.point.pickMesh.setMatrixAt(n,r.matrix),n+=1})),this.point.getObject3d().instanceMatrix.needsUpdate=!0,this.point.pickMesh.instanceMatrix.needsUpdate=!0}},{key:"dispose",value:function(){this.isToolTip&&this.point&&this.point.removeToolTip(),this._closeEvent(),this.point&&(this.groupId?this.threeLayer.removeMesh1(this.point,this.groupId):this.threeLayer.removeMesh(this.point),this.point.object3d.geometry&&this.point.object3d.geometry.dispose(),this.point.object3d.material&&this.point.object3d.material.dispose(),this.point.pickObject3d.geometry&&this.point.pickObject3d.geometry.dispose(),this.point.pickObject3d.material&&this.point.pickObject3d.material.dispose(),this.point._datas=[],this.point._colorMap={},delete this.point.object3d,delete this.point.pickObject3d,this.point.toolTip&&delete this.point.toolTip,delete this.point),this.textures&&this.textures.length>0&&(this.textures.forEach((function(t){t.dispose()})),delete this.textures),this.m&&(this.m.dispose(),delete this.m),this.m_pick&&(this.m_pick.dispose(),delete this.m_pick),this.glyphMap={},this.glyphAtlas&&delete this.glyphAtlas}}]),e}();function ae(t){var e;try{e=new URL(t,"http://fakehost.com/")}catch(t){return null}var r=e.pathname.split("/").pop(),n=r.lastIndexOf(".");return-1===n||n===r.length-1?null:r.substring(n+1)}var ue=function(){function t(){i(this,t),this.maxSize=800,this.minSize=600,this.unloadPercent=.05,this.itemSet=new Map,this.itemList=[],this.usedSet=new Set,this.callbacks=new Map,this.unloadPriorityCallback=null;var e=this.itemSet;this.defaultPriorityCallback=function(t){return e.get(t)}}return s(t,[{key:"isFull",value:function(){return this.itemSet.size>=this.maxSize}},{key:"add",value:function(t,e){var r=this.itemSet;if(r.has(t))return!1;if(this.isFull())return!1;var n=this.usedSet,i=this.itemList,o=this.callbacks;return i.push(t),n.add(t),r.set(t,Date.now()),o.set(t,e),!0}},{key:"remove",value:function(t){var e=this.usedSet,r=this.itemSet,n=this.itemList,i=this.callbacks;if(r.has(t)){i.get(t)(t);var o=n.indexOf(t);return n.splice(o,1),e.delete(t),r.delete(t),i.delete(t),!0}return!1}},{key:"markUsed",value:function(t){var e=this.itemSet,r=this.usedSet;e.has(t)&&!r.has(t)&&(e.set(t,Date.now()),r.add(t))}},{key:"markAllUnused",value:function(){this.usedSet.clear()}},{key:"unloadUnusedContent",value:function(){var t=this.unloadPercent,e=this.minSize,r=this.itemList,n=this.itemSet,i=this.usedSet,o=this.callbacks,s=r.length-i.size,a=r.length-e,u=this.unloadPriorityCallback||this.defaultPriorityCallback;if(a>0&&s>0){r.sort((function(t,e){var r=i.has(t),n=i.has(e);return r&&n?0:r||n?r?1:-1:u(e)-u(t)}));var l=Math.min(a,s),h=Math.max(e*t,l*t),c=Math.min(h,s);c=Math.ceil(c);for(var f=r.splice(0,c),p=0,g=f.length;p<g;p++){var d=f[p];o.get(d)(d),n.delete(d),o.delete(d)}}}},{key:"scheduleUnload",value:function(){var t,e=this,r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scheduled||(this.scheduled=!0,t=function(){e.scheduled=!1,e.unloadUnusedContent(),r&&e.markAllUnused()},Promise.resolve().then(t))}}]),t}(),le=function(){function t(){var e=this;i(this,t),this.maxJobs=6,this.items=[],this.callbacks=new Map,this.currJobs=0,this.scheduled=!1,this.autoUpdate=!0,this.priorityCallback=function(){throw new Error("PriorityQueue: PriorityCallback function not defined.")},this.schedulingCallback=function(t){requestAnimationFrame(t)},this._runjobs=function(){e.tryRunJobs(),e.scheduled=!1}}return s(t,[{key:"sort",value:function(){var t=this.priorityCallback;this.items.sort(t)}},{key:"add",value:function(t,e){var r=this;return new Promise((function(n,i){var o=r.items,s=r.callbacks;o.push(t),s.set(t,(function(){return e.apply(void 0,arguments).then(n).catch(i)})),r.autoUpdate&&r.scheduleJobRun()}))}},{key:"remove",value:function(t){var e=this.items,r=this.callbacks,n=e.indexOf(t);-1!==n&&(e.splice(n,1),r.delete(t))}},{key:"tryRunJobs",value:function(){var t=this;this.sort();for(var e=this.items,r=this.callbacks,n=this.maxJobs,i=this.currJobs;n>i&&e.length>0;){i++;var o=e.pop(),s=r.get(o);r.delete(o),s(o).then((function(){t.currJobs--,t.autoUpdate&&t.scheduleJobRun()})).catch((function(){t.currJobs--,t.autoUpdate&&t.scheduleJobRun()}))}this.currJobs=i}},{key:"scheduleJobRun",value:function(){this.scheduled||(this.schedulingCallback(this._runjobs),this.scheduled=!0)}}]),t}(),he=3,ce=4,fe=6378137,pe=6356752.314245179;function ge(t){return t===he||t===ce}function de(t,e){return t.__lastFrameVisited===e&&t.__used}function Ae(t,e){t.__lastFrameVisited!==e&&(t.__lastFrameVisited=e,t.__used=!1,t.__inFrustum=!1,t.__isLeaf=!1,t.__visible=!1,t.__active=!1,t.__error=1/0,t.__distanceFromCamera=1/0,t.__childrenWereVisible=!1,t.__allChildrenLoaded=!1)}function ye(t,e,r,n){if(n.ensureChildrenArePreprocessed(t),Ae(t,e),t.__used=!0,r.markUsed(t),t.__contentEmpty)for(var i=t.children,o=0,s=i.length;o<s;o++)ye(i[o],e,r,n)}function ve(t,e,r){if(r.ensureChildrenArePreprocessed(t),t.__contentEmpty&&(!t.__externalTileSet||ge(t.__loadingState)))for(var n=t.children,i=0,o=n.length;i<o;i++){var s=n[i];s.__depthFromRenderedParent=e,ve(s,e,r)}else r.requestTileContents(t)}function me(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(e&&e(t,n,i))r&&r(t,n,i);else{for(var o=t.children,s=0,a=o.length;s<a;s++)me(o[s],e,r,t,i+1);r&&r(t,n,i)}}function Ee(t,e){e.ensureChildrenArePreprocessed(t);var r=e.stats,n=e.frameCount,i=e.errorTarget,o=e.maxDepth,s=e.loadSiblings,a=e.lruCache,u=e.stopAtEmptyTiles;if(Ae(t,n),!1===e.tileInView(t))return!1;if(t.__used=!0,a.markUsed(t),t.__inFrustum=!0,r.inFrustum++,(u||!t.__contentEmpty)&&!t.__externalTileSet){if(e.calculateError(t),t.__error<=i)return!0;if(e.maxDepth>0&&t.__depth+1>=o)return!0}for(var l=!1,h=t.children,c=0,f=h.length;c<f;c++){var p=Ee(h[c],e);l=l||p}if(l&&s)for(var g=0,d=h.length;g<d;g++){ye(h[g],n,a,e)}return!0}function _e(t,e){var r=e.stats,n=e.frameCount;if(de(t,n)){r.used++;for(var i=t.children,o=!1,s=0,a=i.length;s<a;s++){var u=i[s];o=o||de(u,n)}if(o){for(var l=!1,h=!0,c=0,f=i.length;c<f;c++){var p=i[c];if(_e(p,e),l=l||p.__wasSetVisible||p.__childrenWereVisible,de(p,n)){var g=p.__allChildrenLoaded||!p.__contentEmpty&&ge(p.__loadingState)||p.__externalTileSet&&p.__loadingState===ce;h=h&&g}}t.__childrenWereVisible=l,t.__allChildrenLoaded=h}else t.__isLeaf=!0}}function Ie(t,e){var r=e.stats,n=e.frameCount;if(de(t,n)){var i=t.parent,o=i?i.__depthFromRenderedParent:-1;t.__depthFromRenderedParent=o;var s=e.lruCache;if(t.__isLeaf)return t.__depthFromRenderedParent++,void(t.__loadingState===he?(t.__inFrustum&&(t.__visible=!0,r.visible++),t.__active=!0,r.active++):s.isFull()||t.__contentEmpty&&!t.__externalTileSet||e.requestTileContents(t));var a=(e.errorTarget+1)*e.errorThreshold,u=t.__error<=a,l=u||"ADD"===t.refine,h=!t.__contentEmpty,c=h||t.__externalTileSet,f=ge(t.__loadingState)&&c,p=t.__childrenWereVisible,g=t.children,d=t.__allChildrenLoaded;if(l&&h&&t.__depthFromRenderedParent++,l&&!f&&!s.isFull()&&c&&e.requestTileContents(t),(u&&!d&&!p&&f||"ADD"===t.refine&&f)&&(t.__inFrustum&&(t.__visible=!0,r.visible++),t.__active=!0,r.active++),"ADD"!==t.refine&&u&&!d&&f)for(var A=0,y=g.length;A<y;A++){var v=g[A];de(v,n)&&!s.isFull()&&(v.__depthFromRenderedParent=t.__depthFromRenderedParent+1,ve(v,v.__depthFromRenderedParent,e))}else for(var m=0,E=g.length;m<E;m++){var _=g[m];de(_,n)&&Ie(_,e)}}}function xe(t,e){var r=de(t,e.frameCount);if(r||t.__usedLastFrame){var n=!1,i=!1;r&&(n=t.__active,i=e.displayActiveTiles&&t.__active||t.__visible),t.__contentEmpty||t.__loadingState!==he||(t.__wasSetActive!==n&&e.setTileActive(t,n),t.__wasSetVisible!==i&&e.setTileVisible(t,i)),t.__wasSetActive=n,t.__wasSetVisible=i,t.__usedLastFrame=r;for(var o=t.children,s=0,a=o.length;s<a;s++){xe(o[s],e)}}}var Ce=function(t,e){return t.__depth!==e.__depth?t.__depth>e.__depth?-1:1:t.__inFrustum!==e.__inFrustum?t.__inFrustum?1:-1:t.__used!==e.__used?t.__used?1:-1:t.__error!==e.__error?t.__error>e.__error?1:-1:t.__distanceFromCamera!==e.__distanceFromCamera?t.__distanceFromCamera>e.__distanceFromCamera?-1:1:0},we=function(t){return 1/(t.__depthFromRenderedParent+1)},be=function(){function t(e,r){i(this,t),this.tileSets={},this.rootURL=e,this.fetchOptions={},this.preprocessURL=null;var n=new ue;n.unloadPriorityCallback=we;var o=new le;o.maxJobs=4,o.priorityCallback=Ce;var s=new le;s.maxJobs=1,s.priorityCallback=Ce,this.lruCache=n,this.downloadQueue=o,this.parseQueue=s,this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0,this.errorTarget=6,this.errorThreshold=1/0,this.loadSiblings=!0,this.displayActiveTiles=!1,this.maxDepth=1/0,this.stopAtEmptyTiles=!0,this.threeLayer=r,this.heightOffset=0,this.xOffset=0,this.yOffset=0}return s(t,[{key:"rootTileSet",get:function(){var t=this.tileSets[this.rootURL];return!t||t instanceof Promise?null:t}},{key:"root",get:function(){var t=this.rootTileSet;return t?t.root:null}},{key:"traverse",value:function(t,e){var r=this,n=this.tileSets[this.rootURL];n&&n.root&&me(n.root,(function(e){r.ensureChildrenArePreprocessed(e);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return!!t&&t.apply(void 0,[e].concat(i))}),e)}},{key:"update",value:function(){var t=this.stats,e=this.lruCache,r=this.tileSets,n=r[this.rootURL];if(this.rootURL in r){if(n&&n.root){var i=n.root;t.inFrustum=0,t.used=0,t.active=0,t.visible=0,this.frameCount++,Ee(i,this),_e(i,this),Ie(i,this),xe(i,this),e.scheduleUnload()}}else this.loadRootTileSet(this.rootURL)}},{key:"parseTile",value:function(t,e,r){return null}},{key:"disposeTile",value:function(t){}},{key:"preprocessNode",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t.content&&(!("uri"in t.content)&&"url"in t.content&&(t.content.uri=t.content.url,delete t.content.url),t.content.uri&&(t.content.uri=new URL(t.content.uri,e+"/").toString()),t.content.boundingVolume&&!("box"in t.content.boundingVolume||"sphere"in t.content.boundingVolume||"region"in t.content.boundingVolume)&&delete t.content.boundingVolume),t.parent=r,t.children=t.children||[],t.content&&t.content.uri){var n=ae(t.content.uri),i=Boolean(n&&"json"===n.toLowerCase());t.__externalTileSet=i,t.__contentEmpty=i}else t.__externalTileSet=!1,t.__contentEmpty=!0;t.__distanceFromCamera=1/0,t.__error=1/0,t.__inFrustum=!1,t.__isLeaf=!1,t.__usedLastFrame=!1,t.__used=!1,t.__wasSetVisible=!1,t.__visible=!1,t.__childrenWereVisible=!1,t.__allChildrenLoaded=!1,t.__wasSetActive=!1,t.__active=!1,t.__loadingState=0,t.__loadIndex=0,t.__loadAbort=null,t.__depthFromRenderedParent=-1,null===r?(t.__depth=0,t.refine=t.refine||"REPLACE"):(t.__depth=r.__depth+1,t.refine=t.refine||r.refine),t.__basePath=e}},{key:"setTileActive",value:function(t,e){}},{key:"setTileVisible",value:function(t,e){}},{key:"calculateError",value:function(t){return 0}},{key:"tileInView",value:function(t){return!0}},{key:"ensureChildrenArePreprocessed",value:function(t){for(var e=t.children,r=0,n=e.length;r<n;r++){var i=e[r];if("__depth"in i)break;this.preprocessNode(i,t.__basePath,t)}}},{key:"resetFailedTiles",value:function(){var t=this.stats;0!==t.failed&&(this.traverse((function(t){t.__loadingState===ce&&(t.__loadingState=0)})),t.failed=0)}},{key:"fetchTileSet",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return fetch(t,e).then((function(e){if(e.ok)return e.json();throw new Error('TilesRenderer: Failed to load tileset "'.concat(t,'" with status ').concat(e.status," : ").concat(e.statusText))})).then((function(e){var i=e.asset.version;console.assert("1.0"===i||"0.0"===i,'asset.version is expected to be a string of "1.0" or "0.0"');var o=t.replace(/\/[^\/]*\/?$/,"");return o=new URL(o,window.location.href).toString(),r.preprocessNode(e.root,o,n),e}))}},{key:"loadRootTileSet",value:function(t){var e=this.tileSets;if(t in e)return e[t]instanceof Error?Promise.reject(e[t]):Promise.resolve(e[t]);var r=this.fetchTileSet(this.preprocessURL?this.preprocessURL(t):t,this.fetchOptions).then((function(r){e[t]=r}));return r.catch((function(r){console.error(r),e[t]=r})),e[t]=r,r}},{key:"requestTileContents",value:function(t){var e=this;if(0===t.__loadingState){var r=this.stats,n=this.lruCache,i=this.downloadQueue,o=this.parseQueue,s=t.__externalTileSet;n.add(t,(function(t){1===t.__loadingState?(t.__loadAbort.abort(),t.__loadAbort=null):s?t.children.length=0:e.disposeTile(t),1===t.__loadingState?r.downloading--:2===t.__loadingState&&r.parsing--,t.__loadingState=0,t.__loadIndex++,o.remove(t),i.remove(t)})),t.__loadIndex++;var a=t.__loadIndex,u=new AbortController,l=u.signal;r.downloading++,t.__loadAbort=u,t.__loadingState=1;var h=function(e){t.__loadIndex===a&&("AbortError"!==e.name?(o.remove(t),i.remove(t),2===t.__loadingState?r.parsing--:1===t.__loadingState&&r.downloading--,r.failed++,console.error('TilesRenderer : Failed to load tile at url "'.concat(t.content.uri,'".')),console.error(e),t.__loadingState=ce):n.remove(t))};s?i.add(t,(function(t){if(t.__loadIndex!==a)return Promise.resolve();var r=e.preprocessURL?e.preprocessURL(t.content.uri):t.content.uri;return e.fetchTileSet(r,Object.assign({signal:l},e.fetchOptions),t)})).then((function(e){t.__loadIndex===a&&(r.downloading--,t.__loadAbort=null,t.__loadingState=he,t.children.push(e.root))})).catch(h):i.add(t,(function(t){if(t.__loadIndex!==a)return Promise.resolve();var r=e.preprocessURL?e.preprocessURL(t.content.uri):t.content.uri;return fetch(r,Object.assign({signal:l},e.fetchOptions))})).then((function(e){if(t.__loadIndex===a){if(e.ok)return e.arrayBuffer();throw new Error("Failed to load model with error code ".concat(e.status))}})).then((function(n){if(t.__loadIndex===a)return r.downloading--,r.parsing++,t.__loadAbort=null,t.__loadingState=2,o.add(t,(function(t){if(t.__loadIndex!==a)return Promise.resolve();var r=ae(t.content.uri);return e.parseTile(n,t,r)}))})).then((function(){t.__loadIndex===a&&(r.parsing--,t.__loadingState=he,t.__wasSetVisible&&e.setTileVisible(t,!0),t.__wasSetActive&&e.setTileActive(t,!0))})).catch(h)}}},{key:"dispose",value:function(){var t=this.lruCache,e=[];this.traverse((function(t){return e.push(t),!1}));for(var r=0,n=e.length;r<n;r++)t.remove(e[r]);this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0}}]),t}();function Be(t){return(new TextDecoder).decode(t)}var Se=function(){function t(e,r,n,o){i(this,t),this.buffer=e,this.binOffset=r+n,this.binLength=o;var s=null;if(0!==n){var a=new Uint8Array(e,r,n);s=JSON.parse(Be(a))}else s={};this.header=s}return s(t,[{key:"getKeys",value:function(){return Object.keys(this.header)}},{key:"getData",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=this.header;if(!(t in i))return null;var o=i[t];if(o instanceof Object){if(Array.isArray(o))return o;var s,a,u=this.buffer,l=this.binOffset,h=this.binLength,c=o.byteOffset||0,f=o.type||n,p=o.componentType||r;if("type"in o&&n&&o.type!==n)throw new Error("FeatureTable: Specified type does not match expected type.");switch(f){case"SCALAR":s=1;break;case"VEC2":s=2;break;case"VEC3":s=3;break;case"VEC4":s=4;break;default:throw new Error('FeatureTable : Feature type not provided for "'.concat(t,'".'))}var g=l+c,d=e*s;switch(p){case"BYTE":a=new Int8Array(u,g,d);break;case"UNSIGNED_BYTE":a=new Uint8Array(u,g,d);break;case"SHORT":a=new Int16Array(u,g,d);break;case"UNSIGNED_SHORT":a=new Uint16Array(u,g,d);break;case"INT":a=new Int32Array(u,g,d);break;case"UNSIGNED_INT":a=new Uint32Array(u,g,d);break;case"FLOAT":a=new Float32Array(u,g,d);break;case"DOUBLE":a=new Float64Array(u,g,d);break;default:throw new Error('FeatureTable : Feature component type not provided for "'.concat(t,'".'))}if(g+d*a.BYTES_PER_ELEMENT>l+h)throw new Error("FeatureTable: Feature data read outside binary body length.");return a}return o}},{key:"getBuffer",value:function(t,e){var r=this.buffer,n=this.binOffset;return r.slice(n+t,n+t+e)}}]),t}(),Te=function(t){u(r,Se);var e=f(r);function r(t,n,o,s,a){var u;return i(this,r),(u=e.call(this,t,o,s,a)).batchSize=n,u}return s(r,[{key:"getData",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return g(l(r.prototype),"getData",this).call(this,t,this.batchSize,e,n)}}]),r}(),Me=function(){function t(){i(this,t),this.fetchOptions={},this.workingPath=""}return s(t,[{key:"load",value:function(t){var e=this;return fetch(t,this.fetchOptions).then((function(e){if(!e.ok)throw new Error('Failed to load file "'.concat(t,'" with status ').concat(e.status," : ").concat(e.statusText));return e.arrayBuffer()})).then((function(r){return""===e.workingPath&&(e.workingPath=e.workingPathForURL(t)),e.parse(r)}))}},{key:"resolveExternalURL",value:function(t){return/^[^\\/]/.test(t)?this.workingPath+"/"+t:t}},{key:"workingPathForURL",value:function(t){var e=t.split(/[\\/]/g);return e.pop(),e.join("/")+"/"}},{key:"parse",value:function(t){throw new Error("LoaderBase: Parse not implemented.")}}]),t}();function Re(t){var e;if(e=t instanceof DataView?t:new DataView(t),"{"===String.fromCharCode(e.getUint8(0)))return null;for(var r="",n=0;n<4;n++)r+=String.fromCharCode(e.getUint8(n));return r}var Le=function(t){u(r,Me);var e=f(r);function r(){return i(this,r),e.apply(this,arguments)}return s(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Re(e);console.assert("b3dm"===r);var n=e.getUint32(4,!0);console.assert(1===n);var i=e.getUint32(8,!0);console.assert(i===t.byteLength);var o=e.getUint32(12,!0),s=e.getUint32(16,!0),a=e.getUint32(20,!0),u=e.getUint32(24,!0),l=t.slice(28,28+o+s),h=new Se(l,0,o,s),c=28+o+s,f=t.slice(c,c+a+u),p=new Te(f,h.getData("BATCH_LENGTH"),0,a,u),g=c+a+u;return{version:n,featureTable:h,batchTable:p,glbBytes:new Uint8Array(t,g,i-g)}}}]),r}(),Ne=function(t){u(r,THREE.Loader);var e=f(r);function r(t){var n;return i(this,r),(n=e.call(this,t)).dracoLoader=null,n.ktx2Loader=null,n.meshoptDecoder=null,n.pluginCallbacks=[],n.register((function(t){return new Fe(t)})),n.register((function(t){return new ze(t)})),n.register((function(t){return new Ye(t)})),n.register((function(t){return new Ue(t)})),n.register((function(t){return new He(t)})),n.register((function(t){return new je(t)})),n.register((function(t){return new qe(t)})),n.register((function(t){return new Oe(t)})),n.register((function(t){return new Ve(t)})),n.register((function(t){return new Ge(t)})),n.register((function(t){return new De(t)})),n.register((function(t){return new Xe(t)})),n.register((function(t){return new Je(t)})),n}return s(r,[{key:"load",value:function(t,e,r,n){var i,o=this;i=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:THREE.LoaderUtils.extractUrlBase(t),this.manager.itemStart(t);var s=function(e){n?n(e):console.error(e),o.manager.itemError(t),o.manager.itemEnd(t)},a=new THREE.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(r){try{o.parse(r,i,(function(r){e(r),o.manager.itemEnd(t)}),s)}catch(t){s(t)}}),r,s)}},{key:"setDRACOLoader",value:function(t){return this.dracoLoader=t,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(t){return this.ktx2Loader=t,this}},{key:"setMeshoptDecoder",value:function(t){return this.meshoptDecoder=t,this}},{key:"register",value:function(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}},{key:"unregister",value:function(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}},{key:"parse",value:function(t,e,r,n){var i,o={},s={};if("string"==typeof t)i=JSON.parse(t);else if(t instanceof ArrayBuffer){if(THREE.LoaderUtils.decodeText(new Uint8Array(t,0,4))===We){try{o[ke.KHR_BINARY_GLTF]=new $e(t)}catch(t){return void(n&&n(t))}i=JSON.parse(o[ke.KHR_BINARY_GLTF].content)}else i=JSON.parse(THREE.LoaderUtils.decodeText(new Uint8Array(t)))}else i=t;if(void 0===i.asset||i.asset.version[0]<2)n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var a=new xr(i,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});a.fileLoader.setRequestHeader(this.requestHeader);for(var u=0;u<this.pluginCallbacks.length;u++){var l=this.pluginCallbacks[u](a);s[l.name]=l,o[l.name]=!0}if(i.extensionsUsed)for(var h=0;h<i.extensionsUsed.length;++h){var c=i.extensionsUsed[h],f=i.extensionsRequired||[];switch(c){case ke.KHR_MATERIALS_UNLIT:o[c]=new Qe;break;case ke.KHR_DRACO_MESH_COMPRESSION:o[c]=new tr(i,this.dracoLoader);break;case ke.KHR_TEXTURE_TRANSFORM:o[c]=new er;break;case ke.KHR_MESH_QUANTIZATION:o[c]=new rr;break;default:f.indexOf(c)>=0&&void 0===s[c]&&console.warn('THREE.GLTFLoader: Unknown extension "'+c+'".')}}a.setExtensions(o),a.setPlugins(s),a.parse(r,n)}}},{key:"parseAsync",value:function(t,e){var r=this;return new Promise((function(n,i){r.parse(t,e,n,i)}))}}]),r}();function Pe(){var t={};return{get:function(e){return t[e]},add:function(e,r){t[e]=r},remove:function(e){delete t[e]},removeAll:function(){t={}}}}var ke={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},De=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return s(t,[{key:"_markDefs",value:function(){for(var t=this.parser,e=this.parser.json.nodes||[],r=0,n=e.length;r<n;r++){var i=e[r];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&t._addNodeRef(this.cache,i.extensions[this.name].light)}}},{key:"_loadLight",value:function(t){var e=this.parser,r="light:"+t,n=e.cache.get(r);if(n)return n;var i,o=e.json,s=((o.extensions&&o.extensions[this.name]||{}).lights||[])[t],a=new THREE.Color(16777215);void 0!==s.color&&a.fromArray(s.color);var u=void 0!==s.range?s.range:0;switch(s.type){case"directional":(i=new THREE.DirectionalLight(a)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new THREE.PointLight(a)).distance=u;break;case"spot":(i=new THREE.SpotLight(a)).distance=u,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,i.angle=s.spot.outerConeAngle,i.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return i.position.set(0,0,0),i.decay=2,vr(i,s),void 0!==s.intensity&&(i.intensity=s.intensity),i.name=e.createUniqueName(s.name||"light_"+t),n=Promise.resolve(i),e.cache.add(r,n),n}},{key:"getDependency",value:function(t,e){if("light"===t)return this._loadLight(e)}},{key:"createNodeAttachment",value:function(t){var e=this,r=this.parser,n=r.json.nodes[t],i=(n.extensions&&n.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then((function(t){return r._getNodeRef(e.cache,i,t)}))}}]),t}(),Qe=function(){function t(){i(this,t),this.name=ke.KHR_MATERIALS_UNLIT}return s(t,[{key:"getMaterialType",value:function(){return THREE.MeshBasicMaterial}},{key:"extendParams",value:function(t,e,r){var n=[];t.color=new THREE.Color(1,1,1),t.opacity=1;var i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){var o=i.baseColorFactor;t.color.fromArray(o),t.opacity=o[3]}void 0!==i.baseColorTexture&&n.push(r.assignTexture(t,"map",i.baseColorTexture,THREE.sRGBEncoding))}return Promise.all(n)}}]),t}(),Oe=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_EMISSIVE_STRENGTH}return s(t,[{key:"extendMaterialParams",value:function(t,e){var r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var n=r.extensions[this.name].emissiveStrength;return void 0!==n&&(e.emissiveIntensity=n),Promise.resolve()}}]),t}(),Fe=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_CLEARCOAT}return s(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?THREE.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];if(void 0!==o.clearcoatFactor&&(e.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&i.push(r.assignTexture(e,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(e.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&i.push(r.assignTexture(e,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(i.push(r.assignTexture(e,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var s=o.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new THREE.Vector2(s,s)}return Promise.all(i)}}]),t}(),Ge=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_IRIDESCENCE}return s(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?THREE.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];return void 0!==o.iridescenceFactor&&(e.iridescence=o.iridescenceFactor),void 0!==o.iridescenceTexture&&i.push(r.assignTexture(e,"iridescenceMap",o.iridescenceTexture)),void 0!==o.iridescenceIor&&(e.iridescenceIOR=o.iridescenceIor),void 0===e.iridescenceThicknessRange&&(e.iridescenceThicknessRange=[100,400]),void 0!==o.iridescenceThicknessMinimum&&(e.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),void 0!==o.iridescenceThicknessMaximum&&(e.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),void 0!==o.iridescenceThicknessTexture&&i.push(r.assignTexture(e,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(i)}}]),t}(),Ue=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_SHEEN}return s(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?THREE.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[];e.sheenColor=new THREE.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;var o=n.extensions[this.name];return void 0!==o.sheenColorFactor&&e.sheenColor.fromArray(o.sheenColorFactor),void 0!==o.sheenRoughnessFactor&&(e.sheenRoughness=o.sheenRoughnessFactor),void 0!==o.sheenColorTexture&&i.push(r.assignTexture(e,"sheenColorMap",o.sheenColorTexture,THREE.sRGBEncoding)),void 0!==o.sheenRoughnessTexture&&i.push(r.assignTexture(e,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(i)}}]),t}(),He=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_TRANSMISSION}return s(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?THREE.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];return void 0!==o.transmissionFactor&&(e.transmission=o.transmissionFactor),void 0!==o.transmissionTexture&&i.push(r.assignTexture(e,"transmissionMap",o.transmissionTexture)),Promise.all(i)}}]),t}(),je=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_VOLUME}return s(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?THREE.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];e.thickness=void 0!==o.thicknessFactor?o.thicknessFactor:0,void 0!==o.thicknessTexture&&i.push(r.assignTexture(e,"thicknessMap",o.thicknessTexture)),e.attenuationDistance=o.attenuationDistance||1/0;var s=o.attenuationColor||[1,1,1];return e.attenuationColor=new THREE.Color(s[0],s[1],s[2]),Promise.all(i)}}]),t}(),qe=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_IOR}return s(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?THREE.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var n=r.extensions[this.name];return e.ior=void 0!==n.ior?n.ior:1.5,Promise.resolve()}}]),t}(),Ve=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_MATERIALS_SPECULAR}return s(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?THREE.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var i=[],o=n.extensions[this.name];e.specularIntensity=void 0!==o.specularFactor?o.specularFactor:1,void 0!==o.specularTexture&&i.push(r.assignTexture(e,"specularIntensityMap",o.specularTexture));var s=o.specularColorFactor||[1,1,1];return e.specularColor=new THREE.Color(s[0],s[1],s[2]),void 0!==o.specularColorTexture&&i.push(r.assignTexture(e,"specularColorMap",o.specularColorTexture,THREE.sRGBEncoding)),Promise.all(i)}}]),t}(),ze=function(){function t(e){i(this,t),this.parser=e,this.name=ke.KHR_TEXTURE_BASISU}return s(t,[{key:"loadTexture",value:function(t){var e=this.parser,r=e.json,n=r.textures[t];if(!n.extensions||!n.extensions[this.name])return null;var i=n.extensions[this.name],o=e.options.ktx2Loader;if(!o){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,i.source,o)}}]),t}(),Ye=function(){function t(e){i(this,t),this.parser=e,this.name=ke.EXT_TEXTURE_WEBP,this.isSupported=null}return s(t,[{key:"loadTexture",value:function(t){var e=this.name,r=this.parser,n=r.json,i=n.textures[t];if(!i.extensions||!i.extensions[e])return null;var o=i.extensions[e],s=n.images[o.source],a=r.textureLoader;if(s.uri){var u=r.options.manager.getHandler(s.uri);null!==u&&(a=u)}return this.detectSupport().then((function(i){if(i)return r.loadTextureImage(t,o.source,a);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(t)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(t){var e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}]),t}(),Xe=function(){function t(e){i(this,t),this.name=ke.EXT_MESHOPT_COMPRESSION,this.parser=e}return s(t,[{key:"loadBufferView",value:function(t){var e=this.parser.json,r=e.bufferViews[t];if(r.extensions&&r.extensions[this.name]){var n=r.extensions[this.name],i=this.parser.getDependency("buffer",n.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(t){var e=n.byteOffset||0,r=n.byteLength||0,i=n.count,s=n.byteStride,a=new Uint8Array(t,e,r);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(i,s,a,n.mode,n.filter).then((function(t){return t.buffer})):o.ready.then((function(){var t=new ArrayBuffer(i*s);return o.decodeGltfBuffer(new Uint8Array(t),i,s,a,n.mode,n.filter),t}))}))}return null}}]),t}(),Je=function(){function t(e){i(this,t),this.name=ke.EXT_MESH_GPU_INSTANCING,this.parser=e}return s(t,[{key:"createNodeMesh",value:function(t){var e=this,r=this.parser.json,n=r.nodes[t];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;var i,o=_(r.meshes[n.mesh].primitives);try{for(o.s();!(i=o.n()).done;){var s=i.value;if(s.mode!==sr.TRIANGLES&&s.mode!==sr.TRIANGLE_STRIP&&s.mode!==sr.TRIANGLE_FAN&&void 0!==s.mode)return null}}catch(t){o.e(t)}finally{o.f()}var a=n.extensions[this.name].attributes,u=[],l={},h=function(t){u.push(e.parser.getDependency("accessor",a[t]).then((function(e){return l[t]=e,l[t]})))};for(var c in a)h(c);return u.length<1?null:(u.push(this.parser.createNodeMesh(t)),Promise.all(u).then((function(t){var r,n=t.pop(),i=n.isGroup?n.children:[n],o=t[0].count,s=[],a=_(i);try{for(a.s();!(r=a.n()).done;){for(var u=r.value,h=new THREE.Matrix4,c=new THREE.Vector3,f=new THREE.Quaternion,p=new THREE.Vector3(1,1,1),g=new THREE.InstancedMesh(u.geometry,u.material,o),d=0;d<o;d++)l.TRANSLATION&&c.fromBufferAttribute(l.TRANSLATION,d),l.ROTATION&&f.fromBufferAttribute(l.ROTATION,d),l.SCALE&&p.fromBufferAttribute(l.SCALE,d),g.setMatrixAt(d,h.compose(c,f,p));for(var A in l)"TRANSLATION"!==A&&"ROTATION"!==A&&"SCALE"!==A&&u.geometry.setAttribute(A,l[A]);THREE.Object3D.prototype.copy.call(g,u),g.frustumCulled=!1,e.parser.assignFinalMaterial(g),s.push(g)}}catch(t){a.e(t)}finally{a.f()}return n.isGroup?(n.clear(),n.add.apply(n,s),n):s[0]})))}}]),t}(),We="glTF",Ke=1313821514,Ze=5130562,$e=s((function t(e){i(this,t),this.name=ke.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(e,0,12);if(this.header={magic:THREE.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==We)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var n=this.header.length-12,o=new DataView(e,12),s=0;s<n;){var a=o.getUint32(s,!0);s+=4;var u=o.getUint32(s,!0);if(s+=4,u===Ke){var l=new Uint8Array(e,12+s,a);this.content=THREE.LoaderUtils.decodeText(l)}else if(u===Ze){var h=12+s;this.body=e.slice(h,h+a)}s+=a}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),tr=function(){function t(e,r){if(i(this,t),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=ke.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=r,this.dracoLoader.preload()}return s(t,[{key:"decodePrimitive",value:function(t,e){var r=this.json,n=this.dracoLoader,i=t.extensions[this.name].bufferView,o=t.extensions[this.name].attributes,s={},a={},u={};for(var l in o){var h=cr[l]||l.toLowerCase();s[h]=o[l]}for(var c in t.attributes){var f=cr[c]||c.toLowerCase();if(void 0!==o[c]){var p=r.accessors[t.attributes[c]],g=ar[p.componentType];u[f]=g.name,a[f]=!0===p.normalized}}return e.getDependency("bufferView",i).then((function(t){return new Promise((function(e){n.decodeDracoFile(t,(function(t){for(var r in t.attributes){var n=t.attributes[r],i=a[r];void 0!==i&&(n.normalized=i)}e(t)}),s,u)}))}))}}]),t}(),er=function(){function t(){i(this,t),this.name=ke.KHR_TEXTURE_TRANSFORM}return s(t,[{key:"extendTexture",value:function(t,e){return void 0!==e.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===e.offset&&void 0===e.rotation&&void 0===e.scale||(t=t.clone(),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}]),t}(),rr=s((function t(){i(this,t),this.name=ke.KHR_MESH_QUANTIZATION})),nr=function(t){u(r,THREE.Interpolant);var e=f(r);function r(t,n,o,s){return i(this,r),e.call(this,t,n,o,s)}return s(r,[{key:"copySampleValue_",value:function(t){for(var e=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=t*n*3+n,o=0;o!==n;o++)e[o]=r[i+o];return e}},{key:"interpolate_",value:function(t,e,r,n){for(var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=2*s,u=3*s,l=n-e,h=(r-e)/l,c=h*h,f=c*h,p=t*u,g=p-u,d=-2*f+3*c,A=f-c,y=1-d,v=A-c+h,m=0;m!==s;m++){var E=o[g+m+s],_=o[g+m+a]*l,I=o[p+m+s],x=o[p+m]*l;i[m]=y*E+v*_+d*I+A*x}return i}}]),r}(),ir=new THREE.Quaternion,or=function(t){u(r,nr);var e=f(r);function r(){return i(this,r),e.apply(this,arguments)}return s(r,[{key:"interpolate_",value:function(t,e,n,i){var o=g(l(r.prototype),"interpolate_",this).call(this,t,e,n,i);return ir.fromArray(o).normalize().toArray(o),o}}]),r}(),sr={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},ar={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ur={9728:THREE.NearestFilter,9729:THREE.LinearFilter,9984:THREE.NearestMipmapNearestFilter,9985:THREE.LinearMipmapNearestFilter,9986:THREE.NearestMipmapLinearFilter,9987:THREE.LinearMipmapLinearFilter},lr={33071:THREE.ClampToEdgeWrapping,33648:THREE.MirroredRepeatWrapping,10497:THREE.RepeatWrapping},hr={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},cr={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},fr={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},pr={CUBICSPLINE:void 0,LINEAR:THREE.InterpolateLinear,STEP:THREE.InterpolateDiscrete},gr="OPAQUE",dr="MASK",Ar="BLEND";function yr(t,e,r){for(var n in r.extensions)void 0===t[n]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=r.extensions[n])}function vr(t,r){void 0!==r.extras&&("object"===e(r.extras)?Object.assign(t.userData,r.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+r.extras))}function mr(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(var r=0,n=e.weights.length;r<n;r++)t.morphTargetInfluences[r]=e.weights[r];if(e.extras&&Array.isArray(e.extras.targetNames)){var i=e.extras.targetNames;if(t.morphTargetInfluences.length===i.length){t.morphTargetDictionary={};for(var o=0,s=i.length;o<s;o++)t.morphTargetDictionary[i[o]]=o}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Er(t){for(var e="",r=Object.keys(t).sort(),n=0,i=r.length;n<i;n++)e+=r[n]+":"+t[r[n]]+";";return e}function _r(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var Ir=new THREE.Matrix4,xr=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i(this,t),this.json=e,this.extensions={},this.plugins={},this.options=r,this.cache=new Pe,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};var n=!1,o=!1,s=-1;"undefined"!=typeof navigator&&(n=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),s=(o=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||o&&s<98?this.textureLoader=new THREE.TextureLoader(this.options.manager):this.textureLoader=new THREE.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new THREE.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return s(t,[{key:"setExtensions",value:function(t){this.extensions=t}},{key:"setPlugins",value:function(t){this.plugins=t}},{key:"parse",value:function(t,e){var r=this,n=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(e){var o={scene:e[0][n.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:n.asset,parser:r,userData:{}};yr(i,o,n),vr(o,n),Promise.all(r._invokeAll((function(t){return t.afterRoot&&t.afterRoot(o)}))).then((function(){t(o)}))})).catch(e)}},{key:"_markDefs",value:function(){for(var t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[],n=0,i=e.length;n<i;n++)for(var o=e[n].joints,s=0,a=o.length;s<a;s++)t[o[s]].isBone=!0;for(var u=0,l=t.length;u<l;u++){var h=t[u];void 0!==h.mesh&&(this._addNodeRef(this.meshCache,h.mesh),void 0!==h.skin&&(r[h.mesh].isSkinnedMesh=!0)),void 0!==h.camera&&this._addNodeRef(this.cameraCache,h.camera)}}},{key:"_addNodeRef",value:function(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}},{key:"_getNodeRef",value:function(t,e,r){var n=this;if(t.refs[e]<=1)return r;var i=r.clone();return function t(e,r){var i=n.associations.get(e);null!=i&&n.associations.set(r,i);var o,s=_(e.children.entries());try{for(s.s();!(o=s.n()).done;){var a=y(o.value,2),u=a[0];t(a[1],r.children[u])}}catch(t){s.e(t)}finally{s.f()}}(r,i),i.name+="_instance_"+t.uses[e]++,i}},{key:"_invokeOne",value:function(t){var e=Object.values(this.plugins);e.push(this);for(var r=0;r<e.length;r++){var n=t(e[r]);if(n)return n}return null}},{key:"_invokeAll",value:function(t){var e=Object.values(this.plugins);e.unshift(this);for(var r=[],n=0;n<e.length;n++){var i=t(e[n]);i&&r.push(i)}return r}},{key:"getDependency",value:function(t,e){var r=t+":"+e,n=this.cache.get(r);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne((function(t){return t.loadNode&&t.loadNode(e)}));break;case"mesh":n=this._invokeOne((function(t){return t.loadMesh&&t.loadMesh(e)}));break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne((function(t){return t.loadBufferView&&t.loadBufferView(e)}));break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne((function(t){return t.loadMaterial&&t.loadMaterial(e)}));break;case"texture":n=this._invokeOne((function(t){return t.loadTexture&&t.loadTexture(e)}));break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne((function(t){return t.loadAnimation&&t.loadAnimation(e)}));break;case"camera":n=this.loadCamera(e);break;default:if(!(n=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(t,e)}))))throw new Error("Unknown type: "+t)}this.cache.add(r,n)}return n}},{key:"getDependencies",value:function(t){var e=this.cache.get(t);if(!e){var r=this,n=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(n.map((function(e,n){return r.getDependency(t,n)}))),this.cache.add(t,e)}return e}},{key:"loadBuffer",value:function(t){var e=this.json.buffers[t],r=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[ke.KHR_BINARY_GLTF].body);var n=this.options;return new Promise((function(t,i){r.load(THREE.LoaderUtils.resolveURL(e.uri,n.path),t,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))}))}))}},{key:"loadBufferView",value:function(t){var e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){var r=e.byteLength||0,n=e.byteOffset||0;return t.slice(n,n+r)}))}},{key:"loadAccessor",value:function(t){var e=this,r=this.json,n=this.json.accessors[t];if(void 0===n.bufferView&&void 0===n.sparse){var i=hr[n.type],o=ar[n.componentType],s=!0===n.normalized,a=new o(n.count*i);return Promise.resolve(new THREE.BufferAttribute(a,i,s))}var u=[];return void 0!==n.bufferView?u.push(this.getDependency("bufferView",n.bufferView)):u.push(null),void 0!==n.sparse&&(u.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),u.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(u).then((function(t){var i,o,s=t[0],a=hr[n.type],u=ar[n.componentType],l=u.BYTES_PER_ELEMENT,h=l*a,c=n.byteOffset||0,f=void 0!==n.bufferView?r.bufferViews[n.bufferView].byteStride:void 0,p=!0===n.normalized;if(f&&f!==h){var g=Math.floor(c/f),d="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+g+":"+n.count,A=e.cache.get(d);A||(i=new u(s,g*f,n.count*f/l),A=new THREE.InterleavedBuffer(i,f/l),e.cache.add(d,A)),o=new THREE.InterleavedBufferAttribute(A,a,c%f/l,p)}else i=null===s?new u(n.count*a):new u(s,c,n.count*a),o=new THREE.BufferAttribute(i,a,p);if(void 0!==n.sparse){var y=hr.SCALAR,v=ar[n.sparse.indices.componentType],m=n.sparse.indices.byteOffset||0,E=n.sparse.values.byteOffset||0,_=new v(t[1],m,n.sparse.count*y),I=new u(t[2],E,n.sparse.count*a);null!==s&&(o=new THREE.BufferAttribute(o.array.slice(),o.itemSize,o.normalized));for(var x=0,C=_.length;x<C;x++){var w=_[x];if(o.setX(w,I[x*a]),a>=2&&o.setY(w,I[x*a+1]),a>=3&&o.setZ(w,I[x*a+2]),a>=4&&o.setW(w,I[x*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o}))}},{key:"loadTexture",value:function(t){var e=this.json,r=this.options,n=e.textures[t].source,i=e.images[n],o=this.textureLoader;if(i.uri){var s=r.manager.getHandler(i.uri);null!==s&&(o=s)}return this.loadTextureImage(t,n,o)}},{key:"loadTextureImage",value:function(t,e,r){var n=this,i=this.json,o=i.textures[t],s=i.images[e],a=(s.uri||s.bufferView)+":"+o.sampler;if(this.textureCache[a])return this.textureCache[a];var u=this.loadImageSource(e,r).then((function(e){e.flipY=!1,e.name=o.name||s.name||"";var r=(i.samplers||{})[o.sampler]||{};return e.magFilter=ur[r.magFilter]||THREE.LinearFilter,e.minFilter=ur[r.minFilter]||THREE.LinearMipmapLinearFilter,e.wrapS=lr[r.wrapS]||THREE.RepeatWrapping,e.wrapT=lr[r.wrapT]||THREE.RepeatWrapping,n.associations.set(e,{textures:t}),e})).catch((function(){return null}));return this.textureCache[a]=u,u}},{key:"loadImageSource",value:function(t,e){var r=this.json,n=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then((function(t){return t.clone()}));var i=r.images[t],o=self.URL||self.webkitURL,s=i.uri||"",a=!1;if(void 0!==i.bufferView)s=this.getDependency("bufferView",i.bufferView).then((function(t){a=!0;var e=new Blob([t],{type:i.mimeType});return s=o.createObjectURL(e)}));else if(void 0===i.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");var u=Promise.resolve(s).then((function(t){return new Promise((function(r,i){var o=r;!0===e.isImageBitmapLoader&&(o=function(t){var e=new THREE.Texture(t);e.needsUpdate=!0,r(e)}),e.load(THREE.LoaderUtils.resolveURL(t,n.path),o,void 0,i)}))})).then((function(t){var e;return!0===a&&o.revokeObjectURL(s),t.userData.mimeType=i.mimeType||((e=i.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(t){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),t}));return this.sourceCache[t]=u,u}},{key:"assignTexture",value:function(t,e,r,n){var i=this;return this.getDependency("texture",r.index).then((function(o){if(!o)return null;if(void 0===r.texCoord||0==r.texCoord||"aoMap"===e&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+e+" not yet supported."),i.extensions[ke.KHR_TEXTURE_TRANSFORM]){var s=void 0!==r.extensions?r.extensions[ke.KHR_TEXTURE_TRANSFORM]:void 0;if(s){var a=i.associations.get(o);o=i.extensions[ke.KHR_TEXTURE_TRANSFORM].extendTexture(o,s),i.associations.set(o,a)}}return void 0!==n&&(o.encoding=n),t[e]=o,o}))}},{key:"assignFinalMaterial",value:function(t){var e=t.geometry,r=t.material,n=void 0===e.attributes.tangent,i=void 0!==e.attributes.color,o=void 0===e.attributes.normal;if(t.isPoints){var s="PointsMaterial:"+r.uuid,a=this.cache.get(s);a||(a=new THREE.PointsMaterial,THREE.Material.prototype.copy.call(a,r),a.color.copy(r.color),a.map=r.map,a.sizeAttenuation=!1,this.cache.add(s,a)),r=a}else if(t.isLine){var u="LineBasicMaterial:"+r.uuid,l=this.cache.get(u);l||(l=new THREE.LineBasicMaterial,THREE.Material.prototype.copy.call(l,r),l.color.copy(r.color),this.cache.add(u,l)),r=l}if(n||i||o){var h="ClonedMaterial:"+r.uuid+":";n&&(h+="derivative-tangents:"),i&&(h+="vertex-colors:"),o&&(h+="flat-shading:");var c=this.cache.get(h);c||(c=r.clone(),i&&(c.vertexColors=!0),o&&(c.flatShading=!0),n&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(h,c),this.associations.set(c,this.associations.get(r))),r=c}r.aoMap&&void 0===e.attributes.uv2&&void 0!==e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv),t.material=r}},{key:"getMaterialType",value:function(){return THREE.MeshStandardMaterial}},{key:"loadMaterial",value:function(t){var e,r=this,n=this.json,i=this.extensions,o=n.materials[t],s={},a=[];if((o.extensions||{})[ke.KHR_MATERIALS_UNLIT]){var u=i[ke.KHR_MATERIALS_UNLIT];e=u.getMaterialType(),a.push(u.extendParams(s,o,r))}else{var l=o.pbrMetallicRoughness||{};if(s.color=new THREE.Color(1,1,1),s.opacity=1,Array.isArray(l.baseColorFactor)){var h=l.baseColorFactor;s.color.fromArray(h),s.opacity=h[3]}void 0!==l.baseColorTexture&&a.push(r.assignTexture(s,"map",l.baseColorTexture,THREE.sRGBEncoding)),s.metalness=void 0!==l.metallicFactor?l.metallicFactor:1,s.roughness=void 0!==l.roughnessFactor?l.roughnessFactor:1,void 0!==l.metallicRoughnessTexture&&(a.push(r.assignTexture(s,"metalnessMap",l.metallicRoughnessTexture)),a.push(r.assignTexture(s,"roughnessMap",l.metallicRoughnessTexture))),e=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),a.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,s)}))))}!0===o.doubleSided&&(s.side=THREE.DoubleSide);var c=o.alphaMode||gr;if(c===Ar?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,c===dr&&(s.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&e!==THREE.MeshBasicMaterial&&(a.push(r.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new THREE.Vector2(1,1),void 0!==o.normalTexture.scale)){var f=o.normalTexture.scale;s.normalScale.set(f,f)}return void 0!==o.occlusionTexture&&e!==THREE.MeshBasicMaterial&&(a.push(r.assignTexture(s,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(s.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&e!==THREE.MeshBasicMaterial&&(s.emissive=(new THREE.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&e!==THREE.MeshBasicMaterial&&a.push(r.assignTexture(s,"emissiveMap",o.emissiveTexture,THREE.sRGBEncoding)),Promise.all(a).then((function(){var n=new e(s);return o.name&&(n.name=o.name),vr(n,o),r.associations.set(n,{materials:t}),o.extensions&&yr(i,n,o),n}))}},{key:"createUniqueName",value:function(t){for(var e=THREE.PropertyBinding.sanitizeNodeName(t||""),r=e,n=1;this.nodeNamesUsed[r];++n)r=e+"_"+n;return this.nodeNamesUsed[r]=!0,r}},{key:"loadGeometries",value:function(t){var e=this,r=this.extensions,n=this.primitiveCache;function i(t){return r[ke.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(r){return Cr(r,t,e)}))}for(var o,s,a=[],u=0,l=t.length;u<l;u++){var h=t[u],c=(s=void 0,(s=(o=h).extensions&&o.extensions[ke.KHR_DRACO_MESH_COMPRESSION])?"draco:"+s.bufferView+":"+s.indices+":"+Er(s.attributes):o.indices+":"+Er(o.attributes)+":"+o.mode),f=n[c];if(f)a.push(f.promise);else{var p=void 0;p=h.extensions&&h.extensions[ke.KHR_DRACO_MESH_COMPRESSION]?i(h):Cr(new THREE.BufferGeometry,h,e),n[c]={primitive:h,promise:p},a.push(p)}}return Promise.all(a)}},{key:"loadMesh",value:function(t){for(var e,r=this,n=this.json,i=this.extensions,o=n.meshes[t],s=o.primitives,a=[],u=0,l=s.length;u<l;u++){var h=void 0===s[u].material?(void 0===(e=this.cache).DefaultMaterial&&(e.DefaultMaterial=new THREE.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:THREE.FrontSide})),e.DefaultMaterial):this.getDependency("material",s[u].material);a.push(h)}return a.push(r.loadGeometries(s)),Promise.all(a).then((function(e){for(var n=e.slice(0,e.length-1),a=e[e.length-1],u=[],l=0,h=a.length;l<h;l++){var c=a[l],f=s[l],p=void 0,g=n[l];if(f.mode===sr.TRIANGLES||f.mode===sr.TRIANGLE_STRIP||f.mode===sr.TRIANGLE_FAN||void 0===f.mode)!0!==(p=!0===o.isSkinnedMesh?new THREE.SkinnedMesh(c,g):new THREE.Mesh(c,g)).isSkinnedMesh||p.geometry.attributes.skinWeight.normalized||p.normalizeSkinWeights(),f.mode===sr.TRIANGLE_STRIP?p.geometry=wr(p.geometry,THREE.TriangleStripDrawMode):f.mode===sr.TRIANGLE_FAN&&(p.geometry=wr(p.geometry,THREE.TriangleFanDrawMode));else if(f.mode===sr.LINES)p=new THREE.LineSegments(c,g);else if(f.mode===sr.LINE_STRIP)p=new THREE.Line(c,g);else if(f.mode===sr.LINE_LOOP)p=new THREE.LineLoop(c,g);else{if(f.mode!==sr.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);p=new THREE.Points(c,g)}Object.keys(p.geometry.morphAttributes).length>0&&mr(p,o),p.name=r.createUniqueName(o.name||"mesh_"+t),vr(p,o),f.extensions&&yr(i,p,f),r.assignFinalMaterial(p),u.push(p)}for(var d=0,A=u.length;d<A;d++)r.associations.set(u[d],{meshes:t,primitives:d});if(1===u.length)return u[0];var y=new THREE.Group;r.associations.set(y,{meshes:t});for(var v=0,m=u.length;v<m;v++)y.add(u[v]);return y}))}},{key:"loadCamera",value:function(t){var e,r=this.json.cameras[t],n=r[r.type];if(n)return"perspective"===r.type?e=new THREE.PerspectiveCamera(THREE.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===r.type&&(e=new THREE.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(e.name=this.createUniqueName(r.name)),vr(e,r),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(t){for(var e=this.json.skins[t],r=[],n=0,i=e.joints.length;n<i;n++)r.push(this.getDependency("node",e.joints[n]));return void 0!==e.inverseBindMatrices?r.push(this.getDependency("accessor",e.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(t){for(var r=t.pop(),n=t,i=[],o=[],s=0,a=n.length;s<a;s++){var u=n[s];if(u){i.push(u);var l=new THREE.Matrix4;null!==r&&l.fromArray(r.array,16*s),o.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[s])}return new THREE.Skeleton(i,o)}))}},{key:"loadAnimation",value:function(t){for(var e=this.json.animations[t],r=[],n=[],i=[],o=[],s=[],a=0,u=e.channels.length;a<u;a++){var l=e.channels[a],h=e.samplers[l.sampler],c=l.target,f=c.node,p=void 0!==e.parameters?e.parameters[h.input]:h.input,g=void 0!==e.parameters?e.parameters[h.output]:h.output;r.push(this.getDependency("node",f)),n.push(this.getDependency("accessor",p)),i.push(this.getDependency("accessor",g)),o.push(h),s.push(c)}return Promise.all([Promise.all(r),Promise.all(n),Promise.all(i),Promise.all(o),Promise.all(s)]).then((function(r){for(var n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],u=[],l=function(){var t,e=n[h],r=i[h],l=o[h],c=s[h],f=a[h];if(void 0===e)return 1;switch(e.updateMatrix(),fr[f.path]){case fr.weights:t=THREE.NumberKeyframeTrack;break;case fr.rotation:t=THREE.QuaternionKeyframeTrack;break;default:t=THREE.VectorKeyframeTrack}var p=e.name?e.name:e.uuid,g=void 0!==c.interpolation?pr[c.interpolation]:THREE.InterpolateLinear,d=[];fr[f.path]===fr.weights?e.traverse((function(t){t.morphTargetInfluences&&d.push(t.name?t.name:t.uuid)})):d.push(p);var A=l.array;if(l.normalized){for(var y=_r(A.constructor),v=new Float32Array(A.length),m=0,E=A.length;m<E;m++)v[m]=A[m]*y;A=v}for(var _=0,I=d.length;_<I;_++){var x=new t(d[_]+"."+fr[f.path],r.array,A,g);"CUBICSPLINE"===c.interpolation&&(x.createInterpolant=function(t){return new(this instanceof THREE.QuaternionKeyframeTrack?or:nr)(this.times,this.values,this.getValueSize()/3,t)},x.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(x)}},h=0,c=n.length;h<c;h++)l();var f=e.name?e.name:"animation_"+t;return new THREE.AnimationClip(f,void 0,u)}))}},{key:"createNodeMesh",value:function(t){var e=this.json,r=this,n=e.nodes[t];return void 0===n.mesh?null:r.getDependency("mesh",n.mesh).then((function(t){var e=r._getNodeRef(r.meshCache,n.mesh,t);return void 0!==n.weights&&e.traverse((function(t){if(t.isMesh)for(var e=0,r=n.weights.length;e<r;e++)t.morphTargetInfluences[e]=n.weights[e]})),e}))}},{key:"loadNode",value:function(t){var e=this.json,r=this.extensions,n=this,i=e.nodes[t],o=i.name?n.createUniqueName(i.name):"";return function(){var e=[],r=n._invokeOne((function(e){return e.createNodeMesh&&e.createNodeMesh(t)}));r&&e.push(r),void 0!==i.camera&&e.push(n.getDependency("camera",i.camera).then((function(t){return n._getNodeRef(n.cameraCache,i.camera,t)}))),n._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){e.push(t)}));for(var o=[],s=i.children||[],a=0,u=s.length;a<u;a++)o.push(n.getDependency("node",s[a]));var l=void 0===i.skin?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([Promise.all(e),Promise.all(o),l])}().then((function(e){var s,a=e[0],u=e[1],l=e[2];if((s=!0===i.isBone?new THREE.Bone:a.length>1?new THREE.Group:1===a.length?a[0]:new THREE.Object3D)!==a[0])for(var h=0,c=a.length;h<c;h++)s.add(a[h]);if(i.name&&(s.userData.name=i.name,s.name=o),vr(s,i),i.extensions&&yr(r,s,i),void 0!==i.matrix){var f=new THREE.Matrix4;f.fromArray(i.matrix),s.applyMatrix4(f)}else void 0!==i.translation&&s.position.fromArray(i.translation),void 0!==i.rotation&&s.quaternion.fromArray(i.rotation),void 0!==i.scale&&s.scale.fromArray(i.scale);n.associations.has(s)||n.associations.set(s,{}),n.associations.get(s).nodes=t,null!==l&&s.traverse((function(t){t.isSkinnedMesh&&t.bind(l,Ir)}));for(var p=0,g=u.length;p<g;p++)s.add(u[p]);return s}))}},{key:"loadScene",value:function(t){var e=this.extensions,r=this.json.scenes[t],n=this,i=new THREE.Group;r.name&&(i.name=n.createUniqueName(r.name)),vr(i,r),r.extensions&&yr(e,i,r);for(var o=r.nodes||[],s=[],a=0,u=o.length;a<u;a++)s.push(n.getDependency("node",o[a]));return Promise.all(s).then((function(t){for(var e=0,r=t.length;e<r;e++)i.add(t[e]);return n.associations=function(t){var e,r=new Map,i=_(n.associations);try{for(i.s();!(e=i.n()).done;){var o=y(e.value,2),s=o[0],a=o[1];(s instanceof THREE.Material||s instanceof THREE.Texture)&&r.set(s,a)}}catch(t){i.e(t)}finally{i.f()}return t.traverse((function(t){var e=n.associations.get(t);null!=e&&r.set(t,e)})),r}(i),i}))}}]),t}();function Cr(t,e,r){var n=e.attributes,i=[];function o(e,n){return r.getDependency("accessor",e).then((function(e){t.setAttribute(n,e)}))}for(var s in n){var a=cr[s]||s.toLowerCase();a in t.attributes||i.push(o(n[s],a))}if(void 0!==e.indices&&!t.index){var u=r.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));i.push(u)}return vr(t,e),function(t,e,r){var n=e.attributes,i=new THREE.Box3;if(void 0!==n.POSITION){var o=r.json.accessors[n.POSITION],s=o.min,a=o.max;if(void 0!==s&&void 0!==a){if(i.set(new THREE.Vector3(s[0],s[1],s[2]),new THREE.Vector3(a[0],a[1],a[2])),o.normalized){var u=_r(ar[o.componentType]);i.min.multiplyScalar(u),i.max.multiplyScalar(u)}var l=e.targets;if(void 0!==l){for(var h=new THREE.Vector3,c=new THREE.Vector3,f=0,p=l.length;f<p;f++){var g=l[f];if(void 0!==g.POSITION){var d=r.json.accessors[g.POSITION],A=d.min,y=d.max;if(void 0!==A&&void 0!==y){if(c.setX(Math.max(Math.abs(A[0]),Math.abs(y[0]))),c.setY(Math.max(Math.abs(A[1]),Math.abs(y[1]))),c.setZ(Math.max(Math.abs(A[2]),Math.abs(y[2]))),d.normalized){var v=_r(ar[d.componentType]);c.multiplyScalar(v)}h.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(h)}t.boundingBox=i;var m=new THREE.Sphere;i.getCenter(m.center),m.radius=i.min.distanceTo(i.max)/2,t.boundingSphere=m}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,e,r),Promise.all(i).then((function(){return void 0!==e.targets?function(t,e,r){for(var n=!1,i=!1,o=!1,s=0,a=e.length;s<a;s++){var u=e[s];if(void 0!==u.POSITION&&(n=!0),void 0!==u.NORMAL&&(i=!0),void 0!==u.COLOR_0&&(o=!0),n&&i&&o)break}if(!n&&!i&&!o)return Promise.resolve(t);for(var l=[],h=[],c=[],f=0,p=e.length;f<p;f++){var g=e[f];if(n){var d=void 0!==g.POSITION?r.getDependency("accessor",g.POSITION):t.attributes.position;l.push(d)}if(i){var A=void 0!==g.NORMAL?r.getDependency("accessor",g.NORMAL):t.attributes.normal;h.push(A)}if(o){var y=void 0!==g.COLOR_0?r.getDependency("accessor",g.COLOR_0):t.attributes.color;c.push(y)}}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(c)]).then((function(e){var r=e[0],s=e[1],a=e[2];return n&&(t.morphAttributes.position=r),i&&(t.morphAttributes.normal=s),o&&(t.morphAttributes.color=a),t.morphTargetsRelative=!0,t}))}(t,e.targets,r):t}))}function wr(t,e){var r=t.getIndex();if(null===r){var n=[],i=t.getAttribute("position");if(void 0===i)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var o=0;o<i.count;o++)n.push(o);t.setIndex(n),r=t.getIndex()}var s=r.count-2,a=[];if(e===THREE.TriangleFanDrawMode)for(var u=1;u<=s;u++)a.push(r.getX(0)),a.push(r.getX(u)),a.push(r.getX(u+1));else for(var l=0;l<s;l++)l%2==0?(a.push(r.getX(l)),a.push(r.getX(l+1)),a.push(r.getX(l+2))):(a.push(r.getX(l+2)),a.push(r.getX(l+1)),a.push(r.getX(l)));a.length/3!==s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var h=t.clone();return h.setIndex(a),h}var br=function(t){u(r,Le);var e=f(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:THREE.DefaultLoadingManager;return i(this,r),(t=e.call(this)).manager=n,t.adjustmentTransform=new THREE.Matrix4,t}return s(r,[{key:"parse",value:function(t){var e=this,n=g(l(r.prototype),"parse",this).call(this,t),i=n.glbBytes.slice().buffer;return new Promise((function(t,r){var o=e.manager,s=e.fetchOptions,a=o.getHandler("path.gltf")||new Ne(o);"include"===s.credentials&&"cors"===s.mode&&a.setCrossOrigin("use-credentials"),"credentials"in s&&a.setWithCredentials("include"===s.credentials),s.headers&&a.setRequestHeader(s.headers);var u=e.workingPath;!/[\\/]$/.test(u)&&u.length&&(u+="/");var l=e.adjustmentTransform;a.parse(i,u,(function(e){var r=n.batchTable,i=n.featureTable,o=e.scene,s=i.getData("RTC_CENTER");s&&(o.position.x+=s[0],o.position.y+=s[1],o.position.z+=s[2]),e.scene.updateMatrix(),e.scene.matrix.multiply(l),e.scene.matrix.decompose(e.scene.position,e.scene.quaternion,e.scene.scale),e.batchTable=r,e.featureTable=i,o.batchTable=r,o.featureTable=i,t(e)}),r)}))}}]),r}(),Br=function(t){u(r,Me);var e=f(r);function r(){return i(this,r),e.apply(this,arguments)}return s(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Re(e);console.assert("pnts"===r);var n=e.getUint32(4,!0);console.assert(1===n);var i=e.getUint32(8,!0);console.assert(i===t.byteLength);var o=e.getUint32(12,!0),s=e.getUint32(16,!0),a=e.getUint32(20,!0),u=e.getUint32(24,!0),l=t.slice(28,28+o+s),h=new Se(l,0,o,s),c=28+o+s,f=t.slice(c,c+a+u),p=new Te(f,h.getData("BATCH_LENGTH")||h.getData("POINTS_LENGTH"),0,a,u);return Promise.resolve({version:n,featureTable:h,batchTable:p})}}]),r}(),Sr={RGB:"color",POSITION:"position"},Tr=function(e){u(o,Br);var r=f(o);function o(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:THREE.DefaultLoadingManager;return i(this,o),(t=r.call(this)).manager=e,t}return s(o,[{key:"parse",value:function(e){var r=this;return g(l(o.prototype),"parse",this).call(this,e).then(function(){var e=n(t().mark((function e(n){var i,o,s,a,u,l,h,c,f,p,g,d,A,y,v,m,E,_,I,x,C,w,b,B,S,T;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=n.featureTable,o=new THREE.PointsMaterial,s=i.header.extensions,a=new THREE.Vector3,!s||!s["3DTILES_draco_point_compression"]){t.next=19;break}if(l=s["3DTILES_draco_point_compression"],h=l.byteOffset,c=l.byteLength,f=l.properties,null!=(p=r.manager.getHandler("draco.drc"))){t.next=9;break}throw new Error("PNTSLoader: dracoLoader not available.");case 9:for(d in g={},f)d in Sr&&d in f&&(g[Sr[d]]=f[d]);return A={attributeIDs:g,attributeTypes:{position:"Float32Array",color:"Uint8Array"},useUniqueIDs:!0},y=i.getBuffer(h,c),t.next=15,p.decodeGeometry(y,A);case 15:(u=t.sent).attributes.color&&(o.vertexColors=!0),t.next=28;break;case 19:if(v=i.getData("POINTS_LENGTH"),m=i.getData("POSITION",v,"FLOAT","VEC3"),E=i.getData("RGB",v,"UNSIGNED_BYTE","VEC3"),_=i.getData("POSITION_QUANTIZED",v,"UNSIGNED_SHORT","VEC3"),I=i.getData("QUANTIZED_VOLUME_SCALE",v,"FLOAT","VEC3"),x=i.getData("QUANTIZED_VOLUME_OFFSET",v,"FLOAT","VEC3"),u=new THREE.BufferGeometry,_){for(C=new Float32Array(3*v),w=0;w<v;w++)for(b=0;b<3;b++)C[B=3*w+b]=_[B]/65535*I[b];a.x=x[0],a.y=x[1],a.z=x[2],u.setAttribute("position",new THREE.BufferAttribute(C,3,!1))}else u.setAttribute("position",new THREE.BufferAttribute(m,3,!1));null!==E&&(u.setAttribute("color",new THREE.BufferAttribute(E,3,!0)),o.vertexColors=!0);case 28:return["CONSTANT_RGBA","BATCH_LENGTH","RGBA","RGB565","NORMAL","NORMAL_OCT16P"].forEach((function(t){t in i.header&&console.warn('PNTSLoader: Unsupported FeatureTable feature "'.concat(t,'" detected.'))})),(S=new THREE.Points(u,o)).position.copy(a),n.scene=S,n.scene.featureTable=i,(T=i.getData("RTC_CENTER"))&&(n.scene.position.x+=T[0],n.scene.position.y+=T[1],n.scene.position.z+=T[2]),t.abrupt("return",n);case 36:case"end":return t.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}}]),o}(),Mr=function(t){u(r,Me);var e=f(r);function r(){return i(this,r),e.apply(this,arguments)}return s(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Re(e);console.assert("i3dm"===r);var n=e.getUint32(4,!0);console.assert(1===n);var i=e.getUint32(8,!0);console.assert(i===t.byteLength);var o=e.getUint32(12,!0),s=e.getUint32(16,!0),a=e.getUint32(20,!0),u=e.getUint32(24,!0),l=e.getUint32(28,!0),h=t.slice(32,32+o+s),c=new Se(h,0,o,s),f=32+o+s,p=t.slice(f,f+a+u),g=new Te(p,c.getData("INSTANCES_LENGTH"),0,a,u),d=f+a+u,A=new Uint8Array(t,d,i-d),y=null,v=null;if(l)y=A,v=Promise.resolve();else{var m=this.resolveExternalURL(Be(A));v=fetch(m,this.fetchOptions).then((function(t){if(!t.ok)throw new Error('I3DMLoaderBase : Failed to load file "'.concat(m,'" with status ').concat(t.status," : ").concat(t.statusText));return t.arrayBuffer()})).then((function(t){y=new Uint8Array(t)}))}return v.then((function(){return{version:n,featureTable:c,batchTable:g,glbBytes:y}}))}}]),r}(),Rr=new THREE.Vector3,Lr=new THREE.Vector3,Nr=new THREE.Vector3,Pr=new THREE.Vector3,kr=new THREE.Quaternion,Dr=new THREE.Vector3,Qr=new THREE.Matrix4,Or=function(t){u(r,Mr);var e=f(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:THREE.DefaultLoadingManager;return i(this,r),(t=e.call(this)).manager=n,t.adjustmentTransform=new THREE.Matrix4,t}return s(r,[{key:"resolveExternalURL",value:function(t){return this.manager.resolveURL(g(l(r.prototype),"resolveExternalURL",this).call(this,t))}},{key:"parse",value:function(t){var e=this;return g(l(r.prototype),"parse",this).call(this,t).then((function(t){var r=t.featureTable,n=t.batchTable,i=t.glbBytes.slice().buffer;return new Promise((function(t,o){var s=e.fetchOptions,a=e.manager,u=a.getHandler("path.gltf")||new Ne(a);"include"===s.credentials&&"cors"===s.mode&&u.setCrossOrigin("use-credentials"),"credentials"in s&&u.setWithCredentials("include"===s.credentials),s.headers&&u.setRequestHeader(s.headers);var l=e.workingPath;/[\\/]$/.test(l)||(l+="/");var h=e.adjustmentTransform;u.parse(i,l,(function(e){var i=r.getData("INSTANCES_LENGTH"),o=r.getData("POSITION",i,"FLOAT","VEC3"),s=r.getData("NORMAL_UP",i,"FLOAT","VEC3"),a=r.getData("NORMAL_RIGHT",i,"FLOAT","VEC3"),u=r.getData("SCALE_NON_UNIFORM",i,"FLOAT","VEC3"),l=r.getData("SCALE",i,"FLOAT","SCALAR");["RTC_CENTER","QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","EAST_NORTH_UP","POSITION_QUANTIZED","NORMAL_UP_OCT32P","NORMAL_RIGHT_OCT32P"].forEach((function(t){t in r.header&&console.warn('I3DMLoader: Unsupported FeatureTable feature "'.concat(t,'" detected.'))}));var c=new Map,f=[];e.scene.traverse((function(t){if(t.isMesh){var e=t.geometry,r=t.material,n=new THREE.InstancedMesh(e,r,i);n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),f.push(n),c.set(t,n)}}));for(var p=new THREE.Vector3,g=0;g<i;g++)p.x+=o[3*g+0]/i,p.y+=o[3*g+1]/i,p.z+=o[3*g+2]/i;c.forEach((function(t,e){var r=e.parent;r&&(r.remove(e),r.add(t),t.updateMatrixWorld(),t.position.copy(p).applyMatrix4(t.matrixWorld))}));for(var d=0;d<i;d++){Pr.set(o[3*d+0]-p.x,o[3*d+1]-p.y,o[3*d+2]-p.z),s?(Lr.set(s[3*d+0],s[3*d+1],s[3*d+2]),Nr.set(a[3*d+0],a[3*d+1],a[3*d+2]),Rr.crossVectors(Nr,Lr).normalize(),Qr.makeBasis(Nr,Lr,Rr),kr.setFromRotationMatrix(Qr)):kr.set(0,0,0,1),l?Dr.setScalar(l[d]):u?Dr.set(u[3*d+0],u[3*d+1],u[3*d+2]):Dr.set(1,1,1),Qr.compose(Pr,kr,Dr).multiply(h);for(var A=0,y=f.length;A<y;A++){f[A].setMatrixAt(d,Qr)}}e.batchTable=n,e.featureTable=r,e.scene.batchTable=n,e.scene.featureTable=r,t(e)}),o)}))}))}}]),r}(),Fr=function(t){u(r,Me);var e=f(r);function r(){return i(this,r),e.apply(this,arguments)}return s(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Re(e);console.assert("cmpt"===r,'CMPTLoader: The magic bytes equal "cmpt".');var n=e.getUint32(4,!0);console.assert(1===n,'CMPTLoader: The version listed in the header is "1".');var i=e.getUint32(8,!0);console.assert(i===t.byteLength,"CMPTLoader: The contents buffer length listed in the header matches the file.");for(var o=e.getUint32(12,!0),s=[],a=16,u=0;u<o;u++){var l=new DataView(t,a,12),h=Re(l),c=l.getUint32(4,!0),f=l.getUint32(8,!0),p=new Uint8Array(t,a,f);s.push({type:h,buffer:p,version:c}),a+=f}return{version:n,tiles:s}}}]),r}(),Gr=function(t){u(r,Fr);var e=f(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:THREE.DefaultLoadingManager;return i(this,r),(t=e.call(this)).manager=n,t.adjustmentTransform=new THREE.Matrix4,t}return s(r,[{key:"parse",value:function(t){var e=g(l(r.prototype),"parse",this).call(this,t),n=this.manager,i=this.adjustmentTransform,o=[];for(var s in e.tiles){var a=e.tiles[s],u=a.type,h=a.buffer;switch(u){case"b3dm":var c=h.slice(),f=new br(n);f.workingPath=this.workingPath,f.fetchOptions=this.fetchOptions,f.adjustmentTransform.copy(i);var p=f.parse(c.buffer);o.push(p);break;case"pnts":var d=h.slice(),A=new Tr(n);A.workingPath=this.workingPath,A.fetchOptions=this.fetchOptions;var y=A.parse(d.buffer);o.push(y);break;case"i3dm":var v=h.slice(),m=new Or(n);m.workingPath=this.workingPath,m.fetchOptions=this.fetchOptions,m.adjustmentTransform.copy(i);var E=m.parse(v.buffer);o.push(E)}}return Promise.all(o).then((function(t){var e=new THREE.Group;return t.forEach((function(t){e.add(t.scene)})),{tiles:t,scene:e}}))}}]),r}(),Ur=function(){function t(){i(this,t),this.name="CESIUM_RTC"}return s(t,[{key:"afterRoot",value:function(t){if(t.parser.json.extensions&&t.parser.json.extensions.CESIUM_RTC){var e=t.parser.json.extensions.CESIUM_RTC.center;e&&(t.scene.position.x+=e[0],t.scene.position.y+=e[1],t.scene.position.z+=e[2])}}}]),t}(),Hr=function(t){u(r,Me);var e=f(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:THREE.DefaultLoadingManager;return i(this,r),(t=e.call(this)).manager=n,t}return s(r,[{key:"parse",value:function(t){var e=this;return new Promise((function(r,n){var i=e.manager,o=e.fetchOptions,s=i.getHandler("path.gltf")||i.getHandler("path.glb");s||((s=new Ne(i)).register((function(){return new Ur})),"include"===o.credentials&&"cors"===o.mode&&s.setCrossOrigin("use-credentials"),"credentials"in o&&s.setWithCredentials("include"===o.credentials),o.headers&&s.setRequestHeader(o.headers));var a=s.resourcePath||s.path||e.workingPath;!/[\\/]$/.test(a)&&a.length&&(a+="/"),s.parse(t,a,(function(t){r(t)}),n)}))}}]),r}(),jr=new THREE.Matrix4,qr=function(t){u(r,THREE.Group);var e=f(r);function r(t){var n;return i(this,r),(n=e.call(this)).name="TilesRenderer.TilesGroup",n.tilesRenderer=t,n}return s(r,[{key:"raycast",value:function(t,e){this.tilesRenderer.optimizeRaycast&&this.tilesRenderer.raycast(t,e)}},{key:"updateMatrixWorld",value:function(t){if(this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldNeedsUpdate||t){null===this.parent?jr.copy(this.matrix):jr.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1;for(var e=jr.elements,r=this.matrixWorld.elements,n=!1,i=0;i<16;i++){var o=e[i],s=r[i];if(Math.abs(o-s)>Number.EPSILON){n=!0;break}}if(n){this.matrixWorld.copy(jr);for(var a=this.children,u=0,l=a.length;u<l;u++)a[u].updateMatrixWorld()}}}}]),r}(),Vr=new THREE.Matrix4,zr=new THREE.Ray,Yr=new THREE.Vector3,Xr=[];function Jr(t,e){return t.distance-e.distance}function Wr(t,e,r){t.traverse((function(t){Object.getPrototypeOf(t).raycast.call(t,e,r)}))}function Kr(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=t.group,o=t.activeTiles;t.ensureChildrenArePreprocessed(e),null===n&&(n=zr,Vr.copy(i.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(Vr));for(var s=[],a=e.children,u=0,l=a.length;u<l;u++){var h=a[u];if(h.__used)null!==h.cached.boundingVolume.intersectRay(n,Yr)&&(Yr.applyMatrix4(i.matrixWorld),s.push({distance:Yr.distanceToSquared(r.ray.origin),tile:h}))}s.sort(Jr);var c=null,f=1/0;if(o.has(e)){var p=function(t,e){Wr(t,e,Xr),Xr.sort(Jr);var r=Xr[0]||null;return Xr.length=0,r}(e.cached.scene,r);p&&(c=p,f=p.distance*p.distance)}for(var g=0,d=s.length;g<d;g++){var A=s[g],y=A.distance,v=A.tile;if(y>f)break;var m=Kr(t,v,r,n);if(m){var E=m.distance*m.distance;E<f&&(c=m,f=E)}}return c}function Zr(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=t.group,s=t.activeTiles,a=e.cached,u=a.scene,l=a.boundingVolume;if(t.ensureChildrenArePreprocessed(e),null===i&&(i=zr,Vr.copy(o.matrixWorld).invert(),i.copy(r.ray).applyMatrix4(Vr)),e.__used&&l.intersectsRay(i)){s.has(e)&&Wr(u,r,n);for(var h=e.children,c=0,f=h.length;c<f;c++)Zr(t,h[c],r,n,i)}}var $r=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new THREE.Box3,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new THREE.Matrix4;i(this,t),this.box=e.clone(),this.transform=r.clone(),this.inverseTransform=new THREE.Matrix4,this.points=new Array(8).fill().map((function(){return new THREE.Vector3}))}return s(t,[{key:"update",value:function(){var t=this.points,e=this.inverseTransform,r=this.transform,n=this.box;e.copy(r).invert();for(var i=n.min,o=n.max,s=0,a=-1;a<=1;a+=2)for(var u=-1;u<=1;u+=2)for(var l=-1;l<=1;l+=2)t[s].set(a<0?i.x:o.x,u<0?i.y:o.y,l<0?i.z:o.z).applyMatrix4(r),s++}},{key:"intersectsFrustum",value:function(t){for(var e=this.points,r=t.planes,n=0;n<6;n++){for(var i=r[n],o=-1/0,s=0;s<8;s++){var a=e[s],u=i.distanceToPoint(a);o=o<u?u:o}if(o<0)return!1}return!0}}]),t}();new THREE.Spherical,new THREE.Vector3;var tn=new THREE.Spherical,en=new THREE.Vector3,rn=new THREE.Vector3,nn=new THREE.Vector3,on=new THREE.Vector3,sn=new THREE.Vector3,an=new THREE.Vector3,un=new THREE.Vector3,ln=new THREE.Vector3,hn=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;i(this,t),this.radius=new THREE.Vector3(e,r,n)}return s(t,[{key:"constructLatLonFrame",value:function(t,e,r){return this.getCartographicToPosition(t,e,0,ln),this.getCartographicToNormal(t,e,un),this.getNorthernTangent(t,e,an),sn.crossVectors(an,un),r.makeBasis(sn,an,un).setPosition(ln)}},{key:"getNorthernTangent",value:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:on,i=1,o=t+1e-7;t>Math.PI/4&&(i=-1,o=t-1e-7);var s=this.getCartographicToNormal(t,e,rn).normalize(),a=this.getCartographicToNormal(o,e,nn).normalize();return n.crossVectors(s,a).normalize().multiplyScalar(i),r.crossVectors(n,s).normalize()}},{key:"getCartographicToPosition",value:function(t,e,r,n){this.getCartographicToNormal(t,e,en);var i=this.radius;rn.copy(en),rn.x*=Math.pow(i.x,2),rn.y*=Math.pow(i.y,2),rn.z*=Math.pow(i.z,2);var o=Math.sqrt(en.dot(rn));return rn.divideScalar(o),n.copy(rn).addScaledVector(en,r)}},{key:"getPositionToCartographic",value:function(t,e){this.getPositionToSurfacePoint(t,rn),this.getPositionToNormal(t,en);var r=nn.subVectors(t,rn);return e.lon=Math.atan2(en.y,en.x),e.lat=Math.asin(en.z),e.height=Math.sign(r.dot(t))*r.length(),e}},{key:"getCartographicToNormal",value:function(t,e,r){return tn.set(1,-t+Math.PI/2,e),r.setFromSpherical(tn).normalize(),function(t){var e=t.x,r=t.y,n=t.z;t.x=n,t.y=e,t.z=r}(r),r}},{key:"getPositionToNormal",value:function(t,e){var r=this.radius;return e.copy(t),e.x/=Math.pow(r.x,2),e.y/=Math.pow(r.y,2),e.z/=Math.pow(r.z,2),e.normalize(),e}},{key:"getPositionToSurfacePoint",value:function(t,e){var r=this.radius,n=1/Math.pow(r.x,2),i=1/Math.pow(r.y,2),o=1/Math.pow(r.z,2),s=t.x*t.x*n,a=t.y*t.y*i,u=t.z*t.z*o,l=s+a+u,h=Math.sqrt(1/l),c=rn.copy(t).multiplyScalar(h);if(l<.1)return isFinite(h)?e.copy(c):null;var f,p,g,d,A,y,v,m=nn.set(c.x*n*2,c.y*i*2,c.z*o*2),E=(1-h)*t.length()/(.5*m.length()),_=0;do{_=(f=s*(A=(p=1/(1+(E-=_)*n))*p)+a*(y=(g=1/(1+E*i))*g)+u*(v=(d=1/(1+E*o))*d)-1)/(-2*(s*(A*p)*n+a*(y*g)*i+u*(v*d)*o))}while(Math.abs(f)>1e-12);return e.set(t.x*p,t.y*g,t.z*d)}}]),t}(),cn=Math.PI,fn=cn/2,pn=new THREE.Vector3,gn=new THREE.Vector3,dn=new THREE.Vector3,An=new THREE.Matrix4,yn=0,vn=[];function mn(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?(vn[yn]||(vn[yn]=new THREE.Vector3),yn++,vn[yn-1]):new THREE.Vector3}function En(){yn=0}var _n=function(t){u(r,hn);var e=f(r);function r(t,n,o){var s,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-fn,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:fn,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,h=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*cn,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0;return i(this,r),(s=e.call(this,t,n,o)).latStart=a,s.latEnd=u,s.lonStart=l,s.lonEnd=h,s.heightStart=c,s.heightEnd=f,s}return s(r,[{key:"_getPoints",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.latStart,r=this.latEnd,n=this.lonStart,i=this.lonEnd,o=this.heightStart,s=this.heightEnd,a=THREE.MathUtils.mapLinear(.5,0,1,e,r),u=THREE.MathUtils.mapLinear(.5,0,1,n,i),l=Math.floor(n/fn)*fn,h=[[-cn/2,0],[cn/2,0],[0,l],[0,l+cn/2],[0,l+cn],[0,l+3*cn/2],[e,i],[r,i],[e,n],[r,n],[0,n],[0,i],[a,u],[e,u],[r,u],[a,n],[a,i]],c=[],f=h.length,p=0;p<=1;p++)for(var g=THREE.MathUtils.mapLinear(p,0,1,o,s),d=0,A=f;d<A;d++){var v=y(h[d],2),m=v[0],E=v[1];if(m>=e&&m<=r&&E>=n&&E<=i){var _=mn(t);c.push(_),this.getCartographicToPosition(m,E,g,_)}}return c}},{key:"getBoundingBox",value:function(t,e){En();var r=this.latStart,n=this.latEnd,i=this.lonStart,o=this.lonEnd;if(n-r<cn/2){var s=THREE.MathUtils.mapLinear(.5,0,1,r,n),a=THREE.MathUtils.mapLinear(.5,0,1,i,o);this.getCartographicToNormal(s,a,dn),gn.set(0,0,1),pn.crossVectors(gn,dn),gn.crossVectors(pn,dn),e.makeBasis(pn,gn,dn)}else pn.set(1,0,0),gn.set(0,1,0),dn.set(0,0,1),e.makeBasis(pn,gn,dn);An.copy(e).invert();for(var u=this._getPoints(!0),l=0,h=u.length;l<h;l++)u[l].applyMatrix4(An);t.makeEmpty(),t.setFromPoints(u)}},{key:"getBoundingSphere",value:function(t,e){En();var r=this._getPoints(!0);t.makeEmpty(),t.setFromPoints(r,e)}}]),r}();function In(t){return In="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},In(t)}function xn(t){var e=function(t,e){if("object"!==In(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==In(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===In(e)?e:String(e)}function Cn(t,e,r){return(e=xn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wn(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}const bn=1/Math.PI*180,Bn=1/180*Math.PI,Sn={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function Tn(t,{precision:e=Sn.precision}={}){return t=function(t){return Math.round(t/Sn.EPSILON)*Sn.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function Mn(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Rn(t){return function(t,e){return Pn(t,(t=>t*Bn),e)}(t)}function Ln(t){return function(t,e){return Pn(t,(t=>t*bn),e)}(t)}function Nn(t,e,r){const n=Sn.EPSILON;r&&(Sn.EPSILON=r);try{if(t===e)return!0;if(Mn(t)&&Mn(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!Nn(t[r],e[r]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):"number"==typeof t&&"number"==typeof e&&Math.abs(t-e)<=Sn.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))}finally{Sn.EPSILON=n}}function Pn(t,e,r){if(Mn(t)){const n=t;r=r||function(t){return t.clone?t.clone():new Array(t.length)}(n);for(let i=0;i<r.length&&i<n.length;++i)r[i]=e(t[i],i,r);return r}return e(t)}class kn extends(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Array)){clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+e];return this.check()}toArray(t=[],e=0){for(let r=0;r<this.ELEMENTS;++r)t[e+r]=this[r];return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Mn(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Sn)}formatString(t){let e="";for(let r=0;r<this.ELEMENTS;++r)e+=(r>0?", ":"")+Tn(this[r],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(e,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(!Nn(this[e],t[e]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(this[e]!==t[e])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,e,r){if(void 0===r)return this.lerp(this,t,e);for(let n=0;n<this.ELEMENTS;++n){const i=t[n];this[n]=i+r*(e[n]-i)}return this.check()}min(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.min(t[e],this[e]);return this.check()}max(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.max(t[e],this[e]);return this.check()}clamp(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),e[r]);return this.check()}add(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]+=e[t];return this.check()}subtract(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]-=e[t];return this.check()}scale(t){if("number"==typeof t)for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;else for(let e=0;e<this.ELEMENTS&&e<t.length;++e)this[e]*=t[e];return this.check()}multiplyByScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}check(){if(Sn.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let e=0;e<this.ELEMENTS;++e)t=t&&Number.isFinite(this[e]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=t;return this.check()}addScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),e);return this.check()}get elements(){return this}}function Dn(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(t));return t}function Qn(t,e,r=""){if(Sn.debug&&!function(t,e){if(t.length!==e)return!1;for(let e=0;e<t.length;++e)if(!Number.isFinite(t[e]))return!1;return!0}(t,e))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return t}class On extends kn{get x(){return this[0]}set x(t){this[0]=Dn(t)}get y(){return this[1]}set y(t){this[1]=Dn(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let e=0;e<this.ELEMENTS;++e)t+=this[e]*this[e];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let e=0;for(let r=0;r<this.ELEMENTS;++r){const n=this[r]-t[r];e+=n*n}return Dn(e)}dot(t){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*t[r];return Dn(e)}normalize(){const t=this.magnitude();if(0!==t)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t;return this.check()}multiply(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]*=e[t];return this.check()}divide(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e[t];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return wn(t>=0&&t<this.ELEMENTS,"index is out of range"),Dn(this[t])}setComponent(t,e){return wn(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=e,this.check()}addVectors(t,e){return this.copy(t).add(e)}subVectors(t,e){return this.copy(t).subtract(e)}multiplyVectors(t,e){return this.copy(t).multiply(e)}addScaledVector(t,e){return this.add(new this.constructor(t).multiplyScalar(e))}}var Fn,Gn=1e-6,Un="undefined"!=typeof Float32Array?Float32Array:Array;function Hn(t,e,r){const n=e[0],i=e[1],o=e[2],s=r[3]*n+r[7]*i+r[11]*o||1;return t[0]=(r[0]*n+r[4]*i+r[8]*o)/s,t[1]=(r[1]*n+r[5]*i+r[9]*o)/s,t[2]=(r[2]*n+r[6]*i+r[10]*o)/s,t}function jn(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function qn(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[3]*n+r[7]*i+r[11]*o+r[15];return s=s||1,t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/s,t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/s,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/s,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),Fn=new Un(2),Un!=Float32Array&&(Fn[0]=0,Fn[1]=0),function(){var t=function(){var t=new Un(3);return Un!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}()}();const Vn=[0,0,0];let zn;class Yn extends On{static get ZERO(){return zn||(zn=new Yn(0,0,0),Object.freeze(zn)),zn}constructor(t=0,e=0,r=0){super(-0,-0,-0),1===arguments.length&&Mn(t)?this.copy(t):(Sn.debug&&(Dn(t),Dn(e),Dn(r)),this[0]=t,this[1]=e,this[2]=r)}set(t,e,r){return this[0]=t,this[1]=e,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Sn.debug&&(Dn(t.x),Dn(t.y),Dn(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=Dn(t)}angle(t){return r=t,n=(e=this)[0],i=e[1],o=e[2],s=r[0],a=r[1],u=r[2],l=Math.sqrt(n*n+i*i+o*o)*Math.sqrt(s*s+a*a+u*u),h=l&&jn(e,r)/l,Math.acos(Math.min(Math.max(h,-1),1));var e,r,n,i,o,s,a,u,l,h}cross(t){return function(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[0],a=r[1],u=r[2];t[0]=i*u-o*a,t[1]=o*s-n*u,t[2]=n*a-i*s}(this,this,t),this.check()}rotateX({radians:t,origin:e=Vn}){return function(t,e,r,n){var i=[],o=[];i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2]}(this,this,e,t),this.check()}rotateY({radians:t,origin:e=Vn}){return function(t,e,r,n){var i=[],o=[];i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2]}(this,this,e,t),this.check()}rotateZ({radians:t,origin:e=Vn}){return function(t,e,r,n){var i=[],o=[];i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2]}(this,this,e,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return qn(this,this,t),this.check()}transformAsVector(t){return Hn(this,this,t),this.check()}transformByMatrix3(t){return function(t,e,r){var n=e[0],i=e[1],o=e[2];t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8]}(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,r){const n=e[0],i=e[1];t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t[2]=e[2]}(this,this,t),this.check()}transformByQuaternion(t){return function(t,e,r){var n=r[0],i=r[1],o=r[2],s=r[3],a=e[0],u=e[1],l=e[2],h=i*l-o*u,c=o*a-n*l,f=n*u-i*a,p=i*f-o*c,g=o*h-n*f,d=n*c-i*h,A=2*s;h*=A,c*=A,f*=A,p*=2,g*=2,d*=2,t[0]=a+h+p,t[1]=u+c+g,t[2]=l+f+d}(this,this,t),this.check()}}class Xn extends kn{toString(){let t="[";if(Sn.printRowMajor){t+="row-major:";for(let e=0;e<this.RANK;++e)for(let r=0;r<this.RANK;++r)t+=" ".concat(this[r*this.RANK+e])}else{t+="column-major:";for(let e=0;e<this.ELEMENTS;++e)t+=" ".concat(this[e])}return t+="]",t}getElementIndex(t,e){return e*this.RANK+t}getElement(t,e){return this[e*this.RANK+t]}setElement(t,e,r){return this[e*this.RANK+t]=Dn(r),this}getColumn(t,e=new Array(this.RANK).fill(-0)){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)e[t]=this[r+t];return e}setColumn(t,e){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)this[r+t]=e[t];return this}}function Jn(t,e,r){var n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],l=e[6],h=e[7],c=e[8],f=e[9],p=e[10],g=e[11],d=e[12],A=e[13],y=e[14],v=e[15],m=r[0],E=r[1],_=r[2],I=r[3];return t[0]=m*n+E*a+_*c+I*d,t[1]=m*i+E*u+_*f+I*A,t[2]=m*o+E*l+_*p+I*y,t[3]=m*s+E*h+_*g+I*v,m=r[4],E=r[5],_=r[6],I=r[7],t[4]=m*n+E*a+_*c+I*d,t[5]=m*i+E*u+_*f+I*A,t[6]=m*o+E*l+_*p+I*y,t[7]=m*s+E*h+_*g+I*v,m=r[8],E=r[9],_=r[10],I=r[11],t[8]=m*n+E*a+_*c+I*d,t[9]=m*i+E*u+_*f+I*A,t[10]=m*o+E*l+_*p+I*y,t[11]=m*s+E*h+_*g+I*v,m=r[12],E=r[13],_=r[14],I=r[15],t[12]=m*n+E*a+_*c+I*d,t[13]=m*i+E*u+_*f+I*A,t[14]=m*o+E*l+_*p+I*y,t[15]=m*s+E*h+_*g+I*v,t}var Wn=function(t,e,r,n,i){var o,s=1/Math.tan(e/2);return t[0]=s/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(n-i),t[10]=(i+n)*o,t[14]=2*i*n*o):(t[10]=-1,t[14]=-2*n),t};var Kn,Zn=function(t,e,r,n,i,o,s){var a=1/(e-r),u=1/(n-i),l=1/(o-s);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+r)*a,t[13]=(i+n)*u,t[14]=(s+o)*l,t[15]=1,t};!function(){var t=function(){var t=new Un(4);return Un!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}()}(),function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"}(Kn||(Kn={}));const $n=45*Math.PI/180,ti=1,ei=.1,ri=500,ni=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class ii extends Xn{static get IDENTITY(){return function(){si||(si=new ii,Object.freeze(si));return si}()}static get ZERO(){return function(){oi||(oi=new ii([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(oi));return oi}()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Kn}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,e,r,n,i,o,s,a,u,l,h,c,f,p,g,d){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=i,this[5]=o,this[6]=s,this[7]=a,this[8]=u,this[9]=l,this[10]=h,this[11]=c,this[12]=f,this[13]=p,this[14]=g,this[15]=d,this.check()}setRowMajor(t,e,r,n,i,o,s,a,u,l,h,c,f,p,g,d){return this[0]=t,this[1]=i,this[2]=u,this[3]=f,this[4]=e,this[5]=o,this[6]=l,this[7]=p,this[8]=r,this[9]=s,this[10]=h,this[11]=g,this[12]=n,this[13]=a,this[14]=c,this[15]=d,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(ni)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],s=r+r,a=n+n,u=i+i,l=r*s,h=n*s,c=n*a,f=i*s,p=i*a,g=i*u,d=o*s,A=o*a,y=o*u;t[0]=1-c-g,t[1]=h+y,t[2]=f-A,t[3]=0,t[4]=h-y,t[5]=1-l-g,t[6]=p+d,t[7]=0,t[8]=f+A,t[9]=p-d,t[10]=1-l-c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(this,t),this.check()}frustum(t){const{left:e,right:r,bottom:n,top:i,near:o=ei,far:s=ri}=t;return s===1/0?function(t,e,r,n,i,o){const s=2*o/(r-e),a=2*o/(i-n),u=(r+e)/(r-e),l=(i+n)/(i-n),h=-1,c=-1,f=-2*o;t[0]=s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=u,t[9]=l,t[10]=h,t[11]=c,t[12]=0,t[13]=0,t[14]=f,t[15]=0}(this,e,r,n,i,o):function(t,e,r,n,i,o,s){var a=1/(r-e),u=1/(i-n),l=1/(o-s);t[0]=2*o*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*u,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(i+n)*u,t[10]=(s+o)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*o*2*l,t[15]=0}(this,e,r,n,i,o,s),this.check()}lookAt(t){const{eye:e,center:r=[0,0,0],up:n=[0,1,0]}=t;return function(t,e,r,n){var i,o,s,a,u,l,h,c,f,p,g=e[0],d=e[1],A=e[2],y=n[0],v=n[1],m=n[2],E=r[0],_=r[1],I=r[2];Math.abs(g-E)<Gn&&Math.abs(d-_)<Gn&&Math.abs(A-I)<Gn?function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t):(h=g-E,c=d-_,f=A-I,i=v*(f*=p=1/Math.hypot(h,c,f))-m*(c*=p),o=m*(h*=p)-y*f,s=y*c-v*h,(p=Math.hypot(i,o,s))?(i*=p=1/p,o*=p,s*=p):(i=0,o=0,s=0),a=c*s-f*o,u=f*i-h*s,l=h*o-c*i,(p=Math.hypot(a,u,l))?(a*=p=1/p,u*=p,l*=p):(a=0,u=0,l=0),t[0]=i,t[1]=a,t[2]=h,t[3]=0,t[4]=o,t[5]=u,t[6]=c,t[7]=0,t[8]=s,t[9]=l,t[10]=f,t[11]=0,t[12]=-(i*g+o*d+s*A),t[13]=-(a*g+u*d+l*A),t[14]=-(h*g+c*d+f*A),t[15]=1)}(this,e,r,n),this.check()}ortho(t){const{left:e,right:r,bottom:n,top:i,near:o=ei,far:s=ri}=t;return Zn(this,e,r,n,i,o,s),this.check()}orthographic(t){const{fovy:e=$n,aspect:r=ti,focalDistance:n=1,near:i=ei,far:o=ri}=t;ai(e);const s=e/2,a=n*Math.tan(s),u=a*r;return this.ortho({left:-u,right:u,bottom:-a,top:a,near:i,far:o})}perspective(t){const{fovy:e=45*Math.PI/180,aspect:r=1,near:n=.1,far:i=500}=t;return ai(e),Wn(this,e,r,n,i),this.check()}determinant(){return e=(t=this)[0],r=t[1],n=t[2],i=t[3],o=t[4],s=t[5],a=t[6],u=t[7],l=t[8],h=t[9],c=t[10],f=t[11],p=t[12],g=t[13],d=t[14],A=t[15],(e*s-r*o)*(c*A-f*d)-(e*a-n*o)*(h*A-f*g)+(e*u-i*o)*(h*d-c*g)+(r*a-n*s)*(l*A-f*p)-(r*u-i*s)*(l*d-c*p)+(n*u-i*a)*(l*g-h*p);var t,e,r,n,i,o,s,a,u,l,h,c,f,p,g,d,A}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const r=this.getScale(e),n=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*n,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*n,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const r=this.getScale(e),n=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*n,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*n,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return function(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],s=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=s,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15]}(this,this),this.check()}invert(){return function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],u=e[6],l=e[7],h=e[8],c=e[9],f=e[10],p=e[11],g=e[12],d=e[13],A=e[14],y=e[15],v=r*a-n*s,m=r*u-i*s,E=r*l-o*s,_=n*u-i*a,I=n*l-o*a,x=i*l-o*u,C=h*d-c*g,w=h*A-f*g,b=h*y-p*g,B=c*A-f*d,S=c*y-p*d,T=f*y-p*A,M=v*T-m*S+E*B+_*b-I*w+x*C;M&&(M=1/M,t[0]=(a*T-u*S+l*B)*M,t[1]=(i*S-n*T-o*B)*M,t[2]=(d*x-A*I+y*_)*M,t[3]=(f*I-c*x-p*_)*M,t[4]=(u*b-s*T-l*w)*M,t[5]=(r*T-i*b+o*w)*M,t[6]=(A*E-g*x-y*m)*M,t[7]=(h*x-f*E+p*m)*M,t[8]=(s*S-a*b+l*C)*M,t[9]=(n*b-r*S-o*C)*M,t[10]=(g*I-d*E+y*v)*M,t[11]=(c*E-h*I-p*v)*M,t[12]=(a*w-s*B-u*C)*M,t[13]=(r*B-n*w+i*C)*M,t[14]=(d*m-g*_-A*v)*M,t[15]=(h*_-c*m+f*v)*M)}(this,this),this.check()}multiplyLeft(t){return Jn(this,t,this),this.check()}multiplyRight(t){return Jn(this,this,t),this.check()}rotateX(t){return function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],s=e[5],a=e[6],u=e[7],l=e[8],h=e[9],c=e[10],f=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+l*n,t[5]=s*i+h*n,t[6]=a*i+c*n,t[7]=u*i+f*n,t[8]=l*i-o*n,t[9]=h*i-s*n,t[10]=c*i-a*n,t[11]=f*i-u*n}(this,this,t),this.check()}rotateY(t){return function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],s=e[1],a=e[2],u=e[3],l=e[8],h=e[9],c=e[10],f=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-l*n,t[1]=s*i-h*n,t[2]=a*i-c*n,t[3]=u*i-f*n,t[8]=o*n+l*i,t[9]=s*n+h*i,t[10]=a*n+c*i,t[11]=u*n+f*i}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],s=e[1],a=e[2],u=e[3],l=e[4],h=e[5],c=e[6],f=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+l*n,t[1]=s*i+h*n,t[2]=a*i+c*n,t[3]=u*i+f*n,t[4]=l*i-o*n,t[5]=h*i-s*n,t[6]=c*i-a*n,t[7]=f*i-u*n}(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,e){return function(t,e,r,n){var i,o,s,a,u,l,h,c,f,p,g,d,A,y,v,m,E,_,I,x,C,w,b,B,S=n[0],T=n[1],M=n[2],R=Math.hypot(S,T,M);R<Gn||(S*=R=1/R,T*=R,M*=R,i=Math.sin(r),s=1-(o=Math.cos(r)),a=e[0],u=e[1],l=e[2],h=e[3],c=e[4],f=e[5],p=e[6],g=e[7],d=e[8],A=e[9],y=e[10],v=e[11],m=S*S*s+o,E=T*S*s+M*i,_=M*S*s-T*i,I=S*T*s-M*i,x=T*T*s+o,C=M*T*s+S*i,w=S*M*s+T*i,b=T*M*s-S*i,B=M*M*s+o,t[0]=a*m+c*E+d*_,t[1]=u*m+f*E+A*_,t[2]=l*m+p*E+y*_,t[3]=h*m+g*E+v*_,t[4]=a*I+c*x+d*C,t[5]=u*I+f*x+A*C,t[6]=l*I+p*x+y*C,t[7]=h*I+g*x+v*C,t[8]=a*w+c*b+d*B,t[9]=u*w+f*b+A*B,t[10]=l*w+p*b+y*B,t[11]=h*w+g*b+v*B,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]))}(this,this,t,e),this.check()}scale(t){return function(t,e,r){var n=r[0],i=r[1],o=r[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return function(t,e,r){var n,i,o,s,a,u,l,h,c,f,p,g,d=r[0],A=r[1],y=r[2];e===t?(t[12]=e[0]*d+e[4]*A+e[8]*y+e[12],t[13]=e[1]*d+e[5]*A+e[9]*y+e[13],t[14]=e[2]*d+e[6]*A+e[10]*y+e[14],t[15]=e[3]*d+e[7]*A+e[11]*y+e[15]):(n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],u=e[5],l=e[6],h=e[7],c=e[8],f=e[9],p=e[10],g=e[11],t[0]=n,t[1]=i,t[2]=o,t[3]=s,t[4]=a,t[5]=u,t[6]=l,t[7]=h,t[8]=c,t[9]=f,t[10]=p,t[11]=g,t[12]=n*d+a*A+c*y+e[12],t[13]=i*d+u*A+f*y+e[13],t[14]=o*d+l*A+p*y+e[14],t[15]=s*d+h*A+g*y+e[15])}(this,this,t),this.check()}transform(t,e){return 4===t.length?(e=function(t,e,r){var n=e[0],i=e[1],o=e[2],s=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*s,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*s,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*s,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*s,t}(e||[-0,-0,-0,-0],t,this),Qn(e,4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:r}=t;let n;switch(r){case 2:n=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t}(e||[-0,-0],t,this);break;case 3:n=qn(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Qn(n,t.length),n}transformAsVector(t,e){let r;switch(t.length){case 2:r=function(t,e,r){const n=e[0],i=e[1],o=r[3]*n+r[7]*i||1;return t[0]=(r[0]*n+r[4]*i)/o,t[1]=(r[1]*n+r[5]*i)/o,t}(e||[-0,-0],t,this);break;case 3:r=Hn(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Qn(r,t.length),r}transformPoint(t,e){return this.transformAsPoint(t,e)}transformVector(t,e){return this.transformAsPoint(t,e)}transformDirection(t,e){return this.transformAsVector(t,e)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,r){return this.identity().translate([t,e,r])}}let oi,si;function ai(t){if(t>2*Math.PI)throw Error("expected radians")}var ui=.1,li=1e-12,hi=1e-15;Math.PI,Math.PI,Math.PI,Math.PI;function ci(t){return t}function fi(t,e=[]){return function(t,e=[],r=ci){return"longitude"in t?(e[0]=r(t.longitude),e[1]=r(t.latitude),e[2]=t.height):"x"in t?(e[0]=r(t.x),e[1]=r(t.y),e[2]=t.z):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}(t,e,Sn._cartographicRadians?ci:Rn)}function pi(t,e){return function(t,e,r=ci){return"longitude"in e?(e.longitude=r(t[0]),e.latitude=r(t[1]),e.height=t[2]):"x"in e?(e.x=r(t[0]),e.y=r(t[1]),e.z=t[2]):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}(t,e,Sn._cartographicRadians?ci:Ln)}new Yn;const gi=new Yn,di=new Yn,Ai=new Yn;const yi=new Yn,vi={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},mi={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Ei={east:new Yn,north:new Yn,up:new Yn,west:new Yn,south:new Yn,down:new Yn},_i=new Yn,Ii=new Yn,xi=new Yn;function Ci(t,e,r,n,i,o){const s=vi[e]&&vi[e][r];let a,u,l;wn(s&&(!n||n===s));const h=yi.copy(i);if(Nn(h.x,0,1e-14)&&Nn(h.y,0,1e-14)){const t=Math.sign(h.z);a=_i.fromArray(mi[e]),"east"!==e&&"west"!==e&&a.scale(t),u=Ii.fromArray(mi[r]),"east"!==r&&"west"!==r&&u.scale(t),l=xi.fromArray(mi[n]),"east"!==n&&"west"!==n&&l.scale(t)}else{const{up:i,east:o,north:s}=Ei;o.set(-h.y,h.x,0).normalize(),t.geodeticSurfaceNormal(h,i),s.copy(i).cross(o);const{down:c,west:f,south:p}=Ei;c.copy(i).scale(-1),f.copy(o).scale(-1),p.copy(s).scale(-1),a=Ei[e],u=Ei[r],l=Ei[n]}return o[0]=a.x,o[1]=a.y,o[2]=a.z,o[3]=0,o[4]=u.x,o[5]=u.y,o[6]=u.z,o[7]=0,o[8]=l.x,o[9]=l.y,o[10]=l.z,o[11]=0,o[12]=h.x,o[13]=h.y,o[14]=h.z,o[15]=1,o}const wi=new Yn,bi=new Yn,Bi=new Yn,Si=new Yn,Ti=new Yn,Mi=new Yn;class Ri{constructor(t=0,e=0,r=0){Cn(this,"radii",void 0),Cn(this,"radiiSquared",void 0),Cn(this,"radiiToTheFourth",void 0),Cn(this,"oneOverRadii",void 0),Cn(this,"oneOverRadiiSquared",void 0),Cn(this,"minimumRadius",void 0),Cn(this,"maximumRadius",void 0),Cn(this,"centerToleranceSquared",ui),Cn(this,"squaredXOverSquaredZ",void 0),wn(t>=0),wn(e>=0),wn(r>=0),this.radii=new Yn(t,e,r),this.radiiSquared=new Yn(t*t,e*e,r*r),this.radiiToTheFourth=new Yn(t*t*t*t,e*e*e*e,r*r*r*r),this.oneOverRadii=new Yn(0===t?0:1/t,0===e?0:1/e,0===r?0:1/r),this.oneOverRadiiSquared=new Yn(0===t?0:1/(t*t),0===e?0:1/(e*e),0===r?0:1/(r*r)),this.minimumRadius=Math.min(t,e,r),this.maximumRadius=Math.max(t,e,r),0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,e=[0,0,0]){const r=bi,n=Bi,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,r),n.copy(this.radiiSquared).scale(r);const o=Math.sqrt(r.dot(n));return n.scale(1/o),r.scale(i),n.add(r),n.to(e)}cartesianToCartographic(t,e=[0,0,0]){Mi.from(t);const r=this.scaleToGeodeticSurface(Mi,Si);if(!r)return;const n=this.geodeticSurfaceNormal(r,bi),i=Ti;i.copy(Mi).subtract(r);const o=Math.atan2(n.y,n.x),s=Math.asin(n.z),a=Math.sign(jn(i,Mi))*function(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}(i);return pi([o,s,a],e)}eastNorthUpToFixedFrame(t,e=new ii){return Ci(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,r,n,i=new ii){return Ci(this,t,e,r,n,i)}geocentricSurfaceNormal(t,e=[0,0,0]){return wi.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const r=fi(t),n=r[0],i=r[1],o=Math.cos(i);return wi.set(o*Math.cos(n),o*Math.sin(n),Math.sin(i)).normalize(),wi.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return wi.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,r=[]){const{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:o}=e;gi.from(t);const s=gi.x,a=gi.y,u=gi.z,l=n.x,h=n.y,c=n.z,f=s*s*l*l,p=a*a*h*h,g=u*u*c*c,d=f+p+g,A=Math.sqrt(1/d);if(!Number.isFinite(A))return;const y=di;if(y.copy(t).scale(A),d<o)return y.to(r);const v=i.x,m=i.y,E=i.z,_=Ai;_.set(y.x*v*2,y.y*m*2,y.z*E*2);let I,x,C,w,b=(1-A)*gi.len()/(.5*_.len()),B=0;do{b-=B,I=1/(1+b*v),x=1/(1+b*m),C=1/(1+b*E);const t=I*I,e=x*x,r=C*C;w=f*t+p*e+g*r-1,B=w/(-2*(f*(t*I)*v+p*(e*x)*m+g*(r*C)*E))}while(Math.abs(w)>li);return gi.scale([I,x,C]).to(r)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){Si.from(t);const r=Si.x,n=Si.y,i=Si.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(r*r*o.x+n*n*o.y+i*i*o.z);return Si.multiplyScalar(s).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return Si.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return Si.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,r=[0,0,0]){wn(Nn(this.radii.x,this.radii.y,hi)),wn(this.radii.z>0),Si.from(t);const n=Si.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-e))return Si.set(0,0,n).to(r)}}Cn(Ri,"WGS84",new Ri(6378137,6378137,6356752.314245179));var Li=new THREE.Vector3,Ni=new THREE.Vector3,Pi=new THREE.Vector3,ki=new THREE.Vector3,Di=new THREE.Vector3,Qi=new THREE.Vector3,Oi=new THREE.Ray,Fi=new THREE.Vector3,Gi=new THREE.Matrix4,Ui=new THREE.Vector3,Hi=new THREE.Vector3,ji=new THREE.Vector3,qi=new THREE.Quaternion,Vi=new THREE.Vector3,zi=new THREE.Vector3,Yi=function(){function t(e,r,n,o){i(this,t),this.sphere=null,this.obb=null,this.region=null,this.regionObb=null,this.scale=null,this.threeLayer=e,this.heightOffset=r,this.xOffset=n,this.yOffset=o}return s(t,[{key:"intersectsRay",value:function(t){var e=this.sphere,r=this.obb||this.regionObb;return!(e&&!t.intersectsSphere(e))&&!(r&&(Oi.copy(t).applyMatrix4(r.inverseTransform),!Oi.intersectsBox(r.box)))}},{key:"intersectRay",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=this.sphere,n=this.obb||this.regionObb,i=-1/0,o=-1/0;r&&t.intersectSphere(r,Di)&&(i=r.containsPoint(t.origin)?0:t.origin.distanceToSquared(Di)),n&&(Oi.copy(t).applyMatrix4(n.inverseTransform),Oi.intersectBox(n.box,Qi)&&(o=n.box.containsPoint(Oi.origin)?0:Oi.origin.distanceToSquared(Qi)));var s=Math.max(i,o);return s===-1/0?null:(t.at(Math.sqrt(s),e),e)}},{key:"distanceToPoint",value:function(t){var e=this.sphere,r=this.obb||this.regionObb,n=-1/0,i=-1/0;return e&&(n=Math.max(e.distanceToPoint(t),0)),r&&(ki.copy(t).applyMatrix4(r.inverseTransform),i=r.box.distanceToPoint(ki)),n>i?n:i}},{key:"intersectsFrustum",value:function(t){var e=this.obb||this.regionObb,r=this.sphere;return!(r&&!t.intersectsSphere(r))&&(!(e&&!e.intersectsFrustum(t))&&Boolean(r||e))}},{key:"getOBB",value:function(t,e){var r=this.obb||this.regionObb;r?(t.copy(r.box),e.copy(r.transform)):(this.getAABB(t),e.identity())}},{key:"getAABB",value:function(t){if(this.sphere)this.sphere.getBoundingBox(t);else{var e=this.obb||this.regionObb;t.copy(e.box).applyMatrix4(e.transform)}}},{key:"getSphere",value:function(t){if(this.sphere)t.copy(this.sphere);else if(this.region)this.region.getBoundingSphere(t);else{var e=this.obb||this.regionObb;e.box.getBoundingSphere(t),t.applyMatrix4(e.transform)}}},{key:"setObbData",value:function(t,e,r){var n=new $r,i=new THREE.Vector3,o=this.threeLayer.distanceToVector3(t[3],t[3]).x,s=this.threeLayer.distanceToVector3(t[4],t[4]).x,a=this.threeLayer.distanceToVector3(t[5],t[5]).x;Li.set(o,s,a);var u=this.threeLayer.distanceToVector3(t[6],t[6]).x,l=this.threeLayer.distanceToVector3(t[7],t[7]).x,h=this.threeLayer.distanceToVector3(t[8],t[8]).x;Ni.set(u,l,h);var c=this.threeLayer.distanceToVector3(t[9],t[9]).x,f=this.threeLayer.distanceToVector3(t[10],t[10]).x,p=this.threeLayer.distanceToVector3(t[11],t[11]).x;Pi.set(c,f,p),Ui.set(t[3],t[4],t[5]),Hi.set(t[6],t[7],t[8]),ji.set(t[9],t[10],t[11]);var g=Li.length(),d=Ni.length(),A=Pi.length(),y=Ui.length(),v=Hi.length(),m=ji.length();if(i.set(g/y,d/v,A/m),this.scale=i,Li.normalize(),Ni.normalize(),Pi.normalize(),0===g&&Li.crossVectors(Ni,Pi),0===d&&Ni.crossVectors(Li,Pi),0===A&&Pi.crossVectors(Li,Ni),n.transform.set(Li.x,Ni.x,Pi.x,t[0],Li.y,Ni.y,Pi.y,t[1],Li.z,Ni.z,Pi.z,t[2],0,0,0,1).premultiply(e),r){r.decompose(zi,qi,Vi);var E=Gi.makeRotationFromQuaternion(qi);n.transform.multiply(E)}var _=Ri.WGS84.cartesianToCartographic([n.transform.elements[12],n.transform.elements[13],n.transform.elements[14]],Fi),I=this.threeLayer.coordinateToVector3([_.x,_.y],_.z),x=this.threeLayer.distanceToVector3(I.z+this.heightOffset,I.z+this.heightOffset).x;n.transform.elements[12]=I.x+this.xOffset,n.transform.elements[13]=I.y+this.yOffset,n.transform.elements[14]=x,n.box.min.set(-g,-d,-A),n.box.max.set(g,d,A),n.update(),this.obb=n}},{key:"setSphereData",value:function(t,e,r,n,i){var o=new THREE.Sphere;o.center.set(t,e,r),o.radius=n,o.applyMatrix4(i),this.sphere=o}},{key:"setRegionData",value:function(t,e,r,n,i,o){var s=new _n(fe,fe,pe,e,n,t,r,i,o),a=new $r;s.getBoundingBox(a.box,a.transform),a.update(),this.region=s,this.regionObb=a}}]),t}(),Xi=Symbol("INITIAL_FRUSTUM_CULLED"),Ji=new THREE.Matrix4,Wi=new THREE.Matrix4,Ki=new THREE.Vector3,Zi=new THREE.Vector3,$i=new THREE.Vector3,to=new THREE.Quaternion,eo=new THREE.Vector3(1,0,0),ro=new THREE.Vector3(0,1,0);function no(t,e){t.traverse((function(t){t.frustumCulled=t[Xi]&&e}))}var io=function(t){u(r,be);var e=f(r);function r(){var t;i(this,r);for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];(t=e.call.apply(e,[this].concat(o))).group=new qr(c(t)),t.cameras=[],t.cameraMap=new Map,t.cameraInfo=[],t.activeTiles=new Set,t.visibleTiles=new Set,t._autoDisableRendererCulling=!0,t.optimizeRaycast=!0,t.onLoadTileSet=null,t.onLoadModel=null,t.onDisposeModel=null,t.onTileVisibilityChange=null;var a=new THREE.LoadingManager;a.setURLModifier((function(e){return t.preprocessURL?t.preprocessURL(e):e})),t.manager=a;var u=c(t);return t._overridenRaycast=function(t,e){u.optimizeRaycast||Object.getPrototypeOf(this).raycast.call(this,t,e)},t}return s(r,[{key:"autoDisableRendererCulling",get:function(){return this._autoDisableRendererCulling},set:function(t){this._autoDisableRendererCulling!==t&&(A(l(r.prototype),"_autoDisableRendererCulling",t,this,!0),this.forEachLoadedModel((function(e){no(e,!t)})))}},{key:"getBounds",value:function(t){if(!this.root)return!1;var e=this.root.cached.boundingVolume;return!e||(e.getAABB(t),!0)}},{key:"getOrientedBounds",value:function(t,e){if(!this.root)return!1;var r=this.root.cached.boundingVolume;return!r||(r.getOBB(t,e),!0)}},{key:"getBoundingSphere",value:function(t){if(!this.root)return!1;var e=this.root.cached.boundingVolume;return!!e&&(e.getSphere(t),!0)}},{key:"forEachLoadedModel",value:function(t){this.traverse((function(e){var r=e.cached.scene;r&&t(r,e)}))}},{key:"raycast",value:function(t,e){if(this.root)if(t.firstHitOnly){var r=Kr(this,this.root,t);r&&e.push(r)}else Zr(this,this.root,t,e)}},{key:"hasCamera",value:function(t){return this.cameraMap.has(t)}},{key:"setCamera",value:function(t){var e=this.cameras,r=this.cameraMap;return!r.has(t)&&(r.set(t,new THREE.Vector2),e.push(t),!0)}},{key:"setResolution",value:function(t,e,r){var n=this.cameraMap;return!!n.has(t)&&(e instanceof THREE.Vector2?n.get(t).copy(e):n.get(t).set(e,r),!0)}},{key:"setResolutionFromRenderer",value:function(t,e){var r=this.cameraMap;if(!r.has(t))return!1;var n=r.get(t);return e.getSize(n),n.multiplyScalar(e.getPixelRatio()),!0}},{key:"deleteCamera",value:function(t){var e=this.cameras,r=this.cameraMap;if(r.has(t)){var n=e.indexOf(t);return e.splice(n,1),r.delete(t),!0}return!1}},{key:"fetchTileSet",value:function(t){for(var e,n=this,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];var a=(e=g(l(r.prototype),"fetchTileSet",this)).call.apply(e,[this,t].concat(o));return a.then((function(e){n.onLoadTileSet&&Promise.resolve().then((function(){n.onLoadTileSet(e,t)}))})),a}},{key:"update",value:function(){var t=this.group,e=this.cameras,n=this.cameraMap,i=this.cameraInfo;if(0!==e.length){for(;i.length>e.length;)i.pop();for(;i.length<e.length;)i.push({frustum:new THREE.Frustum,isOrthographic:!1,sseDenominator:-1,position:new THREE.Vector3,invScale:-1,pixelSize:0});Wi.copy(t.matrixWorld).invert(),Ki.setFromMatrixScale(Wi);var o=Ki.x;Math.abs(Math.max(Ki.x-Ki.y,Ki.x-Ki.z))>1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when calculating screen space error.");for(var s=0,a=i.length;s<a;s++){var u=e[s],h=i[s],c=h.frustum,f=h.position,p=n.get(u);0!==p.width&&0!==p.height||console.warn("TilesRenderer: resolution for camera error calculation is not set.");var d=u.projectionMatrix.elements;if(h.isOrthographic=1===d[15],h.isOrthographic){var A=2/d[0],y=2/d[5];h.pixelSize=Math.max(y/p.height,A/p.width)}else h.sseDenominator=2/d[5]/p.height;h.invScale=o,Ji.copy(t.matrixWorld),Ji.premultiply(u.matrixWorldInverse),Ji.premultiply(u.projectionMatrix),c.setFromProjectionMatrix(Ji),f.set(0,0,0),f.applyMatrix4(u.matrixWorld),f.applyMatrix4(Wi)}g(l(r.prototype),"update",this).call(this)}else console.warn("TilesRenderer: no cameras defined. Cannot update 3d tiles.")}},{key:"preprocessNode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;g(l(r.prototype),"preprocessNode",this).call(this,t,e,n);var i=new THREE.Matrix4;if(t.transform)for(var o=t.transform,s=0;s<16;s++)i.elements[s]=o[s];else i.identity();n&&i.premultiply(n.cached.transform);var a=(new THREE.Matrix4).copy(i).invert(),u=new Yi(this.threeLayer,this.heightOffset,this.xOffset,this.yOffset);"sphere"in t.boundingVolume&&u.setSphereData.apply(u,v(t.boundingVolume.sphere).concat([i])),"box"in t.boundingVolume&&u.setObbData(t.boundingVolume.box,i,a),"region"in t.boundingVolume&&u.setRegionData.apply(u,v(t.boundingVolume.region)),t.cached={loadIndex:0,transform:i,transformInverse:a,active:!1,inFrustum:[],boundingVolume:u,scene:null,geometry:null,material:null}}},{key:"parseTile",value:function(t,e,r){var n=this;e._loadIndex=e._loadIndex||0,e._loadIndex++;var i=e.content.uri.split(/[\\\/]/g);i.pop();var o=i.join("/"),s=this.fetchOptions,a=this.manager,u=e._loadIndex,l=null,h=this.rootTileSet.asset&&this.rootTileSet.asset.gltfUpAxis||"y",c=e.cached,f=c.transform,p=c.boundingVolume.scale,g=c.transformInverse,d=new THREE.Matrix4;switch(h.toLowerCase()){case"x":d.makeRotationAxis(ro,-Math.PI/2);break;case"y":d.makeRotationAxis(eo,Math.PI/2);break;case"z":d.identity()}var A=(Re(t)||r).toLowerCase();switch(A){case"b3dm":var y=new br(a);y.workingPath=o,y.fetchOptions=s,y.adjustmentTransform.copy(d),l=y.parse(t);break;case"pnts":var v=new Tr(a);v.workingPath=o,v.fetchOptions=s,l=v.parse(t);break;case"i3dm":var m=new Or(a);m.workingPath=o,m.fetchOptions=s,m.adjustmentTransform.copy(d),l=m.parse(t);break;case"cmpt":var E=new Gr(a);E.workingPath=o,E.fetchOptions=s,E.adjustmentTransform.copy(d),l=E.parse(t).then((function(t){return t.scene}));break;case"gltf":case"glb":var _=new Hr(a);_.workingPath=o,_.fetchOptions=s,l=_.parse(t);break;default:console.warn('TilesRenderer: Content type "'.concat(A,'" not supported.')),l=Promise.resolve(null)}return l.then((function(t){var r,i;if(t.isObject3D?(r=t,i=null):(r=t.scene,i=t),e._loadIndex===u){r.updateMatrix(),"glb"!==A&&"gltf"!==A||r.matrix.multiply(d),r.matrix.premultiply(f);var o=Ri.WGS84.cartesianToCartographic([r.matrix.elements[12],r.matrix.elements[13],r.matrix.elements[14]],Ki),s=n.threeLayer.coordinateToVector3([o.x,o.y],o.z),a=n.threeLayer.distanceToVector3(s.z+n.heightOffset,s.z+n.heightOffset).x;r.matrix.elements[12]=s.x+n.xOffset,r.matrix.elements[13]=s.y+n.yOffset,r.matrix.elements[14]=a,r.matrix.decompose(r.position,r.quaternion,r.scale),g.decompose(Zi,to,$i),r.applyQuaternion(to),r.scale.copy(p),r.traverse((function(t){t[Xi]=t.frustumCulled})),no(r,!n.autoDisableRendererCulling),r.traverse((function(t){t.raycast=n._overridenRaycast}));var l=[],h=[],y=[];r.traverse((function(t){if(t.geometry&&h.push(t.geometry),t.material){var e=t.material;for(var r in l.push(t.material),e){var n=e[r];n&&n.isTexture&&y.push(n)}}})),c.materials=l,c.geometry=h,c.textures=y,c.scene=r,c.metadata=i,n.onLoadModel&&n.onLoadModel(r,e)}}))}},{key:"disposeTile",value:function(t){var e=t.cached;if(e.scene){for(var r=e.materials,n=e.geometry,i=e.textures,o=e.scene.parent,s=0,a=n.length;s<a;s++)n[s].dispose();for(var u=0,l=r.length;u<l;u++)r[u].dispose();for(var h=0,c=i.length;h<c;h++){i[h].dispose()}o&&o.remove(e.scene),this.onDisposeModel&&this.onDisposeModel(e.scene,t),e.scene=null,e.materials=null,e.textures=null,e.geometry=null,e.metadata=null}this.activeTiles.delete(t),this.visibleTiles.delete(t),t._loadIndex++}},{key:"setTileVisible",value:function(t,e){var r=t.cached.scene,n=this.visibleTiles,i=this.group;e?(i.add(r),n.add(t),r.updateMatrixWorld(!0)):(i.remove(r),n.delete(t)),this.onTileVisibilityChange&&this.onTileVisibilityChange(r,t,e)}},{key:"setTileActive",value:function(t,e){var r=this.activeTiles;e?r.add(t):r.delete(t)}},{key:"calculateError",value:function(t){for(var e=t.cached,r=e.inFrustum,n=this.cameras,i=this.cameraInfo,o=e.boundingVolume,s=-1/0,a=1/0,u=0,l=n.length;u<l;u++)if(r[u]){var h=i[u],c=h.invScale,f=void 0;if(h.isOrthographic){var p=h.pixelSize;f=t.geometricError/(p*c)}else{var g=o.distanceToPoint(h.position)*c,d=h.sseDenominator;f=t.geometricError/(g*d),a=Math.min(a,g)}s=Math.max(s,f)}t.__distanceFromCamera=a,t.__error=s}},{key:"tileInView",value:function(t){for(var e=t.cached,r=e.boundingVolume,n=e.inFrustum,i=this.cameraInfo,o=!1,s=0,a=i.length;s<a;s++){var u=i[s].frustum;r.intersectsFrustum(u)?(o=!0,n[s]=!0):n[s]=!1}return o}}]),r}();new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3;new THREE.Sphere,new hn(fe,fe,pe),new THREE.Matrix4,new THREE.Euler;var oo=new WeakMap,so=function(t){u(n,THREE.Loader);var r=f(n);function n(t){var e;return i(this,n),(e=r.call(this,t)).decoderPath="",e.decoderConfig={},e.decoderBinary=null,e.decoderPending=null,e.workerLimit=4,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},e.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},e}return s(n,[{key:"setDecoderPath",value:function(t){return this.decoderPath=t,this}},{key:"setDecoderConfig",value:function(t){return this.decoderConfig=t,this}},{key:"setWorkerLimit",value:function(t){return this.workerLimit=t,this}},{key:"load",value:function(t,e,r,n){var i=this,o=new THREE.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(t){i.decodeDracoFile(t,e).catch(n)}),r,n)}},{key:"decodeDracoFile",value:function(t,e,r,n){var i={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r};return this.decodeGeometry(t,i).then(e)}},{key:"decodeGeometry",value:function(t,e){var r,n=this,i=JSON.stringify(e);if(oo.has(t)){var o=oo.get(t);if(o.key===i)return o.promise;if(0===t.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var s=this.workerNextTaskID++,a=t.byteLength,u=this._getWorker(s,a).then((function(n){return r=n,new Promise((function(n,i){r._callbacks[s]={resolve:n,reject:i},r.postMessage({type:"decode",id:s,taskConfig:e,buffer:t},[t])}))})).then((function(t){return n._createGeometry(t.geometry)}));return u.catch((function(){return!0})).then((function(){r&&s&&n._releaseTask(r,s)})),oo.set(t,{key:i,promise:u}),u}},{key:"_createGeometry",value:function(t){var e=new THREE.BufferGeometry;t.index&&e.setIndex(new THREE.BufferAttribute(t.index.array,1));for(var r=0;r<t.attributes.length;r++){var n=t.attributes[r],i=n.name,o=n.array,s=n.itemSize;e.setAttribute(i,new THREE.BufferAttribute(o,s))}return e}},{key:"_loadLibrary",value:function(t,e){var r=new THREE.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(e),r.setWithCredentials(this.withCredentials),new Promise((function(e,n){r.load(t,e,void 0,n)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var t=this;if(this.decoderPending)return this.decoderPending;var r="object"!==("undefined"==typeof WebAssembly?"undefined":e(WebAssembly))||"js"===this.decoderConfig.type,n=[];return r?n.push(this._loadLibrary("draco_decoder.js","text")):(n.push(this._loadLibrary("draco_wasm_wrapper.js","text")),n.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(n).then((function(e){var n=e[0];r||(t.decoderConfig.wasmBinary=e[1]);var i=ao.toString(),o=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([o]))})),this.decoderPending}},{key:"_getWorker",value:function(t,e){var r=this;return this._initDecoder().then((function(){if(r.workerPool.length<r.workerLimit){var n=new Worker(r.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:r.decoderConfig}),n.onmessage=function(t){var e=t.data;switch(e.type){case"decode":n._callbacks[e.id].resolve(e);break;case"error":n._callbacks[e.id].reject(e);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+e.type+'"')}},r.workerPool.push(n)}else r.workerPool.sort((function(t,e){return t._taskLoad>e._taskLoad?-1:1}));var i=r.workerPool[r.workerPool.length-1];return i._taskCosts[t]=e,i._taskLoad+=e,i}))}},{key:"_releaseTask",value:function(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(t){return t._taskLoad})))}},{key:"dispose",value:function(){for(var t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this}}]),n}();function ao(){var t,e;function r(t,e,r,n,i,o){var s=o.num_components(),a=r.num_points()*s,u=a*i.BYTES_PER_ELEMENT,l=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32}}(t,i),h=t._malloc(u);e.GetAttributeDataArrayForAllPoints(r,o,l,u,h);var c=new i(t.HEAPF32.buffer,h,a).slice();return t._free(h),{name:n,array:c,itemSize:s}}onmessage=function(n){var i=n.data;switch(i.type){case"init":t=i.decoderConfig,e=new Promise((function(e){t.onModuleLoaded=function(t){e({draco:t})},DracoDecoderModule(t)}));break;case"decode":var o=i.buffer,s=i.taskConfig;e.then((function(t){var e=t.draco,n=new e.Decoder,a=new e.DecoderBuffer;a.Init(new Int8Array(o),o.byteLength);try{var u=function(t,e,n,i){var o,s,a=i.attributeIDs,u=i.attributeTypes,l=e.GetEncodedGeometryType(n);if(l===t.TRIANGULAR_MESH)o=new t.Mesh,s=e.DecodeBufferToMesh(n,o);else{if(l!==t.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new t.PointCloud,s=e.DecodeBufferToPointCloud(n,o)}if(!s.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+s.error_msg());var h={index:null,attributes:[]};for(var c in a){var f=self[u[c]],p=void 0,g=void 0;if(i.useUniqueIDs)g=a[c],p=e.GetAttributeByUniqueId(o,g);else{if(-1===(g=e.GetAttributeId(o,t[a[c]])))continue;p=e.GetAttribute(o,g)}h.attributes.push(r(t,e,o,c,f,p))}l===t.TRIANGULAR_MESH&&(h.index=function(t,e,r){var n=r.num_faces(),i=3*n,o=4*i,s=t._malloc(o);e.GetTrianglesUInt32Array(r,o,s);var a=new Uint32Array(t.HEAPF32.buffer,s,i).slice();return t._free(s),{array:a,itemSize:1}}(t,e,o));return t.destroy(o),h}(e,n,a,s),l=u.attributes.map((function(t){return t.array.buffer}));u.index&&l.push(u.index.array.buffer),self.postMessage({type:"decode",id:i.id,geometry:u},l)}catch(t){console.error(t),self.postMessage({type:"error",id:i.id,error:t.message})}finally{e.destroy(a),e.destroy(n)}}))}}}var uo,lo,ho,co=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4;i(this,t),this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}return s(t,[{key:"_initWorker",value:function(t){if(!this.workers[t]){var e=this.workerCreator();e.addEventListener("message",this._onMessage.bind(this,t)),this.workers[t]=e}}},{key:"_getIdleWorker",value:function(){for(var t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1}},{key:"_onMessage",value:function(t,e){var r=this.workersResolve[t];if(r&&r(e),this.queue.length){var n=this.queue.shift(),i=n.resolve,o=n.msg,s=n.transfer;this.workersResolve[t]=i,this.workers[t].postMessage(o,s)}else this.workerStatus^=1<<t}},{key:"setWorkerCreator",value:function(t){this.workerCreator=t}},{key:"setWorkerLimit",value:function(t){this.pool=t}},{key:"postMessage",value:function(t,e){var r=this;return new Promise((function(n){var i=r._getIdleWorker();-1!==i?(r._initWorker(i),r.workerStatus|=1<<i,r.workersResolve[i]=n,r.workers[i].postMessage(t,e)):r.queue.push({resolve:n,msg:t,transfer:e})}))}},{key:"dispose",value:function(){this.workers.forEach((function(t){return t.terminate()})),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}]),t}(),fo=0,po=2,go=s((function t(){i(this,t),this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null})),Ao=function(){function t(e,r,n,o){i(this,t),this._dataView=new DataView(e.buffer,e.byteOffset+r,n),this._littleEndian=o,this._offset=0}return s(t,[{key:"_nextUint8",value:function(){var t=this._dataView.getUint8(this._offset);return this._offset+=1,t}},{key:"_nextUint16",value:function(){var t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}},{key:"_nextUint32",value:function(){var t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}},{key:"_nextUint64",value:function(){var t=this._dataView.getUint32(this._offset,this._littleEndian)+Math.pow(2,32)*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,t}},{key:"_nextInt32",value:function(){var t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}},{key:"_skip",value:function(t){return this._offset+=t,this}},{key:"_scan",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this._offset,n=0;this._dataView.getUint8(this._offset)!==e&&n<t;)n++,this._offset++;return n<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}}]),t}(),yo=[171,75,84,88,32,50,48,187,13,10,26,10];function vo(t){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(t):Buffer.from(t).toString("utf8")}function mo(t){var e=new Uint8Array(t.buffer,t.byteOffset,yo.length);if(e[0]!==yo[0]||e[1]!==yo[1]||e[2]!==yo[2]||e[3]!==yo[3]||e[4]!==yo[4]||e[5]!==yo[5]||e[6]!==yo[6]||e[7]!==yo[7]||e[8]!==yo[8]||e[9]!==yo[9]||e[10]!==yo[10]||e[11]!==yo[11])throw new Error("Missing KTX 2.0 identifier.");var r=new go,n=17*Uint32Array.BYTES_PER_ELEMENT,i=new Ao(t,yo.length,n,!0);r.vkFormat=i._nextUint32(),r.typeSize=i._nextUint32(),r.pixelWidth=i._nextUint32(),r.pixelHeight=i._nextUint32(),r.pixelDepth=i._nextUint32(),r.layerCount=i._nextUint32(),r.faceCount=i._nextUint32();var o=i._nextUint32();r.supercompressionScheme=i._nextUint32();for(var s=i._nextUint32(),a=i._nextUint32(),u=i._nextUint32(),l=i._nextUint32(),h=i._nextUint64(),c=i._nextUint64(),f=new Ao(t,yo.length+n,3*o*8,!0),p=0;p<o;p++)r.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+f._nextUint64(),f._nextUint64()),uncompressedByteLength:f._nextUint64()});for(var g=new Ao(t,s,a,!0),d={vendorId:g._skip(4)._nextUint16(),descriptorType:g._nextUint16(),versionNumber:g._nextUint16(),descriptorBlockSize:g._nextUint16(),colorModel:g._nextUint8(),colorPrimaries:g._nextUint8(),transferFunction:g._nextUint8(),flags:g._nextUint8(),texelBlockDimension:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],bytesPlane:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],samples:[]},A=(d.descriptorBlockSize/4-6)/4,y=0;y<A;y++){var v={bitOffset:g._nextUint16(),bitLength:g._nextUint8(),channelType:g._nextUint8(),samplePosition:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&v.channelType?(v.sampleLower=g._nextInt32(),v.sampleUpper=g._nextInt32()):(v.sampleLower=g._nextUint32(),v.sampleUpper=g._nextUint32()),d.samples[y]=v}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(d);for(var m=new Ao(t,u,l,!0);m._offset<l;){var E=m._nextUint32(),_=m._scan(E),I=vo(_),x=m._scan(E-_.byteLength);r.keyValue[I]=I.match(/^ktx/i)?vo(x):x,m._offset%4&&m._skip(4-m._offset%4)}if(c<=0)return r;for(var C=new Ao(t,h,c,!0),w=C._nextUint16(),b=C._nextUint16(),B=C._nextUint32(),S=C._nextUint32(),T=C._nextUint32(),M=C._nextUint32(),R=[],L=0;L<o;L++)R.push({imageFlags:C._nextUint32(),rgbSliceByteOffset:C._nextUint32(),rgbSliceByteLength:C._nextUint32(),alphaSliceByteOffset:C._nextUint32(),alphaSliceByteLength:C._nextUint32()});var N=h+C._offset,P=N+B,k=P+S,D=k+T,Q=new Uint8Array(t.buffer,t.byteOffset+N,B),O=new Uint8Array(t.buffer,t.byteOffset+P,S),F=new Uint8Array(t.buffer,t.byteOffset+k,T),G=new Uint8Array(t.buffer,t.byteOffset+D,M);return r.globalData={endpointCount:w,selectorCount:b,imageDescs:R,endpointsData:Q,selectorsData:O,tablesData:F,extendedData:G},r}var Eo,_o,Io,xo,Co={env:{emscripten_notify_memory_growth:function(t){ho=new Uint8Array(lo.exports.memory.buffer)}}},wo=function(){function t(){i(this,t)}return s(t,[{key:"init",value:function(){return uo||(uo="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+bo).then((function(t){return t.arrayBuffer()})).then((function(t){return WebAssembly.instantiate(t,Co)})).then(this._init):WebAssembly.instantiate(Buffer.from(bo,"base64"),Co).then(this._init))}},{key:"_init",value:function(t){lo=t.instance,Co.env.emscripten_notify_memory_growth(0)}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!lo)throw new Error("ZSTDDecoder: Await .init() before decoding.");var r=t.byteLength,n=lo.exports.malloc(r);ho.set(t,n),e=e||Number(lo.exports.ZSTD_findDecompressedSize(n,r));var i=lo.exports.malloc(e),o=lo.exports.ZSTD_decompress(i,e,n,r),s=ho.slice(i,i+o);return lo.exports.free(n),lo.exports.free(i),s}}]),t}(),bo="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGA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A0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECEN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oAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVB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ARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAi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wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",Bo=new WeakMap,So=0,To=function(e){u(a,THREE.Loader);var r,o=f(a);function a(t){var e;return i(this,a),(e=o.call(this,t)).transcoderPath="",e.transcoderBinary=null,e.transcoderPending=null,e.workerPool=new co,e.workerSourceURL="",e.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.'),e}return s(a,[{key:"setTranscoderPath",value:function(t){return this.transcoderPath=t,this}},{key:"setWorkerLimit",value:function(t){return this.workerPool.setWorkerLimit(t),this}},{key:"detectSupport",value:function(t){return this.workerConfig={astcSupported:t.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:t.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:t.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:t.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:t.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:t.extensions.has("WEBGL_compressed_texture_pvrtc")||t.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},t.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1),this}},{key:"init",value:function(){var t=this;if(!this.transcoderPending){var e=new THREE.FileLoader(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);var r=e.loadAsync("basis_transcoder.js"),n=new THREE.FileLoader(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);var i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([r,i]).then((function(e){var r=y(e,2),n=r[0],i=r[1],o=a.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(a.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(a.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(a.BasisFormat),"/* basis_transcoder.js */",n,"/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([s])),t.transcoderBinary=i,t.workerPool.setWorkerCreator((function(){var e=new Worker(t.workerSourceURL),r=t.transcoderBinary.slice(0);return e.postMessage({type:"init",config:t.workerConfig,transcoderBinary:r},[r]),e}))})),So>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),So++}return this.transcoderPending}},{key:"load",value:function(t,e,r,n){var i=this;if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");var o=new THREE.FileLoader(this.manager);o.setResponseType("arraybuffer"),o.setWithCredentials(this.withCredentials),o.load(t,(function(t){if(Bo.has(t))return Bo.get(t).promise.then(e).catch(n);i._createTexture(t).then((function(t){return e?e(t):null})).catch(n)}),r,n)}},{key:"_createTextureFrom",value:function(t,e){var r=t.mipmaps,n=t.width,i=t.height,o=t.format,s=t.type,a=t.error,u=t.dfdTransferFn,l=t.dfdFlags;if("error"===s)return Promise.reject(a);var h=e.layerCount>1?new THREE.CompressedArrayTexture(r,n,i,e.layerCount,o,THREE.UnsignedByteType):new THREE.CompressedTexture(r,n,i,o,THREE.UnsignedByteType);return h.minFilter=1===r.length?THREE.LinearFilter:THREE.LinearMipmapLinearFilter,h.magFilter=THREE.LinearFilter,h.generateMipmaps=!1,h.needsUpdate=!0,h.encoding=2===u?THREE.sRGBEncoding:THREE.LinearEncoding,h.premultiplyAlpha=!!(1&l),h}},{key:"_createTexture",value:(r=n(t().mark((function e(r){var n,i,o,s,a=this,u=arguments;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=u.length>1&&void 0!==u[1]?u[1]:{},0===(i=mo(new Uint8Array(r))).vkFormat){t.next=4;break}return t.abrupt("return",No(i));case 4:return o=n,s=this.init().then((function(){return a.workerPool.postMessage({type:"transcode",buffer:r,taskConfig:o},[r])})).then((function(t){return a._createTextureFrom(t.data,i)})),Bo.set(r,{promise:s}),t.abrupt("return",s);case 8:case"end":return t.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"dispose",value:function(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),So--,this}}]),a}();To.BasisFormat={ETC1S:0,UASTC_4x4:1},To.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},To.EngineFormat={RGBAFormat:THREE.RGBAFormat,RGBA_ASTC_4x4_Format:THREE.RGBA_ASTC_4x4_Format,RGBA_BPTC_Format:THREE.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:THREE.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:THREE.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:THREE.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:THREE.RGB_ETC1_Format,RGB_ETC2_Format:THREE.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:THREE.RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format:THREE.RGB_S3TC_DXT1_Format},To.BasisWorker=function(){var t,e,r,n=_EngineFormat,i=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",(function(s){var c,f=s.data;switch(f.type){case"init":t=f.config,c=f.transcoderBinary,e=new Promise((function(t){r={wasmBinary:c,onRuntimeInitialized:t},BASIS(r)})).then((function(){r.initializeBasis(),void 0===r.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}));break;case"transcode":e.then((function(){try{for(var e=function(e){var s=new r.KTX2File(new Uint8Array(e));function c(){s.close(),s.delete()}if(!s.isValid())throw c(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");var f=s.isUASTC()?o.UASTC_4x4:o.ETC1S,p=s.getWidth(),g=s.getHeight(),d=s.getLayers()||1,A=s.getLevels(),y=s.getHasAlpha(),v=s.getDFDTransferFunc(),m=s.getDFDFlags(),E=function(e,r,s,h){for(var c,f,p=e===o.ETC1S?a:u,g=0;g<p.length;g++){var d=p[g];if(t[d.if]&&(d.basisFormat.includes(e)&&!(h&&d.transcoderFormat.length<2)&&(!d.needsPowerOfTwo||l(r)&&l(s))))return{transcoderFormat:c=d.transcoderFormat[h?1:0],engineFormat:f=d.engineFormat[h?1:0]}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),c=i.RGBA32,f=n.RGBAFormat,{transcoderFormat:c,engineFormat:f}}(f,p,g,y),_=E.transcoderFormat,I=E.engineFormat;if(!p||!g||!A)throw c(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!s.startTranscoding())throw c(),new Error("THREE.KTX2Loader: .startTranscoding failed");for(var x=[],C=0;C<A;C++){for(var w=[],b=void 0,B=void 0,S=0;S<d;S++){var T=s.getImageLevelInfo(C,S,0);b=T.origWidth,B=T.origHeight;var M=new Uint8Array(s.getImageTranscodedSizeInBytes(C,S,0,_));if(!s.transcodeImage(M,C,S,0,_,0,-1,-1))throw c(),new Error("THREE.KTX2Loader: .transcodeImage failed.");w.push(M)}x.push({data:h(w),width:b,height:B})}return c(),{width:p,height:g,hasAlpha:y,mipmaps:x,format:I,dfdTransferFn:v,dfdFlags:m}}(f.buffer),s=e.width,c=e.height,p=e.hasAlpha,g=e.mipmaps,d=e.format,A=e.dfdTransferFn,y=e.dfdFlags,v=[],m=0;m<g.length;++m)v.push(g[m].data.buffer);self.postMessage({type:"transcode",id:f.id,width:s,height:c,hasAlpha:p,mipmaps:g,format:d,dfdTransferFn:A,dfdFlags:y},v)}catch(t){console.error(t),self.postMessage({type:"error",id:f.id,error:t.message})}}))}}));var s=[{if:"astcSupported",basisFormat:[o.UASTC_4x4],transcoderFormat:[i.ASTC_4x4,i.ASTC_4x4],engineFormat:[n.RGBA_ASTC_4x4_Format,n.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.BC7_M5,i.BC7_M5],engineFormat:[n.RGBA_BPTC_Format,n.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.BC1,i.BC3],engineFormat:[n.RGB_S3TC_DXT1_Format,n.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.ETC1,i.ETC2],engineFormat:[n.RGB_ETC2_Format,n.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.ETC1],engineFormat:[n.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.PVRTC1_4_RGB,i.PVRTC1_4_RGBA],engineFormat:[n.RGB_PVRTC_4BPPV1_Format,n.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],a=s.sort((function(t,e){return t.priorityETC1S-e.priorityETC1S})),u=s.sort((function(t,e){return t.priorityUASTC-e.priorityUASTC}));function l(t){return t<=2||0==(t&t-1)&&0!==t}function h(t){var e,r=0,n=_(t);try{for(n.s();!(e=n.n()).done;){r+=e.value.byteLength}}catch(t){n.e(t)}finally{n.f()}var i,o=new Uint8Array(r),s=0,a=_(t);try{for(a.s();!(i=a.n()).done;){var u=i.value;o.set(u,s),s+=u.byteLength}}catch(t){a.e(t)}finally{a.f()}return o}};var Mo=(a(Eo={},109,THREE.RGBAFormat),a(Eo,97,THREE.RGBAFormat),a(Eo,37,THREE.RGBAFormat),a(Eo,43,THREE.RGBAFormat),a(Eo,103,THREE.RGFormat),a(Eo,83,THREE.RGFormat),a(Eo,16,THREE.RGFormat),a(Eo,22,THREE.RGFormat),a(Eo,100,THREE.RedFormat),a(Eo,76,THREE.RedFormat),a(Eo,15,THREE.RedFormat),a(Eo,9,THREE.RedFormat),Eo),Ro=(a(_o={},109,THREE.FloatType),a(_o,97,THREE.HalfFloatType),a(_o,37,THREE.UnsignedByteType),a(_o,43,THREE.UnsignedByteType),a(_o,103,THREE.FloatType),a(_o,83,THREE.HalfFloatType),a(_o,16,THREE.UnsignedByteType),a(_o,22,THREE.UnsignedByteType),a(_o,100,THREE.FloatType),a(_o,76,THREE.HalfFloatType),a(_o,15,THREE.UnsignedByteType),a(_o,9,THREE.UnsignedByteType),_o),Lo=(a(Io={},43,THREE.sRGBEncoding),a(Io,22,THREE.sRGBEncoding),a(Io,15,THREE.sRGBEncoding),Io);function No(t){return Po.apply(this,arguments)}function Po(){return Po=n(t().mark((function e(r){var i,o,s,a,u,l,h,c;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=r.vkFormat,o=r.pixelWidth,s=r.pixelHeight,a=r.pixelDepth,void 0!==Mo[i]){e.next=3;break}throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");case 3:if(u=r.levels[0],r.supercompressionScheme!==fo){e.next=8;break}l=u.levelData,e.next=16;break;case 8:if(r.supercompressionScheme!==po){e.next=15;break}return xo||(xo=new Promise(function(){var e=n(t().mark((function e(r){var n;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new wo,t.next=3,n.init();case 3:r(n);case 4:case"end":return t.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())),e.next=12,xo;case 12:l=e.sent.decode(u.levelData,u.uncompressedByteLength),e.next=16;break;case 15:throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");case 16:return h=Ro[i]===THREE.FloatType?new Float32Array(l.buffer,l.byteOffset,l.byteLength/Float32Array.BYTES_PER_ELEMENT):Ro[i]===THREE.HalfFloatType?new Uint16Array(l.buffer,l.byteOffset,l.byteLength/Uint16Array.BYTES_PER_ELEMENT):l,(c=0===a?new THREE.DataTexture(h,o,s):new THREE.Data3DTexture(h,o,s,a)).type=Ro[i],c.format=Mo[i],c.encoding=Lo[i]||THREE.LinearEncoding,c.needsUpdate=!0,e.abrupt("return",Promise.resolve(c));case 23:case"end":return e.stop()}}),e)}))),Po.apply(this,arguments)}var ko={altitude:0},Do=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n){var o;return i(this,r),(o=e.call(this))._initOptions(ko),o.object3d=t,o.object3d.__parent=c(o),o._raycaster=new THREE.Raycaster,o._mouse=new THREE.Vector2,o.camera=n,o.selectMesh=null,o}return s(r,[{key:"getSelectMesh",value:function(){return this.selectMesh}},{key:"identify",value:function(t){var e=this.getMap().coordToContainerPoint(t),r=e.x,n=e.y,i=this._raycaster,o=this._mouse,s=this.camera,a=this.getMap().getSize(),u=a.width,l=a.height;o.x=r/u*2-1,o.y=-n/l*2+1,i.setFromCamera(o,s);var h=i.intersectObject(this.object3d,!0);return h.length?(this.selectMesh=h[0],!0):(this.selectMesh=null,!1)}}]),r}(),Qo=6,Oo=!1,Fo=!1,Go=0,Uo=function(){function t(e,r,n,o){var s=this;i(this,t),this.threelayer=n,this.map=n.map,this.layerClass=o,this.statsUpdate=r.statsUpdate;var a=n.getScene(),u=n.getRenderer().context;u.outputEncoding=THREE.sRGBEncoding;var l=n.getCamera();this.scene=a,this.renderer=u,this.camera=l,this.multiles=[],this.meshs=[];var h=new so;h.setDecoderPath(r.decoderPath);var c=new To;c.setTranscoderPath(r.transcoderPath),c.detectSupport(u),e.forEach((function(t){var e=new io(t.url,n);if(e.errorTarget=Qo,e.displayBoxBounds=Oo,e.displaySphereBounds=Fo,e.colorMode=parseFloat(Go),e.heightOffset=t.heightOffset||0,e.xOffset=t.xOffset||0,e.yOffset=t.yOffset||0,e.setCamera(l),e.setResolutionFromRenderer(l,u),s.multiles.length>0){var r=s.multiles[0];e.lruCache=r.lruCache,e.downloadQueue=r.downloadQueue}e.fetchOptions.mode="cors";var i=new Ne(e.manager);i.setDRACOLoader(h),i.setKTX2Loader(c),e.manager.addHandler(/\.gltf$/,i);var o=new Do(e.group,l);s.meshs.push(o),s.multiles.push(e)})),this.threelayer.addMesh(this.meshs),this.layerClass.updatables.push(this),this._bindMapEvents()}return s(t,[{key:"tick",value:function(t){this.multiles.forEach((function(t){t.update()})),this.statsUpdate&&this.statsUpdate()}},{key:"_bindMapEvents",value:function(){var t=this;this.meshs.forEach((function(e){e.on("click empty mousemove mouseout",t._setPointEvent,t)}))}},{key:"_setPointEvent",value:function(t){var e=t.selectMesh;if("click"===t.type&&e){console.log(e);var r=e.object;if(r.geometry.getAttribute("_batchid")){for(var n=r;!n.batchTable;)n=n.parent;var i=n.batchTable;console.log(i.header)}}}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.threelayer.removeMesh(this.meshs),this.multiles.forEach((function(t){t.dispose()})),this.removeAnimation()}}]),t}(),Ho={radius:100,altitude:0},jo=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),o=maptalks.Util.extend({},Ho,o,{layer:s,coordinate:t}),(a=e.call(this))._initOptions(o);var u=o.altitude;a._createGroup(),a.getObject3d().add(n);var l=s.distanceToVector3(u,u).x,h=s.coordinateToVector3(t,l);return a.getObject3d().position.copy(h),a}return s(r)}(),qo=function(){function e(t,r,n){i(this,e),this.threeLayer=r,this.groupId=n;var o=new THREE.LoadingManager,s=new Ne(o),a=new so(o);a.setDecoderPath(t),s.setDRACOLoader(a),o.addHandler(/\.gltf$/,s),o.addHandler(/\.glb$/,s),this.loader=new Hr(o)}var r;return s(e,[{key:"addModel",value:(r=n(t().mark((function e(r,n,i){var o,s,a=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loader.workingPath=this.loader.workingPathForURL(r),t.next=3,this.loader.load(r);case 3:return o=t.sent,(s=new jo([parseFloat(n.longitude),parseFloat(n.latitude)],o.scene,i,this.threeLayer)).setProperties(n),this.groupId?this.threeLayer.addMesh1(s,this.groupId):this.threeLayer.addMesh(s),this.clickFunc=i.clickFunc,this.model=s,i.zoomChange&&(this.model.zoomChange=function(){i.zoomChange(a.model)}),this._bindMapEvents(),t.abrupt("return",this);case 12:case"end":return t.stop()}}),e,this)}))),function(t,e,n){return r.apply(this,arguments)})},{key:"_bindMapEvents",value:function(){this.model&&this.model.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.model&&this.model.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setPointEvent",value:function(t){var e=t.target.getProperties();"click"===t.type&&e&&this.clickFunc&&this.clickFunc(e)}},{key:"hide",value:function(){this.model.hide()}},{key:"show",value:function(){this.model.show()}},{key:"dispose",value:function(){if(this._closeEvent(),this.model){this.groupId?this.threeLayer.removeMesh1(this.model,this.groupId):this.threeLayer.removeMesh(this.model);var t=this.model.object3d.children[0];t.traverse((function(e){"Mesh"===e.type&&(e.geometry.dispose(),e.material.dispose(),t.remove(e))}))}}}]),e}(),Vo=function(t){u(r,THREE.Group);var e=f(r);function r(t,n){var o;return i(this,r),(o=e.call(this)).name=n,o.customId=B(),t.add(c(o)),o.customType="layer",o}return s(r)}(),zo=function(t){return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};try{URL.revokeObjectURL(zo(""))}catch(t){zo=function(t){return"data:application/javascript;charset=UTF-8,"+encodeURI(t)}}var Yo=Uint8Array,Xo=Uint16Array,Jo=Uint32Array,Wo=new Yo([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,0,0,0]),Ko=new Yo([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,0,0]),Zo=new Yo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$o=function(t,e){for(var r=new Xo(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];var i=new Jo(r[30]);for(n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return[r,i]},ts=$o(Wo,2),es=ts[0],rs=ts[1];es[28]=258,rs[258]=28;for(var ns=$o(Ko,0)[0],is=new Xo(32768),os=0;os<32768;++os){var ss=(43690&os)>>>1|(21845&os)<<1;ss=(61680&(ss=(52428&ss)>>>2|(13107&ss)<<2))>>>4|(3855&ss)<<4,is[os]=((65280&ss)>>>8|(255&ss)<<8)>>>1}var as=function(t,e,r){for(var n=t.length,i=0,o=new Xo(e);i<n;++i)++o[t[i]-1];var s,a=new Xo(e);for(i=0;i<e;++i)a[i]=a[i-1]+o[i-1]<<1;if(r){s=new Xo(1<<e);var u=15-e;for(i=0;i<n;++i)if(t[i])for(var l=i<<4|t[i],h=e-t[i],c=a[t[i]-1]++<<h,f=c|(1<<h)-1;c<=f;++c)s[is[c]>>>u]=l}else for(s=new Xo(n),i=0;i<n;++i)t[i]&&(s[i]=is[a[t[i]-1]++]>>>15-t[i]);return s},us=new Yo(288);for(os=0;os<144;++os)us[os]=8;for(os=144;os<256;++os)us[os]=9;for(os=256;os<280;++os)us[os]=7;for(os=280;os<288;++os)us[os]=8;var ls=new Yo(32);for(os=0;os<32;++os)ls[os]=5;var hs=as(us,9,1),cs=as(ls,5,1),fs=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},ps=function(t,e,r){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(7&e)&r},gs=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(7&e)},ds=function(t){return(t/8|0)+(7&t&&1)},As=function(t,e,r){var n=t.length;if(!n||r&&!r.l&&n<5)return e||new Yo(0);var i=!e||r,o=!r||r.i;r||(r={}),e||(e=new Yo(3*n));var s=function(t){var r=e.length;if(t>r){var n=new Yo(Math.max(2*r,t));n.set(e),e=n}},a=r.f||0,u=r.p||0,l=r.b||0,h=r.l,c=r.d,f=r.m,p=r.n,g=8*n;do{if(!h){r.f=a=ps(t,u,1);var d=ps(t,u+1,3);if(u+=3,!d){var A=t[(B=ds(u)+4)-4]|t[B-3]<<8,y=B+A;if(y>n){if(o)throw"unexpected EOF";break}i&&s(l+A),e.set(t.subarray(B,y),l),r.b=l+=A,r.p=u=8*y;continue}if(1==d)h=hs,c=cs,f=9,p=5;else{if(2!=d)throw"invalid block type";var v=ps(t,u,31)+257,m=ps(t,u+10,15)+4,E=v+ps(t,u+5,31)+1;u+=14;for(var _=new Yo(E),I=new Yo(19),x=0;x<m;++x)I[Zo[x]]=ps(t,u+3*x,7);u+=3*m;var C=fs(I),w=(1<<C)-1,b=as(I,C,1);for(x=0;x<E;){var B,S=b[ps(t,u,w)];if(u+=15&S,(B=S>>>4)<16)_[x++]=B;else{var T=0,M=0;for(16==B?(M=3+ps(t,u,3),u+=2,T=_[x-1]):17==B?(M=3+ps(t,u,7),u+=3):18==B&&(M=11+ps(t,u,127),u+=7);M--;)_[x++]=T}}var R=_.subarray(0,v),L=_.subarray(v);f=fs(R),p=fs(L),h=as(R,f,1),c=as(L,p,1)}if(u>g){if(o)throw"unexpected EOF";break}}i&&s(l+131072);for(var N=(1<<f)-1,P=(1<<p)-1,k=u;;k=u){var D=(T=h[gs(t,u)&N])>>>4;if((u+=15&T)>g){if(o)throw"unexpected EOF";break}if(!T)throw"invalid length/literal";if(D<256)e[l++]=D;else{if(256==D){k=u,h=null;break}var Q=D-254;if(D>264){var O=Wo[x=D-257];Q=ps(t,u,(1<<O)-1)+es[x],u+=O}var F=c[gs(t,u)&P],G=F>>>4;if(!F)throw"invalid distance";u+=15&F;L=ns[G];if(G>3){O=Ko[G];L+=gs(t,u)&(1<<O)-1,u+=O}if(u>g){if(o)throw"unexpected EOF";break}i&&s(l+131072);for(var U=l+Q;l<U;l+=4)e[l]=e[l-L],e[l+1]=e[l+1-L],e[l+2]=e[l+2-L],e[l+3]=e[l+3-L];l=U}}r.l=h,r.p=k,r.b=l,h&&(a=1,r.m=f,r.d=c,r.n=p)}while(!a);return l==e.length?e:function(t,e,r){(null==e||e<0)&&(e=0),(null==r||r>t.length)&&(r=t.length);var n=new(t instanceof Xo?Xo:t instanceof Jo?Jo:Yo)(r-e);return n.set(t.subarray(e,r)),n}(e,0,l)},ys=new Yo(0);var vs="undefined"!=typeof TextDecoder&&new TextDecoder;try{vs.decode(ys,{stream:!0}),1}catch(t){}function ms(t,e,r){var n=r.length-t-1;if(e>=r[n])return n-1;if(e<=r[t])return t;for(var i=t,o=n,s=Math.floor((i+o)/2);e<r[s]||e>=r[s+1];)e<r[s]?o=s:i=s,s=Math.floor((i+o)/2);return s}function Es(t,e){for(var r=1,n=2;n<=t;++n)r*=n;for(var i=1,o=2;o<=e;++o)i*=o;for(var s=2;s<=t-e;++s)i*=s;return r/i}function _s(t,e,r,n,i){var o=function(t,e,r,n,i){for(var o=i<t?i:t,s=[],a=ms(t,n,e),u=function(t,e,r,n,i){for(var o=[],s=0;s<=r;++s)o[s]=0;for(var a=[],u=0;u<=n;++u)a[u]=o.slice(0);for(var l=[],h=0;h<=r;++h)l[h]=o.slice(0);l[0][0]=1;for(var c=o.slice(0),f=o.slice(0),p=1;p<=r;++p){c[p]=e-i[t+1-p],f[p]=i[t+p]-e;for(var g=0,d=0;d<p;++d){var A=f[d+1],y=c[p-d];l[p][d]=A+y;var v=l[d][p-1]/l[p][d];l[d][p]=g+A*v,g=y*v}l[p][p]=g}for(var m=0;m<=r;++m)a[0][m]=l[m][r];for(var E=0;E<=r;++E){for(var _=0,I=1,x=[],C=0;C<=r;++C)x[C]=o.slice(0);x[0][0]=1;for(var w=1;w<=n;++w){var b=0,B=E-w,S=r-w;E>=w&&(x[I][0]=x[_][0]/l[S+1][B],b=x[I][0]*l[B][S]);for(var T=E-1<=S?w-1:r-E,M=B>=-1?1:-B;M<=T;++M)x[I][M]=(x[_][M]-x[_][M-1])/l[S+1][B+M],b+=x[I][M]*l[B+M][S];E<=S&&(x[I][w]=-x[_][w-1]/l[S+1][E],b+=x[I][w]*l[E][S]),a[w][E]=b;var R=_;_=I,I=R}}for(var L=r,N=1;N<=n;++N){for(var P=0;P<=r;++P)a[N][P]*=L;L*=r-N}return a}(a,n,t,o,e),l=[],h=0;h<r.length;++h){var c=r[h].clone(),f=c.w;c.x*=f,c.y*=f,c.z*=f,l[h]=c}for(var p=0;p<=o;++p){for(var g=l[a-t].clone().multiplyScalar(u[p][0]),d=1;d<=t;++d)g.add(l[a-t+d].clone().multiplyScalar(u[p][d]));s[p]=g}for(var A=o+1;A<=i+1;++A)s[A]=new THREE.Vector4(0,0,0);return s}(t,e,r,n,i);return function(t){for(var e=t.length,r=[],n=[],i=0;i<e;++i){var o=t[i];r[i]=new THREE.Vector3(o.x,o.y,o.z),n[i]=o.w}for(var s=[],a=0;a<e;++a){for(var u=r[a].clone(),l=1;l<=a;++l)u.sub(s[a-l].clone().multiplyScalar(Es(a,l)*n[l]));s[a]=u.divideScalar(n[0])}return s}(o)}var Is,xs,Cs,ws=function(t){u(r,THREE.Curve);var e=f(r);function r(t,n,o,s,a){var u;i(this,r),(u=e.call(this)).degree=t,u.knots=n,u.controlPoints=[],u.startKnot=s||0,u.endKnot=a||u.knots.length-1;for(var l=0;l<o.length;++l){var h=o[l];u.controlPoints[l]=new THREE.Vector4(h.x,h.y,h.z,h.w)}return u}return s(r,[{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new THREE.Vector3,r=this.knots[this.startKnot]+t*(this.knots[this.endKnot]-this.knots[this.startKnot]),n=function(t,e,r,n){for(var i=ms(t,n,e),o=function(t,e,r,n){var i=[],o=[],s=[];i[0]=1;for(var a=1;a<=r;++a){o[a]=e-n[t+1-a],s[a]=n[t+a]-e;for(var u=0,l=0;l<a;++l){var h=s[l+1],c=o[a-l],f=i[l]/(h+c);i[l]=u+h*f,u=c*f}i[a]=u}return i}(i,n,t,e),s=new THREE.Vector4(0,0,0,0),a=0;a<=t;++a){var u=r[i-t+a],l=o[a],h=u.w*l;s.x+=u.x*h,s.y+=u.y*h,s.z+=u.z*h,s.w+=u.w*l}return s}(this.degree,this.knots,this.controlPoints,r);return 1!==n.w&&n.divideScalar(n.w),e.set(n.x,n.y,n.z)}},{key:"getTangent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new THREE.Vector3,r=this.knots[0]+t*(this.knots[this.knots.length-1]-this.knots[0]),n=_s(this.degree,this.knots,this.controlPoints,r,1);return e.copy(n[1]).normalize(),e}}]),r}(),bs=function(t){u(r,THREE.Loader);var e=f(r);function r(t){return i(this,r),e.call(this,t)}return s(r,[{key:"load",value:function(t,e,r,n){var i=this,o=""===i.path?THREE.LoaderUtils.extractUrlBase(t):i.path,s=new THREE.FileLoader(this.manager);s.setPath(i.path),s.setResponseType("arraybuffer"),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(t,(function(r){try{e(i.parse(r,o))}catch(e){n?n(e):console.error(e),i.manager.itemError(t)}}),r,n)}},{key:"parse",value:function(t,e){if(function(t){var e="Kaydara FBX Binary \0";return t.byteLength>=e.length&&e===js(t,0,e.length)}(t))Is=(new Rs).parse(t);else{var r=js(t);if(!function(t){var e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0;function n(e){var n=t[e-1];return t=t.slice(r+e),r++,n}for(var i=0;i<e.length;++i){if(n(1)===e[i])return!1}return!0}(r))throw new Error("THREE.FBXLoader: Unknown format.");if(Ps(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Ps(r));Is=(new Ms).parse(r)}var n=new THREE.TextureLoader(this.manager).setPath(this.resourcePath||e).setCrossOrigin(this.crossOrigin);return new Bs(n,this.manager).parse(Is)}}]),r}(),Bs=function(){function t(e,r){i(this,t),this.textureLoader=e,this.manager=r}return s(t,[{key:"parse",value:function(){xs=this.parseConnections();var t=this.parseImages(),e=this.parseTextures(t),r=this.parseMaterials(e),n=this.parseDeformers(),i=(new Ss).parse(n);return this.parseScene(n,i,r),Cs}},{key:"parseConnections",value:function(){var t=new Map;"Connections"in Is&&Is.Connections.connections.forEach((function(e){var r=e[0],n=e[1],i=e[2];t.has(r)||t.set(r,{parents:[],children:[]});var o={ID:n,relationship:i};t.get(r).parents.push(o),t.has(n)||t.set(n,{parents:[],children:[]});var s={ID:r,relationship:i};t.get(n).children.push(s)}));return t}},{key:"parseImages",value:function(){var t={},e={};if("Video"in Is.Objects){var r=Is.Objects.Video;for(var n in r){var i=r[n];if(t[parseInt(n)]=i.RelativeFilename||i.Filename,"Content"in i){var o=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,s="string"==typeof i.Content&&""!==i.Content;if(o||s){var a=this.parseImage(r[n]);e[i.RelativeFilename||i.Filename]=a}}}}for(var u in t){var l=t[u];void 0!==e[l]?t[u]=e[l]:t[u]=t[u].split("\\").pop()}return t}},{key:"parseImage",value:function(t){var e,r=t.Content,n=t.RelativeFilename||t.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":e="image/bmp";break;case"jpg":case"jpeg":e="image/jpeg";break;case"png":e="image/png";break;case"tif":e="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),e="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof r)return"data:"+e+";base64,"+r;var o=new Uint8Array(r);return window.URL.createObjectURL(new Blob([o],{type:e}))}},{key:"parseTextures",value:function(t){var e=new Map;if("Texture"in Is.Objects){var r=Is.Objects.Texture;for(var n in r){var i=this.parseTexture(r[n],t);e.set(parseInt(n),i)}}return e}},{key:"parseTexture",value:function(t,e){var r=this.loadTexture(t,e);r.ID=t.id,r.name=t.attrName;var n=t.WrapModeU,i=t.WrapModeV,o=void 0!==n?n.value:0,s=void 0!==i?i.value:0;if(r.wrapS=0===o?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,r.wrapT=0===s?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,"Scaling"in t){var a=t.Scaling.value;r.repeat.x=a[0],r.repeat.y=a[1]}if("Translation"in t){var u=t.Translation.value;r.offset.x=u[0],r.offset.y=u[1]}return r}},{key:"loadTexture",value:function(t,e){var r,n,i=this.textureLoader.path,o=xs.get(t.id).children;void 0!==o&&o.length>0&&void 0!==e[o[0].ID]&&(0!==(r=e[o[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0));var s=t.FileName.slice(-3).toLowerCase();if("tga"===s){var a=this.manager.getHandler(".tga");null===a?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),n=new THREE.Texture):(a.setPath(this.textureLoader.path),n=a.load(r))}else"psd"===s?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),n=new THREE.Texture):n=this.textureLoader.load(r);return this.textureLoader.setPath(i),n}},{key:"parseMaterials",value:function(t){var e=new Map;if("Material"in Is.Objects){var r=Is.Objects.Material;for(var n in r){var i=this.parseMaterial(r[n],t);null!==i&&e.set(parseInt(n),i)}}return e}},{key:"parseMaterial",value:function(t,r){var n=t.id,i=t.attrName,o=t.ShadingModel;if("object"===e(o)&&(o=o.value),!xs.has(n))return null;var s,a=this.parseParameters(t,r,n);switch(o.toLowerCase()){case"phong":s=new THREE.MeshPhongMaterial;break;case"lambert":s=new THREE.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),s=new THREE.MeshPhongMaterial}return s.setValues(a),s.name=i,s}},{key:"parseParameters",value:function(t,e,r){var n={};t.BumpFactor&&(n.bumpScale=t.BumpFactor.value),t.Diffuse?n.color=(new THREE.Color).fromArray(t.Diffuse.value):!t.DiffuseColor||"Color"!==t.DiffuseColor.type&&"ColorRGB"!==t.DiffuseColor.type||(n.color=(new THREE.Color).fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(n.displacementScale=t.DisplacementFactor.value),t.Emissive?n.emissive=(new THREE.Color).fromArray(t.Emissive.value):!t.EmissiveColor||"Color"!==t.EmissiveColor.type&&"ColorRGB"!==t.EmissiveColor.type||(n.emissive=(new THREE.Color).fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(n.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(n.opacity=parseFloat(t.Opacity.value)),n.opacity<1&&(n.transparent=!0),t.ReflectionFactor&&(n.reflectivity=t.ReflectionFactor.value),t.Shininess&&(n.shininess=t.Shininess.value),t.Specular?n.specular=(new THREE.Color).fromArray(t.Specular.value):t.SpecularColor&&"Color"===t.SpecularColor.type&&(n.specular=(new THREE.Color).fromArray(t.SpecularColor.value));var i=this;return xs.get(r).children.forEach((function(t){var r=t.relationship;switch(r){case"Bump":n.bumpMap=i.getTexture(e,t.ID);break;case"Maya|TEX_ao_map":n.aoMap=i.getTexture(e,t.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=i.getTexture(e,t.ID),void 0!==n.map&&(n.map.encoding=THREE.sRGBEncoding);break;case"DisplacementColor":n.displacementMap=i.getTexture(e,t.ID);break;case"EmissiveColor":n.emissiveMap=i.getTexture(e,t.ID),void 0!==n.emissiveMap&&(n.emissiveMap.encoding=THREE.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=i.getTexture(e,t.ID);break;case"ReflectionColor":n.envMap=i.getTexture(e,t.ID),void 0!==n.envMap&&(n.envMap.mapping=THREE.EquirectangularReflectionMapping,n.envMap.encoding=THREE.sRGBEncoding);break;case"SpecularColor":n.specularMap=i.getTexture(e,t.ID),void 0!==n.specularMap&&(n.specularMap.encoding=THREE.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=i.getTexture(e,t.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),n}},{key:"getTexture",value:function(t,e){return"LayeredTexture"in Is.Objects&&e in Is.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),e=xs.get(e).children[0].ID),t.get(e)}},{key:"parseDeformers",value:function(){var t={},e={};if("Deformer"in Is.Objects){var r=Is.Objects.Deformer;for(var n in r){var i=r[n],o=xs.get(parseInt(n));if("Skin"===i.attrType){var s=this.parseSkeleton(o,r);s.ID=n,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),s.geometryID=o.parents[0].ID,t[n]=s}else if("BlendShape"===i.attrType){var a={id:n};a.rawTargets=this.parseMorphTargets(o,r),a.id=n,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),e[n]=a}}}return{skeletons:t,morphTargets:e}}},{key:"parseSkeleton",value:function(t,e){var r=[];return t.children.forEach((function(t){var n=e[t.ID];if("Cluster"===n.attrType){var i={ID:t.ID,indices:[],weights:[],transformLink:(new THREE.Matrix4).fromArray(n.TransformLink.a)};"Indexes"in n&&(i.indices=n.Indexes.a,i.weights=n.Weights.a),r.push(i)}})),{rawBones:r,bones:[]}}},{key:"parseMorphTargets",value:function(t,e){for(var r=[],n=0;n<t.children.length;n++){var i=t.children[n],o=e[i.ID],s={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if("BlendShapeChannel"!==o.attrType)return;s.geoID=xs.get(parseInt(i.ID)).children.filter((function(t){return void 0===t.relationship}))[0].ID,r.push(s)}return r}},{key:"parseScene",value:function(t,e,r){Cs=new THREE.Group;var n=this.parseModels(t.skeletons,e,r),i=Is.Objects.Model,o=this;n.forEach((function(t){var e=i[t.ID];o.setLookAtProperties(t,e),xs.get(t.ID).parents.forEach((function(e){var r=n.get(e.ID);void 0!==r&&r.add(t)})),null===t.parent&&Cs.add(t)})),this.bindSkeleton(t.skeletons,e,n),this.createAmbientLight(),Cs.traverse((function(t){if(t.userData.transformData){t.parent&&(t.userData.transformData.parentMatrix=t.parent.matrix,t.userData.transformData.parentMatrixWorld=t.parent.matrixWorld);var e=Gs(t.userData.transformData);t.applyMatrix4(e),t.updateWorldMatrix()}}));var s=(new Ts).parse();1===Cs.children.length&&Cs.children[0].isGroup&&(Cs.children[0].animations=s,Cs=Cs.children[0]),Cs.animations=s}},{key:"parseModels",value:function(t,e,r){var n=new Map,i=Is.Objects.Model;for(var o in i){var s=parseInt(o),a=i[o],u=xs.get(s),l=this.buildSkeleton(u,t,s,a.attrName);if(!l){switch(a.attrType){case"Camera":l=this.createCamera(u);break;case"Light":l=this.createLight(u);break;case"Mesh":l=this.createMesh(u,e,r);break;case"NurbsCurve":l=this.createCurve(u,e);break;case"LimbNode":case"Root":l=new THREE.Bone;break;default:l=new THREE.Group}l.name=a.attrName?THREE.PropertyBinding.sanitizeNodeName(a.attrName):"",l.ID=s}this.getTransformData(l,a),n.set(s,l)}return n}},{key:"buildSkeleton",value:function(t,e,r,n){var i=null;return t.parents.forEach((function(t){var o=function(){var o=e[s];o.rawBones.forEach((function(e,s){if(e.ID===t.ID){var a=i;(i=new THREE.Bone).matrixWorld.copy(e.transformLink),i.name=n?THREE.PropertyBinding.sanitizeNodeName(n):"",i.ID=r,o.bones[s]=i,null!==a&&i.add(a)}}))};for(var s in e)o()})),i}},{key:"createCamera",value:function(t){var e,r;if(t.children.forEach((function(t){var e=Is.Objects.NodeAttribute[t.ID];void 0!==e&&(r=e)})),void 0===r)e=new THREE.Object3D;else{var n=0;void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(n=1);var i=1;void 0!==r.NearPlane&&(i=r.NearPlane.value/1e3);var o=1e3;void 0!==r.FarPlane&&(o=r.FarPlane.value/1e3);var s=window.innerWidth,a=window.innerHeight;void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(s=r.AspectWidth.value,a=r.AspectHeight.value);var u=s/a,l=45;void 0!==r.FieldOfView&&(l=r.FieldOfView.value);var h=r.FocalLength?r.FocalLength.value:null;switch(n){case 0:e=new THREE.PerspectiveCamera(l,u,i,o),null!==h&&e.setFocalLength(h);break;case 1:e=new THREE.OrthographicCamera(-s/2,s/2,a/2,-a/2,i,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),e=new THREE.Object3D}}return e}},{key:"createLight",value:function(t){var e,r;if(t.children.forEach((function(t){var e=Is.Objects.NodeAttribute[t.ID];void 0!==e&&(r=e)})),void 0===r)e=new THREE.Object3D;else{var n;n=void 0===r.LightType?0:r.LightType.value;var i=16777215;void 0!==r.Color&&(i=(new THREE.Color).fromArray(r.Color.value));var o=void 0===r.Intensity?1:r.Intensity.value/100;void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(o=0);var s=0;void 0!==r.FarAttenuationEnd&&(s=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value);switch(n){case 0:e=new THREE.PointLight(i,o,s,1);break;case 1:e=new THREE.DirectionalLight(i,o);break;case 2:var a=Math.PI/3;void 0!==r.InnerAngle&&(a=THREE.MathUtils.degToRad(r.InnerAngle.value));var u=0;void 0!==r.OuterAngle&&(u=THREE.MathUtils.degToRad(r.OuterAngle.value),u=Math.max(u,1)),e=new THREE.SpotLight(i,o,s,a,u,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),e=new THREE.PointLight(i,o)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(e.castShadow=!0)}return e}},{key:"createMesh",value:function(t,e,r){var n,i=null,o=null,s=[];return t.children.forEach((function(t){e.has(t.ID)&&(i=e.get(t.ID)),r.has(t.ID)&&s.push(r.get(t.ID))})),s.length>1?o=s:s.length>0?o=s[0]:(o=new THREE.MeshPhongMaterial({color:13421772}),s.push(o)),"color"in i.attributes&&s.forEach((function(t){t.vertexColors=!0})),i.FBX_Deformer?(n=new THREE.SkinnedMesh(i,o)).normalizeSkinWeights():n=new THREE.Mesh(i,o),n}},{key:"createCurve",value:function(t,e){var r=t.children.reduce((function(t,r){return e.has(r.ID)&&(t=e.get(r.ID)),t}),null),n=new THREE.LineBasicMaterial({color:3342591,linewidth:1});return new THREE.Line(r,n)}},{key:"getTransformData",value:function(t,e){var r={};"InheritType"in e&&(r.inheritType=parseInt(e.InheritType.value)),r.eulerOrder="RotationOrder"in e?Us(e.RotationOrder.value):"ZYX","Lcl_Translation"in e&&(r.translation=e.Lcl_Translation.value),"PreRotation"in e&&(r.preRotation=e.PreRotation.value),"Lcl_Rotation"in e&&(r.rotation=e.Lcl_Rotation.value),"PostRotation"in e&&(r.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(r.scale=e.Lcl_Scaling.value),"ScalingOffset"in e&&(r.scalingOffset=e.ScalingOffset.value),"ScalingPivot"in e&&(r.scalingPivot=e.ScalingPivot.value),"RotationOffset"in e&&(r.rotationOffset=e.RotationOffset.value),"RotationPivot"in e&&(r.rotationPivot=e.RotationPivot.value),t.userData.transformData=r}},{key:"setLookAtProperties",value:function(t,e){"LookAtProperty"in e&&xs.get(t.ID).children.forEach((function(e){if("LookAtProperty"===e.relationship){var r=Is.Objects.Model[e.ID];if("Lcl_Translation"in r){var n=r.Lcl_Translation.value;void 0!==t.target?(t.target.position.fromArray(n),Cs.add(t.target)):t.lookAt((new THREE.Vector3).fromArray(n))}}}))}},{key:"bindSkeleton",value:function(t,e,r){var n=this.parsePoseNodes(),i=function(){var i=t[o];xs.get(parseInt(i.ID)).parents.forEach((function(t){if(e.has(t.ID)){var o=t.ID;xs.get(o).parents.forEach((function(t){r.has(t.ID)&&r.get(t.ID).bind(new THREE.Skeleton(i.bones),n[t.ID])}))}}))};for(var o in t)i()}},{key:"parsePoseNodes",value:function(){var t={};if("Pose"in Is.Objects){var e=Is.Objects.Pose;for(var r in e)if("BindPose"===e[r].attrType&&e[r].NbPoseNodes>0){var n=e[r].PoseNode;Array.isArray(n)?n.forEach((function(e){t[e.Node]=(new THREE.Matrix4).fromArray(e.Matrix.a)})):t[n.Node]=(new THREE.Matrix4).fromArray(n.Matrix.a)}}return t}},{key:"createAmbientLight",value:function(){if("GlobalSettings"in Is&&"AmbientColor"in Is.GlobalSettings){var t=Is.GlobalSettings.AmbientColor.value,e=t[0],r=t[1],n=t[2];if(0!==e||0!==r||0!==n){var i=new THREE.Color(e,r,n);Cs.add(new THREE.AmbientLight(i,1))}}}}]),t}(),Ss=function(){function t(){i(this,t),this.negativeMaterialIndices=!1}return s(t,[{key:"parse",value:function(t){var e=new Map;if("Geometry"in Is.Objects){var r=Is.Objects.Geometry;for(var n in r){var i=xs.get(parseInt(n)),o=this.parseGeometry(i,r[n],t);e.set(parseInt(n),o)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),e}},{key:"parseGeometry",value:function(t,e,r){switch(e.attrType){case"Mesh":return this.parseMeshGeometry(t,e,r);case"NurbsCurve":return this.parseNurbsGeometry(e)}}},{key:"parseMeshGeometry",value:function(t,e,r){var n=r.skeletons,i=[],o=t.parents.map((function(t){return Is.Objects.Model[t.ID]}));if(0!==o.length){var s=t.children.reduce((function(t,e){return void 0!==n[e.ID]&&(t=n[e.ID]),t}),null);t.children.forEach((function(t){void 0!==r.morphTargets[t.ID]&&i.push(r.morphTargets[t.ID])}));var a=o[0],u={};"RotationOrder"in a&&(u.eulerOrder=Us(a.RotationOrder.value)),"InheritType"in a&&(u.inheritType=parseInt(a.InheritType.value)),"GeometricTranslation"in a&&(u.translation=a.GeometricTranslation.value),"GeometricRotation"in a&&(u.rotation=a.GeometricRotation.value),"GeometricScaling"in a&&(u.scale=a.GeometricScaling.value);var l=Gs(u);return this.genGeometry(e,s,i,l)}}},{key:"genGeometry",value:function(t,e,r,n){var i=new THREE.BufferGeometry;t.attrName&&(i.name=t.attrName);var o=this.parseGeoNode(t,e),s=this.genBuffers(o),a=new THREE.Float32BufferAttribute(s.vertex,3);if(a.applyMatrix4(n),i.setAttribute("position",a),s.colors.length>0&&i.setAttribute("color",new THREE.Float32BufferAttribute(s.colors,3)),e&&(i.setAttribute("skinIndex",new THREE.Uint16BufferAttribute(s.weightsIndices,4)),i.setAttribute("skinWeight",new THREE.Float32BufferAttribute(s.vertexWeights,4)),i.FBX_Deformer=e),s.normal.length>0){var u=(new THREE.Matrix3).getNormalMatrix(n),l=new THREE.Float32BufferAttribute(s.normal,3);l.applyNormalMatrix(u),i.setAttribute("normal",l)}if(s.uvs.forEach((function(t,e){var r="uv"+(e+1).toString();0===e&&(r="uv"),i.setAttribute(r,new THREE.Float32BufferAttribute(s.uvs[e],2))})),o.material&&"AllSame"!==o.material.mappingType){var h=s.materialIndex[0],c=0;if(s.materialIndex.forEach((function(t,e){t!==h&&(i.addGroup(c,e-c,h),h=t,c=e)})),i.groups.length>0){var f=i.groups[i.groups.length-1],p=f.start+f.count;p!==s.materialIndex.length&&i.addGroup(p,s.materialIndex.length-p,h)}0===i.groups.length&&i.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(i,t,r,n),i}},{key:"parseGeoNode",value:function(t,e){var r={};if(r.vertexPositions=void 0!==t.Vertices?t.Vertices.a:[],r.vertexIndices=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(r.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(r.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(r.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){r.uv=[];for(var n=0;t.LayerElementUV[n];)t.LayerElementUV[n].UV&&r.uv.push(this.parseUVs(t.LayerElementUV[n])),n++}return r.weightTable={},null!==e&&(r.skeleton=e,e.rawBones.forEach((function(t,e){t.indices.forEach((function(n,i){void 0===r.weightTable[n]&&(r.weightTable[n]=[]),r.weightTable[n].push({id:e,weight:t.weights[i]})}))}))),r}},{key:"genBuffers",value:function(t){var e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,n=0,i=!1,o=[],s=[],a=[],u=[],l=[],h=[],c=this;return t.vertexIndices.forEach((function(f,p){var g,d=!1;f<0&&(f^=-1,d=!0);var A=[],y=[];if(o.push(3*f,3*f+1,3*f+2),t.color){var v=Qs(p,r,f,t.color);a.push(v[0],v[1],v[2])}if(t.skeleton){if(void 0!==t.weightTable[f]&&t.weightTable[f].forEach((function(t){y.push(t.weight),A.push(t.id)})),y.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);var m=[0,0,0,0],E=[0,0,0,0];y.forEach((function(t,e){var r=t,n=A[e];E.forEach((function(t,e,i){if(r>t){i[e]=r,r=t;var o=m[e];m[e]=n,n=o}}))})),A=m,y=E}for(;y.length<4;)y.push(0),A.push(0);for(var _=0;_<4;++_)l.push(y[_]),h.push(A[_])}if(t.normal){var I=Qs(p,r,f,t.normal);s.push(I[0],I[1],I[2])}t.material&&"AllSame"!==t.material.mappingType&&(g=Qs(p,r,f,t.material)[0])<0&&(c.negativeMaterialIndices=!0,g=0),t.uv&&t.uv.forEach((function(t,e){var n=Qs(p,r,f,t);void 0===u[e]&&(u[e]=[]),u[e].push(n[0]),u[e].push(n[1])})),n++,d&&(n>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),c.genFace(e,t,o,g,s,a,u,l,h,n),r++,n=0,o=[],s=[],a=[],u=[],l=[],h=[])})),e}},{key:"genFace",value:function(t,e,r,n,i,o,s,a,u,l){for(var h=function(l){t.vertex.push(e.vertexPositions[r[0]]),t.vertex.push(e.vertexPositions[r[1]]),t.vertex.push(e.vertexPositions[r[2]]),t.vertex.push(e.vertexPositions[r[3*(l-1)]]),t.vertex.push(e.vertexPositions[r[3*(l-1)+1]]),t.vertex.push(e.vertexPositions[r[3*(l-1)+2]]),t.vertex.push(e.vertexPositions[r[3*l]]),t.vertex.push(e.vertexPositions[r[3*l+1]]),t.vertex.push(e.vertexPositions[r[3*l+2]]),e.skeleton&&(t.vertexWeights.push(a[0]),t.vertexWeights.push(a[1]),t.vertexWeights.push(a[2]),t.vertexWeights.push(a[3]),t.vertexWeights.push(a[4*(l-1)]),t.vertexWeights.push(a[4*(l-1)+1]),t.vertexWeights.push(a[4*(l-1)+2]),t.vertexWeights.push(a[4*(l-1)+3]),t.vertexWeights.push(a[4*l]),t.vertexWeights.push(a[4*l+1]),t.vertexWeights.push(a[4*l+2]),t.vertexWeights.push(a[4*l+3]),t.weightsIndices.push(u[0]),t.weightsIndices.push(u[1]),t.weightsIndices.push(u[2]),t.weightsIndices.push(u[3]),t.weightsIndices.push(u[4*(l-1)]),t.weightsIndices.push(u[4*(l-1)+1]),t.weightsIndices.push(u[4*(l-1)+2]),t.weightsIndices.push(u[4*(l-1)+3]),t.weightsIndices.push(u[4*l]),t.weightsIndices.push(u[4*l+1]),t.weightsIndices.push(u[4*l+2]),t.weightsIndices.push(u[4*l+3])),e.color&&(t.colors.push(o[0]),t.colors.push(o[1]),t.colors.push(o[2]),t.colors.push(o[3*(l-1)]),t.colors.push(o[3*(l-1)+1]),t.colors.push(o[3*(l-1)+2]),t.colors.push(o[3*l]),t.colors.push(o[3*l+1]),t.colors.push(o[3*l+2])),e.material&&"AllSame"!==e.material.mappingType&&(t.materialIndex.push(n),t.materialIndex.push(n),t.materialIndex.push(n)),e.normal&&(t.normal.push(i[0]),t.normal.push(i[1]),t.normal.push(i[2]),t.normal.push(i[3*(l-1)]),t.normal.push(i[3*(l-1)+1]),t.normal.push(i[3*(l-1)+2]),t.normal.push(i[3*l]),t.normal.push(i[3*l+1]),t.normal.push(i[3*l+2])),e.uv&&e.uv.forEach((function(e,r){void 0===t.uvs[r]&&(t.uvs[r]=[]),t.uvs[r].push(s[r][0]),t.uvs[r].push(s[r][1]),t.uvs[r].push(s[r][2*(l-1)]),t.uvs[r].push(s[r][2*(l-1)+1]),t.uvs[r].push(s[r][2*l]),t.uvs[r].push(s[r][2*l+1])}))},c=2;c<l;c++)h(c)}},{key:"addMorphTargets",value:function(t,e,r,n){if(0!==r.length){t.morphTargetsRelative=!0,t.morphAttributes.position=[];var i=this;r.forEach((function(r){r.rawTargets.forEach((function(r){var o=Is.Objects.Geometry[r.geoID];void 0!==o&&i.genMorphGeometry(t,e,o,n,r.name)}))}))}}},{key:"genMorphGeometry",value:function(t,e,r,n,i){for(var o=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],s=void 0!==r.Vertices?r.Vertices.a:[],a=void 0!==r.Indexes?r.Indexes.a:[],u=3*t.attributes.position.count,l=new Float32Array(u),h=0;h<a.length;h++){var c=3*a[h];l[c]=s[3*h],l[c+1]=s[3*h+1],l[c+2]=s[3*h+2]}var f={vertexIndices:o,vertexPositions:l},p=this.genBuffers(f),g=new THREE.Float32BufferAttribute(p.vertex,3);g.name=i||r.attrName,g.applyMatrix4(n),t.morphAttributes.position.push(g)}},{key:"parseNormals",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,n=t.Normals.a,i=[];return"IndexToDirect"===r&&("NormalIndex"in t?i=t.NormalIndex.a:"NormalsIndex"in t&&(i=t.NormalsIndex.a)),{dataSize:3,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseUVs",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,n=t.UV.a,i=[];return"IndexToDirect"===r&&(i=t.UVIndex.a),{dataSize:2,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseVertexColors",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType,n=t.Colors.a,i=[];return"IndexToDirect"===r&&(i=t.ColorIndex.a),{dataSize:4,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseMaterialIndices",value:function(t){var e=t.MappingInformationType,r=t.ReferenceInformationType;if("NoMappingInformation"===e)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=t.Materials.a,i=[],o=0;o<n.length;++o)i.push(o);return{dataSize:1,buffer:n,indices:i,mappingType:e,referenceType:r}}},{key:"parseNurbsGeometry",value:function(t){var e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new THREE.BufferGeometry;for(var r,n,i=e-1,o=t.KnotVector.a,s=[],a=t.Points.a,u=0,l=a.length;u<l;u+=4)s.push((new THREE.Vector4).fromArray(a,u));if("Closed"===t.Form)s.push(s[0]);else if("Periodic"===t.Form){r=i,n=o.length-1-r;for(var h=0;h<i;++h)s.push(s[h])}var c=new ws(i,o,s,r,n).getPoints(12*s.length);return(new THREE.BufferGeometry).setFromPoints(c)}}]),t}(),Ts=function(){function t(){i(this,t)}return s(t,[{key:"parse",value:function(){var t=[],e=this.parseClips();if(void 0!==e)for(var r in e){var n=e[r],i=this.addClip(n);t.push(i)}return t}},{key:"parseClips",value:function(){if(void 0!==Is.Objects.AnimationCurve){var t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);var e=this.parseAnimationLayers(t);return this.parseAnimStacks(e)}}},{key:"parseAnimationCurveNodes",value:function(){var t=Is.Objects.AnimationCurveNode,e=new Map;for(var r in t){var n=t[r];if(null!==n.attrName.match(/S|R|T|DeformPercent/)){var i={id:n.id,attr:n.attrName,curves:{}};e.set(i.id,i)}}return e}},{key:"parseAnimationCurves",value:function(t){var e=Is.Objects.AnimationCurve;for(var r in e){var n={id:e[r].id,times:e[r].KeyTime.a.map(ks),values:e[r].KeyValueFloat.a},i=xs.get(n.id);if(void 0!==i){var o=i.parents[0].ID,s=i.parents[0].relationship;s.match(/X/)?t.get(o).curves.x=n:s.match(/Y/)?t.get(o).curves.y=n:s.match(/Z/)?t.get(o).curves.z=n:s.match(/d|DeformPercent/)&&t.has(o)&&(t.get(o).curves.morph=n)}}}},{key:"parseAnimationLayers",value:function(t){var e=Is.Objects.AnimationLayer,r=new Map,n=function(){var e=[],n=xs.get(parseInt(i));void 0!==n&&(n.children.forEach((function(r,n){if(t.has(r.ID)){var i=t.get(r.ID);if(void 0!==i.curves.x||void 0!==i.curves.y||void 0!==i.curves.z){if(void 0===e[n]){var o=xs.get(r.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID;if(void 0!==o){var s=Is.Objects.Model[o.toString()];if(void 0===s)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",r);var a={modelName:s.attrName?THREE.PropertyBinding.sanitizeNodeName(s.attrName):"",ID:s.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Cs.traverse((function(t){t.ID===s.id&&(a.transform=t.matrix,t.userData.transformData&&(a.eulerOrder=t.userData.transformData.eulerOrder))})),a.transform||(a.transform=new THREE.Matrix4),"PreRotation"in s&&(a.preRotation=s.PreRotation.value),"PostRotation"in s&&(a.postRotation=s.PostRotation.value),e[n]=a}}e[n]&&(e[n][i.attr]=i)}else if(void 0!==i.curves.morph){if(void 0===e[n]){var u=xs.get(r.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID,l=xs.get(u).parents[0].ID,h=xs.get(l).parents[0].ID,c=xs.get(h).parents[0].ID,f=Is.Objects.Model[c],p={modelName:f.attrName?THREE.PropertyBinding.sanitizeNodeName(f.attrName):"",morphName:Is.Objects.Deformer[u].attrName};e[n]=p}e[n][i.attr]=i}}})),r.set(parseInt(i),e))};for(var i in e)n();return r}},{key:"parseAnimStacks",value:function(t){var e=Is.Objects.AnimationStack,r={};for(var n in e){var i=xs.get(parseInt(n)).children;i.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var o=t.get(i[0].ID);r[n]={name:e[n].attrName,layer:o}}return r}},{key:"addClip",value:function(t){var e=[],r=this;return t.layer.forEach((function(t){e=e.concat(r.generateTracks(t))})),new THREE.AnimationClip(t.name,-1,e)}},{key:"generateTracks",value:function(t){var e=[],r=new THREE.Vector3,n=new THREE.Quaternion,i=new THREE.Vector3;if(t.transform&&t.transform.decompose(r,n,i),r=r.toArray(),n=(new THREE.Euler).setFromQuaternion(n,t.eulerOrder).toArray(),i=i.toArray(),void 0!==t.T&&Object.keys(t.T.curves).length>0){var o=this.generateVectorTrack(t.modelName,t.T.curves,r,"position");void 0!==o&&e.push(o)}if(void 0!==t.R&&Object.keys(t.R.curves).length>0){var s=this.generateRotationTrack(t.modelName,t.R.curves,n,t.preRotation,t.postRotation,t.eulerOrder);void 0!==s&&e.push(s)}if(void 0!==t.S&&Object.keys(t.S.curves).length>0){var a=this.generateVectorTrack(t.modelName,t.S.curves,i,"scale");void 0!==a&&e.push(a)}if(void 0!==t.DeformPercent){var u=this.generateMorphTrack(t);void 0!==u&&e.push(u)}return e}},{key:"generateVectorTrack",value:function(t,e,r,n){var i=this.getTimesForAllAxes(e),o=this.getKeyframeTrackValues(i,e,r);return new THREE.VectorKeyframeTrack(t+"."+n,i,o)}},{key:"generateRotationTrack",value:function(t,e,r,n,i,o){void 0!==e.x&&(this.interpolateRotations(e.x),e.x.values=e.x.values.map(THREE.MathUtils.degToRad)),void 0!==e.y&&(this.interpolateRotations(e.y),e.y.values=e.y.values.map(THREE.MathUtils.degToRad)),void 0!==e.z&&(this.interpolateRotations(e.z),e.z.values=e.z.values.map(THREE.MathUtils.degToRad));var s=this.getTimesForAllAxes(e),a=this.getKeyframeTrackValues(s,e,r);void 0!==n&&((n=n.map(THREE.MathUtils.degToRad)).push(o),n=(new THREE.Euler).fromArray(n),n=(new THREE.Quaternion).setFromEuler(n)),void 0!==i&&((i=i.map(THREE.MathUtils.degToRad)).push(o),i=(new THREE.Euler).fromArray(i),i=(new THREE.Quaternion).setFromEuler(i).invert());for(var u=new THREE.Quaternion,l=new THREE.Euler,h=[],c=0;c<a.length;c+=3)l.set(a[c],a[c+1],a[c+2],o),u.setFromEuler(l),void 0!==n&&u.premultiply(n),void 0!==i&&u.multiply(i),u.toArray(h,c/3*4);return new THREE.QuaternionKeyframeTrack(t+".quaternion",s,h)}},{key:"generateMorphTrack",value:function(t){var e=t.DeformPercent.curves.morph,r=e.values.map((function(t){return t/100})),n=Cs.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new THREE.NumberKeyframeTrack(t.modelName+".morphTargetInfluences["+n+"]",e.times,r)}},{key:"getTimesForAllAxes",value:function(t){var e=[];if(void 0!==t.x&&(e=e.concat(t.x.times)),void 0!==t.y&&(e=e.concat(t.y.times)),void 0!==t.z&&(e=e.concat(t.z.times)),(e=e.sort((function(t,e){return t-e}))).length>1){for(var r=1,n=e[0],i=1;i<e.length;i++){var o=e[i];o!==n&&(e[r]=o,n=o,r++)}e=e.slice(0,r)}return e}},{key:"getKeyframeTrackValues",value:function(t,e,r){var n=r,i=[],o=-1,s=-1,a=-1;return t.forEach((function(t){if(e.x&&(o=e.x.times.indexOf(t)),e.y&&(s=e.y.times.indexOf(t)),e.z&&(a=e.z.times.indexOf(t)),-1!==o){var r=e.x.values[o];i.push(r),n[0]=r}else i.push(n[0]);if(-1!==s){var u=e.y.values[s];i.push(u),n[1]=u}else i.push(n[1]);if(-1!==a){var l=e.z.values[a];i.push(l),n[2]=l}else i.push(n[2])})),i}},{key:"interpolateRotations",value:function(t){for(var e=1;e<t.values.length;e++){var r=t.values[e-1],n=t.values[e]-r,i=Math.abs(n);if(i>=180){for(var o=i/180,s=n/o,a=r+s,u=t.times[e-1],l=(t.times[e]-u)/o,h=u+l,c=[],f=[];h<t.times[e];)c.push(h),h+=l,f.push(a),a+=s;t.times=qs(t.times,e,c),t.values=qs(t.values,e,f)}}}}]),t}(),Ms=function(){function t(){i(this,t)}return s(t,[{key:"getPrevNode",value:function(){return this.nodeStack[this.currentIndent-2]}},{key:"getCurrentNode",value:function(){return this.nodeStack[this.currentIndent-1]}},{key:"getCurrentProp",value:function(){return this.currentProp}},{key:"pushStack",value:function(t){this.nodeStack.push(t),this.currentIndent+=1}},{key:"popStack",value:function(){this.nodeStack.pop(),this.currentIndent-=1}},{key:"setCurrentProp",value:function(t,e){this.currentProp=t,this.currentPropName=e}},{key:"parse",value:function(t){this.currentIndent=0,this.allNodes=new Ns,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var e=this,r=t.split(/[\r\n]+/);return r.forEach((function(t,n){var i=t.match(/^[\s\t]*;/),o=t.match(/^[\s\t]*$/);if(!i&&!o){var s=t.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){",""),a=t.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),u=t.match("^\\t{"+(e.currentIndent-1)+"}}");s?e.parseNodeBegin(t,s):a?e.parseNodeProperty(t,a,r[++n]):u?e.popStack():t.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(t)}})),this.allNodes}},{key:"parseNodeBegin",value:function(t,e){var r=e[1].trim().replace(/^"/,"").replace(/"$/,""),n=e[2].split(",").map((function(t){return t.trim().replace(/^"/,"").replace(/"$/,"")})),i={name:r},o=this.parseNodeAttr(n),s=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(r,i):r in s?("PoseNode"===r?s.PoseNode.push(i):void 0!==s[r].id&&(s[r]={},s[r][s[r].id]=s[r]),""!==o.id&&(s[r][o.id]=i)):"number"==typeof o.id?(s[r]={},s[r][o.id]=i):"Properties70"!==r&&(s[r]="PoseNode"===r?[i]:i),"number"==typeof o.id&&(i.id=o.id),""!==o.name&&(i.attrName=o.name),""!==o.type&&(i.attrType=o.type),this.pushStack(i)}},{key:"parseNodeAttr",value:function(t){var e=t[0];""!==t[0]&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));var r="",n="";return t.length>1&&(r=t[1].replace(/^(\w+)::/,""),n=t[2]),{id:e,name:r,type:n}}},{key:"parseNodeProperty",value:function(t,e,r){var n=e[1].replace(/^"/,"").replace(/"$/,"").trim(),i=e[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===n&&","===i&&(i=r.replace(/"/g,"").replace(/,$/,"").trim());var o=this.getCurrentNode();if("Properties70"!==o.name){if("C"===n){var s=i.split(",").slice(1),a=parseInt(s[0]),u=parseInt(s[1]),l=i.split(",").slice(3);n="connections",function(t,e){for(var r=0,n=t.length,i=e.length;r<i;r++,n++)t[n]=e[r]}(i=[a,u],l=l.map((function(t){return t.trim().replace(/^"/,"")}))),void 0===o[n]&&(o[n]=[])}"Node"===n&&(o.id=i),n in o&&Array.isArray(o[n])?o[n].push(i):"a"!==n?o[n]=i:o.a=i,this.setCurrentProp(o,n),"a"===n&&","!==i.slice(-1)&&(o.a=Hs(i))}else this.parseNodeSpecialProperty(t,n,i)}},{key:"parseNodePropertyContinued",value:function(t){var e=this.getCurrentNode();e.a+=t,","!==t.slice(-1)&&(e.a=Hs(e.a))}},{key:"parseNodeSpecialProperty",value:function(t,e,r){var n=r.split('",').map((function(t){return t.trim().replace(/^\"/,"").replace(/\s/,"_")})),i=n[0],o=n[1],s=n[2],a=n[3],u=n[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":u=parseFloat(u);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":u=Hs(u)}this.getPrevNode()[i]={type:o,type2:s,flag:a,value:u},this.setCurrentProp(this.getPrevNode(),i)}}]),t}(),Rs=function(){function t(){i(this,t)}return s(t,[{key:"parse",value:function(t){var e=new Ls(t);e.skip(23);var r=e.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var n=new Ns;!this.endOfContent(e);){var i=this.parseNode(e,r);null!==i&&n.add(i.name,i)}return n}},{key:"endOfContent",value:function(t){return t.size()%16==0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()}},{key:"parseNode",value:function(t,e){var r={},n=e>=7500?t.getUint64():t.getUint32(),i=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();var o=t.getUint8(),s=t.getString(o);if(0===n)return null;for(var a=[],u=0;u<i;u++)a.push(this.parseProperty(t));var l=a.length>0?a[0]:"",h=a.length>1?a[1]:"",c=a.length>2?a[2]:"";for(r.singleProperty=1===i&&t.getOffset()===n;n>t.getOffset();){var f=this.parseNode(t,e);null!==f&&this.parseSubNode(s,r,f)}return r.propertyList=a,"number"==typeof l&&(r.id=l),""!==h&&(r.attrName=h),""!==c&&(r.attrType=c),""!==s&&(r.name=s),r}},{key:"parseSubNode",value:function(t,e,r){if(!0===r.singleProperty){var n=r.propertyList[0];Array.isArray(n)?(e[r.name]=r,r.a=n):e[r.name]=n}else if("Connections"===t&&"C"===r.name){var i=[];r.propertyList.forEach((function(t,e){0!==e&&i.push(t)})),void 0===e.connections&&(e.connections=[]),e.connections.push(i)}else if("Properties70"===r.name){Object.keys(r).forEach((function(t){e[t]=r[t]}))}else if("Properties70"===t&&"P"===r.name){var o,s=r.propertyList[0],a=r.propertyList[1],u=r.propertyList[2],l=r.propertyList[3];0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),o="Color"===a||"ColorRGB"===a||"Vector"===a||"Vector3D"===a||0===a.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],e[s]={type:a,type2:u,flag:l,value:o}}else void 0===e[r.name]?"number"==typeof r.id?(e[r.name]={},e[r.name][r.id]=r):e[r.name]=r:"PoseNode"===r.name?(Array.isArray(e[r.name])||(e[r.name]=[e[r.name]]),e[r.name].push(r)):void 0===e[r.name][r.id]&&(e[r.name][r.id]=r)}},{key:"parseProperty",value:function(t){var e,r=t.getString(1);switch(r){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return e=t.getUint32(),t.getArrayBuffer(e);case"S":return e=t.getUint32(),t.getString(e);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var n=t.getUint32(),i=t.getUint32(),o=t.getUint32();if(0===i)switch(r){case"b":case"c":return t.getBooleanArray(n);case"d":return t.getFloat64Array(n);case"f":return t.getFloat32Array(n);case"i":return t.getInt32Array(n);case"l":return t.getInt64Array(n)}var s=function(t,e){return As((function(t){if(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"}(t),t.subarray(2,-4)),e)}(new Uint8Array(t.getArrayBuffer(o))),a=new Ls(s.buffer);switch(r){case"b":case"c":return a.getBooleanArray(n);case"d":return a.getFloat64Array(n);case"f":return a.getFloat32Array(n);case"i":return a.getInt32Array(n);case"l":return a.getInt64Array(n)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+r)}}}]),t}(),Ls=function(){function t(e,r){i(this,t),this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===r||r}return s(t,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(t){this.offset+=t}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getBoolean());return e}},{key:"getUint8",value:function(){var t=this.dv.getUint8(this.offset);return this.offset+=1,t}},{key:"getInt16",value:function(){var t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}},{key:"getInt32",value:function(){var t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}},{key:"getInt32Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt32());return e}},{key:"getUint32",value:function(){var t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}},{key:"getInt64",value:function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),2147483648&e?(e=4294967295&~e,4294967295===(t=4294967295&~t)&&(e=e+1&4294967295),-(4294967296*e+(t=t+1&4294967295))):4294967296*e+t}},{key:"getInt64Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt64());return e}},{key:"getUint64",value:function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),4294967296*e+t}},{key:"getFloat32",value:function(){var t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}},{key:"getFloat32Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat32());return e}},{key:"getFloat64",value:function(){var t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}},{key:"getFloat64Array",value:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat64());return e}},{key:"getArrayBuffer",value:function(t){var e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}},{key:"getString",value:function(t){for(var e=[],r=0;r<t;r++)e[r]=this.getUint8();var n=e.indexOf(0);return n>=0&&(e=e.slice(0,n)),THREE.LoaderUtils.decodeText(new Uint8Array(e))}}]),t}(),Ns=function(){function t(){i(this,t)}return s(t,[{key:"add",value:function(t,e){this[t]=e}}]),t}();function Ps(t){var e=t.match(/FBXVersion: (\d+)/);if(e)return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function ks(t){return t/46186158e3}var Ds=[];function Qs(t,e,r,n){var i;switch(n.mappingType){case"ByPolygonVertex":i=t;break;case"ByPolygon":i=e;break;case"ByVertice":i=r;break;case"AllSame":i=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}"IndexToDirect"===n.referenceType&&(i=n.indices[i]);var o=i*n.dataSize,s=o+n.dataSize;return function(t,e,r,n){for(var i=r,o=0;i<n;i++,o++)t[o]=e[i];return t}(Ds,n.buffer,o,s)}var Os=new THREE.Euler,Fs=new THREE.Vector3;function Gs(t){var e=new THREE.Matrix4,r=new THREE.Matrix4,n=new THREE.Matrix4,i=new THREE.Matrix4,o=new THREE.Matrix4,s=new THREE.Matrix4,a=new THREE.Matrix4,u=new THREE.Matrix4,l=new THREE.Matrix4,h=new THREE.Matrix4,c=new THREE.Matrix4,f=new THREE.Matrix4,p=t.inheritType?t.inheritType:0;if(t.translation&&e.setPosition(Fs.fromArray(t.translation)),t.preRotation){var g=t.preRotation.map(THREE.MathUtils.degToRad);g.push(t.eulerOrder||THREE.Euler.DefaultOrder),r.makeRotationFromEuler(Os.fromArray(g))}if(t.rotation){var d=t.rotation.map(THREE.MathUtils.degToRad);d.push(t.eulerOrder||THREE.Euler.DefaultOrder),n.makeRotationFromEuler(Os.fromArray(d))}if(t.postRotation){var A=t.postRotation.map(THREE.MathUtils.degToRad);A.push(t.eulerOrder||THREE.Euler.DefaultOrder),i.makeRotationFromEuler(Os.fromArray(A)),i.invert()}t.scale&&o.scale(Fs.fromArray(t.scale)),t.scalingOffset&&a.setPosition(Fs.fromArray(t.scalingOffset)),t.scalingPivot&&s.setPosition(Fs.fromArray(t.scalingPivot)),t.rotationOffset&&u.setPosition(Fs.fromArray(t.rotationOffset)),t.rotationPivot&&l.setPosition(Fs.fromArray(t.rotationPivot)),t.parentMatrixWorld&&(c.copy(t.parentMatrix),h.copy(t.parentMatrixWorld));var y=r.clone().multiply(n).multiply(i),v=new THREE.Matrix4;v.extractRotation(h);var m=new THREE.Matrix4;m.copyPosition(h);var E=m.clone().invert().multiply(h),_=v.clone().invert().multiply(E),I=o,x=new THREE.Matrix4;if(0===p)x.copy(v).multiply(y).multiply(_).multiply(I);else if(1===p)x.copy(v).multiply(_).multiply(y).multiply(I);else{var C=(new THREE.Matrix4).scale((new THREE.Vector3).setFromMatrixScale(c)).clone().invert(),w=_.clone().multiply(C);x.copy(v).multiply(y).multiply(w).multiply(I)}var b=l.clone().invert(),B=s.clone().invert(),S=e.clone().multiply(u).multiply(l).multiply(r).multiply(n).multiply(i).multiply(b).multiply(a).multiply(s).multiply(o).multiply(B),T=(new THREE.Matrix4).copyPosition(S),M=h.clone().multiply(T);return f.copyPosition(M),(S=f.clone().multiply(x)).premultiply(h.invert()),S}function Us(t){var e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(t=t||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[t]}function Hs(t){return t.split(",").map((function(t){return parseFloat(t)}))}function js(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=t.byteLength),THREE.LoaderUtils.decodeText(new Uint8Array(t,e,r))}function qs(t,e,r){return t.slice(0,e).concat(r).concat(t.slice(e))}var Vs=function(){function t(e,r,n,o,s){i(this,t),this.threelayer=o,this.map=o.map,this.groupId=s,this.loader=new bs,this.loader.load(e,(function(t){t.traverse((function(t){t instanceof THREE.Mesh&&(t.geometry.computeVertexNormals(),t.scale.set(.04,.04,.04),t.rotation.set(1*Math.PI/2,1*-Math.PI/2,0))}));var e=o.toModel(t,{coordinate:r,altitude:n.altitude||0});s?o.addMesh1(e,s):o.addMesh(e),e.object3d.rotation.z=Math.PI/2}))}return s(t,[{key:"dispose",value:function(){}}]),t}(),zs={altitude:0,speed:.015,height:10},Ys=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s,a){var u;i(this,r),Array.isArray(t)&&(t=new maptalks.Polygon([t])),n=maptalks.Util.extend({},zs,n,{layer:s,polygon:t}),(u=e.call(this)).parent=a,u._initOptions(n);var l=n,h=l.altitude,c=l.height,f=u.createGeometry(t,s,c);u._createMesh(f,o);var p=s.altitudeToVector3(h,h).x,g=s.coordinateToVector3(t.getCenter(),p);return u.getObject3d().position.copy(g),u}return s(r,[{key:"createGeometry",value:function(t,e,r){r=e.altitudeToVector3(r,r).x;var n=e.coordinateToVector3(t.getCenter()),i=t.getShell(),o=[],s=[];i.forEach((function(t){var r=e.coordinateToVector3(t).sub(n);o.push(r),s.push(r.x),s.push(r.y)}));for(var a=s,u=[],l=0,h=0;l<a.length-2;l+=2,h++)0===l?u[0]=Math.sqrt((a[2]-a[0])*(a[2]-a[0])+(a[3]-a[1])*(a[3]-a[1])):u[h]=u[h-1]+Math.sqrt((a[l+2]-a[l])*(a[l+2]-a[l])+(a[l+3]-a[l+1])*(a[l+3]-a[l+1]));for(var c=[],f=[],p=u[u.length-1],g=0,d=c.length,A=f.length;g<o.length-1;g++){var y=o[g],v=o[g+1],m=u[g];c[d++]=y.x,c[d++]=y.y,c[d++]=0,f[A++]=0===g?0:u[g-1]/p,f[A++]=0,c[d++]=v.x,c[d++]=v.y,c[d++]=0,f[A++]=m/p,f[A++]=0,c[d++]=y.x,c[d++]=y.y,c[d++]=r,f[A++]=0===g?0:u[g-1]/p,f[A++]=1,c[d++]=y.x,c[d++]=y.y,c[d++]=r,f[A++]=0===g?0:u[g-1]/p,f[A++]=1,c[d++]=v.x,c[d++]=v.y,c[d++]=0,f[A++]=m/p,f[A++]=0,c[d++]=v.x,c[d++]=v.y,c[d++]=r,f[A++]=m/p,f[A++]=1}var E=new THREE.BufferGeometry;return E.setAttribute("position",new THREE.BufferAttribute(new Float32Array(c),3)),E.setAttribute("uv",new THREE.BufferAttribute(new Float32Array(f),2)),E}}]),r}(),Xs=function(){function t(e,r,n,o,s){i(this,t),this.threelayer=n,this.map=n.map,this.groupId=o,this.layerClass=s,this.opacity=r.opacity||.8,this.fadeOpacity=r.fadeOpacity||.65,this.color=r.color||"#0099FF",this.fadeColor=r.fadeColor||"#000",this.num=r.num||5,this.hiz=r.hiz||.15,this.data=e.data,this.coords=e.coords,this._uniforms={time:{type:"pv2",value:0},color:{type:"uvs",value:new THREE.Color(this.color)},fadeColor:{type:"uvs",value:new THREE.Color(this.fadeColor)},opacity:{type:"pv2",value:this.opacity},num:{type:"pv2",value:this.num},hiz:{type:"pv2",value:this.hiz},fadeOpacity:{value:this.fadeOpacity}};var a=new THREE.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n precision lowp float;\n precision lowp int;\n #ifdef USE_FOG\n varying float vFogDepth;\n #endif\n varying vec2 vUv;\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n #ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n #endif\n }\n ",fragmentShader:"\n precision lowp float;\n precision lowp int;\n uniform float time;\n uniform float opacity;\n uniform vec3 color;\n uniform vec3 fadeColor;\n uniform float fadeOpacity;\n uniform float num;\n uniform float hiz;\n varying vec2 vUv;\n void main() {\n vec4 fragColor = vec4(0.);\n float sin = sin((vUv.y - time * hiz) * 10. * num);\n float high = 0.92;\n float medium = 0.4;\n if (sin > high) {\n fragColor = vec4(mix(vec3(.8, 1., 1.), color, (1. - sin) / (1. - high)), 1.);\n } else if(sin > medium) {\n fragColor = vec4(color, mix(1., 0., 1.-(sin - medium) / (high - medium)));\n } else {\n fragColor = vec4(color, 0.);\n }\n //vec3 fade = mix(color, vec3(0., 0., 0.), vUv.y);\n vec3 fade = mix(color, fadeColor, vUv.y);\n //fragColor = mix(fragColor, vec4(fade, 1.), 0.85);\n fragColor = mix(fragColor, vec4(fade, 1.), fadeOpacity);\n gl_FragColor = vec4(fragColor.rgb, fragColor.a * opacity * (1. - vUv.y));\n }\n ",blending:THREE.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:THREE.DoubleSide});this.interactive=void 0===r.interactive||r.interactive,this.groundWall=new Ys(this.coords,{height:r.height||1e3,interactive:this.interactive},a,n,this),o?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this),this.clickFunc=r.clickFunc,this._bindMapEvents()}return s(t,[{key:"_bindMapEvents",value:function(){this.groundWall&&this.groundWall.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.groundWall&&this.groundWall.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setPointEvent",value:function(t){var e=t.target.parent.data;"click"===t.type&&e&&this.clickFunc&&this.clickFunc(e)}},{key:"tick",value:function(t){this._uniforms.time.value+=this.hiz/10*60*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this._closeEvent(),this.groundWall&&(this.groupId?this.threelayer.removeMesh1(this.groundWall,this.groupId):this.threelayer.removeMesh(this.groundWall),this.groundWall.object3d.geometry&&this.groundWall.object3d.geometry.dispose(),this.groundWall.object3d.material&&(this.groundWall.object3d.material.dispose(),delete this.m))}}]),t}(),Js=function(){function t(e,r,n,o,s){if(i(this,t),this.threelayer=n,this.map=n.map,this.layerClass=s,this.opacity=r.opacity||.8,this.color=r.color||"#0099FF",this.fadeColor=r.fadeColor||"#000",this.repeatX=r.repeatX||10,this.speed=r.speed||.01,r.imgUrl){this.loader=new THREE.TextureLoader,this.texture=this.loader.load(r.imgUrl),this._uniforms={time:{type:"pv2",value:0},map:{value:this.texture},repeatX:{value:this.repeatX},uvTransform:{value:this.elements}};var a=new THREE.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n #ifdef USE_FOG\n varying float vFogDepth;\n #endif\n uniform mat3 uvTransform;\n varying vec2 vUv;\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n vUv = uv;\n //vUv = (uvTransform * vec3(uv,1.0) ).xy;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n #ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n #endif\n }\n ",fragmentShader:"\n uniform float time;\n varying vec2 vUv;\n uniform sampler2D map;\n uniform float repeatX;\n void main() {\n vec4 fragColor = texture2D(map, vec2(1.0 - fract(vUv.x * repeatX + time * 2.), vUv.y));\n //vec4 fragColor = texture2D(map, vUv.x, vec2(fract(vUv.y * repeatX + time * 2.));\n //vec4 fragColor = texture2D(map, vec2(vUv.x, fract(vUv.y * repeatX + time * 2.)));\n gl_FragColor = fragColor;\n }\n ",transparent:!0,depthWrite:!1,depthTest:!1,side:THREE.DoubleSide});this.groundWall=new Ys(e,{height:r.height||1e3},a,n),o?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this)}}return s(t,[{key:"setUvTransform",value:function(t,e,r,n,i,o,s){this.elements=1}},{key:"tick",value:function(t){this._uniforms.time.value+=60*this.speed*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this.groundWall&&(groupId?this.threelayer.removeMesh1(this.groundWall,this.groupId):this.threelayer.removeMesh(this.groundWall),this.groundWall.object3d.geometry&&this.groundWall.object3d.geometry.dispose(),this.groundWall.object3d.material&&(this.groundWall.object3d.material.dispose(),delete this.m),this.texture&&this.texture.dispose())}}]),t}();THREE.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new THREE.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},THREE.ShaderLib.line={uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var Ws,Ks,Zs=function(t){u(r,THREE.ShaderMaterial);var e=f(r);function r(t){var n;return i(this,r),(n=e.call(this,{type:"LineMaterial",uniforms:THREE.UniformsUtils.clone(THREE.ShaderLib.line.uniforms),vertexShader:THREE.ShaderLib.line.vertexShader,fragmentShader:THREE.ShaderLib.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(c(n),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){!0===t?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===t?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===t?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),n.setValues(t),n}return s(r)}(),$s=function(){function e(t,r,n,o){i(this,e),this.map=n.map,this.threeLayer=n,this.groupId=o,this.dashed=void 0!==r.dashed&&r.dashed,this.dashScale=void 0!==r.dashScale?r.dashScale:2,this.dashSize=void 0!==r.dashSize?r.dashSize:1,this.gapSize=void 0!==r.gapSize?r.gapSize:1,this.dashed?this.lineMaterial=new Zs({color:r.lineColor||"rgb(15,159,190)",transparent:!0,linewidth:r.linewidth||1,dashed:!0,defines:{USE_DASH:""},dashScale:this.dashScale,dashSize:this.dashSize,gapSize:this.gapSize}):this.lineMaterial=new Zs({color:r.lineColor||"rgb(15,159,190)",transparent:!0,linewidth:r.linewidth||1});var s=[];t.features.forEach((function(t){var e=t.geometry;s.push(e)})),this.lineItems=s}var r;return s(e,[{key:"addLine",value:(r=n(t().mark((function e(){var r,n,i=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[],this.lineItems.forEach((function(t){"Polygon"===t.type?t.coordinates.forEach((function(t){var e=new maptalks.LineString(t);r.push(e)})):t.coordinates.forEach((function(t){var e=new maptalks.LineString(t[0]);r.push(e)}))})),r.length>0&&(n=this.threeLayer.toFatLines(r,{altitude:1,interactive:!1},this.lineMaterial),this.dashed&&(n.zoomChange=function(){if(i.map){var t=i.map.pixelToDistance(1,0);i.lineMaterial.dashScale=18.93/t}}),this.groupId?this.threeLayer.addMesh1(n,this.groupId):this.threeLayer.addMesh(n),this.line=n),t.abrupt("return",this);case 4:case"end":return t.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"dispose",value:function(){this.groupId?this.threeLayer.removeMesh1(this.line,this.groupId):this.threeLayer.removeMesh(this.line),this.line.object3d.geometry&&this.line.object3d.geometry.dispose(),this.line.object3d.material&&this.line.object3d.material.dispose(),this.lineMaterial&&this.lineMaterial.dispose()}}]),e}(),ta={altitude:0},ea=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),n=maptalks.Util.extend({layer:s},ta,n),(a=e.call(this))._initOptions(n),a.height=n.height||50;for(var u=1/0,l=1/0,h=-1/0,c=-1/0,f=0;f<t.length;f++){var p=t[f].getCenter();u=Math.min(u,p.x),l=Math.min(l,p.y),h=Math.max(h,p.x),c=Math.max(c,p.y)}var g=new maptalks.Coordinate((u+h)/2,(l+c)/2),d=s.coordinateToVector3(g),A=s.altitudeToVector3(a.height,a.height).x,y=[];a._geometriesAttributes=[],a._colorMap={};for(var v=0;v<t.length;v++){var m=L(d,t[v],s,A),E=m.attributes.position.array;a._geometriesAttributes[v]={position:{count:E.length/3}},y.push(m)}a._datas=t,a._uniforms={time:{type:"pv2",value:0},color:{type:"uvs",value:new THREE.Color("#0099FF")},fadeColor:{type:"uvs",value:new THREE.Color("#000")},opacity:{type:"pv2",value:a.opacity},num:{type:"pv2",value:5},hiz:{type:"pv2",value:.15}},new THREE.ShaderMaterial({uniforms:a._uniforms,vertexShader:"\n precision lowp float;\n precision lowp int;\n #ifdef USE_FOG\n varying float vFogDepth;\n #endif\n varying vec2 vUv;\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n #ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n #endif\n }\n ",fragmentShader:"\n precision lowp float;\n precision lowp int;\n uniform float time;\n uniform float opacity;\n uniform vec3 color;\n uniform vec3 fadeColor;\n uniform float num;\n uniform float hiz;\n varying vec2 vUv;\n void main() {\n vec4 fragColor = vec4(0.);\n float sin = sin((vUv.y - time * hiz) * 10. * num);\n float high = 0.92;\n float medium = 0.4;\n if (sin > high) {\n fragColor = vec4(mix(vec3(.8, 1., 1.), color, (1. - sin) / (1. - high)), 1.);\n } else if(sin > medium) {\n fragColor = vec4(color, mix(1., 0., 1.-(sin - medium) / (high - medium)));\n } else {\n fragColor = vec4(color, 0.);\n }\n //vec3 fade = mix(color, vec3(0., 0., 0.), vUv.y);\n vec3 fade = mix(color, fadeColor, vUv.y);\n //fragColor = mix(fragColor, vec4(fade, 1.), 0.85);\n fragColor = mix(fragColor, vec4(fade, 1.), 0.65);\n gl_FragColor = vec4(fragColor.rgb, fragColor.a * opacity * (1. - vUv.y));\n }\n ",blending:THREE.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:THREE.DoubleSide});var _=new THREE.MeshBasicMaterial({side:THREE.DoubleSide,transparent:!0,opacity:.5,depthTest:!1,color:"blue"});a._createMesh(y[0],_);var I=s.coordinateToVector3(g,0);return a.getObject3d().position.copy(I),a._setPickObject3d(),a._init(),a}return s(r,[{key:"_init",value:function(){var t=this,e=this.getLayer().getPick();this.on("add",(function(){e.add(t.pickObject3d)})),this.on("remove",(function(){e.remove(t.pickObject3d)}))}},{key:"_setPickObject3d",value:function(){if(this._colorMap){for(var t=this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),r=this._geometriesAttributes.length,n=N(this._geometriesAttributes),i=0,o=0;o<r;o++){var s=e.getColor(),a=s.getHex();this._colorMap[a]=o;var u=this._geometriesAttributes[o].position.count;this._datas[o].colorIndex=a;for(var l=0;l<u;l++)n[i]=s.r,n[i+1]=s.g,n[i+2]=s.b,i+=3}t.setAttribute("pickColor",new THREE.BufferAttribute(n,3,!0));var h=new THREE.ShaderMaterial({vertexShader:"\n attribute vec3 pickColor;\n varying vec3 vPickColor;\n void main(){\n vPickColor = pickColor;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n varying vec3 vPickColor;\n void main() {\n gl_FragColor = vec4(vPickColor, 1.0);\n }",side:THREE.DoubleSide,transparent:!0}),c=e.getColor().getHex(),f=new THREE.Mesh(t,h);f.position.copy(this.getObject3d().position),f._colorIndex=c,this.setPickObject3d(f)}}},{key:"getSelectMesh",value:function(){return console.log(this._datas[this.index]),this._datas[this.index]}},{key:"identify",value:function(t){return this.picked}}]),r}(),ra=function(){function e(t,r,n,o,s){i(this,e),this.map=n.map,this.threeLayer=n,this.groupId=o,this.layerClass=s;var a=[];t.features.forEach((function(t){var e=t.geometry;a.push(e)})),this.lineItems=a}var r;return s(e,[{key:"addLine",value:(r=n(t().mark((function e(){var r,n;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=[],this.lineItems.forEach((function(t){"Polygon"===t.type?r.push(t):t.coordinates.forEach((function(t){var e=new maptalks.Polygon(t);r.push(e)}))})),n=new ea(r,{},null,this.threeLayer),this.groupId?this.threeLayer.addMesh1(n,this.groupId):this.threeLayer.addMesh(n);case 4:case"end":return t.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})}]),e}(),na=new THREE.Box3,ia=new THREE.Vector3,oa=function(t){u(r,THREE.InstancedBufferGeometry);var e=f(r);function r(){var t;i(this,r),(t=e.call(this)).isLineSegmentsGeometry=!0,t.type="LineSegmentsGeometry";return t.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),t.setAttribute("position",new THREE.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),t.setAttribute("uv",new THREE.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),t}return s(r,[{key:"applyMatrix4",value:function(t){var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),r.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var r=new THREE.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceStart",new THREE.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceEnd",new THREE.InterleavedBufferAttribute(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var r=new THREE.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceColorStart",new THREE.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceColorEnd",new THREE.InterleavedBufferAttribute(r,3,3)),this}},{key:"fromWireframeGeometry",value:function(t){return this.setPositions(t.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(t){return this.setPositions(t.attributes.position.array),this}},{key:"fromMesh",value:function(t){return this.fromWireframeGeometry(new THREE.WireframeGeometry(t.geometry)),this}},{key:"fromLineSegments",value:function(t){var e=t.geometry;return this.setPositions(e.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),na.setFromBufferAttribute(e),this.boundingBox.union(na))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var r=this.boundingSphere.center;this.boundingBox.getCenter(r);for(var n=0,i=0,o=t.count;i<o;i++)ia.fromBufferAttribute(t,i),n=Math.max(n,r.distanceToSquared(ia)),ia.fromBufferAttribute(e,i),n=Math.max(n,r.distanceToSquared(ia));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}}]),r}(),sa=new THREE.Vector3,aa=new THREE.Vector3,ua=new THREE.Vector4,la=new THREE.Vector4,ha=new THREE.Vector4,ca=new THREE.Vector3,fa=new THREE.Matrix4,pa=new THREE.Line3,ga=new THREE.Vector3,da=new THREE.Box3,Aa=new THREE.Sphere,ya=new THREE.Vector4;function va(t,e,r){return ya.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),ya.multiplyScalar(1/ya.w),ya.x=Ks/r.width,ya.y=Ks/r.height,ya.applyMatrix4(t.projectionMatrixInverse),ya.multiplyScalar(1/ya.w),Math.abs(Math.max(ya.x,ya.y))}var ma=function(t){u(r,THREE.Mesh);var e=f(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new oa,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zs({color:16777215*Math.random()});return i(this,r),(t=e.call(this,n,o)).isLineSegments2=!0,t.type="LineSegments2",t}return s(r,[{key:"computeLineDistances",value:function(){for(var t=this.geometry,e=t.attributes.instanceStart,r=t.attributes.instanceEnd,n=new Float32Array(2*e.count),i=0,o=0,s=e.count;i<s;i++,o+=2)sa.fromBufferAttribute(e,i),aa.fromBufferAttribute(r,i),n[o]=0===o?0:n[o-1],n[o+1]=n[o]+sa.distanceTo(aa);var a=new THREE.InstancedInterleavedBuffer(n,2,1);return t.setAttribute("instanceDistanceStart",new THREE.InterleavedBufferAttribute(a,1,0)),t.setAttribute("instanceDistanceEnd",new THREE.InterleavedBufferAttribute(a,1,1)),this}},{key:"raycast",value:function(t,e){var r=this.material.worldUnits,n=t.camera;null!==n||r||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');var i=void 0!==t.params.Line2&&t.params.Line2.threshold||0;Ws=t.ray;var o,s=this.matrixWorld,a=this.geometry,u=this.material;(Ks=u.linewidth+i,null===a.boundingSphere&&a.computeBoundingSphere(),Aa.copy(a.boundingSphere).applyMatrix4(s),r)?o=.5*Ks:o=va(n,Math.max(n.near,Aa.distanceToPoint(Ws.origin)),u.resolution);if(Aa.radius+=o,!1!==Ws.intersectsSphere(Aa)){var l;if(null===a.boundingBox&&a.computeBoundingBox(),da.copy(a.boundingBox).applyMatrix4(s),r)l=.5*Ks;else l=va(n,Math.max(n.near,da.distanceToPoint(Ws.origin)),u.resolution);da.expandByScalar(l),!1!==Ws.intersectsBox(da)&&(r?function(t,e){for(var r=t.matrixWorld,n=t.geometry,i=n.attributes.instanceStart,o=n.attributes.instanceEnd,s=0,a=Math.min(n.instanceCount,i.count);s<a;s++){pa.start.fromBufferAttribute(i,s),pa.end.fromBufferAttribute(o,s),pa.applyMatrix4(r);var u=new THREE.Vector3,l=new THREE.Vector3;Ws.distanceSqToSegment(pa.start,pa.end,l,u),l.distanceTo(u)<.5*Ks&&e.push({point:l,pointOnLine:u,distance:Ws.origin.distanceTo(l),object:t,face:null,faceIndex:s,uv:null,uv2:null})}}(this,e):function(t,e,r){var n=e.projectionMatrix,i=t.material.resolution,o=t.matrixWorld,s=t.geometry,a=s.attributes.instanceStart,u=s.attributes.instanceEnd,l=Math.min(s.instanceCount,a.count),h=-e.near;Ws.at(1,ha),ha.w=1,ha.applyMatrix4(e.matrixWorldInverse),ha.applyMatrix4(n),ha.multiplyScalar(1/ha.w),ha.x*=i.x/2,ha.y*=i.y/2,ha.z=0,ca.copy(ha),fa.multiplyMatrices(e.matrixWorldInverse,o);for(var c=0,f=l;c<f;c++)if(ua.fromBufferAttribute(a,c),la.fromBufferAttribute(u,c),ua.w=1,la.w=1,ua.applyMatrix4(fa),la.applyMatrix4(fa),!(ua.z>h&&la.z>h)){if(ua.z>h){var p=ua.z-la.z,g=(ua.z-h)/p;ua.lerp(la,g)}else if(la.z>h){var d=la.z-ua.z,A=(la.z-h)/d;la.lerp(ua,A)}ua.applyMatrix4(n),la.applyMatrix4(n),ua.multiplyScalar(1/ua.w),la.multiplyScalar(1/la.w),ua.x*=i.x/2,ua.y*=i.y/2,la.x*=i.x/2,la.y*=i.y/2,pa.start.copy(ua),pa.start.z=0,pa.end.copy(la),pa.end.z=0;var y=pa.closestPointToPointParameter(ca,!0);pa.at(y,ga);var v=THREE.MathUtils.lerp(ua.z,la.z,y),m=v>=-1&&v<=1,E=ca.distanceTo(ga)<.5*Ks;if(m&&E){pa.start.fromBufferAttribute(a,c),pa.end.fromBufferAttribute(u,c),pa.start.applyMatrix4(o),pa.end.applyMatrix4(o);var _=new THREE.Vector3,I=new THREE.Vector3;Ws.distanceSqToSegment(pa.start,pa.end,I,_),r.push({point:I,pointOnLine:_,distance:Ws.origin.distanceTo(I),object:t,face:null,faceIndex:c,uv:null,uv2:null})}}}(this,n,e))}}}]),r}(),Ea=function(t){u(r,oa);var e=f(r);function r(){var t;return i(this,r),(t=e.call(this)).isLineGeometry=!0,t.type="LineGeometry",t}return s(r,[{key:"setPositions",value:function(t){for(var e=t.length-3,n=new Float32Array(2*e),i=0;i<e;i+=3)n[2*i]=t[i],n[2*i+1]=t[i+1],n[2*i+2]=t[i+2],n[2*i+3]=t[i+3],n[2*i+4]=t[i+4],n[2*i+5]=t[i+5];return g(l(r.prototype),"setPositions",this).call(this,n),this}},{key:"setColors",value:function(t){for(var e=t.length-3,n=new Float32Array(2*e),i=0;i<e;i+=3)n[2*i]=t[i],n[2*i+1]=t[i+1],n[2*i+2]=t[i+2],n[2*i+3]=t[i+3],n[2*i+4]=t[i+4],n[2*i+5]=t[i+5];return g(l(r.prototype),"setColors",this).call(this,n),this}},{key:"fromLine",value:function(t){var e=t.geometry;return this.setPositions(e.attributes.position.array),this}}]),r}(),_a=function(t){u(r,ma);var e=f(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ea,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zs({color:16777215*Math.random()});return i(this,r),(t=e.call(this,n,o)).isLine2=!0,t.type="Line2",t}return s(r)}(),Ia={altitude:0,height:10},xa=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),n=maptalks.Util.extend({},Ia,n,{layer:s,coordinate:t}),a=e.call(this);var u=n,l=u.altitude,h=u.height;a._initOptions(n),a.map=s.map;var f=s.altitudeToVector3(h,h).x;a.beginSizeZoom=n.beginSizeZoom||3,a.endSizeZoom=n.endSizeZoom||12,a.spanSizeZoom=a.endSizeZoom-a.beginSizeZoom,a.stepSize=1/(a.endSizeZoom-a.beginSizeZoom+1);var p=[];p.push(0,0,f),p.push(0,0,0);var g=new Ea;g.setPositions(p),a.object3d=new _a(g,o),a.object3d.computeLineDistances(),a.object3d.scale.set(1,1,1),a.object3d.__parent=c(a);var d=s.distanceToVector3(l,l).x,A=s.coordinateToVector3(t,d);return a.getObject3d().position.copy(A),n.closeZoomChange||(a.zoomChange=function(){var t=a.getMap();if(t){var e=t.pixelToDistance(1,0);g.attributes.instanceStart.data.array[2]=f*e*a._getRate(),g.attributes.instanceStart.needsUpdate=!0}}),a}return s(r,[{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}}]),r}(),Ca=function(){function t(e,r,n,o){var s=this;i(this,t),0!=e.length?(this.map=n.map,this.threeLayer=n,this.groupId=o,this.height=r.height||50,this.renderOrder=r.renderOrder||0,this.isGradient=void 0===r.isGradient||r.isGradient,this.closeZoomChange=r.closeZoomChange||!1,this.dashed=void 0!==r.dashed&&r.dashed,this.dashScale=void 0!==r.dashScale?r.dashScale:2,this.dashSize=void 0!==r.dashSize?r.dashSize:1,this.gapSize=void 0!==r.gapSize?r.gapSize:1,this.meshs=[],e.forEach((function(t){var e;e=s.dashed?new Zs({color:t.color||"#35FFAC",transparent:!0,linewidth:r.linewidth||4,dashed:!0,defines:{USE_DASH:""},dashScale:s.dashScale,dashSize:s.dashSize,gapSize:s.gapSize}):new Zs({color:t.color||"#35FFAC",linewidth:r.lineWidth||4,dashed:!1,transparent:!0,opacity:r.opacity||1}),s._setMaterialRes(n,e);var i=new xa([t.longitude,t.latitude],{height:t.height||s.height,interactive:!1,beginSizeZoom:r.beginSizeZoom||9,endSizeZoom:r.endSizeZoom||16,closeZoomChange:s.closeZoomChange},e,n);i.object3d.renderOrder=s.renderOrder,s.dashed&&(i.zoomChange=function(){if(s.map){var t=s.map.pixelToDistance(1,0);e.dashScale=18.93/t}}),s.isGradient&&(e.onBeforeCompile=function(t){t.vertexShader=t.vertexShader.replace("uniform float linewidth;","\n varying vec3 vPos;\n uniform float linewidth;\n "),t.vertexShader=t.vertexShader.replace("void main() {","\n void main() {\n vPos = position;\n "),t.fragmentShader=t.fragmentShader.replace("#include <common>","\n varying vec3 vPos;\n #include <common>\n "),t.fragmentShader=t.fragmentShader.replace("gl_FragColor = vec4( diffuseColor.rgb, alpha );","\n vec3 origin = vec3(0., 0., 0.);\n vec3 dis = vec3(0.,vPos.y, 0.);\n float distance = clamp(length(dis - origin), 0., 1.0);\n float opacity = 1. - distance / 1.;\n //float opacity = 1.;\n gl_FragColor = vec4( diffuseColor.rgb, alpha * opacity );\n ")}),void 0!==t.visible&&!1===t.visible&&i.hide(),s.meshs.push(i)})),o?this.threeLayer.addMesh1(this.meshs,this.groupId):this.threeLayer.addMesh(this.meshs),this.dataItems=e):console.error("需要绘制的点位数量为0")}return s(t,[{key:"_setMaterialRes",value:function(t,e){var r=t.getMap().getSize(),n=r.width,i=r.height;e.resolution.set(n,i)}},{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}},{key:"_bindMapEvents",value:function(t){t&&t.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setPointEvent",value:function(t){"click"===t.type&&this.callback&&this.callback(t.target.data)}},{key:"show",value:function(){this.meshs.forEach((function(t){t.show()}))}},{key:"hide",value:function(){this.meshs.forEach((function(t){t.hide()}))}},{key:"pointShowHideByCode",value:function(t,e,r){for(var n=1/0,i=1/0,o=-1/0,s=-1/0,a=0;a<this.dataItems.length;a++){var u=this.dataItems[a];t.includes(u.code)?(n=Math.min(n,this.dataItems[a].longitude),i=Math.min(i,this.dataItems[a].latitude),o=Math.max(o,this.dataItems[a].longitude),s=Math.max(s,this.dataItems[a].latitude),u.visibility=1):u.visibility=.1}this.updateByVisibility(),e&&this.map.fitExtent(new maptalks.Extent(n,i,o,s),r||0)}},{key:"updateByVisibility",value:function(){var t=this;this.meshs.forEach((function(e,r){.1===t.dataItems[r].visibility?e.hide():e.show()}))}},{key:"dispose",value:function(){var t=this;this.meshs.forEach((function(e){t.groupId?t.threeLayer.removeMesh1(e,t.groupId):t.threeLayer.removeMesh(e),e.object3d.geometry&&e.object3d.geometry.dispose(),e.object3d.material&&e.object3d.material.dispose()}))}}]),t}(),wa={altitude:0,height:0},ba=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),o=maptalks.Util.extend({},wa,o,{layer:s}),a=e.call(this);var u=o,l=u.width,h=u.height,c=u.altitude;a._initOptions(o);var f=new THREE.PlaneGeometry(l,h);a._createMesh(f,n);var p=s.distanceToVector3(c,c).x,g=s.coordinateToVector3(t,p);return a.getObject3d().position.copy(g),a}return s(r)}(),Ba=function(){function t(e,r,n,o,s,a,u){var l=this;i(this,t),this.threelayer=s,this.map=s.map,this.layerClass=a,this.groupId=u,this.millsec=o.millsec||1e3,this.duration=o.duration||75;var h=e.split(","),c=r.split(","),f=parseFloat(h[0]),p=parseFloat(h[1]),g=parseFloat(c[0]),d=parseFloat(c[1]),A=new maptalks.Extent(f,p,g,d),y=1/0,v=1/0,m=-1/0,E=-1/0;[[f,p],[f,d],[g,d],[g,p]].forEach((function(t){var e=l.threelayer.coordinateToVector3(t),r=e.x,n=e.y;y=Math.min(r,y),v=Math.min(n,v),m=Math.max(r,m),E=Math.max(n,E)}));var _=Math.abs(m-y),I=Math.abs(E-v);n.length>1&&jt.generateGifTexture(n,o.width,o.height).then((function(t){l.texture=t.texture,l.annie=new X(t.texture,t.colNum,t.rowNum,n.length,l.duration,t.colNum==t.rowNum);var e=new THREE.MeshBasicMaterial({map:t.texture,transparent:!0,opacity:void 0!==o.opacity?parseFloat(o.opacity):1}),r=new ba(A.getCenter(),e,{width:_,height:I,interactive:!1},s);l.groupId?l.threelayer.addMesh1(r,l.groupId):l.threelayer.addMesh(r),l.imgObj=r,l.layerClass.updatables.push(l)}))}return s(t,[{key:"show",value:function(){var t;null===(t=this.imgObj)||void 0===t||t.show()}},{key:"hide",value:function(){var t;null===(t=this.imgObj)||void 0===t||t.hide()}},{key:"tick",value:function(t){var e;null===(e=this.annie)||void 0===e||e.update(this.millsec*t)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.groupId?this.threelayer.removeMesh1(this.imgObj,this.groupId):this.threelayer.removeMesh(this.imgObj),this.imgObj.object3d.geometry&&this.imgObj.object3d.geometry.dispose(),this.imgObj.object3d.material&&this.imgObj.object3d.material.dispose(),null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),Sa={radius:50,altitude:0},Ta=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),n=maptalks.Util.extend({},Sa,n,{layer:s}),a=e.call(this),n.altitude,a._initOptions(n);var u=R(t),l=s.coordinateToVector3(u),h=[];t.forEach((function(t){var e=s.coordinateToVector3(t);e.sub(l),h.push(e)}));var c=new THREE.CatmullRomCurve3(h),f=s.distanceToVector3(n.radius,n.radius).x,p=new THREE.TubeGeometry(c,2,f,20,!1);return a._createMesh(p,o),a.parent=null,a.getObject3d().position.set(l.x,l.y,f/2),a}return s(r)}(),Ma=function(){function t(e,r,n,o){i(this,t),this.threelayer=n,this.map=n.map,this.groupId=o;var s=new THREE.MeshMatcapMaterial({color:r.color||"red",side:THREE.DoubleSide});this.m=s;var a=new Ta(e,{radius:r.radius||2},s,n);a.parent=this,this.groupId?this.threelayer.addMesh1(a,this.groupId):this.threelayer.addMesh(a),this.mesh=a}return s(t,[{key:"dispose",value:function(){this.groupId?this.threelayer.removeMesh1(this.mesh,this.groupId):this.threelayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose(),this.mesh.object3d.material&&(this.mesh.object3d.material.dispose(),delete this.m)}}]),t}(),Ra={radius:100,altitude:0},La=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s,a){var u;i(this,r),n=maptalks.Util.extend({},Ra,n,{layer:a,coordinate:t}),(u=e.call(this))._initOptions(n);var l=n.altitude;u.object3d=new _a(o,s),u.object3d.computeLineDistances(),u.object3d.scale.set(1,1,1),u.object3d.__parent=c(u);var h=a.distanceToVector3(l,l).x,f=a.coordinateToVector3(t,h);return u.getObject3d().position.copy(f),u}return s(r)}(),Na={altitude:0,height:0},Pa=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),o=maptalks.Util.extend({},Na,o,{layer:s}),a=e.call(this);var u=o.altitude;a._initOptions(o);var l=o.scaleFactor||1,h=[],c=new THREE.ConeGeometry(1*l,2*l,10);c.translate(0,2.5*l,0),h.push(c);var f=new THREE.CylinderGeometry(.4*l,.6*l,3*l,10);h.push(f);var p=x(h);p.computeVertexNormals(),a._createMesh(p,n);var g=s.distanceToVector3(u,u).x,d=s.coordinateToVector3(t,g);return a.getObject3d().position.copy(d),a}return s(r)}(),ka=function(){function e(t,r,n,o,s){i(this,e),this.threelayer=n,this.map=n.map,this.layerClass=o,this.groupId=s;var a=void 0===r.lineFlag||!1!==r.lineFlag,u=r.heightDiv||4,l=r.pointsLen||20,h=r.arrowColor||"rgb(0,255,255)",c=r.arrowNum||5;this.speedFactor=r.speedFactor||2e-4,this.material=null,this.curve=null,this.meshs=[],this.arrows=[],this.up=new THREE.Vector3(0,1,0),this.axis=new THREE.Vector3,a&&(this.lineMaterial=new Zs({color:r.lineColor||"red",transparent:!0,linewidth:r.linewidth||4}),this._setMaterialRes(n,this.lineMaterial));var f=new THREE.MeshBasicMaterial({color:h,side:THREE.DoubleSide,transparent:!0});this.material=f;var p=new maptalks.LineString(t),g=D(p)/u,d=n.distanceToVector3(g,g).x,A=t[0],y=t[1],v=[A[0]/2+y[0]/2,A[1]/2+y[1]/2],m=n.coordinateToVector3(p.getCenter()),E=n.coordinateToVector3(A).sub(m),_=n.coordinateToVector3(y).sub(m),I=n.coordinateToVector3(v,d).sub(m),x=new THREE.CatmullRomCurve3([E,I,_],!1,"catmullrom");this.curve=x,this.centerPt=m;var C=x.getPoints(l),w=[];C.forEach((function(t){w.push(t.x,t.y,t.z)}));var b=new Ea;b.setPositions(w);var B=new La(p.getCenter(),{interactive:!1},b,this.lineMaterial,n);this.meshs.push(B),this.ArrowNum=c;var S=1/this.ArrowNum;this.addSpan=Math.floor(100*S)/100;for(var T=0;T<this.ArrowNum;T++){var M=new Pa(t[0],f,{scaleFactor:r.scaleFactor||1},n);M.object3d.renderOrder=r.arrowOrder||1,this.arrows.push(M)}this.groupId?(this.threelayer.addMesh1(B,this.groupId),this.threelayer.addMesh1(this.arrows,this.groupId)):(this.threelayer.addMesh(B),this.threelayer.addMesh(this.arrows)),this.layerClass.updatables.push(this)}var r;return s(e,[{key:"tick",value:function(t){if(this.curve)for(var e=this.speedFactor*performance.now(),r=0;r<this.ArrowNum;r++){var n=(e+this.addSpan*r)%1,i=this.curve.getPointAt(n).add(this.centerPt);this.arrows[r].getObject3d().position.copy(i);var o=this.curve.getTangentAt(n);this.axis.crossVectors(this.up,o).normalize();var s=Math.acos(this.up.dot(o));this.arrows[r].getObject3d().quaternion.setFromAxisAngle(this.axis,s)}}},{key:"_setMaterialRes",value:function(t,e){var r=t.getMap().getSize(),n=r.width,i=r.height;e.resolution.set(n,i)}},{key:"loadTexture",value:(r=n(t().mark((function e(r){var n;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.promiseToDoSomething(r);case 2:return n=t.sent,this.texture=new THREE.CanvasTexture(n.canvas),this.material=new THREE.MeshBasicMaterial({map:this.texture,side:THREE.DoubleSide,transparent:!0}),t.abrupt("return",this.material);case 6:case"end":return t.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"promiseToDoSomething",value:function(t){return new Promise((function(e){var r=document.createElement("canvas").getContext("2d");r.canvas.width=64,r.canvas.height=64,r.translate(35,32),r.rotate(.5*-Math.PI),r.fillStyle=t,r.textAlign="center",r.textBaseline="middle",r.font="48px sans-serif",r.fillText("➡︎",0,0),setTimeout((function(){return e(r)}),4)}))}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this.meshs&&(this.groupId?this.threelayer.removeMesh1(this.meshs,this.groupId):this.threelayer.removeMesh(this.meshs),this.meshs.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()}))),this.arrows&&(this.groupId?this.threelayer.removeMesh1(this.arrows,this.groupId):this.threelayer.removeMesh(this.arrows),this.arrows.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()}))),this.material&&this.material.dispose(),this.lineMaterial&&this.lineMaterial.dispose(),this.texture&&this.texture.dispose(),this.curve&&delete this.curve}}]),e}(),Da=function(){function t(e,r,n,o,s){var a=this;i(this,t),this.threelayer=n,this.map=n.map,this.layerClass=o,this.groupId=s;var u=r.heightDiv||4,l=r.pointsLen||20;this.speedFactor=r.speedFactor||.01,this.sum=0,this.meshs=[];var h=new maptalks.LineString(e),c=D(h)/u,f=n.distanceToVector3(c,c).x,p=e[0],g=e[1],d=[p[0]/2+g[0]/2,p[1]/2+g[1]/2],A=n.coordinateToVector3(h.getCenter()),y=n.coordinateToVector3(p).sub(A),v=n.coordinateToVector3(g).sub(A),m=n.coordinateToVector3(d,f).sub(A);this.lineMaterialDash=new Zs({color:r.lineDashColor||"red",transparent:!0,linewidth:r.lineDashWidth||4,dashed:!0,defines:{USE_DASH:""},dashScale:1,dashSize:r.dashSize||20,gapSize:1}),this.lineMaterial=new Zs({color:r.lineColor||"red",transparent:!0,linewidth:r.lineWidth||2,opacity:r.lineOpacity||.4}),this._setMaterialRes(n,this.lineMaterialDash),this._setMaterialRes(n,this.lineMaterial);var E=new THREE.CatmullRomCurve3([y,m,v],!1,"catmullrom").getPoints(l),_=[];E.forEach((function(t){_.push(t.x,t.y,t.z)}));var I=new Ea;I.setPositions(_);var x=new La(h.getCenter(),{interactive:!1},I,this.lineMaterialDash,n),C=new La(h.getCenter(),{interactive:!1},I,this.lineMaterial,n),w=C.object3d.geometry.attributes.instanceDistanceEnd.array;this.len=w[w.length-1],this.dur=this.len/3,this.lineMaterialDash.onBeforeCompile=function(t){t.uniforms.actionRatio={value:0},t.uniforms.lineLength={value:a.len},t.fragmentShader=t.fragmentShader.replace("#include <common>","\n uniform float actionRatio;\n uniform float lineLength;\n #include <common>\n "),t.fragmentShader=t.fragmentShader.replace("if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard;","\n float halfDash = dashSize * 0.5;\n float currPos = (lineLength + dashSize) * actionRatio;\n float d = (vLineDistance + halfDash) - currPos;\n if (abs(d) > halfDash ) discard;\n \n float grad = ((vLineDistance + halfDash) - (currPos - halfDash)) / halfDash;\n ").replace("gl_FragColor = vec4( diffuseColor.rgb, alpha );","\n gl_FragColor = vec4( diffuseColor.rgb, alpha * grad);\n "),a.shaderDash=t},this.groupId?(this.threelayer.addMesh1(C,this.groupId),this.threelayer.addMesh1(x,this.groupId)):(this.threelayer.addMesh(C),this.threelayer.addMesh(x)),this.meshs.push(C),this.meshs.push(x),this.layerClass.updatables.push(this)}return s(t,[{key:"tick",value:function(t){this.shaderDash&&(this.sum+=this.dur*t*this.speedFactor,this.sum%=1,this.shaderDash.uniforms.actionRatio.value=this.sum)}},{key:"setPath",value:function(t,e,r,n){for(var i=t.geometry.attributes.position,o=new THREE.CatmullRomCurve3([e,n,r],!1,"catmullrom").getPoints(20),s=0;s<=19;s++){var a=o[s];i.setXYZ(s,a.x,a.y,a.z)}i.needsUpdate=!0,t.computeLineDistances(),t.geometry.attributes.lineDistance.needsUpdate=!0,t.material.dashSize=20}},{key:"_setMaterialRes",value:function(t,e){var r=t.getMap().getSize(),n=r.width,i=r.height;e.resolution.set(n,i)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){this.removeAnimation(),this.meshs&&(this.groupId?this.threelayer.removeMesh1(this.meshs,this.groupId):this.threelayer.removeMesh(this.meshs),this.meshs.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()}))),this.lineMaterialDash&&this.lineMaterialDash.dispose(),this.lineMaterial&&this.lineMaterial.dispose()}}]),t}();function Qa(t,e){void 0===e&&(e={});var r="object"==typeof e?e.mutate:e;if(!t)throw new Error("geojson is required");var n=Qt(t),i=[];switch(n){case"LineString":i=Oa(t);break;case"MultiLineString":case"Polygon":Rt(t).forEach((function(t){i.push(Oa(t))}));break;case"MultiPolygon":Rt(t).forEach((function(t){var e=[];t.forEach((function(t){e.push(Oa(t))})),i.push(e)}));break;case"Point":return t;case"MultiPoint":var o={};Rt(t).forEach((function(t){var e=t.join("-");Object.prototype.hasOwnProperty.call(o,e)||(i.push(t),o[e]=!0)}));break;default:throw new Error(n+" geometry not supported")}return t.coordinates?!0===r?(t.coordinates=i,t):{type:n,coordinates:i}:!0===r?(t.geometry.coordinates=i,t):nt({type:n,coordinates:i},t.properties,{bbox:t.bbox,id:t.id})}function Oa(t){var e=Rt(t);if(2===e.length&&!Fa(e[0],e[1]))return e;var r=[],n=e.length-1,i=r.length;r.push(e[0]);for(var o=1;o<n;o++){var s=r[r.length-1];e[o][0]===s[0]&&e[o][1]===s[1]||(r.push(e[o]),(i=r.length)>2&&Ga(r[i-3],r[i-1],r[i-2])&&r.splice(r.length-2,1))}if(r.push(e[e.length-1]),i=r.length,Fa(e[0],e[e.length-1])&&i<4)throw new Error("invalid polygon");return Ga(r[i-3],r[i-1],r[i-2])&&r.splice(r.length-2,1),r}function Fa(t,e){return t[0]===e[0]&&t[1]===e[1]}function Ga(t,e,r){var n=r[0],i=r[1],o=t[0],s=t[1],a=e[0],u=e[1],l=a-o,h=u-s;return 0===(n-o)*h-(i-s)*l&&(Math.abs(l)>=Math.abs(h)?l>0?o<=n&&n<=a:a<=n&&n<=o:h>0?s<=i&&i<=u:u<=i&&i<=s)}function Ua(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Ha(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(r){switch(r){case"type":case"features":return;default:e[r]=t[r]}})),e.features=t.features.map((function(t){return Ha(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return qa(t);default:throw new Error("unknown GeoJSON type")}}function Ha(t){var e={type:"Feature"};return Object.keys(t).forEach((function(r){switch(r){case"type":case"properties":case"geometry":return;default:e[r]=t[r]}})),e.properties=ja(t.properties),e.geometry=qa(t.geometry),e}function ja(t){var e={};return t?(Object.keys(t).forEach((function(r){var n=t[r];"object"==typeof n?null===n?e[r]=null:Array.isArray(n)?e[r]=n.map((function(t){return t})):e[r]=ja(n):e[r]=n})),e):e}function qa(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return qa(t)})),e):(e.coordinates=Va(t.coordinates),e)}function Va(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Va(t)}))}function za(t,e,r){if(null!==t)for(var n,i,o,s,a,u,l,h,c=0,f=0,p=t.type,g="FeatureCollection"===p,d="Feature"===p,A=g?t.features.length:1,y=0;y<A;y++){a=(h=!!(l=g?t.features[y].geometry:d?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var v=0;v<a;v++){var m=0,E=0;if(null!==(s=h?l.geometries[v]:l)){u=s.coordinates;var _=s.type;switch(c=!r||"Polygon"!==_&&"MultiPolygon"!==_?0:1,_){case null:break;case"Point":if(!1===e(u,f,y,m,E))return!1;f++,m++;break;case"LineString":case"MultiPoint":for(n=0;n<u.length;n++){if(!1===e(u[n],f,y,m,E))return!1;f++,"MultiPoint"===_&&m++}"LineString"===_&&m++;break;case"Polygon":case"MultiLineString":for(n=0;n<u.length;n++){for(i=0;i<u[n].length-c;i++){if(!1===e(u[n][i],f,y,m,E))return!1;f++}"MultiLineString"===_&&m++,"Polygon"===_&&E++}"Polygon"===_&&m++;break;case"MultiPolygon":for(n=0;n<u.length;n++){for(E=0,i=0;i<u[n].length;i++){for(o=0;o<u[n][i].length-c;o++){if(!1===e(u[n][i][o],f,y,m,E))return!1;f++}E++}m++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(!1===za(s.geometries[n],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Ya(t,e,r,n){var i=r;return za(t,(function(t,n,o,s,a){i=0===n&&void 0===r?t:e(i,t,n,o,s,a)}),n),i}function Xa(t,e){var r;switch(t.type){case"FeatureCollection":for(r=0;r<t.features.length&&!1!==e(t.features[r].properties,r);r++);break;case"Feature":e(t.properties,0)}}function Ja(t,e,r){var n=r;return Xa(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n}function Wa(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var r=0;r<t.features.length&&!1!==e(t.features[r],r);r++);}function Ka(t,e,r){var n=r;return Wa(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n}function Za(t){var e=[];return za(t,(function(t){e.push(t)})),e}function $a(t,e){var r,n,i,o,s,a,u,l,h,c,f=0,p="FeatureCollection"===t.type,g="Feature"===t.type,d=p?t.features.length:1;for(r=0;r<d;r++){for(a=p?t.features[r].geometry:g?t.geometry:t,l=p?t.features[r].properties:g?t.properties:{},h=p?t.features[r].bbox:g?t.bbox:void 0,c=p?t.features[r].id:g?t.id:void 0,s=(u=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=u?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,f,l,h,c))return!1;break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===e(o.geometries[n],f,l,h,c))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,f,l,h,c))return!1;f++}}function tu(t,e,r){var n=r;return $a(t,(function(t,i,o,s,a){n=0===i&&void 0===r?t:e(n,t,i,o,s,a)})),n}function eu(t,e){$a(t,(function(t,r,n,i,o){var s,a=null===t?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==e(nt(t,n,{bbox:i,id:o}),r,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var u=0;u<t.coordinates.length;u++){var l=t.coordinates[u];if(!1===e(nt({type:s,coordinates:l},n),r,u))return!1}}))}function ru(t,e,r){var n=r;return eu(t,(function(t,i,o){n=0===i&&0===o&&void 0===r?t:e(n,t,i,o)})),n}function nu(t,e){eu(t,(function(t,r,n){var i=0;if(t.geometry){var o=t.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var s,a=0,u=0,l=0;return!1!==za(t,(function(o,h,c,f,p){if(void 0===s||r>a||f>u||p>l)return s=o,a=r,u=f,l=p,void(i=0);var g=lt([s,o],t.properties);if(!1===e(g,r,n,p,i))return!1;i++,s=o}))&&void 0}}}))}function iu(t,e,r){var n=r,i=!1;return nu(t,(function(t,o,s,a,u){n=!1===i&&void 0===r?t:e(n,t,o,s,a,u),i=!0})),n}function ou(t,e){if(!t)throw new Error("geojson is required");eu(t,(function(t,r,n){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,r,n,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===e(lt(o[s],t.properties),r,n,s))return!1}}}))}function su(t,e,r){var n=r;return ou(t,(function(t,i,o,s){n=0===i&&void 0===r?t:e(n,t,i,o,s)})),n}function au(t,e){if(!bt(e=e||{}))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),a=a||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":a=a||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var u=r.coordinates;switch(r.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=u.length+s-1),lt([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),lt([u[o][s],u[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s-1),lt([u[i][s],u[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s-1),lt([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")}function uu(t,e){if(!bt(e=e||{}))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),a=a||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":a=a||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var u=r.coordinates;switch(r.type){case"Point":return ot(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),ot(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),ot(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),ot(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),ot(u[i][s],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s),ot(u[i][o][s],a,e)}throw new Error("geojson is invalid")}var lu=Object.freeze({__proto__:null,coordAll:Za,coordEach:za,coordReduce:Ya,featureEach:Wa,featureReduce:Ka,findPoint:uu,findSegment:au,flattenEach:eu,flattenReduce:ru,geomEach:$a,geomReduce:tu,lineEach:ou,lineReduce:su,propEach:Xa,propReduce:Ja,segmentEach:nu,segmentReduce:iu});function hu(t,e,r){var n=e.x,i=e.y,o=r.x-n,s=r.y-i;if(0!==o||0!==s){var a=((t.x-n)*o+(t.y-i)*s)/(o*o+s*s);a>1?(n=r.x,i=r.y):a>0&&(n+=o*a,i+=s*a)}return(o=t.x-n)*o+(s=t.y-i)*s}function cu(t,e,r,n,i){for(var o,s=n,a=e+1;a<r;a++){var u=hu(t[a],t[e],t[r]);u>s&&(o=a,s=u)}s>n&&(o-e>1&&cu(t,e,o,n,i),i.push(t[o]),r-o>1&&cu(t,o,r,n,i))}function fu(t,e){var r=t.length-1,n=[t[0]];return cu(t,0,r,e,n),n.push(t[r]),n}function pu(t,e,r){if(t.length<=2)return t;var n=void 0!==e?e*e:1;return t=r?t:function(t,e){for(var r,n,i,o,s,a=t[0],u=[a],l=1,h=t.length;l<h;l++)r=t[l],i=a,o=void 0,s=void 0,o=(n=r).x-i.x,s=n.y-i.y,o*o+s*s>e&&(u.push(r),a=r);return a!==r&&u.push(r),u}(t,n),t=fu(t,n)}function gu(t,e){if(!bt(e=e||{}))throw new Error("options is invalid");var r=void 0!==e.tolerance?e.tolerance:1,n=e.highQuality||!1,i=e.mutate||!1;if(!t)throw new Error("geojson is required");if(r&&r<0)throw new Error("invalid tolerance");return!0!==i&&(t=Ua(t)),$a(t,(function(t){!function(t,e,r){var n=t.type;if("Point"===n||"MultiPoint"===n)return t;Qa(t,!0);var i=t.coordinates;switch(n){case"LineString":t.coordinates=du(i,e,r);break;case"MultiLineString":t.coordinates=i.map((function(t){return du(t,e,r)}));break;case"Polygon":t.coordinates=Au(i,e,r);break;case"MultiPolygon":t.coordinates=i.map((function(t){return Au(t,e,r)}))}}(t,r,n)})),t}function du(t,e,r){return pu(t.map((function(t){return{x:t[0],y:t[1],z:t[2]}})),e,r).map((function(t){return t.z?[t.x,t.y,t.z]:[t.x,t.y]}))}function Au(t,e,r){return t.map((function(t){var n=t.map((function(t){return{x:t[0],y:t[1]}}));if(n.length<4)throw new Error("invalid polygon");for(var i=pu(n,e,r).map((function(t){return[t.x,t.y]}));!yu(i);)i=pu(n,e-=.01*e,r).map((function(t){return[t.x,t.y]}));return i[i.length-1][0]===i[0][0]&&i[i.length-1][1]===i[0][1]||i.push(i[0]),i}))}function yu(t){return!(t.length<3)&&!(3===t.length&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}var vu={exports:{}};function mu(t,e,r){r=r||2;var n,i,o,s,a,u,l,h=e&&e.length,c=h?e[0]*r:t.length,f=Eu(t,0,c,r,!0),p=[];if(!f||f.next===f.prev)return p;if(h&&(f=function(t,e,r,n){var i,o,s,a=[];for(i=0,o=e.length;i<o;i++)(s=Eu(t,e[i]*n,i<o-1?e[i+1]*n:t.length,n,!1))===s.next&&(s.steiner=!0),a.push(Ru(s));for(a.sort(Bu),i=0;i<a.length;i++)r=Su(a[i],r);return r}(t,e,f,r)),t.length>80*r){n=o=t[0],i=s=t[1];for(var g=r;g<c;g+=r)(a=t[g])<n&&(n=a),(u=t[g+1])<i&&(i=u),a>o&&(o=a),u>s&&(s=u);l=0!==(l=Math.max(o-n,s-i))?32767/l:0}return Iu(f,p,r,n,i,l,0),p}function Eu(t,e,r,n,i){var o,s;if(i===qu(t,e,r,n)>0)for(o=e;o<r;o+=n)s=Uu(o,t[o],t[o+1],s);else for(o=r-n;o>=e;o-=n)s=Uu(o,t[o],t[o+1],s);return s&&ku(s,s.next)&&(Hu(s),s=s.next),s}function _u(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!ku(n,n.next)&&0!==Pu(n.prev,n,n.next))n=n.next;else{if(Hu(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function Iu(t,e,r,n,i,o,s){if(t){!s&&o&&function(t,e,r,n){var i=t;do{0===i.z&&(i.z=Mu(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,o,s,a,u,l=1;do{for(r=t,t=null,o=null,s=0;r;){for(s++,n=r,a=0,e=0;e<l&&(a++,n=n.nextZ);e++);for(u=l;a>0||u>0&&n;)0!==a&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,a--):(i=n,n=n.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,l*=2}while(s>1)}(i)}(t,n,i,o);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,o?Cu(t,n,i,o):xu(t))e.push(a.i/r|0),e.push(t.i/r|0),e.push(u.i/r|0),Hu(t),t=u.next,l=u.next;else if((t=u)===l){s?1===s?Iu(t=wu(_u(t),e,r),e,r,n,i,o,2):2===s&&bu(t,e,r,n,i,o):Iu(_u(t),e,r,n,i,o,1);break}}}function xu(t){var e=t.prev,r=t,n=t.next;if(Pu(e,r,n)>=0)return!1;for(var i=e.x,o=r.x,s=n.x,a=e.y,u=r.y,l=n.y,h=i<o?i<s?i:s:o<s?o:s,c=a<u?a<l?a:l:u<l?u:l,f=i>o?i>s?i:s:o>s?o:s,p=a>u?a>l?a:l:u>l?u:l,g=n.next;g!==e;){if(g.x>=h&&g.x<=f&&g.y>=c&&g.y<=p&&Lu(i,a,o,u,s,l,g.x,g.y)&&Pu(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function Cu(t,e,r,n){var i=t.prev,o=t,s=t.next;if(Pu(i,o,s)>=0)return!1;for(var a=i.x,u=o.x,l=s.x,h=i.y,c=o.y,f=s.y,p=a<u?a<l?a:l:u<l?u:l,g=h<c?h<f?h:f:c<f?c:f,d=a>u?a>l?a:l:u>l?u:l,A=h>c?h>f?h:f:c>f?c:f,y=Mu(p,g,e,r,n),v=Mu(d,A,e,r,n),m=t.prevZ,E=t.nextZ;m&&m.z>=y&&E&&E.z<=v;){if(m.x>=p&&m.x<=d&&m.y>=g&&m.y<=A&&m!==i&&m!==s&&Lu(a,h,u,c,l,f,m.x,m.y)&&Pu(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,E.x>=p&&E.x<=d&&E.y>=g&&E.y<=A&&E!==i&&E!==s&&Lu(a,h,u,c,l,f,E.x,E.y)&&Pu(E.prev,E,E.next)>=0)return!1;E=E.nextZ}for(;m&&m.z>=y;){if(m.x>=p&&m.x<=d&&m.y>=g&&m.y<=A&&m!==i&&m!==s&&Lu(a,h,u,c,l,f,m.x,m.y)&&Pu(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;E&&E.z<=v;){if(E.x>=p&&E.x<=d&&E.y>=g&&E.y<=A&&E!==i&&E!==s&&Lu(a,h,u,c,l,f,E.x,E.y)&&Pu(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function wu(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!ku(i,o)&&Du(i,n,n.next,o)&&Fu(i,o)&&Fu(o,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(o.i/r|0),Hu(n),Hu(n.next),n=t=o),n=n.next}while(n!==t);return _u(n)}function bu(t,e,r,n,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&Nu(s,a)){var u=Gu(s,a);return s=_u(s,s.next),u=_u(u,u.next),Iu(s,e,r,n,i,o,0),void Iu(u,e,r,n,i,o,0)}a=a.next}s=s.next}while(s!==t)}function Bu(t,e){return t.x-e.x}function Su(t,e){var r=function(t,e){var r,n=e,i=t.x,o=t.y,s=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>s&&(s=a,r=n.x<n.next.x?n:n.next,a===i))return r}n=n.next}while(n!==e);if(!r)return null;var u,l=r,h=r.x,c=r.y,f=1/0;n=r;do{i>=n.x&&n.x>=h&&i!==n.x&&Lu(o<c?i:s,o,h,c,o<c?s:i,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(i-n.x),Fu(n,t)&&(u<f||u===f&&(n.x>r.x||n.x===r.x&&Tu(r,n)))&&(r=n,f=u)),n=n.next}while(n!==l);return r}(t,e);if(!r)return e;var n=Gu(r,t);return _u(n,n.next),_u(r,r.next)}function Tu(t,e){return Pu(t.prev,t,e.prev)<0&&Pu(e.next,t,t.next)<0}function Mu(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ru(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function Lu(t,e,r,n,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(n-a)>=(r-s)*(e-a)&&(r-s)*(o-a)>=(i-s)*(n-a)}function Nu(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Du(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Fu(t,e)&&Fu(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Pu(t.prev,t,e.prev)||Pu(t,e.prev,e))||ku(t,e)&&Pu(t.prev,t,t.next)>0&&Pu(e.prev,e,e.next)>0)}function Pu(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function ku(t,e){return t.x===e.x&&t.y===e.y}function Du(t,e,r,n){var i=Ou(Pu(t,e,r)),o=Ou(Pu(t,e,n)),s=Ou(Pu(r,n,t)),a=Ou(Pu(r,n,e));return i!==o&&s!==a||(!(0!==i||!Qu(t,r,e))||(!(0!==o||!Qu(t,n,e))||(!(0!==s||!Qu(r,t,n))||!(0!==a||!Qu(r,e,n)))))}function Qu(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Ou(t){return t>0?1:t<0?-1:0}function Fu(t,e){return Pu(t.prev,t,t.next)<0?Pu(t,e,t.next)>=0&&Pu(t,t.prev,e)>=0:Pu(t,e,t.prev)<0||Pu(t,t.next,e)<0}function Gu(t,e){var r=new ju(t.i,t.x,t.y),n=new ju(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Uu(t,e,r,n){var i=new ju(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Hu(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function ju(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function qu(t,e,r,n){for(var i=0,o=e,s=r-n;o<r;o+=n)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}vu.exports=mu,vu.exports.default=mu,mu.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,s=Math.abs(qu(t,0,o,r));if(i)for(var a=0,u=e.length;a<u;a++){var l=e[a]*r,h=a<u-1?e[a+1]*r:t.length;s-=Math.abs(qu(t,l,h,r))}var c=0;for(a=0;a<n.length;a+=3){var f=n[a]*r,p=n[a+1]*r,g=n[a+2]*r;c+=Math.abs((t[f]-t[g])*(t[p+1]-t[f+1])-(t[f]-t[p])*(t[g+1]-t[f+1]))}return 0===s&&0===c?0:Math.abs((c-s)/s)},mu.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)r.vertices.push(t[i][o][s]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r};var Vu=vu.exports,zu={altitude:0},Yu=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),n=maptalks.Util.extend({},zu,n,{layer:s}),(a=e.call(this))._initOptions(n),n.altitude;var u=t.length;0===u&&console.error("polygons is empty");for(var l=1/0,h=1/0,c=-1/0,f=-1/0,p=0;p<u;p++){var g=t[p],d=g.getCenter?g.getCenter():getGeoJSONCenter(g),A=void 0,y=void 0;Array.isArray(d)?(A=d[0],y=d[1]):d instanceof maptalks.Coordinate&&(A=d.x,y=d.y),l=Math.min(l,A),h=Math.min(h,y),c=Math.max(c,A),f=Math.max(f,y)}var v=new maptalks.Coordinate((l+c)/2,(h+f)/2);a.centerPt=s.coordinateToVector3(v,0);var m=[];a._geometriesAttributes=[],a._colorMap={};for(var E=0;E<t.length;E++){var _=a.getGeometry(t[E],s),I=_.attributes.position.array;a._geometriesAttributes[E]={position:{count:I.length/3}};for(var C=new THREE.Color(t[E].properties.color),w=new Float32Array(I.length),b=0;b<I.length;b++)w[3*b]=C.r,w[3*b+1]=C.g,w[3*b+2]=C.b;_.setAttribute("color1",new THREE.Float32BufferAttribute(w,3)),console.log(_),m.push(_)}a._datas=t;var B=x(m);return a._createMesh(B,o),a.getObject3d().position.copy(a.centerPt),a._setPickObject3d(),a._init(),a}return s(r,[{key:"_init",value:function(){var t=this,e=this.getLayer().getPick();this.on("add",(function(){e.add(t.pickObject3d)})),this.on("remove",(function(){e.remove(t.pickObject3d)}))}},{key:"_setPickObject3d",value:function(){if(this._colorMap){for(var t=this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),r=this._geometriesAttributes.length,n=N(this._geometriesAttributes),i=0,o=0;o<r;o++){var s=e.getColor(),a=s.getHex();this._colorMap[a]=o;var u=this._geometriesAttributes[o].position.count;this._datas[o].colorIndex=a;for(var l=0;l<u;l++)n[i]=s.r,n[i+1]=s.g,n[i+2]=s.b,i+=3}t.setAttribute("pickColor",new THREE.BufferAttribute(n,3,!0));var h=new THREE.ShaderMaterial({vertexShader:"\n attribute vec3 pickColor;\n varying vec3 vPickColor;\n void main(){\n vPickColor = pickColor;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n varying vec3 vPickColor;\n void main() {\n gl_FragColor = vec4(vPickColor, 1.0);\n }",side:THREE.DoubleSide,transparent:!0}),c=e.getColor().getHex(),f=new THREE.Mesh(t,h);f.position.copy(this.getObject3d().position),f._colorIndex=c,this.setPickObject3d(f)}}},{key:"getSelectMesh",value:function(){return this._datas[this.index]}},{key:"identify",value:function(t){return this.picked}},{key:"getGeometry",value:function(t,e){var r=[],n=[];if(t instanceof maptalks.MultiPolygon)for(var i=t.getCoordinates(),o=0,s=i.length;o<s;o++){var a=this.getSingleGeometry(i[o],e,this.centerPt),u=a.positionsV,l=a.faces;if(o>0)for(var h=r.length,c=0,f=l.length;c<f;c++)l[c]+=h;u.forEach((function(t){r.push(t)})),l.forEach((function(t){n.push(t)}))}else{var p=this.getSingleGeometry(t,e,this.centerPt),g=p.positionsV,d=p.faces;r=g,n=d}var A=(new THREE.BufferGeometry).setFromPoints(r);return A.setIndex(n),A}},{key:"getSingleGeometry",value:function(t,e,r){Array.isArray(t)&&(t=new maptalks.Polygon(t));var n=t.getShell(),i=t.getHoles(),o=[],s=[],a=[];n.forEach((function(t){var n=e.coordinateToVector3(t).sub(r);o.push(n.x,n.y,n.z),a.push(n)})),i&&i.length>0&&i.forEach((function(t){s.push(a.length),t.forEach((function(t){var n=e.coordinateToVector3(t).sub(r);o.push(n.x,n.y,n.z),a.push(n)}))}));var u=s.length>0?s:void 0,l=Vu(o,u,3);return{positionsV:a,faces:l}}}]),r}(),Xu=function(){function e(t,r,n,o){var s=this;i(this,e),this.map=n.map,this.threeLayer=n,this.groupId=o,this.isToolTip=void 0!==r.isToolTip&&r.isToolTip,this.interactive=void 0!==r.interactive&&r.interactive,this.isSimplify=void 0!==r.isSimplify&&r.isSimplify;var a={tolerance:r.tolerance||.01,highQuality:!0};if(this.oricolors={},this.colorItems=[],this.meshs=[],this.dataItemsIndex={},this.codeField=r.codeField||"id",this.clickFunc=r.clickFunc||null,this.cFunc=r.cFunc||null,this.mouseMoveFunc=r.mouseMoveFunc||null,this.clickInfoFlag=void 0!==r.clickInfoFlag&&r.clickInfoFlag,this.clickInfoFlag){var u={custom:!0,dy:r.infoDy||-48,content:"",animation:!1,autoOpenOn:null};this.infoWindow=new maptalks.ui.InfoWindow(u).addTo(this.map)}var l=[];t.features.forEach((function(t){if(s.isSimplify){var e=gu(t,a),r=e.geometry.type;if(["Polygon","MultiPolygon"].includes(r)){var n=e.properties,i=maptalks.GeoJSON.toGeometry(e);i.setProperties(n),l.push(i)}}else{var o=t.geometry.type;if(["Polygon","MultiPolygon"].includes(o)){var u=t.properties,h=maptalks.GeoJSON.toGeometry(t);h.setProperties(u),l.push(h)}}})),this.material=new THREE.MeshBasicMaterial({vertexColors:!0,transparent:!0,opacity:void 0!==r.opacity?r.opacity:1}),this.dataItems=l}var r,o;return s(e,[{key:"generatePolygon",value:(o=n(t().mark((function e(){var r,n,i=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.dataItems){t.next=2;break}return t.abrupt("return",null);case 2:return this.material.onBeforeCompile=function(t){r=i._createMergePolygonShaderPol(t),i.shader=r},(n=new Yu(this.dataItems,{interactive:this.interactive},this.material,this.threeLayer)).parent=this,this.groupId?this.threeLayer.addMesh1(n,this.groupId):this.threeLayer.addMesh(n),this.mesh=n,this.isToolTip&&n.setToolTip("hello",{showTimeout:0,eventsPropagation:!0,dx:10}),this._bindMapEvents(n),t.abrupt("return",this);case 10:case"end":return t.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"_bindMapEvents",value:function(t){t&&t.on("click empty mousemove",this._setEvent,this)}},{key:"_closeEvent",value:function(){this.polygonMeshs&&this.polygonMeshs.off("click empty mousemove",this._setEvent,this)}},{key:"addContent",value:(r=n(t().mark((function e(r){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.clickFunc(r);case 2:case"end":return t.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"_setEvent",value:function(t){var e=t.selectMesh;if("mousemove"===t.type&&e){var r=e.properties.name;if(this.isToolTip)this.mesh.getToolTip()._content="".concat(r)}"click"===t.type&&e&&this.clickFunc&&!this.cFunc&&this.addContent(e)}},{key:"dispose",value:function(){this.isToolTip&&this.mesh&&this.mesh.removeToolTip(),this.mesh&&(this.groupId?this.threeLayer.removeMesh1(this.mesh,this.groupId):this.threeLayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose(),this.mesh.object3d.material&&(this.mesh.object3d.material.userData&&delete this.mesh.object3d.material.userData,this.mesh.object3d.material.dispose()))}},{key:"_createMergePolygonShaderPol",value:function(t){return t.vertexShader="\n attribute vec3 color1;\n ".concat(t.vertexShader,"\n ").replace("#include <color_vertex>","#include <color_vertex>\n //vColor = texture(colors, vec2(colorIdx / 7., 0.)).rgb; // divide colorIdx by (amount of colors (3) - 1, thus 2)\n vColor = color1; // divide colorIdx by (amount of colors (3) - 1, thus 2)\n "),t}}]),e}(),Ju={altitude:0,height:0},Wu=function(t){u(r,maptalks.BaseObject);var e=f(r);function r(t,n,o,s){var a;i(this,r),o=maptalks.Util.extend({},Ju,o,{layer:s}),a=e.call(this);var u=o,l=u.width,h=u.height,c=u.triW,f=u.triH,p=u.altitude;a._initOptions(o);var g=[],d=new THREE.BufferGeometry,A=new Float32Array([-c/2,-f/2,0,0,f/2,0,c/2,-f/2,0]),y=new Float32Array([0,0,1]),v=new Float32Array([0,1,.5,.5,1,1]);d.setIndex(new THREE.Uint16BufferAttribute([0,1,2],1)),d.setAttribute("position",new THREE.BufferAttribute(A,3)),d.setAttribute("normal",new THREE.BufferAttribute(y,3)),d.setAttribute("uv",new THREE.BufferAttribute(v,2)),d.computeBoundingBox(),d.translate(0,-d.boundingBox.max.y,0),g.push(d);var m=new THREE.PlaneGeometry(l,h);m.computeBoundingBox(),m.translate(0,-m.boundingBox.max.y-f,0),g.push(m);var E=x(g);E.computeVertexNormals(),a._createMesh(E,n);var _=s.distanceToVector3(p,p).x,I=s.coordinateToVector3(t,_);return a.getObject3d().position.copy(I),a}return s(r)}(),Ku=function(){function e(t,r,n,o){i(this,e),this.threelayer=n,this.map=n.map,this.groupId=o,r.lineImgSrc,r.arrowImgSrc,this.imgWidth=r.imgWidth||80,this.imgHeight=r.imgHeight||160;var s=r.rotation||0,a=r.width||20,u=r.height||10,l=n.distanceToVector3(a,a).x,h=n.distanceToVector3(u,u).x;r.anchor;var c=-(s+180)*Math.PI/180;this.material=new THREE.MeshBasicMaterial({color:r.color||"white",side:THREE.DoubleSide,depthTest:!1,transparent:!0}),this.mesh=new Wu(t,this.material,{width:l,height:h,triW:r.triW||1.6,triH:r.triH||2},n),this.mesh.object3d.renderOrder=r.renderOrder||0,this.mesh.object3d.rotation.z=c,this.groupId?this.threelayer.addMesh1(this.mesh,this.groupId):this.threelayer.addMesh(this.mesh)}var r;return s(e,[{key:"loadTexture",value:(r=n(t().mark((function e(r){var n,i,o,s;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r,!r.includes(".svg")){t.next=8;break}return t.next=4,fetch(r);case 4:return i=t.sent,t.next=7,i.text();case 7:n=t.sent;case 8:return new DOMParser,t.next=11,jt.addImageProcess(n);case 11:return o=t.sent,s=jt.generateTextureOne(o,this.imgWidth,this.imgHeight),t.abrupt("return",s);case 14:case"end":return t.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"dispose",value:function(){this.mesh&&(this.groupId?this.threelayer.removeMesh1(this.mesh,this.groupId):this.threelayer.removeMesh(this.mesh),this.mesh.object3d.geometry&&this.mesh.object3d.geometry.dispose()),this.material&&this.material.dispose()}}]),e}(),Zu=function(){function t(e,r,n,o){var s=this;i(this,t),this.map=n.map,this.threeLayer=n,this.groupId=o,this.meshs=[],this.lineStrings=[];var a=r.lineColor||"#377EE8",u=r.lineWidth||1;this.fatLineMaterial=new Zs({color:new THREE.Color(a),transparent:!0,linewidth:u,blending:THREE.AdditiveBlending}),e.features.forEach((function(t){var e=t.geometry;maptalks.GeoJSON.toGeometry(t);var r=t.properties,i=.1;s.isExtrusion&&(i=r.height?200*r.height:.1),e.coordinates.forEach((function(e){var r=new maptalks.LineString(e[0]),o=n.toFatLine(r,{altitude:.1===i?1:i,interactive:!1},s.fatLineMaterial);o.setProperties(t.properties),o.getObject3d().layers.enable(1),s.meshs.push(o),s.lineStrings.push(r)}))})),this.groupId?n.addMesh1(this.meshs,this.groupId):n.addMesh(this.meshs)}return s(t,[{key:"dispose",value:function(){this.meshs&&(this.groupId?this.threeLayer.removeMesh1(this.meshs,this.groupId):this.threeLayer.removeMesh(this.meshs),this.meshs.forEach((function(t){t.object3d.geometry&&t.object3d.geometry.dispose()})),this.meshs=[]),this.fatLineMaterial&&this.fatLineMaterial.dispose()}}]),t}();maptalks.ThreeLayer.prototype._recursionMesh=function(t){for(;t&&t.parent!==this.getScene()&&!t.parent.customType;)t=t.parent;return t},maptalks.ThreeLayer.prototype.identify=function(t,e){var r=this;if(!t)return console.error("coordinate is null,it should be Coordinate"),[];if(Array.isArray(t)&&(t=new maptalks.Coordinate(t)),!(t instanceof maptalks.Coordinate))return console.error("coordinate type is error,it should be Coordinate"),[];var n=this.getMap().coordToContainerPoint(t);this._containerPoint=n;var i=n.x,o=n.y;this._initRaycaster(),this.fire("identify",{coordinate:t,options:e});var s=this._raycaster,a=this._mouse,u=this.getCamera(),l=this.getScene(),h=this.getMap().getSize();if(!l)return[];var c=h.width,f=h.height;a.x=i/c*2-1,a.y=-o/f*2+1,s.setFromCamera(a,u),s.layers&&s.layers.enableAll&&s.layers.enableAll(),function(t,e){t.linePrecision=e}(s,this._getLinePrecision(this.getMap().getResolution()));var p=[],g=[];l.children.forEach((function(t){var e=t.__parent;if(e&&e.getOptions){var r=e;r.getOptions().interactive&&r.isVisible()&&(r.identify&&maptalks.Util.isFunction(r.identify)?g.push(r):p.push(t))}else(t instanceof THREE.Mesh||t instanceof THREE.Group)&&(t.customType?t.children.forEach((function(t){var e=t.__parent;if(e&&e.getOptions){var r=e;r.getOptions().interactive&&r.isVisible()&&(r.identify&&maptalks.Util.isFunction(r.identify)?g.push(r):p.push(t))}})):p.push(t))}));var d=[],A=s.intersectObjects(p,!0);A&&Array.isArray(A)&&A.length&&(d=A.map((function(t){var e=t.object,n=t.instanceId,i=(e=r._recursionMesh(e)||{}).__parent||e;return i.faceIndex=t.faceIndex,i.index=t.index,i.intersect=t,maptalks.Util.isNumber(n)&&(i.instanceId=n),i}))),this.renderPickScene(),g.length&&g.forEach((function(e){e.identify(t)&&d.push(e)}));for(var y=d.length,v=0;v<y;v++)if(d[v])for(var m=v+1;m<y;m++)d[v]===d[m]&&d.splice(m,1);var E=(e=maptalks.Util.extend({},e)).count;return maptalks.Util.isNumber(E)&&E>0?d.slice(0,E):d},maptalks.ThreeLayer.prototype._zoomend=function(){var t=this.getScene();if(t){var e=this.getMap().getZoom();t.children.forEach((function(t){if(t.customType)t.children.forEach((function(t){var r=t.__parent;if(r&&r.getOptions){var n=r;n.zoomChange&&maptalks.Util.isFunction(n.zoomChange)&&n.zoomChange(e);var i=n.getMinZoom(),o=n.getMaxZoom();e<i||e>o?(n.isVisible()&&(n.getObject3d().visible=!1),n._zoomVisible=!1):i<=e&&e<=o&&(n._visible&&(n.getObject3d().visible=!0),n._zoomVisible=!0)}}));else{var r=t.__parent;if(r&&r.getOptions){var n=r;n.zoomChange&&maptalks.Util.isFunction(n.zoomChange)&&n.zoomChange(e);var i=n.getMinZoom(),o=n.getMaxZoom();e<i||e>o?(n.isVisible()&&(n.getObject3d().visible=!1),n._zoomVisible=!1):i<=e&&e<=o&&(n._visible&&(n.getObject3d().visible=!0),n._zoomVisible=!0)}}}))}},maptalks.ThreeLayer.prototype.addMesh1=function(t,e){var r=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)return this;Array.isArray(t)||(t=[t]);var i=this.getScene(),o=void 0;if(e&&(o=i.getObjectByProperty("customId",e)),t.forEach((function(t){if(t instanceof maptalks.BaseObject){var e;if(o)o.add(t.getObject3d());else console.log("组不存在,销毁创建的对象"),null===(e=t.parent)||void 0===e||e.dispose();t.isAdd||(t.isAdd=!0,t.options.layer=r,t._fire("add",{target:t}))}})),this._zoomend(),n){var s=this._getRenderer();s&&s.setToRedraw()}return this},maptalks.ThreeLayer.prototype.removeMesh1=function(t,e){var r=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)return this;Array.isArray(t)||(t=[t]);var i=this.getScene(),o=i.getObjectByProperty("customId",e);if(t.forEach((function(t){if(t instanceof maptalks.BaseObject){o?o.remove(t.getObject3d()):i.remove(t.getObject3d()),t.isAdd&&(t.isAdd=!1,t._fire("remove",{target:t})),t._animation&&maptalks.Util.isFunction(t._animation)&&delete r._animationBaseObjectMap[t.getObject3d().uuid];var e=r._delayMeshes;if(e.length)for(var n=0,s=e.length;n<s;n++)if(e[n]===t){e.splice(n,1);break}}else t instanceof THREE.Object3D&&i.remove(t)})),n){var s=this._getRenderer();s&&s.setToRedraw()}return this};var $u=function(){function e(t,r,n){var o=this;i(this,e),this.map=r,this.animationId=null,this.updatables=[];var s=B();this.threeLayer=new maptalks.ThreeLayer(s,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new THREE.Clock;var a=function t(){var e;(o.threeLayer._needsUpdate=!o.threeLayer._needsUpdate,o.threeLayer._needsUpdate)&&(null===(e=o.threeLayer)||void 0===e||null===(e=e.getRenderer())||void 0===e||e.clearCanvas(),o.threeLayer.renderScene());var r,n=o.clock.getDelta(),i=_(o.updatables);try{for(i.s();!(r=i.n()).done;){r.value.tick(n)}}catch(t){i.e(t)}finally{i.f()}o.animationId=requestAnimationFrame(t)};this.threeLayer.prepareToDraw=function(t,e,r){var n=new THREE.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),e.add(n),a()},this.threeLayer.addTo(r),this.layerId=s,this.layerName=t,this.dirty=!1,this.initFlag=!1,this.bloomFlag=n||!1,this.bloomStrength=null==n?void 0:n.bloomStrength,this.bloomThreshold=null==n?void 0:n.bloomThreshold,this.bloomRadius=null==n?void 0:n.bloomRadius}var r;return s(e,[{key:"createGroup",value:(r=n(t().mark((function e(r){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),r));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,S(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),r));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var r=t.getObjectByName(e);return r||(r=new Vo(t,e)),r.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=B();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function e(){var r;(t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate)&&(null===(r=t.threeLayer)||void 0===r||null===(r=r.getRenderer())||void 0===r||r.clearCanvas(),t.threeLayer.renderScene());var n,i=t.clock.getDelta(),o=_(t.updatables);try{for(o.s();!(n=o.n()).done;){n.value.tick(i)}}catch(t){o.e(t)}finally{o.f()}t.animationId=requestAnimationFrame(e)};return new Promise((function(r){t.threeLayer.prepareToDraw=function(t,n,i){var o=new THREE.DirectionalLight(16777215);o.position.set(0,-10,10).normalize(),n.add(o),n.add(new THREE.AmbientLight(16777215)),e(),r()}}))}},{key:"drawRadar",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new H(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new H(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSector",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new V(t,e,r||{},i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new V(t,e,r||{},i.threeLayer,n);o(s)}))}))}},{key:"drawSectorImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new J(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new J(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawImage",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new F(t,e,r,n,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new F(t,e,r,n,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new shockEffect(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new shockEffect(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneMarker",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=null;t.length>0?(o=new se(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=null;t.length>0?(o=new se(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new Uo(t,e,r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new Uo(t,e,r.threeLayer,r);n(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new qo(t,e.threeLayer);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new qo(t,e.threeLayer);r(n)}))}))}},{key:"drawFbxModel",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new Vs(t,e,r,i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new Vs(t,e,r,i.threeLayer,n);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Xs(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Xs(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Js(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Js(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawBloomLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Zu(t,e,n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Zu(t,e,n.threeLayer,r);i(o)}))}))}},{key:"drawPolyline",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new $s(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new $s(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Xu(t,e,n.threeLayer,r);o.generatePolygon().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Xu(t,e,n.threeLayer,r);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new ra(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new ra(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Ca(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Ca(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawTube",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Ma(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Ma(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new Ba(t,e,r,n||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new Ba(t,e,r,n||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new ka(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new ka(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Da(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Da(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Ku(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Ku(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),n=this.threeLayer.getPick(),i=n.pickingTexture;n.pickingScene;var o=this.threeLayer.getRenderer();r.remove(e),e=null,r=null,i.dispose(),i=null,o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer)}}]),e}(),tl=function(){function e(t,r){var n=this;i(this,e),this.map=r,this.animationId=null,this.updatables=[];var o=B();this.threeLayer=new maptalks.ThreeLayer(o,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new THREE.Clock;var s=function t(){var e;(n.threeLayer._needsUpdate=!n.threeLayer._needsUpdate,n.threeLayer._needsUpdate)&&(null===(e=n.threeLayer)||void 0===e||null===(e=e.getRenderer())||void 0===e||e.clearCanvas(),n.threeLayer.renderScene());var r,i=n.clock.getDelta(),o=_(n.updatables);try{for(o.s();!(r=o.n()).done;){r.value.tick(i)}}catch(t){o.e(t)}finally{o.f()}n.animationId=requestAnimationFrame(t)};this.threeLayer.prepareToDraw=function(t,e,r){var n=new THREE.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),e.add(n),s()},this.threeLayer.addTo(r),this.layerId=o,this.layerName=t,this.dirty=!1,this.initFlag=!1}var r;return s(e,[{key:"createGroup",value:(r=n(t().mark((function e(r){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),r));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,S(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),r));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var r=t.getObjectByName(e);return r||(r=new Vo(t,e)),r.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=B();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function e(){var r;(t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate)&&(null===(r=t.threeLayer)||void 0===r||null===(r=r.getRenderer())||void 0===r||r.clearCanvas(),t.threeLayer.renderScene());var n,i=t.clock.getDelta(),o=_(t.updatables);try{for(o.s();!(n=o.n()).done;){n.value.tick(i)}}catch(t){o.e(t)}finally{o.f()}t.animationId=requestAnimationFrame(e)};return new Promise((function(r){t.threeLayer.prepareToDraw=function(t,n,i){var o=new THREE.DirectionalLight(16777215);o.position.set(0,-10,10).normalize(),n.add(o),n.add(new THREE.AmbientLight(16777215)),e(),r()}}))}},{key:"drawRadar",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new H(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new H(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSector",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new V(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new V(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSectorImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new J(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new J(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawImage",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new F(t,e,r,n,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new F(t,e,r,n,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new Z(t,e||{},r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new Z(t,e||{},r.threeLayer,r);n(i)}))}))}},{key:"drawPlaneMarker",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=null;t.length>0?(o=new se(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=null;t.length>0?(o=new se(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new Uo(t,e,r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new Uo(t,e,r.threeLayer,r);n(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new qo(t,e.threeLayer);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new qo(t,e.threeLayer);r(n)}))}))}},{key:"drawFbxModel",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new Vs(t,e,r,i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new Vs(t,e,r,i.threeLayer,n);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Xs(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Xs(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Js(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Js(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawPolyline",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new $s(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new $s(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Xu(t,e,n.threeLayer,r);o.generatePolygon().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Xu(t,e,n.threeLayer,r);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new ra(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new ra(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Ca(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Ca(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawTube",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Ma(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Ma(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new Ba(t,e,r,n||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new Ba(t,e,r,n||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new ka(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new ka(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Da(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Da(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new Ku(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Ku(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),n=this.threeLayer.getPick(),i=n.pickingTexture;n.pickingScene;var o=this.threeLayer.getRenderer();r.remove(e),e=null,r=null,i.dispose(),i=null,o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer)}}]),e}(),el=function(){function t(e,r,n,o){i(this,t),this.map=o,this.geometry=null,this.selectGeometry=null,this.isEndSelect=!1,this.drawTool=new maptalks.DrawTool({mode:e,symbol:{lineColor:n.lineColor||"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:n.polygonFill||"#E40D56",polygonOpacity:.2}}).addTo(this.map).enable(),this._bindEvent(),this._drawEnd=r,this.mode=e,this.toolLayer=new maptalks.VectorLayer(maptalks.Util.GUID(),{geometryEvents:!1,hitDetect:!1}).addTo(this.map),this.geometry&&(this.toolLayer.addGeometry(this.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(this.geometry.getCoordinates(),this.geometry.getRadius()):this._drawEnd(this.geometry.getCoordinates()))),n.zIndex&&this.toolLayer.setZIndex(n.zIndex),this.type="drawTool"}return s(t,[{key:"getZIndex",value:function(){this.toolLayer&&this.toolLayer.getZIndex()}},{key:"setZIndex",value:function(t){this.toolLayer&&this.toolLayer.setZIndex(t)}},{key:"selectGeometryByPoint",value:function(){this.map.on("click",this._selectGeometry,this)}},{key:"endSelect",value:function(){this.toolLayer&&this.selectGeometry&&(this._changeSymbol(!1),this.selectGeometry.endEdit(),this.selectGeometry=null),this.map.off("click",this._selectGeometry,this)}},{key:"_selectGeometry",value:function(t){if(this.disableTool(),this.toolLayer){var e=this.toolLayer.identify(t.coordinate);this.selectGeometry&&(this.selectGeometry.endEdit(),this._changeSymbol(!1)),e&&(this.selectGeometry=e[0]),this.selectGeometry&&this._changeSymbol(!0)}}},{key:"_closeMapEvent",value:function(){this.map.off("click",this._selectGeometry,this)}},{key:"_changeSymbol",value:function(t){t?this.selectGeometry.setSymbol({lineColor:"#00ffff",lineWidth:2,lineDasharray:[5,5],polygonFill:"#00ffff",polygonOpacity:.2}):this.selectGeometry.setSymbol({lineColor:"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:"#E40D56",polygonOpacity:.2})}},{key:"deleteGeometry",value:function(){this.toolLayer&&this.selectGeometry&&(this.selectGeometry.endEdit(),this.toolLayer.removeGeometry(this.selectGeometry))}},{key:"undoDrawGeometry",value:function(){if(this.toolLayer){var t=this.toolLayer.getGeometries();if(t.length<1)return;this.toolLayer.removeGeometry(t[t.length-1])}}},{key:"_bindEvent",value:function(){this.drawTool.on("drawend",this.drawEnd,this)}},{key:"_closeEvent",value:function(){this.drawTool.off("drawend",this.drawEnd,this)}},{key:"drawEnd",value:function(t){this.toolLayer&&this.toolLayer.addGeometry(t.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(t.geometry.getCoordinates(),t.geometry.getRadius()):this._drawEnd(t.geometry.getCoordinates())),this.geometry=t.geometry}},{key:"disableTool",value:function(){this.drawTool.disable()}},{key:"clearGeometry",value:function(){this.toolLayer&&this.toolLayer.clear()}},{key:"setMode",value:function(t,e){this._drawEnd&&delete this._drawEnd,this._drawEnd=e,this.drawTool.setMode(t).enable(),this.mode=t}},{key:"startEdit",value:function(){this.disableTool(),this.selectGeometry&&this.selectGeometry.startEdit()}},{key:"endEdit",value:function(t){this.selectGeometry&&(this.selectGeometry.endEdit(),t&&("Circle"===this.mode?t(this.selectGeometry.getCoordinates(),this.geometry.getRadius()):t(this.selectGeometry.getCoordinates())))}},{key:"dispose",value:function(){this.drawTool&&(this._closeEvent(),this.endEdit(),this.disableTool(),delete this.drawTool),this._drawEnd&&delete this._drawEnd,this.geometry&&delete this.geometry,this.selectGeometry&&delete this.selectGeometry,this.map&&this._closeMapEvent(),this.map.removeLayer(this.toolLayer),delete this.toolLayer}}]),t}();function rl(){this.PI=3.141592653589793,this.x_PI=52.35987755982988,this.a=6378245,this.ee=.006693421622965943,this.EARTHRADIUS=6370996.81,this.MCBAND=[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],this.LLBAND=[75,60,45,30,15,0],this.MC2LL=[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],this.LL2MC=[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]],this._transformlat=function(t,e){var r=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,r+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3},this._transformlng=function(t,e){var r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,r+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3},this._out_of_china=function(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271||!1},this._getLoop=function(t,e,r){for(;t>r;)t-=r-e;for(;t<e;)t+=r-e;return t},this._getRange=function(t,e,r){return null!=e&&(t=Math.max(t,e)),null!=r&&(t=Math.min(t,r)),t}}rl.prototype.BD2GCJ=function(t,e){var r=t-.0065,n=e-.006,i=Math.sqrt(r*r+n*n)-2e-5*Math.sin(n*this.x_PI),o=Math.atan2(n,r)-3e-6*Math.cos(r*this.x_PI);return[i*Math.cos(o),i*Math.sin(o)]},rl.prototype.GCJ2BD=function(t,e){var r=Math.sqrt(t*t+e*e)+2e-5*Math.sin(e*this.x_PI),n=Math.atan2(e,t)+3e-6*Math.cos(t*this.x_PI);return[r*Math.cos(n)+.0065,r*Math.sin(n)+.006]},rl.prototype.WGS2GCJ=function(t,e){if(this._out_of_china(t,e))return[t,e];var r=this._transformlat(t-105,e-35),n=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.PI),[t+(n=180*n/(this.a/s*Math.cos(i)*this.PI)),e+r]},rl.prototype.GCJ2WGS=function(t,e){if(this._out_of_china(t,e))return[t,e];var r=this._transformlat(t-105,e-35),n=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.PI),[2*t-(t+(n=180*n/(this.a/s*Math.cos(i)*this.PI))),2*e-(e+r)]},rl.prototype.WGS2BD=function(t,e){var r=this.WGS2GCJ(t,e);return r=this.GCJ2BD(r[0],r[1])},rl.prototype.BD2WGS=function(t,e){var r=this.BD2GCJ(t,e);return r=this.GCJ2WGS(r[0],r[1])},rl.prototype.BD_MKT2WGS=function(t,e){var r=null;t=Math.abs(t),e=Math.abs(e);for(var n=0;n<this.MCBAND.length;n++)if(e>=this.MCBAND[n]){r=this.MC2LL[n];break}t=r[0]+r[1]*Math.abs(t);var i=Math.abs(e)/r[9];return e=r[2]+r[3]*i+r[4]*i*i+r[5]*i*i*i+r[6]*i*i*i*i+r[7]*i*i*i*i*i+r[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]},rl.prototype.BD_WGS2MKT=function(t,e){var r=null;t=this._getLoop(t,-180,180),e=this._getRange(e,-74,74);for(var n=0;n<this.LLBAND.length;n++)if(e>=this.LLBAND[n]){r=this.LL2MC[n];break}if(null!=r)for(n=this.LLBAND.length-1;n>=0;n--)if(e<=-this.LLBAND[n]){r=this.LL2MC[n];break}t=r[0]+r[1]*Math.abs(t);var i=Math.abs(e)/r[9];return e=r[2]+r[3]*i+r[4]*i*i+r[5]*i*i*i+r[6]*i*i*i*i+r[7]*i*i*i*i*i+r[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]};var nl=function(t){u(r,maptalks.Layer);var e=f(r);function r(t,n,o){var s;return i(this,r),(s=e.call(this,t,o)).data=n,s}return s(r,[{key:"setData",value:function(t){return this.data=t,this}},{key:"getData",value:function(){return this.data}}]),r}();nl.mergeOptions({color:"rgba(135,196,240,0.6)",font:"30px san-serif",hitDetect:!1});var il=function(t){u(r,maptalks.renderer.CanvasRenderer);var e=f(r);function r(){return i(this,r),e.apply(this,arguments)}return s(r,[{key:"checkResources",value:function(){return[]}},{key:"needToRedraw",value:function(){return!0}},{key:"draw",value:function(){this._drawData(this.layer.getData(),this.layer.options.color),this.completeRender()}},{key:"drawOnInteracting",value:function(t){this._drawData(this._drawnData,this.layer.options.color),this.completeRender()}},{key:"_drawData",value:function(t,e){this.getMap(),this.prepareCanvas();var r=this.context;r.fillStyle=e;var n=r.canvas;r.rect(0,0,n.width,n.height),r.fill()}}]),r}();function ol(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function sl(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function al(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):
|
|
2
2
|
/*!
|
|
3
3
|
* maptalks.animatemarker v0.4.1
|
|
4
4
|
* LICENSE : MIT
|
|
@@ -7,7 +7,7 @@ function t(){t=function(){return r};var e,r={},n=Object.prototype,i=n.hasOwnProp
|
|
|
7
7
|
/*!
|
|
8
8
|
* requires maptalks@>=0.25.0
|
|
9
9
|
*/
|
|
10
|
-
function(t,e){for(var r=Object.getOwnPropertyNames(e),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(e,i);o&&o.configurable&&void 0===t[i]&&Object.defineProperty(t,i,o)}}(t,e))}nl.registerRenderer("canvas",il);var ul,ll={markerType:"ellipse",markerFill:(ul=[135,196,240],{type:"radial",colorStops:[[.7,"rgba("+ul.join()+", 0.5)"],[.3,"rgba("+ul.join()+", 1)"],[.2,"rgba("+ul.join()+", 1)"],[0,"rgba("+ul.join()+", 0)"]]}),markerFillOpacity:.8,markerLineWidth:0,markerWidth:16,markerHeight:16},hl=function(t){function e(){return ol(this,e),sl(this,t.apply(this,arguments))}return al(e,t),e.prototype.addGeometry=function(e){return e instanceof maptalks.Geometry&&(e=[e]),e.forEach((function(t,e){if(!(t instanceof maptalks.Marker))throw new Error("The geometry at "+e+" to add is not a maptalks.Marker")})),t.prototype.addGeometry.apply(this,arguments)},e.fromJSON=function(t){if(!t||"AnimateMarkerLayer"!==t.type)return null;for(var r=new e(t.id,t.options),n=t.geometries,i=[],o=0;o<n.length;o++){var s=maptalks.Geometry.fromJSON(n[o]);s&&i.push(s)}return r.addGeometry(i),t.style&&r.setStyle(t.style),r},e}(maptalks.VectorLayer);hl.mergeOptions({animation:"scale,fade",randomAnimation:!0,animationDuration:3e3}),hl.registerJSONType("AnimateMarkerLayer"),hl.registerRenderer("canvas",function(t){function e(){return ol(this,e),sl(this,t.apply(this,arguments))}return al(e,t),e.prototype.draw=function(){this._needUpdate&&(this._prepare(),this._needUpdate=!1),this.prepareCanvas();var t=this.getMap(),e=this._currentMarkers;this._drawnExtent&&t.getExtent().equals(this._drawnExtent)&&(e=this._drawnMarkers),this._drawAllMarkers(e),this._drawnExtent=t.getExtent(),this.layer.isLoaded()||this.completeRender()},e.prototype.drawOnInteracting=function(){this._drawnMarkers&&0!==this._drawnMarkers.length&&this._drawAllMarkers(this._drawnMarkers)},e.prototype.needToRedraw=function(){return!!this.layer.options.animation||t.prototype.needToRedraw.call(this)},e.prototype.onCanvasCreate=function(){this._prepare()},e.prototype.onGeometryAdd=function(){this._redraw()},e.prototype.onGeometryRemove=function(){this._redraw()},e.prototype.onGeometrySymbolChange=function(){this._redraw()},e.prototype.onGeometryPositionChange=function(){this._redraw()},e.prototype.onGeometryShow=function(){this._redraw()},e.prototype.onGeometryHide=function(){this._redraw()},e.prototype.onGeometryPropertiesChange=function(t){if(t&&this.layer.getStyle())for(var e=0;e<t.length;e++)this.layer._styleGeometry(t[e])},e.prototype._redraw=function(){delete this._drawnMarkers,delete this._drawnExtent,this._needUpdate=!0},e.prototype._drawAllMarkers=function(t){var e=this,r=this.getMap(),n=r.getContainerExtent(),i=this._drawnTime=Date.now(),o=this._drawnAnim=this._getAnimation(),s=t!==this._drawnMarkers;s&&(this._drawnMarkers=[]),t.forEach((function(t){if(s){if(t.g.isVisible()){var a=r._prjToContainerPoint(t.coordinates);n.contains(a)&&(e._drawMarker(t,a,o,i),e._drawnMarkers.push(t))}}else{var u=r._prjToContainerPoint(t.coordinates);e._drawMarker(t,u,o,i)}}),this)},e.prototype._drawMarker=function(t,e,r,n){var i=this.layer.options.animationDuration,o=this.context,s=o.globalAlpha,a=(n-t.start)%i/i,u=r.fade&&a>=.5?2-2*a:1,l=r.scale?a:1,h=t.cacheKey,c=this._spriteCache[h],f=c.offset,p=c.canvas.width,g=c.canvas.height;c&&u>0&&(o.globalAlpha=s*u,o.drawImage(c.canvas,e.x+f.x-p*l/2,e.y+f.y-g*l/2,p*l,g*l),o.globalAlpha=s)},e.prototype._prepare=function(){var t=this,e=[],r={},n=this.getMap().getProjection();this.layer.forEach((function(i){t._currentGeo=i;var o=i._getInternalSymbol()===i.options.symbol?ll:i._getInternalSymbol(),s=JSON.stringify(o);r[s]||(r[s]=o),e.push({coordinates:n.project(i.getCoordinates()),cacheKey:s,start:t.layer.options.randomAnimation?Math.random()*t.layer.options.animationDuration:0,g:i})})),this._prepareSprites(r),this._currentMarkers=e},e.prototype._prepareSprites=function(t){for(var e in this._spriteCache={},t){var r=t[e],n=new maptalks.Marker([0,0],{symbol:r})._getSprite(this.resources);this._spriteCache[e]=n}},e.prototype.onRemove=function(){delete this._spriteCache,delete this._currentMarkers,delete this._drawnMarkers,delete this._drawnExtent},e.prototype._getAnimation=function(){for(var t,e={fade:!1,scale:!1},r=this.layer.options.animation?this.layer.options.animation.split(","):[],n=0;n<r.length;n++){var i=(t=r[n]).trim?t.trim():t.replace(/^\s+|\s+$/g,"");"fade"===i?e.fade=!0:"scale"===i&&(e.scale=!0)}return e},e}(maptalks.renderer.OverlayLayerCanvasRenderer)),"undefined"!=typeof console&&console.log("maptalks.animatemarker v0.4.1, requires maptalks@>=0.25.0.");var cl=function(){function t(e,r,n){i(this,t);var o=r.color||[255,0,0],s=r.opacity||.8,a=r.width||20,u=r.height||20,l=r.animationDuration||3e3,h=r.markerDx||0,c=r.markerDy||0,f=maptalks.GeoJSON.toGeometry(e);this.layer=new hl(maptalks.Util.GUID(),f,{animation:"scale,fade",animationDuration:l,randomAnimation:!0,geometryEvents:!1,hitDetect:!1}).setStyle([{symbol:{markerType:"ellipse",markerLineWidth:0,markerFill:this.getGradient(o),markerFillOpacity:s,markerWidth:a,markerHeight:u,markerDx:h,markerDy:c}}]).addTo(n)}return s(t,[{key:"getGradient",value:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}},{key:"hide",value:function(){var t;null===(t=this.layer)||void 0===t||t.hide()}},{key:"show",value:function(){this.layer.show()}},{key:"setZIndex",value:function(t){this.layer.setZIndex(t)}},{key:"dispose",value:function(){this.map.removeLayer(this.layer),delete this.layer}}]),t}();function fl(t){var e=[1/0,1/0,-1/0,-1/0];return za(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}fl.default=fl;
|
|
10
|
+
function(t,e){for(var r=Object.getOwnPropertyNames(e),n=0;n<r.length;n++){var i=r[n],o=Object.getOwnPropertyDescriptor(e,i);o&&o.configurable&&void 0===t[i]&&Object.defineProperty(t,i,o)}}(t,e))}nl.registerRenderer("canvas",il);var ul,ll={markerType:"ellipse",markerFill:(ul=[135,196,240],{type:"radial",colorStops:[[.7,"rgba("+ul.join()+", 0.5)"],[.3,"rgba("+ul.join()+", 1)"],[.2,"rgba("+ul.join()+", 1)"],[0,"rgba("+ul.join()+", 0)"]]}),markerFillOpacity:.8,markerLineWidth:0,markerWidth:16,markerHeight:16},hl=function(t){function e(){return ol(this,e),sl(this,t.apply(this,arguments))}return al(e,t),e.prototype.addGeometry=function(e){return e instanceof maptalks.Geometry&&(e=[e]),e.forEach((function(t,e){if(!(t instanceof maptalks.Marker))throw new Error("The geometry at "+e+" to add is not a maptalks.Marker")})),t.prototype.addGeometry.apply(this,arguments)},e.fromJSON=function(t){if(!t||"AnimateMarkerLayer"!==t.type)return null;for(var r=new e(t.id,t.options),n=t.geometries,i=[],o=0;o<n.length;o++){var s=maptalks.Geometry.fromJSON(n[o]);s&&i.push(s)}return r.addGeometry(i),t.style&&r.setStyle(t.style),r},e}(maptalks.VectorLayer);hl.mergeOptions({animation:"scale,fade",randomAnimation:!0,animationDuration:3e3}),hl.registerJSONType("AnimateMarkerLayer"),hl.registerRenderer("canvas",function(t){function e(){return ol(this,e),sl(this,t.apply(this,arguments))}return al(e,t),e.prototype.draw=function(){this._needUpdate&&(this._prepare(),this._needUpdate=!1),this.prepareCanvas();var t=this.getMap(),e=this._currentMarkers;this._drawnExtent&&t.getExtent().equals(this._drawnExtent)&&(e=this._drawnMarkers),this._drawAllMarkers(e),this._drawnExtent=t.getExtent(),this.layer.isLoaded()||this.completeRender()},e.prototype.drawOnInteracting=function(){this._drawnMarkers&&0!==this._drawnMarkers.length&&this._drawAllMarkers(this._drawnMarkers)},e.prototype.needToRedraw=function(){return!!this.layer.options.animation||t.prototype.needToRedraw.call(this)},e.prototype.onCanvasCreate=function(){this._prepare()},e.prototype.onGeometryAdd=function(){this._redraw()},e.prototype.onGeometryRemove=function(){this._redraw()},e.prototype.onGeometrySymbolChange=function(){this._redraw()},e.prototype.onGeometryPositionChange=function(){this._redraw()},e.prototype.onGeometryShow=function(){this._redraw()},e.prototype.onGeometryHide=function(){this._redraw()},e.prototype.onGeometryPropertiesChange=function(t){if(t&&this.layer.getStyle())for(var e=0;e<t.length;e++)this.layer._styleGeometry(t[e])},e.prototype._redraw=function(){delete this._drawnMarkers,delete this._drawnExtent,this._needUpdate=!0},e.prototype._drawAllMarkers=function(t){var e=this,r=this.getMap(),n=r.getContainerExtent(),i=this._drawnTime=Date.now(),o=this._drawnAnim=this._getAnimation(),s=t!==this._drawnMarkers;s&&(this._drawnMarkers=[]),t.forEach((function(t){if(s){if(t.g.isVisible()){var a=r._prjToContainerPoint(t.coordinates);n.contains(a)&&(e._drawMarker(t,a,o,i),e._drawnMarkers.push(t))}}else{var u=r._prjToContainerPoint(t.coordinates);e._drawMarker(t,u,o,i)}}),this)},e.prototype._drawMarker=function(t,e,r,n){var i=this.layer.options.animationDuration,o=this.context,s=o.globalAlpha,a=(n-t.start)%i/i,u=r.fade&&a>=.5?2-2*a:1,l=r.scale?a:1,h=t.cacheKey,c=this._spriteCache[h],f=c.offset,p=c.canvas.width,g=c.canvas.height;c&&u>0&&(o.globalAlpha=s*u,o.drawImage(c.canvas,e.x+f.x-p*l/2,e.y+f.y-g*l/2,p*l,g*l),o.globalAlpha=s)},e.prototype._prepare=function(){var t=this,e=[],r={},n=this.getMap().getProjection();this.layer.forEach((function(i){t._currentGeo=i;var o=i._getInternalSymbol()===i.options.symbol?ll:i._getInternalSymbol(),s=JSON.stringify(o);r[s]||(r[s]=o),e.push({coordinates:n.project(i.getCoordinates()),cacheKey:s,start:t.layer.options.randomAnimation?Math.random()*t.layer.options.animationDuration:0,g:i})})),this._prepareSprites(r),this._currentMarkers=e},e.prototype._prepareSprites=function(t){for(var e in this._spriteCache={},t){var r=t[e],n=new maptalks.Marker([0,0],{symbol:r})._getSprite(this.resources);this._spriteCache[e]=n}},e.prototype.onRemove=function(){delete this._spriteCache,delete this._currentMarkers,delete this._drawnMarkers,delete this._drawnExtent},e.prototype._getAnimation=function(){for(var t,e={fade:!1,scale:!1},r=this.layer.options.animation?this.layer.options.animation.split(","):[],n=0;n<r.length;n++){var i=(t=r[n]).trim?t.trim():t.replace(/^\s+|\s+$/g,"");"fade"===i?e.fade=!0:"scale"===i&&(e.scale=!0)}return e},e}(maptalks.renderer.OverlayLayerCanvasRenderer)),"undefined"!=typeof console&&console.log("maptalks.animatemarker v0.4.1, requires maptalks@>=0.25.0.");var cl=function(){function t(e,r,n){i(this,t),this.map=n;var o=r.color||[255,0,0],s=r.opacity||.8,a=r.width||20,u=r.height||20,l=r.animationDuration||3e3,h=r.markerDx||0,c=r.markerDy||0,f=maptalks.GeoJSON.toGeometry(e);this.layer=new hl(maptalks.Util.GUID(),f,{animation:"scale,fade",animationDuration:l,randomAnimation:!0,geometryEvents:!1,hitDetect:!1}).setStyle([{symbol:{markerType:"ellipse",markerLineWidth:0,markerFill:this.getGradient(o),markerFillOpacity:s,markerWidth:a,markerHeight:u,markerDx:h,markerDy:c}}]).addTo(n)}return s(t,[{key:"getGradient",value:function(t){return{type:"radial",colorStops:[[.7,"rgba("+t.join()+", 0.5)"],[.3,"rgba("+t.join()+", 1)"],[.2,"rgba("+t.join()+", 1)"],[0,"rgba("+t.join()+", 0)"]]}}},{key:"hide",value:function(){var t;null===(t=this.layer)||void 0===t||t.hide()}},{key:"show",value:function(){this.layer.show()}},{key:"setZIndex",value:function(t){this.layer.setZIndex(t)}},{key:"dispose",value:function(){this.map.removeLayer(this.layer),delete this.layer}}]),t}();function fl(t){var e=[1/0,1/0,-1/0,-1/0];return za(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}fl.default=fl;
|
|
11
11
|
/*
|
|
12
12
|
object-assign
|
|
13
13
|
(c) Sindre Sorhus
|