map-core-func 0.1.39 → 0.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/map-core-func.cjs.js +157 -1
- package/dist/map-core-func.esm.js +157 -1
- package/dist/map-core-func.min.js +157 -1
- package/dist/map-core-func.test.js +143 -1
- package/package.json +3 -1
|
@@ -1 +1,157 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("maptalks"),require("three"),require("maptalks.three")):"function"==typeof define&&define.amd?define(["exports","maptalks","three","maptalks.three"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).mapcore=e.mapcore||{},e.maptalks,e.THREE,e.maptalks)}(this,(function(e,t,r,i){function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=n(t),o=n(r);function s(){s=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",A=n.toStringTag||"@@toStringTag";function h(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(e){h=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var a=t&&t.prototype instanceof g?t:g,o=Object.create(a.prototype),s=new x(n||[]);return i(o,"_invoke",{value:E(e,r,s)}),o}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var u={};function g(){}function d(){}function f(){}var p={};h(p,a,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(b([])));m&&m!==t&&r.call(m,a)&&(p=m);var I=f.prototype=g.prototype=Object.create(p);function y(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(i,a,o,s){var A=c(e[i],e,a);if("throw"!==A.type){var h=A.arg,l=h.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,o,s)}),(function(e){n("throw",e,o,s)})):t.resolve(l).then((function(e){h.value=e,o(h)}),(function(e){return n("throw",e,o,s)}))}s(A.arg)}var a;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return a=a?a.then(i,i):i()}})}function E(e,t,r){var i="suspendedStart";return function(n,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===n)throw a;return S()}for(r.method=n,r.arg=a;;){var o=r.delegate;if(o){var s=B(o,r);if(s){if(s===u)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===i)throw i="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i="executing";var A=c(e,t,r);if("normal"===A.type){if(i=r.done?"completed":"suspendedYield",A.arg===u)continue;return{value:A.arg,done:r.done}}"throw"===A.type&&(i="completed",r.method="throw",r.arg=A.arg)}}}function B(e,t){var r=t.method,i=e.iterator[r];if(void 0===i)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,B(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),u;var n=c(i,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,u;var a=n.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function Q(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function b(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,n=function t(){for(;++i<e.length;)if(r.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=void 0,t.done=!0,t};return n.next=n}}return{next:S}}function S(){return{value:void 0,done:!0}}return d.prototype=f,i(I,"constructor",{value:f,configurable:!0}),i(f,"constructor",{value:d,configurable:!0}),d.displayName=h(f,A,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,h(e,A,"GeneratorFunction")),e.prototype=Object.create(I),e},e.awrap=function(e){return{__await:e}},y(C.prototype),h(C.prototype,o,(function(){return this})),e.AsyncIterator=C,e.async=function(t,r,i,n,a){void 0===a&&(a=Promise);var o=new C(l(t,r,i,n),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},y(I),h(I,A,"Generator"),h(I,a,(function(){return this})),h(I,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var i in t)r.push(i);return r.reverse(),function e(){for(;r.length;){var i=r.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},e.values=b,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(Q),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function i(r,i){return o.type="throw",o.arg=e,t.next=r,i&&(t.method="next",t.arg=void 0),!!i}for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n],o=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),A=r.call(a,"finallyLoc");if(s&&A){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!A)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var n=this.tryEntries[i];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,u):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),Q(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var i=r.completion;if("throw"===i.type){var n=i.arg;Q(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:b(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function h(e,t,r,i,n,a,o){try{var s=e[a](o),A=s.value}catch(e){return void r(e)}s.done?t(A):Promise.resolve(A).then(i,n)}function l(e){return function(){var t=this,r=arguments;return new Promise((function(i,n){var a=e.apply(t,r);function o(e){h(a,i,n,o,s,"next",e)}function s(e){h(a,i,n,o,s,"throw",e)}o(void 0)}))}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,S(i.key),i)}}function g(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t,r){return(t=S(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function I(e){var t=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(e){return!1}}();return function(){var r,i=p(e);if(t){var n=p(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}(this,r)}}function y(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}function C(){return C="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var i=y(e,t);if(i){var n=Object.getOwnPropertyDescriptor(i,t);return n.get?n.get.call(arguments.length<3?e:r):n.value}},C.apply(this,arguments)}function E(e,t,r,i){return E="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(e,t,r,i){var n,a=y(e,t);if(a){if((n=Object.getOwnPropertyDescriptor(a,t)).set)return n.set.call(i,r),!0;if(!n.writable)return!1}if(n=Object.getOwnPropertyDescriptor(i,t)){if(!n.writable)return!1;n.value=r,Object.defineProperty(i,t,n)}else d(i,t,r);return!0},E(e,t,r,i)}function B(e,t,r,i,n){if(!E(e,t,r,i||e)&&n)throw new TypeError("failed to set property");return r}function w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,o,s=[],A=!0,h=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;A=!1}else for(;!(A=(i=a.call(r)).done)&&(s.push(i.value),s.length!==t);A=!0);}catch(e){h=!0,n=e}finally{try{if(!A&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(h)throw n}}return s}}(e,t)||Q(e,t)||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 Q(e,t){if(e){if("string"==typeof e)return x(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?x(e,t):void 0}}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function b(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Q(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function S(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function k(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null!==e[0].index,n=new Set(Object.keys(e[0].attributes)),a=new Set(Object.keys(e[0].morphAttributes)),o={},s={},A=e[0].morphTargetsRelative,h=new r.BufferGeometry,l=0,c=0;c<e.length;++c){var u=e[c],g=0;if(i!==(null!==u.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+c+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(var d in u.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+c+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;void 0===o[d]&&(o[d]=[]),o[d].push(u.attributes[d]),g++}if(g!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+c+". Make sure all geometries have the same number of attributes."),null;if(A!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+c+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(var f in u.morphAttributes){if(!a.has(f))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+c+". .morphAttributes must be consistent throughout all geometries."),null;void 0===s[f]&&(s[f]=[]),s[f].push(u.morphAttributes[f])}if(t){var p=void 0;if(i)p=u.index.count;else{if(void 0===u.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+c+". The geometry must have either an index or a position attribute"),null;p=u.attributes.position.count}h.addGroup(l,p,c),l+=p}}if(i){for(var v=0,m=[],I=0;I<e.length;++I){for(var y=e[I].index,C=0;C<y.count;++C)m.push(y.getX(C)+v);v+=e[I].attributes.position.count}h.setIndex(m)}for(var E in o){var B=M(o[E]);if(!B)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+E+" attribute."),null;h.setAttribute(E,B)}for(var w in s){var Q=s[w][0].length;if(0===Q)break;h.morphAttributes=h.morphAttributes||{},h.morphAttributes[w]=[];for(var x=0;x<Q;++x){for(var b=[],S=0;S<s[w].length;++S)b.push(s[w][S][x]);var k=M(b);if(!k)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+w+" morphAttribute."),null;h.morphAttributes[w].push(k)}}return h}function M(e){for(var t,i,n,a=0,o=0;o<e.length;++o){var s=e[o];if(s.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(void 0===t&&(t=s.array.constructor),t!==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===i&&(i=s.itemSize),i!==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;a+=s.array.length}for(var A=new t(a),h=0,l=0;l<e.length;++l)A.set(e[l].array,h),h+=e[l].array.length;return new r.BufferAttribute(A,i,n)}var _=Math.PI/180,T=6378137;function D(){var e="xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return"iep".concat(e,"layer")}function L(e){return new Promise((function(t){return setTimeout(t,e)}))}function R(e,t){return t.split("").forEach((function(t){-1===e.indexOf(t)&&(e+=t)})),e}function F(e,t){return 256*(e=o.MathUtils.clamp(Math.floor(e),0,255))+(t=o.MathUtils.clamp(Math.floor(t),0,255))}function U(e){for(var t=1/0,r=1/0,i=-1/0,n=-1/0,o=0,s=e.length;o<s;o++){var A=e[o],h=A.coordinate,l=A.lnglat,c=A.lnglats,u=A.xy,g=A.xys,d=h||l||c||u||g||e[o],f=void 0,p=void 0;Array.isArray(d)?(f=d[0],p=d[1]):d instanceof a.Coordinate&&(f=d.x,p=d.y),t=Math.min(t,f),r=Math.min(r,p),i=Math.max(i,f),n=Math.max(n,p)}return new a.Coordinate((t+i)/2,(r+n)/2)}function G(e,t,r,i){var n=e,a=t.getShell(),s=[];a.forEach((function(e){var t=r.coordinateToVector3(e).sub(n);s.push(t)}));for(var A=[],h=0,l=s.length;h<l;h++)if(h!==s.length-1){var c=new Float32Array(12),u=s[h],g=s[h+1];c[0]=u.x,c[1]=u.y,c[2]=i,c[6]=u.x,c[7]=u.y,c[8]=0,c[3]=g.x,c[4]=g.y,c[5]=i,c[9]=g.x,c[10]=g.y,c[11]=0;var d=new o.BufferGeometry;d.setAttribute("position",new o.BufferAttribute(c,3)),d.setIndex([0,2,1,2,3,1]),A.push(d)}var f=new Float32Array(12),p=s[s.length-1],v=s[0];f[0]=p.x,f[1]=p.y,f[2]=i,f[6]=p.x,f[7]=p.y,f[8]=0,f[3]=v.x,f[4]=v.y,f[5]=i,f[9]=v.x,f[10]=v.y,f[11]=0;var m=new o.BufferGeometry;m.setAttribute("position",new o.BufferAttribute(f,3)),m.setIndex([0,2,1,2,3,1]),A.push(m);var I=k(A);return I.computeVertexNormals(),I}function N(e){return e*_}function O(e,t){if(!e||!t)return 0;Array.isArray(e)||(e=e.toArray()),Array.isArray(t)||(t=t.toArray());var r=N(e[1]),i=N(t[1]),n=r-i,a=N(e[0])-N(t[0]);return r=2*Math.asin(Math.sqrt(Math.pow(Math.sin(n/2),2)+Math.cos(r)*Math.cos(i)*Math.pow(Math.sin(a/2),2))),r*=T,Math.round(1e5*r)/1e5}function P(e){for(var t=function(e){return e.getCoordinates().map((function(e){return e.toArray()}))}(e),r=0,i=0,n=t.length;i<n-1;i++)r+=O(t[i],t[i+1]);return r}var H={altitude:0,imageWidth:512,imageHeight:512,texture:null},V=function(e){f(r,e);var t=I(r);function r(e,i,n,s){var A;c(this,r);var h=i=a.Util.extend({},H,i),l=h.altitude;h.imageHeight,h.imageWidth,e instanceof a.Extent||(e=new a.Extent(e));var u=e,g=u.xmin,d=u.ymin,f=u.xmax,p=u.ymax,v=1/0,m=1/0,I=-1/0,y=-1/0;[[g,d],[g,p],[f,p],[f,d]].forEach((function(e){var t=s.coordinateToVector3(e),r=t.x,i=t.y;v=Math.min(r,v),m=Math.min(i,m),I=Math.max(r,I),y=Math.max(i,y)}));var C=Math.abs(I-v),E=Math.abs(y-m),B=new o.PlaneGeometry(C,E);(A=t.call(this))._initOptions(i),A._createMesh(B,n);var w=s.distanceToVector3(l,l).x,Q=s.coordinateToVector3(e.getCenter(),w);return A.getObject3d().position.copy(Q),A.parent=null,A.type="Image",A}return g(r)}(i.BaseObject),j=function(){function e(t,r,i,n,s,A){var h=this;c(this,e),this.threelayer=s,this.map=s.map,this.groupId=A,this.textureLoader=new o.TextureLoader;var l=t.split(","),u=r.split(","),g=parseFloat(l[0]),d=parseFloat(l[1]),f=parseFloat(u[0]),p=parseFloat(u[1]),v=n.maxZoom||11,m=n.renderOrder||0,I=n.opacity||1,y=n.minZoom||3,C=new a.Extent(g,d,f,p);this.xmin_g=g,this.ymin_g=d,this.xmax_g=f,this.ymax_g=p,this.cacheTextureFlag=n.cacheTextureFlag,this.cacheTexture={},this.textureLoader.load(i,(function(e){var t=new o.MeshBasicMaterial({map:e,transparent:!0,opacity:I}),r=new V(C,{imageWidth:512,imageHeight:512,maxZoom:v,minZoom:y,interactive:void 0!==n.interactive&&n.interactive},t,h.threelayer);r.object3d.renderOrder=m,h.imgMesh=r,h.imgMesh.parent=h,h.m=t,h.texture=e,h.groupId?h.threelayer.addMesh1(h.imgMesh,h.groupId):h.threelayer.addMesh(h.imgMesh),n.opacityItems&&n.opacityItems.length>0&&!isNaN(n.opacityItems[0])&&!isNaN(n.opacityItems[1])&&n.opacityItems[0]>3&&n.opacityItems[0]<=18&&n.opacityItems[1]>=0&&n.opacityItems[1]<=1&&(h.opacityItems=n.opacityItems,h._bindMapEvents(),h._viewChange()),h.cacheTextureFlag&&void 0===h.cacheTexture[i]&&(h.cacheTexture[i]=e)}))}return g(e,[{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(e,t){var r=this;if(t&&t.leftbottom&&t.righttop){var i=parseFloat(t.leftbottom[0]),n=parseFloat(t.leftbottom[1]),s=parseFloat(t.righttop[0]),A=parseFloat(t.righttop[1]);if(i!==this.xmin_g||n!==this.ymin_g||s!==this.xmax_g||A!==this.ymax_g){var h=new a.Extent(i,n,s,A),l=1/0,c=1/0,u=-1/0,g=-1/0;[[i,n],[i,A],[s,A],[s,n]].forEach((function(e){var t=r.threelayer.coordinateToVector3(e),i=t.x,n=t.y;l=Math.min(i,l),c=Math.min(n,c),u=Math.max(i,u),g=Math.max(n,g)}));for(var d=Math.abs(u-l),f=Math.abs(g-c),p=new o.PlaneBufferGeometry(d,f),v=p.attributes.position.array,m=this.imgMesh.object3d.geometry.attributes.position.array,I=0;I<m.length;I++)m[I]=v[I];this.imgMesh.object3d.geometry.attributes.position.needsUpdate=!0;var y=this.threelayer.coordinateToVector3(h.getCenter(),0);this.imgMesh.getObject3d().position.copy(y),p.dispose(),this.xmin_g=i,this.ymin_g=n,this.xmax_g=s,this.ymax_g=A}}this.cacheTextureFlag?void 0===this.cacheTexture[e]?this.textureLoader.load(e,(function(t){t.magFilter=o.NearestFilter,t.minFilter=o.NearestFilter,r.imgMesh.object3d.material.map=t,r.imgMesh.object3d.material.map.needsUpdate=!0,r.cacheTexture[e]=t})):(this.imgMesh.object3d.material.map=this.cacheTexture[e],this.imgMesh.object3d.material.map.needsUpdate=!0):this.textureLoader.load(e,(function(e){r.texture&&r.texture.dispose(),delete r.texture,e.magFilter=o.NearestFilter,e.minFilter=o.NearestFilter,r.imgMesh.object3d.material.map=e,r.imgMesh.object3d.material.map.needsUpdate=!0,r.texture=e})),!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 e;for(var t 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[t].dispose(),delete this.cacheTexture[t];null===(e=this.texture)||void 0===e||e.dispose(),this.texture=null,this.opacityItems&&(this._closeEvent(),delete this.opacityItems),this.threelayer=null,this.textureLoader&&delete this.textureLoader}}]),e}(),q={interactive:!1,altitude:0,imageWidth:512,imageHeight:512,texture:null},z=function(e){f(r,e);var t=I(r);function r(e,i,n,s,A){var h;c(this,r);var l=(n=a.Util.extend({},q,n)).altitude,u=A.distanceToVector3(i,i).x,g=new o.CircleGeometry(u,32);(h=t.call(this))._initOptions(n),h._createMesh(g,s);var d=A.distanceToVector3(l,l).x,f=A.coordinateToVector3(e,d);return h.getObject3d().position.copy(f),h.parent=null,h.type="radarObject",h}return g(r)}(i.BaseObject),J=function(){function e(t,r,i,n,a,s){c(this,e),this.threelayer=n,this.map=n.map,this.layerClass=a,this.groupId=s,this.imgUrl=i.imgUrl,this.loader=new o.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var A=new o.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:o.DoubleSide,transparent:!0});this.radar=new z(t,r,{},A,n),this.radar.parent=this,this.groupId?this.threelayer.addMesh1(this.radar,this.groupId):this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return g(e,[{key:"tick",value:function(e){this._uniforms.time.value+=2.4*e}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,1)}},{key:"dispose",value:function(){var e;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===(e=this.texture)||void 0===e||e.dispose()}}]),e}(),K={radius:100,altitude:0},Y=function(e){f(r,e);var t=I(r);function r(e,i,n,s){var A;c(this,r),i=a.Util.extend({},K,i,{layer:s,coordinate:e}),(A=t.call(this))._initOptions(i);var h=i,l=h.altitude,u=h.radius,g=s.distanceToVector3(u,u).x,d=i.thetaStart||0,f=i.thetaLength||90,p=new o.CircleGeometry(g,128,d*Math.PI/180,f*Math.PI/180);A._createMesh(p,n);var v=s.distanceToVector3(l,l).x,m=s.coordinateToVector3(e,v);return A.getObject3d().position.copy(m),A}return g(r)}(i.BaseObject),W=function(){function e(t,r,i,n,a){c(this,e),this.threelayer=n,this.map=n.map,this.layerClass=a;var s=i.thetaLength||90,A=i.rotation||0,h=s/2;this.imgUrl=i.imgUrl,this.loader=new o.TextureLoader,this.texture=this.loader.load(this.imgUrl);var l=A-h;l=l<0?l+360:l,this._uniforms={map:{value:this.texture},time:{value:0}};var u=new o.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:o.DoubleSide,transparent:!0,depthTest:!1});this.sector=new Y(t,{thetaStart:l,thetaLength:i.thetaLength,radius:r},u,n),this.threelayer.addMesh(this.sector)}return g(e,[{key:"tick",value:function(e){this._uniforms.time.value+=2.4*e}},{key:"dispose",value:function(){}}]),e}(),X={altitude:0,height:0},Z=function(e){f(r,e);var t=I(r);function r(e,i,n,s){var A;c(this,r),n=a.Util.extend({},X,n,{layer:s}),A=t.call(this);var h=n,l=h.width,u=h.height,g=h.altitude;A._initOptions(n);var d=new o.PlaneGeometry(l,u);d.computeBoundingBox();var f=new o.Mesh(d,i);A._createGroup(),A.getObject3d().add(f);var p=s.distanceToVector3(g,g).x,v=s.coordinateToVector3(e,p);return f.position.set(0,d.boundingBox.max.y,0),A.getObject3d().position.copy(v),A}return g(r)}(i.BaseObject);function $(e,t,r,i,n,a){this.tilesHorizontal=t,this.tilesVertical=r,this.numberOfTiles=i,e.wrapS=e.wrapT=o.RepeatWrapping,e.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=n,this.currentDisplayTime=0,this.currentTile=0,this.flag=a,this.update=function(t){for(this.currentDisplayTime+=t;this.currentDisplayTime>this.tileDisplayDuration;){this.currentDisplayTime-=this.tileDisplayDuration,this.currentTile++,this.currentTile==this.numberOfTiles&&(this.currentTile=0);var r=this.currentTile%this.tilesHorizontal;e.offset.x=r/this.tilesHorizontal;var i=Math.floor(this.currentTile/this.tilesHorizontal);this.flag?e.offset.y=this.tilesVertical-i/this.tilesVertical:e.offset.y=1-i/this.tilesVertical-1/this.tilesVertical}}}var ee=function(){function e(t,r,i,n,a){var s=this;c(this,e),this.threelayer=n,this.map=n.map,this.layerClass=a;var A=i.thetaLength||45;this.millsec=i.millsec||1e3,this.duration=i.duration||75,this.tilesHoriz=i.tilesHoriz||12,this.tilesVert=i.tilesVert||5,this.numTiles=i.numTiles||49;var h=i.rotation||0,l=A/2,u=n.distanceToVector3(r,r).x,g=Math.sin(l*Math.PI/180)*u*2,d=void 0===i.flag;this.imgUrl=i.imgUrl,this.textureLoader=new o.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(e){s.texture=e,s.annie=new $(e,s.tilesHoriz,s.tilesVert,s.numTiles,s.duration,d);var r=new o.MeshBasicMaterial({transparent:!0,map:e,side:o.DoubleSide,depthTest:!1});s.imgObj=new Z(t,r,{width:g,height:u},n),s.imgObj.object3d.renderOrder=1,s.imgObj.object3d.rotation.z=h*Math.PI/180,s.threelayer.addMesh(s.imgObj),s.layerClass.updatables.push(s)}))}return g(e,[{key:"tick",value:function(e){var t;null===(t=this.annie)||void 0===t||t.update(this.millsec*e)}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,1)}},{key:"dispose",value:function(){var e;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===(e=this.texture)||void 0===e||e.dispose()}}]),e}(),te={radius:100,altitude:0},re=function(e){f(r,e);var t=I(r);function r(e,i,n,s){var A;c(this,r),i=a.Util.extend({},te,i,{layer:s}),A=t.call(this);var h=i,l=h.width;h.height;var u=h.altitude;A._initOptions(i);var g=new o.CircleGeometry(l,32);A._createMesh(g,n);var d=s.distanceToVector3(u,u).x,f=s.coordinateToVector3(e,d);return A.getObject3d().position.copy(f),A}return g(r)}(i.BaseObject),ie=function(){function e(t,r,i,n){var a=this;c(this,e),this.threelayer=i,this.map=i.map,this.layerClass=n,this.time=0,i.coordinateToVector3(t,0),this.imgUrl=r.imgUrl,this.textureLoader=new o.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(e){a.texture=e,a._uniforms={impactPosition:{value:new o.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:a.texture}};var r=new o.ShaderMaterial({uniforms:a._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:o.DoubleSide,transparent:!0,depthTest:!1}),n=new re(t,{width:2,height:2},r,i);a.threelayer.addMesh(n),a.layerClass.updatables.push(a)}))}return g(e,[{key:"tick",value:function(e){this.time+=.2*e,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),e}(),ne=6371008.8,ae={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ne,kilometers:6371.0088,kilometres:6371.0088,meters:ne,metres:ne,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ne/1852,radians:1,yards:6967335.223679999};function oe(e){return e%360*Math.PI/180}function se(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return e.geometry.coordinates;if("Point"===e.type)return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Ae(e,t,r){void 0===r&&(r={});var i=se(e),n=se(t),a=oe(n[1]-i[1]),o=oe(n[0]-i[0]),s=oe(i[1]),A=oe(n[1]),h=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(o/2),2)*Math.cos(s)*Math.cos(A);return function(e,t){void 0===t&&(t="kilometers");var r=ae[t];if(!r)throw new Error(t+" units is invalid");return e*r}(2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h)),r.units)}function he(e,t,r){var i=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var n=0,a=t.length-1;n<t.length;a=n++){var o=t[n][0],s=t[n][1],A=t[a][0],h=t[a][1];if(e[1]*(o-A)+s*(A-e[0])+h*(e[0]-o)==0&&(o-e[0])*(A-e[0])<=0&&(s-e[1])*(h-e[1])<=0)return!r;s>e[1]!=h>e[1]&&e[0]<(A-o)*(e[1]-s)/(h-s)+o&&(i=!i)}return i}var le=document.createElement("canvas"),ce=function(){function e(){c(this,e),this.type="gisCommon"}var t;return g(e,null,[{key:"getTexture",value:function(e,t,r,i){var n=e.getContext("2d");n.drawImage(t,r,i);var a=new o.Texture(n.getImageData(0,0,e.width,e.height));return a.minFilter=o.LinearFilter,a.generateMipmaps=!1,a.needsUpdate=!0,a}},{key:"getTexture1",value:function(e,t,r,i,n){le.width=le.height=128;var a=le.getContext("2d");a.drawImage(e,t,r,i,n);var s=new o.Texture(a.getImageData(0,0,le.width,le.height));return s.minFilter=o.LinearFilter,s.generateMipmaps=!1,s.needsUpdate=!0,s}},{key:"addImageProcessImage",value:function(e){return new Promise((function(t,r){var i=document.createElement("img");i&&!i.crossOrigin&&(i.crossOrigin="Anonymous"),i.onload=function(){return t(i)},i.onerror=r,i.setAttribute("src",e)}))}},{key:"addImageProcess",value:function(e){return new Promise((function(t,r){var i=document.createElement("img");i.onload=function(){return t(i)},i.onerror=r,i.setAttribute("src","data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(e))))}))}},{key:"containsCoordinate3",value:function(e,t,r){if(1e3*Ae({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[t.x,t.y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:e}},"kilometers")<t.radius){var i=r.coordinateToVector3([t.x,t.y],0),n=r.coordinateToVector3(e,0).sub(i).normalize(),a=r.distanceToVector3(t.radius,t.radius).x,s=new o.Vector3(i.x,i.y+a,0).sub(i).normalize(),A=((n.clone().cross(s).z<0?-1:1)*Math.acos(n.dot(s))*180/Math.PI).toFixed(2);(A=parseFloat(A))<0&&(A=A+180+180);var h=parseFloat(t.begin),l=parseFloat(t.end);if(h>l){if(A>=h||A<=l)return!0}else if(A>=h&&A<=l)return!0;return!1}return!1}},{key:"containsCoordinate1",value:function(e,t){return 1e3*Ae({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[t.getCenter().x,t.getCenter().y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:e}},"kilometers")<t.getRadius()}},{key:"containsCoordinate2",value:function(e,t){return function(e,t,r){if(void 0===r&&(r={}),!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");var i,n=se(e),a="Feature"===(i=t).type?i.geometry:i,o=a.type,s=t.bbox,A=a.coordinates;if(s&&!1===function(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}(n,s))return!1;"Polygon"===o&&(A=[A]);for(var h=!1,l=0;l<A.length&&!h;l++)if(he(n,A[l][0],r.ignoreBoundary)){for(var c=!1,u=1;u<A[l].length&&!c;)he(n,A[l][u],!r.ignoreBoundary)&&(c=!0),u++;c||(h=!0)}return h}({type:"Feature",geometry:{type:"Point",coordinates:e}},{type:"Feature",geometry:{type:"Polygon",coordinates:t.geometry.coordinates[0]}})}},{key:"containsCoordinate",value:function(e,t){var r,i;Array.isArray(e)?(r=e[0],i=e[1]):e instanceof a.Coordinate&&(r=e.x,i=e.y);var n=t.xmin,o=t.ymin,s=t.xmax,A=t.ymax;return n<=r&&r<=s&&o<=i&&i<=A}},{key:"isInLevels",value:function(e,t){for(var r=!1,i=0;i<e.rangeArr.length;i+=2){var n=1*e.rangeArr[i],a=1*e.rangeArr[i+1];if(t>n&&t<=a){r=!0;break}}return r}},{key:"getExtent",value:function(e){if(0!==e.length){var t=1/0,r=1/0,i=-1/0,n=-1/0;return 1===e.length?(t=1*e[0].longitude-.5,r=1*e[0].latitude-.5,i=1*e[0].longitude+.5,n=1*e[0].latitude+.5):e.length>1&&e.slice(0,1/0).map((function(e){var a=1*e.longitude,o=1*e.latitude;t=Math.min(t,a),r=Math.min(r,o),i=Math.max(i,a),n=Math.max(n,o)})),{minX:t,minY:r,maxX:i,maxY:n}}}},{key:"vector2Pixel",value:function(e,t,r){var i=e.project(r),n=t.width/2,a=t.height/2;return{x:Math.round(i.x*n+n),y:Math.round(-i.y*a+a)}}},{key:"generateTextureOne",value:function(e,t,r){le.width=t,le.height=r;var i=le.getContext("2d");i.drawImage(e,0,0,t,r);var n=new o.Texture(i.getImageData(0,0,le.width,le.height));return n.magFilter=o.NearestFilter,n.minFilter=o.NearestFilter,n.generateMipmaps=!1,n.needsUpdate=!0,n}},{key:"generateTexture",value:function(e){var t=[64,128,256,512,1024],r=-1/0;e.forEach((function(e){r=Math.max(r,e.w),Math.max(r,e.h)}));var i=Math.sqrt(e.length),n=parseInt(i);i>n&&(n+=1);for(var a=(i=n)*r+5*i,s=0,A=0;A<t.length;A++){if(a<t[A]){s=t[A];break}s=1024}le.width=le.height=s;for(var h=le.getContext("2d"),l=0,c=0,u=[],g=0;g<i;g++){for(var d=5*(g+1)+g*l,f=0;f<i;f++){var p=5*(f+1)+f*e[c].w;if("img"===e[c].type){var v=(e[c].w-e[c].iw)/2,m=(e[c].h-e[c].ih)/2;h.drawImage(e[c].src,p+v,d+m,e[c].iw,e[c].ih)}else if("txt"===e[c].type)h.fillStyle=e[c].color,"#fff"===e[c].color?(h.font="lighter "+e[c].size+"px Microsoft YaHei",h.fillText(e[c].src,p+e[c].offx,d+e[c].offy),h.strokeStyle=e[c].color,h.strokeText(e[c].src,p+e[c].offx,d+e[c].offy)):(h.font="normal "+e[c].size+"px Microsoft YaHei",h.fillText(e[c].src,p+e[c].offx,d+e[c].offy));else{var I=(e[c].w-e[c].iw)/2,y=(e[c].h-e[c].ih)/2,C=e[c].offx||0,E=e[c].offy||0;h.drawImage(e[c].src,p+I+C,d+y+E,e[c].iw,e[c].ih)}if(u.push({w:e[c].w,h:e[c].h,u:p/s,v:d/s}),l=Math.max(l,e[c].h),(c+=1)>=e.length)break}if(c>=e.length)break}var B=new o.Texture(h.getImageData(0,0,le.width,le.height));return B.minFilter=o.LinearFilter,B.generateMipmaps=!1,B.needsUpdate=!0,{xys:u,texture:B,textureSize:s}}},{key:"generateTextureNew",value:function(e){var t=[64,128,256,512,1024],r=-1/0;e.forEach((function(e){r=Math.max(r,e.w),Math.max(r,e.h)}));var i=Math.sqrt(e.length),n=parseInt(i);i>n&&(n+=1);for(var a=(i=n)*r+5*i,s=0,A=0;A<t.length;A++){if(a<t[A]){s=t[A];break}s=1024}le.width=le.height=s;for(var h=le.getContext("2d"),l=0,c=0,u=0,g=[],d=0;d<i;d++){for(var f=5*(d+1)+d*l,p=0;p<i;p++){var v=5*(p+1)+u;if("img"===e[c].type){var m=(e[c].w-e[c].iw)/2,I=(e[c].h-e[c].ih)/2;h.drawImage(e[c].src,v+m,f+I,e[c].iw,e[c].ih)}else if("txt"===e[c].type)h.fillStyle=e[c].color,"#fff"===e[c].color?(h.font="lighter "+e[c].size+"px Microsoft YaHei",h.fillText(e[c].src,v+e[c].offx,f+e[c].offy),h.strokeStyle=e[c].color,h.strokeText(e[c].src,v+e[c].offx,f+e[c].offy)):(h.font="normal "+e[c].size+"px Microsoft YaHei",h.fillText(e[c].src,v+e[c].offx,f+e[c].offy));else{var y=(e[c].w-e[c].iw)/2,C=(e[c].h-e[c].ih)/2,E=e[c].offx||0,B=e[c].offy||0;h.drawImage(e[c].src,v+y+E,f+C+B,e[c].iw,e[c].ih)}if(g.push({w:e[c].w,h:e[c].h,u:v/s,v:f/s}),l=Math.max(l,e[c].h),u+=e[c].w,(c+=1)>=e.length)break}if(c>=e.length)break}var w=new o.Texture(h.getImageData(0,0,le.width,le.height));return w.minFilter=o.LinearFilter,w.generateMipmaps=!1,w.needsUpdate=!0,{xys:g,texture:w,textureSize:s}}},{key:"generateGifTexture",value:(t=l(s().mark((function t(r,i,n){var a,A,h,l,c,u,g,d,f,p,v,m,I;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a=Math.sqrt(r.length),A=parseInt(a),h=A,a>A&&(h+=1),(l=document.createElement("canvas")).width=A*i,l.height=h*n,c=l.getContext("2d"),u=0,g=0;case 10:if(!(g<a)){t.next=32;break}d=g*n,f=0,p=0;case 14:if(!(p<a)){t.next=27;break}return v=f,t.next=18,e.addImageProcessImage(r[u]);case 18:if(m=t.sent,c.drawImage(m,v,d,i,n),f+=i,!((u+=1)>=r.length)){t.next=24;break}return t.abrupt("break",27);case 24:p++,t.next=14;break;case 27:if(!(u>=r.length)){t.next=29;break}return t.abrupt("break",32);case 29:g++,t.next=10;break;case 32:return(I=new o.Texture(c.getImageData(0,0,l.width,l.height))).generateMipmaps=!1,I.needsUpdate=!0,t.abrupt("return",{texture:I,colNum:A,rowNum:h});case 36:case"end":return t.stop()}}),t)}))),function(e,r,i){return t.apply(this,arguments)})},{key:"generateTextureOptimize",value:function(e){var t=[64,128,256,512,1024],r=-1/0;e.forEach((function(e){r=Math.max(r,e.w),Math.max(r,e.h)}));var i=Math.sqrt(e.length),n=parseInt(i);i>n&&(n+=1);for(var a=(i=n)*r+5*i,s=0,A=0;A<t.length;A++){if(a<t[A]){s=t[A];break}s=1024}le.width=le.height=s;for(var h=le.getContext("2d"),l=0,c=0,u={},g=0;g<i;g++){for(var d=5*(g+1)+g*l,f=0,p=0;p<i;p++){var v=5*(p+1)+f,m=(e[c].w-e[c].iw)/2,I=(e[c].h-e[c].ih)/2;if(h.drawImage(e[c].src,v+m,d+I,e[c].iw,e[c].ih),u[e[c].key]={w:e[c].w,h:e[c].h,u:v/s,v:d/s},l=Math.max(l,e[c].h),f+=e[c].w,(c+=1)>=e.length)break}if(c>=e.length)break}var y=new o.Texture(h.getImageData(0,0,le.width,le.height));return y.minFilter=o.LinearFilter,y.generateMipmaps=!1,y.needsUpdate=!0,{xys:u,texture:y,textureSize:s}}},{key:"setPointEventStatus",value:function(e,t){e&&e.getMeshes().forEach((function(e){"Points"===e.type&&(e.options.interactive=t)}))}},{key:"createTextTexture",value:function(e,t){le.width=le.height=e;var r=le.width/2,i=le.height/2;if(t){var n=0;t.forEach((function(e){var t=le.getContext("2d");t.fillStyle=e.fontcolor,t.font="".concat(e.fontsize,"px Arial"),t.textAlign="center",t.textBaseline="middle",t.fillText(e.txt,r,i+n),n+=e.fontsize}))}var a=new o.Texture(le);return a.minFilter=o.LinearFilter,a.generateMipmaps=!1,a.needsUpdate=!0,a}},{key:"createTextAndBgTexture",value:function(e,t,r,i){var n=document.createElement("canvas");n.width=e,n.height=t;var a=n.getContext("2d");a.drawImage(r,0,0,e,t);var s=n.width/2,A=n.height/2;a.textAlign="center",a.textBaseline="middle",a.fillStyle="#FFF",a.font="".concat(i.fontsize,"px Arial"),a.fillText(i.txt,s,A);var h=new o.Texture(n);return h.magFilter=o.NearestFilter,h.minFilter=o.NearestFilter,h.needsUpdate=!0,h}},{key:"getIntColor",value:function(e){var t=parseInt(255*e.r);return t=((t=(t<<8)+parseInt(255*e.g))<<8)+parseInt(255*e.b)}},{key:"colorIntToRGB",value:function(e){var t=e>>16&255,r=e>>8&255,i=255&e;return new o.Color("rgb(".concat(t,",").concat(r,",").concat(i,")"))}},{key:"createSimpleShader",value:function(e,t,r){return e.uniforms.texture1={value:t},e.uniforms.size1={value:r},e.uniforms.flag={value:1},e.vertexShader="uniform float size1;\n attribute float imgflag;\n varying float vimgflag;\n attribute float visibility;\n varying float vVisible;\n "+e.vertexShader,e.vertexShader=e.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 "),e.fragmentShader="\n uniform sampler2D texture1;\n varying float vimgflag;\n varying float vVisible;\n "+e.fragmentShader,e.fragmentShader=e.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 "),e}},{key:"calTextWidth",value:function(e,t){var r=(e.match(/[\u4e00-\u9fa5]/g)||"").length;return r*t+.5*(e.length-r)*t}}]),e}();function ue(e,t,r,i,n,a,o,s,A,h){var l=e.split("\n"),c=[],u={positionedGlyphs:c,text:e,top:A[1],bottom:A[1],left:A[0],right:A[0],writingMode:h,lineCount:l.length};return function(e,t,r,i,n,a,o,s,A){var h=0,l=-17,c=0,u=e.positionedGlyphs,g="right"===a?1:"left"===a?0:.5,d=u.length;r.forEach((function(e){if(e.split("").forEach((function(e){var r=t[A],i=e.charCodeAt(0),n=r&&r[i];n&&(u.push({glyph:i,x:h,y:l+0,vertical:!1,scale:1,fontStack:A}),h+=n.metrics.advance+s)})),u.length!==d){var r=h-s;c=Math.max(r,c),function(e,t,r,i,n){if(n){var a=e[i],o=t[a.fontStack],s=o&&o[a.glyph];if(s)for(var A=s.metrics.advance*a.scale,h=(e[i].x+A)*n,l=r;l<=i;l++)e[l].x-=h}}(u,t,d,u.length-1,g)}h=0,l+=i}));var f=function(e){var t=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}(n),p=f.horizontalAlign,v=f.verticalAlign;!function(e,t,r,i,n,a,o){for(var s=(t-r)*n,A=(-i*o+.5)*a,h=0;h<e.length;h++)e[h].x+=s,e[h].y+=A}(u,g,p,v,c,i,r.length);var m=l- -17;e.top+=-v*m,e.bottom=e.top+m,e.left+=-p*c,e.right=e.left+c}(u,t,l,n,a,o,0,s,r),!!c.length&&u}var ge=de;function de(e,t){this.x=e,this.y=t}de.prototype={clone:function(){return new de(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),r=Math.sin(e),i=t*this.x-r*this.y,n=r*this.x+t*this.y;return this.x=i,this.y=n,this},_rotateAround:function(e,t){var r=Math.cos(e),i=Math.sin(e),n=t.x+r*(this.x-t.x)-i*(this.y-t.y),a=t.y+i*(this.x-t.x)+r*(this.y-t.y);return this.x=n,this.y=a,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},de.convert=function(e){return e instanceof de?e:Array.isArray(e)?new de(e[0],e[1]):e};var fe={radius:40,altitude:0},pe=function(e){f(r,e);var t=I(r);function r(e,i,n,s,A,h,l,u){var g;c(this,r);var d=U(e);g=t.call(this),i=a.Util.extend({center:d,layer:u},fe,i),g._initOptions(i);var f=g.getLayer().getPick();g._colorMap={},g._datas=e,g._childCount=l;var p=u.coordinateToVector3(d);g.glyphMap=A,g.glyphAtlas=h;for(var v=new o.InstancedBufferGeometry,m=new Uint16Array([0,1,2,2,3,0]),I=new Float32Array([0,1,-.5,-.5,1,1,.5,-.5,1,0,.5,.5,0,0,-.5,.5]),y=new o.InstancedBufferAttribute(new Float32Array(4*g._childCount),4,!0),C=new o.InstancedBufferAttribute(new Float32Array(4*g._childCount),4,!0),E=new o.InstancedBufferAttribute(new Float32Array(4*g._childCount),4,!0),B=new o.InstancedBufferAttribute(new Float32Array(4*g._childCount),4,!0),w=new o.InstancedBufferAttribute(new Float32Array(3*g._childCount),3,!0),Q=0,x=function(t){var r=e[t],i=r.texts,n=r.markers,a=f.getColor(),o=a.getHex();g._colorMap[o]=t,g._datas[t].colorIndex=o,n&&n.forEach((function(r){if(y.setXYZW(Q,r.markerWidth,r.markerHeight,r.markerDx,r.markerDy),C.setXYZW(Q,r.u,r.v,-16,16),r.markerColor){var i=F(0,255);B.setXYZW(Q,i,0,0,0);var n=g.getColorVector2(r.markerColor,r.markerOpacity);E.setXYZW(Q,n[0],n[1],r.w,r.h)}else{var o=F(0,0);B.setXYZW(Q,o,0,0,0);var s=g.getColorVector2("#fff",r.markerOpacity);E.setXYZW(Q,s[0],s[1],r.w,r.h)}w.setXYZ(Q,a.r,a.g,a.b),r.markerIndex=Q,Q+=1,e[t].childNum+=1})),i&&i.forEach((function(r){var i=g.getColorVector2(r.textColor,r.textOpacity),n=F(255,0);g.buildTextBuffers("".concat(r.text),r.textAnchor,"center",r.textSpacing).forEach((function(o){if(y.setXYZW(Q,r.textSize,0,r.textDx,r.textDy),C.setXYZW(Q,o[0],o[1],o[2],o[3]),r.textHaloColor){var s=g.getColorVector2(r.textHaloColor,r.textHaloOpacity);E.setXYZW(Q,i[0],i[1],s[0],s[1]);var A=r.textHaloRadius;B.setXYZW(Q,n,A,0,0)}else E.setXYZW(Q,i[0],i[1],0,0),B.setXYZW(Q,n,-1.9,0,0);w.setXYZ(Q,a.r,a.g,a.b),r.textIndex.push(Q),Q+=1,e[t].childNum+=1}))}))},b=0;b<e.length;b++)x(b);v.setIndex(new o.Uint16BufferAttribute(m,1)),v.setAttribute("uv_offset",new o.Float32BufferAttribute(I,4,!0)),v.setAttribute("size",y),v.setAttribute("uv_image",C),v.setAttribute("color",E),v.setAttribute("util",B),v.setAttribute("pickingColor",w),g._createInstancedMesh(v,n,g._childCount),g.getObject3d().instanceMatrix.setUsage(o.DynamicDrawUsage);var S=new o.InstancedMesh(v,s,g._childCount);S.instanceMatrix.setUsage(o.DynamicDrawUsage);var k=f.getColor().getHex();S._colorIndex=k,g.setPickObject3d(S);var M=new o.Object3D;Q=0,e.forEach((function(t,r){var i=u.coordinateToVector3(t.coordinate);i.sub(p),t.height&&(i.z=u.altitudeToVector3(t.height).x);for(var n=0;n<e[r].childNum;n++)!1===t.visible?M.position.set(-999,-999,0):M.position.set(i.x,i.y,0),M.updateMatrix(),g.getObject3d().setMatrixAt(Q,M.matrix),S.setMatrixAt(Q,M.matrix),Q+=1}));var _=u.altitudeToVector3(i.altitude,i.altitude).x;return p.z=_,g.getObject3d().position.copy(p),S.position.copy(g.getObject3d().position),g.parent=null,g.pickMesh=S,g.threeLayer=u,g.center=p,g._init(),g}return g(r,[{key:"_init",value:function(){var e=this,t=this.getLayer().getPick();this.on("add",(function(){t.add(e.pickObject3d)})),this.on("remove",(function(){t.remove(e.pickObject3d)}))}},{key:"getSelectMesh",value:function(){return this._datas[this.index]}},{key:"identify",value:function(e){return this.picked}},{key:"getColorVector2",value:function(e,t){var r,i=new o.Color(e).getHexString(),n=(r="#".concat(i),{r:parseInt(r.slice(1,3),16),g:parseInt(r.slice(3,5),16),b:parseInt(r.slice(5,7),16)}),a=n.b;return[F(n.r,n.g),F(a,void 0!==t?t:255)]}},{key:"buildTextBuffers",value:function(e,t,r,i){var n=[],a=[0,0],o=ue(e,this.glyphMap,"sans-serif",0,24,t,r,i,a,1);if(o){var s=function(e,t,r,i){for(var n=e.positionedGlyphs,a=[],o=0;o<n.length;o++){var s=n[o],A=i[s.fontStack],h=A&&A[s.glyph];if(h){var l=h.rect;if(l){var c=h.metrics.advance*s.scale/2,u=r?[s.x+c,s.y]:[0,0],g=r?[0,0]:[s.x+c+t[0],s.y+t[1]],d=(h.metrics.left-4)*s.scale-c+g[0],f=(-h.metrics.top-4)*s.scale+g[1],p=d+l.w*s.scale,v=f+l.h*s.scale,m=new ge(d,f),I=new ge(p,f),y=new ge(d,v),C=new ge(p,v);a.push({tl:m,tr:I,bl:y,br:C,tex:l,writingMode:e.writingMode,glyphOffset:u})}}}return a}(o,a,!1,this.glyphAtlas.positions);s.forEach((function(e){n.push([e.tex.x,e.tex.y+e.tex.h,e.bl.x,e.bl.y])}))}return n}},{key:"changeVisible",value:function(){var e=this,t=new o.Object3D;this._datas.forEach((function(r,i){var n=e.threeLayer.coordinateToVector3(r.coordinate);n.sub(e.center),r.height&&(n.z=e.threeLayer.altitudeToVector3(r.height).x),!1===r.visible?t.position.set(-999,-999,0):t.position.set(n.x,n.y,0),t.updateMatrix(),r.markers&&r.markers.forEach((function(r){e.getObject3d().setMatrixAt(r.markerIndex,t.matrix),e.pickMesh.setMatrixAt(r.markerIndex,t.matrix)})),r.texts&&r.texts.forEach((function(r){r.textIndex.forEach((function(r){e.getObject3d().setMatrixAt(r,t.matrix),e.pickMesh.setMatrixAt(r,t.matrix)}))}))})),this.getObject3d().instanceMatrix.needsUpdate=!0,this.pickMesh.instanceMatrix.needsUpdate=!0}}]),r}(i.BaseObject),ve=function(){function e(t,r){c(this,e),this.createImage(t,1,r)}return g(e,[{key:"createImage",value:function(e,t,r){var i=e.width,n=e.height;if(r){if(r.length!==i*n*t)throw new RangeError("mismatched image size")}else r=new Uint8Array(i*n*t);this.width=i,this.height=n,this.data=r}},{key:"resize",value:function(){}}],[{key:"copy",value:function(e,t,r,i,n){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");for(var o=e.data,s=t.data,A=0;A<n.height;A++)for(var h=((r.y+A)*e.width+r.x)*a,l=((i.y+A)*t.width+i.x)*a,c=0;c<n.width*a;c++)s[l+c]=o[h+c];return t}}]),e}();var me=g((function e(t){c(this,e);var r={},i=[];for(var n in t){var a=t[n],o=r[n]={};for(var s in a){var A=a[+s];if(A&&0!==A.bitmap.width&&0!==A.bitmap.height){var h={x:0,y:0,w:A.bitmap.width+2,h:A.bitmap.height+2};i.push(h),o[s]={rect:h,metrics:A.metrics}}}}var l=function(e){let t=0,r=0;for(const i of e)t+=i.w*i.h,r=Math.max(r,i.w);e.sort(((e,t)=>t.h-e.h));const i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let n=0,a=0;for(const t of e)for(let e=i.length-1;e>=0;e--){const r=i[e];if(!(t.w>r.w||t.h>r.h)){if(t.x=r.x,t.y=r.y,a=Math.max(a,t.y+t.h),n=Math.max(n,t.x+t.w),t.w===r.w&&t.h===r.h){const t=i.pop();e<i.length&&(i[e]=t)}else t.h===r.h?(r.x+=t.w,r.w-=t.w):t.w===r.w?(r.y+=t.h,r.h-=t.h):(i.push({x:r.x+t.w,y:r.y,w:r.w-t.w,h:t.h}),r.y+=t.h,r.h-=t.h);break}}return{w:n,h:a,fill:t/(n*a)||0}}(i),u=l.w,g=l.h,d=new ve({width:u||1,height:g||1});for(var f in t){var p=t[f];for(var v in p){var m=p[+v];if(m&&0!==m.bitmap.width&&0!==m.bitmap.height){var I=r[f][v].rect;ve.copy(m.bitmap,d,{x:0,y:0},{x:I.x+1,y:I.y+1},m.bitmap)}}}this.image=d,this.positions=r})),Ie={exports:{}};Ie.exports=Ce,Ie.exports.default=Ce;var ye=1e20;function Ce(e,t,r,i,n,a){this.fontSize=e||24,this.buffer=void 0===t?3:t,this.cutoff=i||.25,this.fontFamily=n||"sans-serif",this.fontWeight=a||"normal",this.radius=r||8;var o=this.size=this.fontSize+2*this.buffer,s=o+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=o,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(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s),this.useMetrics=void 0!==this.ctx.measureText("A").actualBoundingBoxLeft,this.middle=Math.round(o/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function Ee(e,t,r,i,n,a){for(var o=0;o<t;o++)Be(e,o,t,r,i,n,a);for(var s=0;s<r;s++)Be(e,s*t,1,t,i,n,a)}function Be(e,t,r,i,n,a,o){var s,A,h,l;for(a[0]=0,o[0]=-ye,o[1]=ye,s=0;s<i;s++)n[s]=e[t+s*r];for(s=1,A=0,h=0;s<i;s++){do{l=a[A],h=(n[s]-n[l]+s*s-l*l)/(s-l)/2}while(h<=o[A]&&--A>-1);a[++A]=s,o[A]=h,o[A+1]=ye}for(s=0,A=0;s<i;s++){for(;o[A+1]<s;)A++;l=a[A],e[t+s*r]=n[l]+(s-l)*(s-l)}}Ce.prototype._draw=function(e,t){var r,i,n,a,o,s,A,h,l,c=this.ctx.measureText(e),u=c.width,g=2*this.buffer;t&&this.useMetrics?(o=Math.floor(c.actualBoundingBoxAscent),h=this.buffer+Math.ceil(c.actualBoundingBoxAscent),s=this.buffer,A=this.buffer,r=(i=Math.min(this.size,Math.ceil(c.actualBoundingBoxRight-c.actualBoundingBoxLeft)))+g,n=(a=Math.min(this.size-s,Math.ceil(c.actualBoundingBoxAscent+c.actualBoundingBoxDescent)))+g,this.ctx.textBaseline="alphabetic"):(r=i=this.size,n=a=this.size,o=19*this.fontSize/24,s=A=0,h=this.middle,this.ctx.textBaseline="middle"),i&&a&&(this.ctx.clearRect(A,s,i,a),this.ctx.fillText(e,this.buffer,h),l=this.ctx.getImageData(A,s,i,a));var d=new Uint8ClampedArray(r*n);return function(e,t,r,i,n,a,o){a.fill(ye,0,t*r),o.fill(0,0,t*r);for(var s=(t-i)/2,A=0;A<n;A++)for(var h=0;h<i;h++){var l=(A+s)*t+h+s,c=e.data[4*(A*i+h)+3]/255;if(1===c)a[l]=0,o[l]=ye;else if(0===c)a[l]=ye,o[l]=0;else{var u=Math.max(0,.5-c),g=Math.max(0,c-.5);a[l]=u*u,o[l]=g*g}}}(l,r,n,i,a,this.gridOuter,this.gridInner),Ee(this.gridOuter,r,n,this.f,this.v,this.z),Ee(this.gridInner,r,n,this.f,this.v,this.z),function(e,t,r,i,n,a,o){for(var s=0;s<t*r;s++){var A=Math.sqrt(i[s])-Math.sqrt(n[s]);e[s]=Math.round(255-255*(A/a+o))}}(d,r,n,this.gridOuter,this.gridInner,this.radius,this.cutoff),{data:d,metrics:{width:i,height:a,sdfWidth:r,sdfHeight:n,top:o,left:0,advance:u}}},Ce.prototype.draw=function(e){return this._draw(e,!1).data},Ce.prototype.drawWithMetrics=function(e){return this._draw(e,!0)};var we=Ie.exports,Qe={},xe={};var be=function(){function e(t,r,i,n){var a=this;c(this,e);var o=r.pointMinZoom,s=r.pointOrder;if(0!=t.length){var A=[];this.charArray="",this.imgDict={},this.threeLayer=i,this.map=i.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=n,"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(e){1*e.longitude>70&&1*e.longitude<138&&1*e.latitude>0&&1*e.latitude<56&&a._bindDataItem(A,e)})),this.textures=null,this.glyphMap=null,this.glyphAtlas=null,this.dataItems=A,this.point=null,this.shader=null,this.minZoom=o||8,this.maxZoom=r.pointMaxZoom||20,this.order=s||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}else console.error("需要绘制的点位数量为0")}var t,r,i,n;return g(e,[{key:"_putImgToDict",value:function(e,t,r){void 0===this.imgDict[e]?this.imgDict[e]={imgSrc:e,width:t,height:r}:(this.imgDict[e].width=(this.imgDict[e].width+t)/2,this.imgDict[e].height=(this.imgDict[e].height+r)/2)}},{key:"_bindDataItem",value:function(e,t){var r={coordinate:[parseFloat(t.longitude),parseFloat(t.latitude)],height:void 0!==t.height?parseFloat(t.height):0,visible:void 0===t.visible||t.visible,code:t.code,status:void 0!==t.status?t.status:1,name:t.name,childNum:0,data:t.data},i=t.texts;if(i){r.texts=[];for(var n=0,a=0;a<i.length;a++){var o=i[a];if(o.text&&o.text.length>0){n+=o.text.length,this.charArray=R(this.charArray,o.text);var s={text:o.text,textSize:o.textSize||14,textDx:o.textDx||0,textDy:o.textDy||0,textColor:o.textColor||"#fff",textAnchor:o.textAnchor||"center",textSpacing:o.textSpacing||2,textOpacity:o.textOpacity||255,textIndex:[]};o.textHaloColor&&(s=Object.assign(s,{textHaloColor:o.textHaloColor,textHaloRadius:o.textHaloRadius||1,textHaloOpacity:void 0!==o.textHaloOpacity?o.textHaloOpacity:255})),r.texts.push(s)}}this.childCount+=n}var A=t.markers;if(A){r.markers=[];for(var h=0,l=0;l<A.length;l++){var c=A[l];c.imgSrc&&(h+=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+=h}e.push(r)}},{key:"_loadTexture",value:(n=l(s().mark((function e(){var t,r,i,n,a;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],e.t0=s().keys(this.imgDict);case 2:if((e.t1=e.t0()).done){e.next=18;break}if(r=e.t1.value,i=r,!r.includes(".svg")){e.next=12;break}return e.next=8,fetch(r);case 8:return n=e.sent,e.next=11,n.text();case 11:i=e.sent;case 12:return e.next=14,ce.addImageProcess(i);case 14:a=e.sent,t.push({key:r,src:a,w:this.imgDict[r].width,h:this.imgDict[r].height,iw:this.imgDict[r].width,ih:this.imgDict[r].height}),e.next=2;break;case 18:return e.abrupt("return",ce.generateTextureOptimize(t));case 19:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"initGlyphAtlas",value:function(){var e=this.charArray.split("").map((function(e){return function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0,i=function(e){var t=e.trim().substring(0,e.lastIndexOf(" ")),r="400";return/bold/i.test(e)?r="900":/medium/i.test(e)?r="500":/light/i.test(e)&&(r="200"),{fontFamily:t,fontWeight:r}}(t),n=i.fontFamily,a=i.fontWeight,o=r.charCodeAt(0),s=Qe[t];return s||(s=Qe[t]=new we(24,3,8,.25,n,a)),xe[t]||(xe[t]={}),xe[t][r]||(xe[t][r]=s.ctx.measureText(r).width),{id:o,bitmap:new ve({width:30,height:30},s.draw(r)),metrics:{width:24,height:24,left:0,top:-5,advance:(e=o,e>=19968&&e<=40959?24:xe[t][r])}}}("",e)})).reduce((function(e,t){return e[t.id]=t,e}),{});this.glyphMap||(this.glyphMap={}),this.glyphMap["sans-serif"]=e,this.glyphAtlas=new me(this.glyphMap)}},{key:"addPoint",value:(i=l(s().mark((function e(){var t,r,i,n,a,A,h,l=this;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.dataItems){e.next=2;break}return e.abrupt("return",null);case 2:return e.next=4,this._loadTexture();case 4:return t=e.sent,this.textures||(this.textures=[]),this.textures.push(t.texture),this.initGlyphAtlas(),r=this.glyphAtlas.image,i=r.width,n=r.height,a=r.data,(A=new o.DataTexture(a,i,n)).needsUpdate=!0,A.magFilter=o.LinearFilter,A.minFilter=o.LinearFilter,A.format=o.RedFormat,this.textures.push(A),this.m=this._getRawShaderMaterial(t,A,i,n),this.m.depthTest=!1,this.hasAlign&&(this.m.vertexShader="#define HAS_ALIGN\n"+this.m.vertexShader),this.m_pick=this._getRawShaderMaterial(t,A,i,n),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(e){e.markers&&e.markers.forEach((function(e){e=Object.assign(e,t.xys[e.key])}))})),(h=new pe(this.dataItems,{minZoom:this.minZoom,maxZoom:this.maxZoom,interactive:this.interactive,altitude:this.altitude},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 e=l._getRate(),t=l.point.object3d.geometry.attributes.size.array,r=0,i=0;i<l.dataItems.length;i++){var n=l.dataItems[i];if(n.markers)for(var a=0;a<n.markers.length;a++)t[4*r+0]=n.markers[a].markerWidth*e,t[4*r+1]=n.markers[a].markerHeight*e,t[4*r+2]=n.markers[a].markerDx*e,t[4*r+3]=n.markers[a].markerDy*e,r+=1;if(n.texts)for(var o=function(){var i=n.texts[s].textSize,a=n.texts[s].textDx,o=n.texts[s].textDy;n.texts[s].textIndex.forEach((function(){t[4*r+0]=i*e,t[4*r+1]=0,t[4*r+2]=a*e,t[4*r+3]=o*e,r+=1}))},s=0;s<n.texts.length;s++)o()}l.point.object3d.geometry.attributes.size.needsUpdate=!0,l.zoomChangeCallback&&l.zoomChangeCallback()},this.isToolTip&&h.setToolTip("hello",{showTimeout:0,eventsPropagation:!0,dx:10}),h.object3d.renderOrder=this.order,this.point=h,this.point.parent=this,this.groupId?this.threeLayer.addMesh1(this.point,this.groupId):this.threeLayer.addMesh(this.point),this._bindMapEvents(),e.abrupt("return",this);case 32:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"_getRawShaderMaterial",value:function(e,t,r,i){return new o.RawShaderMaterial({uniforms:{imgTexture:{type:"t",value:e.texture},imgTextureSize:{type:"f",value:e.textureSize},sdfTexture:{type:"t",value:t},sdfTextureSize:{value:[r,i]},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:o.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:(r=l(s().mark((function e(t){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.clickFunc(t);case 2:this.iconFile&&this._addIcon(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_setPointEvent",value:function(e){var t=e.selectMesh;if("mousemove"===e.type&&t){var r=t.name;if(this.isToolTip)this.point.getToolTip()._content="".concat(r)}"click"===e.type&&t&&this.clickFunc&&!this.cFunc&&this.addContent(t)}},{key:"findItemByCode",value:function(e){for(var t=0;t<this.dataItems.length;t++)if(this.dataItems[t].code===e)return t}},{key:"changeParaValue",value:(t=l(s().mark((function e(t){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"_getRate",value:function(){var e=this.map.getZoom()-this.beginSizeZoom;return(e=e>this.spanSizeZoom?this.spanSizeZoom:e)*this.stepSize+this.stepSize}},{key:"show",value:function(){var e,t;null===(e=this.point)||void 0===e||e.show();for(var r=0;r<this.dataItems.length;r++){this.dataItems[r].visible=!0}null===(t=this.point)||void 0===t||t.changeVisible()}},{key:"hide",value:function(){var e;null===(e=this.point)||void 0===e||e.hide()}},{key:"setInteractiveState",value:function(e){this.point&&(this.point.options.interactive=e)}},{key:"pointShowHideByCode",value:function(e,t,r){for(var i,n=1/0,o=1/0,s=-1/0,A=-1/0,h=0;h<this.dataItems.length;h++){var l=this.dataItems[h];e.includes(l.code)?(n=Math.min(n,this.dataItems[h].coordinate[0]),o=Math.min(o,this.dataItems[h].coordinate[1]),s=Math.max(s,this.dataItems[h].coordinate[0]),A=Math.max(A,this.dataItems[h].coordinate[1]),l.visible=!0):l.visible=!1}null===(i=this.point)||void 0===i||i.changeVisible(),t&&this.map.fitExtent(new a.Extent(n,o,s,A),r||0)}},{key:"updateByZoom",value:function(){var e=this,t=this.map.getZoom(),r=new o.Object3D,i=0;this.dataItems.forEach((function(n){var a=e.threeLayer.coordinateToVector3(n.coordinate);if(a.sub(e.point.center),n.height&&(a.z=e.threeLayer.altitudeToVector3(n.height).x),n.markers&&(i+=n.markers.length),n.value&&e.showValueFlag)for(var o=0;o<n.value.length;o++)t<e.valueMinZoom||t>e.valueMaxZoom?r.position.set(-999,-999,0):r.position.set(a.x,a.y,0),r.updateMatrix(),e.point.getObject3d().setMatrixAt(i,r.matrix),e.point.pickMesh.setMatrixAt(i,r.matrix),i+=1;if(n.name&&e.showNameFlag)for(var s=0;s<n.name.length;s++)t<e.nameMinZoom||t>e.nameMaxZoom?r.position.set(-999,-999,0):r.position.set(a.x,a.y,0),r.updateMatrix(),e.point.getObject3d().setMatrixAt(i,r.matrix),e.point.pickMesh.setMatrixAt(i,r.matrix),i+=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(e){e.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 Se(e){var t;try{t=new URL(e,"http://fakehost.com/")}catch(e){return null}var r=t.pathname.split("/").pop(),i=r.lastIndexOf(".");return-1===i||i===r.length-1?null:r.substring(i+1)}var ke=function(){function e(){c(this,e),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 t=this.itemSet;this.defaultPriorityCallback=function(e){return t.get(e)}}return g(e,[{key:"isFull",value:function(){return this.itemSet.size>=this.maxSize}},{key:"add",value:function(e,t){var r=this.itemSet;if(r.has(e))return!1;if(this.isFull())return!1;var i=this.usedSet,n=this.itemList,a=this.callbacks;return n.push(e),i.add(e),r.set(e,Date.now()),a.set(e,t),!0}},{key:"remove",value:function(e){var t=this.usedSet,r=this.itemSet,i=this.itemList,n=this.callbacks;if(r.has(e)){n.get(e)(e);var a=i.indexOf(e);return i.splice(a,1),t.delete(e),r.delete(e),n.delete(e),!0}return!1}},{key:"markUsed",value:function(e){var t=this.itemSet,r=this.usedSet;t.has(e)&&!r.has(e)&&(t.set(e,Date.now()),r.add(e))}},{key:"markAllUnused",value:function(){this.usedSet.clear()}},{key:"unloadUnusedContent",value:function(){var e=this.unloadPercent,t=this.minSize,r=this.itemList,i=this.itemSet,n=this.usedSet,a=this.callbacks,o=r.length-n.size,s=r.length-t,A=this.unloadPriorityCallback||this.defaultPriorityCallback;if(s>0&&o>0){r.sort((function(e,t){var r=n.has(e),i=n.has(t);return r&&i?0:r||i?r?1:-1:A(t)-A(e)}));var h=Math.min(s,o),l=Math.max(t*e,h*e),c=Math.min(l,o);c=Math.ceil(c);for(var u=r.splice(0,c),g=0,d=u.length;g<d;g++){var f=u[g];a.get(f)(f),i.delete(f),a.delete(f)}}}},{key:"scheduleUnload",value:function(){var e,t=this,r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scheduled||(this.scheduled=!0,e=function(){t.scheduled=!1,t.unloadUnusedContent(),r&&t.markAllUnused()},Promise.resolve().then(e))}}]),e}(),Me=function(){function e(){var t=this;c(this,e),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(e){requestAnimationFrame(e)},this._runjobs=function(){t.tryRunJobs(),t.scheduled=!1}}return g(e,[{key:"sort",value:function(){var e=this.priorityCallback;this.items.sort(e)}},{key:"add",value:function(e,t){var r=this;return new Promise((function(i,n){var a=r.items,o=r.callbacks;a.push(e),o.set(e,(function(){return t.apply(void 0,arguments).then(i).catch(n)})),r.autoUpdate&&r.scheduleJobRun()}))}},{key:"remove",value:function(e){var t=this.items,r=this.callbacks,i=t.indexOf(e);-1!==i&&(t.splice(i,1),r.delete(e))}},{key:"tryRunJobs",value:function(){var e=this;this.sort();for(var t=this.items,r=this.callbacks,i=this.maxJobs,n=this.currJobs;i>n&&t.length>0;){n++;var a=t.pop(),o=r.get(a);r.delete(a),o(a).then((function(){e.currJobs--,e.autoUpdate&&e.scheduleJobRun()})).catch((function(){e.currJobs--,e.autoUpdate&&e.scheduleJobRun()}))}this.currJobs=n}},{key:"scheduleJobRun",value:function(){this.scheduled||(this.schedulingCallback(this._runjobs),this.scheduled=!0)}}]),e}(),_e=3,Te=4,De=6378137,Le=6356752.314245179;function Re(e){return e===_e||e===Te}function Fe(e,t){return e.__lastFrameVisited===t&&e.__used}function Ue(e,t){e.__lastFrameVisited!==t&&(e.__lastFrameVisited=t,e.__used=!1,e.__inFrustum=!1,e.__isLeaf=!1,e.__visible=!1,e.__active=!1,e.__error=1/0,e.__distanceFromCamera=1/0,e.__childrenWereVisible=!1,e.__allChildrenLoaded=!1)}function Ge(e,t,r){if(Ue(e,t),e.__used=!0,r.markUsed(e),e.__contentEmpty)for(var i=e.children,n=0,a=i.length;n<a;n++)Ge(i[n],t,r)}function Ne(e,t,r){if(e.__contentEmpty&&(!e.__externalTileSet||Re(e.__loadingState)))for(var i=e.children,n=0,a=i.length;n<a;n++){var o=i[n];o.__depthFromRenderedParent=t,Ne(o,t,r)}else r.requestTileContents(e)}function Oe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(t&&t(e,i,n))r&&r(e,i,n);else{for(var a=e.children,o=0,s=a.length;o<s;o++)Oe(a[o],t,r,e,n+1);r&&r(e,i,n)}}function Pe(e,t){var r=t.stats,i=t.frameCount,n=t.errorTarget,a=t.maxDepth,o=t.loadSiblings,s=t.lruCache,A=t.stopAtEmptyTiles;if(Ue(e,i),!1===t.tileInView(e))return!1;if(e.__used=!0,s.markUsed(e),e.__inFrustum=!0,r.inFrustum++,(A||!e.__contentEmpty)&&!e.__externalTileSet){if(t.calculateError(e),e.__error<=n)return!0;if(t.maxDepth>0&&e.__depth+1>=a)return!0}for(var h=!1,l=e.children,c=0,u=l.length;c<u;c++){var g=Pe(l[c],t);h=h||g}if(h&&o)for(var d=0,f=l.length;d<f;d++){Ge(l[d],i,s)}return!0}function He(e,t){var r=t.stats,i=t.frameCount;if(Fe(e,i)){r.used++;for(var n=e.children,a=!1,o=0,s=n.length;o<s;o++){var A=n[o];a=a||Fe(A,i)}if(a){for(var h=!1,l=!0,c=0,u=n.length;c<u;c++){var g=n[c];if(He(g,t),h=h||g.__wasSetVisible||g.__childrenWereVisible,Fe(g,i)){var d=g.__allChildrenLoaded||!g.__contentEmpty&&Re(g.__loadingState)||g.__externalTileSet&&g.__loadingState===Te;l=l&&d}}e.__childrenWereVisible=h,e.__allChildrenLoaded=l}else e.__isLeaf=!0}}function Ve(e,t){var r=t.stats,i=t.frameCount;if(Fe(e,i)){var n=e.parent,a=n?n.__depthFromRenderedParent:-1;e.__depthFromRenderedParent=a;var o=t.lruCache;if(e.__isLeaf)return e.__depthFromRenderedParent++,void(e.__loadingState===_e?(e.__inFrustum&&(e.__visible=!0,r.visible++),e.__active=!0,r.active++):o.isFull()||e.__contentEmpty&&!e.__externalTileSet||t.requestTileContents(e));var s=(t.errorTarget+1)*t.errorThreshold,A=e.__error<=s,h=A||"ADD"===e.refine,l=!e.__contentEmpty,c=l||e.__externalTileSet,u=Re(e.__loadingState)&&c,g=e.__childrenWereVisible,d=e.children,f=e.__allChildrenLoaded;if(h&&l&&e.__depthFromRenderedParent++,h&&!u&&!o.isFull()&&c&&t.requestTileContents(e),(A&&!f&&!g&&u||"ADD"===e.refine&&u)&&(e.__inFrustum&&(e.__visible=!0,r.visible++),e.__active=!0,r.active++),"ADD"!==e.refine&&A&&!f&&u)for(var p=0,v=d.length;p<v;p++){var m=d[p];Fe(m,i)&&!o.isFull()&&(m.__depthFromRenderedParent=e.__depthFromRenderedParent+1,Ne(m,m.__depthFromRenderedParent,t))}else for(var I=0,y=d.length;I<y;I++){var C=d[I];Fe(C,i)&&Ve(C,t)}}}function je(e,t){var r=Fe(e,t.frameCount);if(r||e.__usedLastFrame){var i=!1,n=!1;r&&(i=e.__active,n=t.displayActiveTiles&&e.__active||e.__visible),e.__contentEmpty||e.__loadingState!==_e||(e.__wasSetActive!==i&&t.setTileActive(e,i),e.__wasSetVisible!==n&&t.setTileVisible(e,n)),e.__wasSetActive=i,e.__wasSetVisible=n,e.__usedLastFrame=r;for(var a=e.children,o=0,s=a.length;o<s;o++){je(a[o],t)}}}var qe=function(e,t){return e.__depth!==t.__depth?e.__depth>t.__depth?-1:1:e.__inFrustum!==t.__inFrustum?e.__inFrustum?1:-1:e.__used!==t.__used?e.__used?1:-1:e.__error!==t.__error?e.__error>t.__error?1:-1:e.__distanceFromCamera!==t.__distanceFromCamera?e.__distanceFromCamera>t.__distanceFromCamera?-1:1:0},ze=function(e){return 1/(e.__depthFromRenderedParent+1)},Je=function(){function e(t,r){c(this,e),this.tileSets={},this.rootURL=t,this.fetchOptions={},this.preprocessURL=null;var i=new ke;i.unloadPriorityCallback=ze;var n=new Me;n.maxJobs=4,n.priorityCallback=qe;var a=new Me;a.maxJobs=1,a.priorityCallback=qe,this.lruCache=i,this.downloadQueue=n,this.parseQueue=a,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 g(e,[{key:"rootTileSet",get:function(){var e=this.tileSets[this.rootURL];return!e||e instanceof Promise?null:e}},{key:"root",get:function(){var e=this.rootTileSet;return e?e.root:null}},{key:"traverse",value:function(e,t){var r=this.tileSets[this.rootURL];r&&r.root&&Oe(r.root,e,t)}},{key:"update",value:function(){var e=this.stats,t=this.lruCache,r=this.tileSets,i=r[this.rootURL];if(this.rootURL in r){if(i&&i.root){var n=i.root;e.inFrustum=0,e.used=0,e.active=0,e.visible=0,this.frameCount++,Pe(n,this),He(n,this),Ve(n,this),je(n,this),t.scheduleUnload()}}else this.loadRootTileSet(this.rootURL)}},{key:"parseTile",value:function(e,t,r){return null}},{key:"disposeTile",value:function(e){}},{key:"preprocessNode",value:function(e,t,r){if(e.content&&(!("uri"in e.content)&&"url"in e.content&&(e.content.uri=e.content.url,delete e.content.url),e.content.uri&&(e.content.uri=new URL(e.content.uri,r+"/").toString()),e.content.boundingVolume&&!("box"in e.content.boundingVolume||"sphere"in e.content.boundingVolume||"region"in e.content.boundingVolume)&&delete e.content.boundingVolume),e.parent=t,e.children=e.children||[],e.content&&e.content.uri){var i=Se(e.content.uri),n=Boolean(i&&"json"===i.toLowerCase());e.__externalTileSet=n,e.__contentEmpty=n}else e.__externalTileSet=!1,e.__contentEmpty=!0;e.__distanceFromCamera=1/0,e.__error=1/0,e.__inFrustum=!1,e.__isLeaf=!1,e.__usedLastFrame=!1,e.__used=!1,e.__wasSetVisible=!1,e.__visible=!1,e.__childrenWereVisible=!1,e.__allChildrenLoaded=!1,e.__wasSetActive=!1,e.__active=!1,e.__loadingState=0,e.__loadIndex=0,e.__loadAbort=null,e.__depthFromRenderedParent=-1,null===t?(e.__depth=0,e.refine=e.refine||"REPLACE"):(e.__depth=t.__depth+1,e.refine=e.refine||t.refine)}},{key:"setTileActive",value:function(e,t){}},{key:"setTileVisible",value:function(e,t){}},{key:"calculateError",value:function(e){return 0}},{key:"tileInView",value:function(e){return!0}},{key:"resetFailedTiles",value:function(){var e=this.stats;0!==e.failed&&(this.traverse((function(e){e.__loadingState===Te&&(e.__loadingState=0)})),e.failed=0)}},{key:"fetchTileSet",value:function(e,t){var r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return fetch(e,t).then((function(t){if(t.ok)return t.json();throw new Error('TilesRenderer: Failed to load tileset "'.concat(e,'" with status ').concat(t.status," : ").concat(t.statusText))})).then((function(t){var n=t.asset.version;console.assert("1.0"===n||"0.0"===n,'asset.version is expected to be a string of "1.0" or "0.0"');var a=e.replace(/\/[^\/]*\/?$/,"");return a=new URL(a,window.location.href).toString(),Oe(t.root,(function(e,t){return r.preprocessNode(e,t,a)}),null,i,i?i.__depth:0),t}))}},{key:"loadRootTileSet",value:function(e){var t=this.tileSets;if(e in t)return t[e]instanceof Error?Promise.reject(t[e]):Promise.resolve(t[e]);var r=this.fetchTileSet(this.preprocessURL?this.preprocessURL(e):e,this.fetchOptions).then((function(r){t[e]=r}));return r.catch((function(r){console.error(r),t[e]=r})),t[e]=r,r}},{key:"requestTileContents",value:function(e){var t=this;if(0===e.__loadingState){var r=this.stats,i=this.lruCache,n=this.downloadQueue,a=this.parseQueue,o=e.__externalTileSet;i.add(e,(function(e){1===e.__loadingState?(e.__loadAbort.abort(),e.__loadAbort=null):o?e.children.length=0:t.disposeTile(e),1===e.__loadingState?r.downloading--:2===e.__loadingState&&r.parsing--,e.__loadingState=0,e.__loadIndex++,a.remove(e),n.remove(e)})),e.__loadIndex++;var s=e.__loadIndex,A=new AbortController,h=A.signal;r.downloading++,e.__loadAbort=A,e.__loadingState=1;var l=function(t){e.__loadIndex===s&&("AbortError"!==t.name?(a.remove(e),n.remove(e),2===e.__loadingState?r.parsing--:1===e.__loadingState&&r.downloading--,r.failed++,console.error('TilesRenderer : Failed to load tile at url "'.concat(e.content.uri,'".')),console.error(t),e.__loadingState=Te):i.remove(e))};o?n.add(e,(function(e){if(e.__loadIndex!==s)return Promise.resolve();var r=t.preprocessURL?t.preprocessURL(e.content.uri):e.content.uri;return t.fetchTileSet(r,Object.assign({signal:h},t.fetchOptions),e)})).then((function(t){e.__loadIndex===s&&(r.downloading--,e.__loadAbort=null,e.__loadingState=_e,e.children.push(t.root))})).catch(l):n.add(e,(function(e){if(e.__loadIndex!==s)return Promise.resolve();var r=t.preprocessURL?t.preprocessURL(e.content.uri):e.content.uri;return fetch(r,Object.assign({signal:h},t.fetchOptions))})).then((function(t){if(e.__loadIndex===s){if(t.ok)return t.arrayBuffer();throw new Error("Failed to load model with error code ".concat(t.status))}})).then((function(i){if(e.__loadIndex===s)return r.downloading--,r.parsing++,e.__loadAbort=null,e.__loadingState=2,a.add(e,(function(e){if(e.__loadIndex!==s)return Promise.resolve();var r=Se(e.content.uri);return t.parseTile(i,e,r)}))})).then((function(){e.__loadIndex===s&&(r.parsing--,e.__loadingState=_e,e.__wasSetVisible&&t.setTileVisible(e,!0),e.__wasSetActive&&t.setTileActive(e,!0))})).catch(l)}}},{key:"dispose",value:function(){var e=this.lruCache,t=[];this.traverse((function(e){return t.push(e)}));for(var r=0,i=t.length;r<i;r++)e.remove(t[r]);this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0}}]),e}();function Ke(e){return(new TextDecoder).decode(e)}var Ye=function(){function e(t,r,i,n){c(this,e),this.buffer=t,this.binOffset=r+i,this.binLength=n;var a=null;if(0!==i){var o=new Uint8Array(t,r,i);a=JSON.parse(Ke(o))}else a={};this.header=a}return g(e,[{key:"getKeys",value:function(){return Object.keys(this.header)}},{key:"getData",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,n=this.header;if(!(e in n))return null;var a=n[e];if(a instanceof Object){if(Array.isArray(a))return a;var o,s,A=this.buffer,h=this.binOffset,l=this.binLength,c=a.byteOffset||0,u=a.type||i,g=a.componentType||r;if("type"in a&&i&&a.type!==i)throw new Error("FeatureTable: Specified type does not match expected type.");switch(u){case"SCALAR":o=1;break;case"VEC2":o=2;break;case"VEC3":o=3;break;case"VEC4":o=4;break;default:throw new Error('FeatureTable : Feature type not provided for "'.concat(e,'".'))}var d=h+c,f=t*o;switch(g){case"BYTE":s=new Int8Array(A,d,f);break;case"UNSIGNED_BYTE":s=new Uint8Array(A,d,f);break;case"SHORT":s=new Int16Array(A,d,f);break;case"UNSIGNED_SHORT":s=new Uint16Array(A,d,f);break;case"INT":s=new Int32Array(A,d,f);break;case"UNSIGNED_INT":s=new Uint32Array(A,d,f);break;case"FLOAT":s=new Float32Array(A,d,f);break;case"DOUBLE":s=new Float64Array(A,d,f);break;default:throw new Error('FeatureTable : Feature component type not provided for "'.concat(e,'".'))}if(d+f*s.BYTES_PER_ELEMENT>h+l)throw new Error("FeatureTable: Feature data read outside binary body length.");return s}return a}},{key:"getBuffer",value:function(e,t){var r=this.buffer,i=this.binOffset;return r.slice(i+e,i+e+t)}}]),e}(),We=function(e){f(r,e);var t=I(r);function r(e,i,n,a,o){var s;return c(this,r),(s=t.call(this,e,n,a,o)).batchSize=i,s}return g(r,[{key:"getData",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return C(p(r.prototype),"getData",this).call(this,e,this.batchSize,t,i)}}]),r}(Ye),Xe=function(){function e(){c(this,e),this.fetchOptions={},this.workingPath=""}return g(e,[{key:"load",value:function(e){var t=this;return fetch(e,this.fetchOptions).then((function(t){if(!t.ok)throw new Error('Failed to load file "'.concat(e,'" with status ').concat(t.status," : ").concat(t.statusText));return t.arrayBuffer()})).then((function(r){return""===t.workingPath&&(t.workingPath=t.workingPathForURL(e)),t.parse(r)}))}},{key:"resolveExternalURL",value:function(e){return/^[^\\/]/.test(e)?this.workingPath+"/"+e:e}},{key:"workingPathForURL",value:function(e){var t=e.split(/[\\/]/g);return t.pop(),t.join("/")+"/"}},{key:"parse",value:function(e){throw new Error("LoaderBase: Parse not implemented.")}}]),e}();function Ze(e){var t;if(t=e instanceof DataView?e:new DataView(e),"{"===String.fromCharCode(t.getUint8(0)))return null;for(var r="",i=0;i<4;i++)r+=String.fromCharCode(t.getUint8(i));return r}var $e=function(e){f(r,e);var t=I(r);function r(){return c(this,r),t.apply(this,arguments)}return g(r,[{key:"parse",value:function(e){var t=new DataView(e),r=Ze(t);console.assert("b3dm"===r);var i=t.getUint32(4,!0);console.assert(1===i);var n=t.getUint32(8,!0);console.assert(n===e.byteLength);var a=t.getUint32(12,!0),o=t.getUint32(16,!0),s=t.getUint32(20,!0),A=t.getUint32(24,!0),h=e.slice(28,28+a+o),l=new Ye(h,0,a,o),c=28+a+o,u=e.slice(c,c+s+A),g=new We(u,l.getData("BATCH_LENGTH"),0,s,A),d=c+s+A;return{version:i,featureTable:l,batchTable:g,glbBytes:new Uint8Array(e,d,n-d)}}}]),r}(Xe),et=function(e){f(i,e);var t=I(i);function i(e){var r;return c(this,i),(r=t.call(this,e)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new ot(e)})),r.register((function(e){return new gt(e)})),r.register((function(e){return new dt(e)})),r.register((function(e){return new At(e)})),r.register((function(e){return new ht(e)})),r.register((function(e){return new lt(e)})),r.register((function(e){return new ct(e)})),r.register((function(e){return new at(e)})),r.register((function(e){return new ut(e)})),r.register((function(e){return new st(e)})),r.register((function(e){return new it(e)})),r.register((function(e){return new ft(e)})),r.register((function(e){return new pt(e)})),r}return g(i,[{key:"load",value:function(e,t,i,n){var a,o=this;a=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:r.LoaderUtils.extractUrlBase(e),this.manager.itemStart(e);var s=function(t){n?n(t):console.error(t),o.manager.itemError(e),o.manager.itemEnd(e)},A=new r.FileLoader(this.manager);A.setPath(this.path),A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setWithCredentials(this.withCredentials),A.load(e,(function(r){try{o.parse(r,a,(function(r){t(r),o.manager.itemEnd(e)}),s)}catch(e){s(e)}}),i,s)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,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(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,i,n){var a,o={},s={};if("string"==typeof e)a=JSON.parse(e);else if(e instanceof ArrayBuffer){if(r.LoaderUtils.decodeText(new Uint8Array(e,0,4))===vt){try{o[rt.KHR_BINARY_GLTF]=new yt(e)}catch(e){return void(n&&n(e))}a=JSON.parse(o[rt.KHR_BINARY_GLTF].content)}else a=JSON.parse(r.LoaderUtils.decodeText(new Uint8Array(e)))}else a=e;if(void 0===a.asset||a.asset.version[0]<2)n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var A=new jt(a,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});A.fileLoader.setRequestHeader(this.requestHeader);for(var h=0;h<this.pluginCallbacks.length;h++){var l=this.pluginCallbacks[h](A);s[l.name]=l,o[l.name]=!0}if(a.extensionsUsed)for(var c=0;c<a.extensionsUsed.length;++c){var u=a.extensionsUsed[c],g=a.extensionsRequired||[];switch(u){case rt.KHR_MATERIALS_UNLIT:o[u]=new nt;break;case rt.KHR_DRACO_MESH_COMPRESSION:o[u]=new Ct(a,this.dracoLoader);break;case rt.KHR_TEXTURE_TRANSFORM:o[u]=new Et;break;case rt.KHR_MESH_QUANTIZATION:o[u]=new Bt;break;default:g.indexOf(u)>=0&&void 0===s[u]&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}A.setExtensions(o),A.setPlugins(s),A.parse(i,n)}}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(i,n){r.parse(e,t,i,n)}))}}]),i}(r.Loader);function tt(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var rt={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"},it=function(){function e(t){c(this,e),this.parser=t,this.name=rt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return g(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,i=t.length;r<i;r++){var n=t[r];n.extensions&&n.extensions[this.name]&&void 0!==n.extensions[this.name].light&&e._addNodeRef(this.cache,n.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,i="light:"+e,n=t.cache.get(i);if(n)return n;var a,o=t.json,s=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e],A=new r.Color(16777215);void 0!==s.color&&A.fromArray(s.color);var h=void 0!==s.range?s.range:0;switch(s.type){case"directional":(a=new r.DirectionalLight(A)).target.position.set(0,0,-1),a.add(a.target);break;case"point":(a=new r.PointLight(A)).distance=h;break;case"spot":(a=new r.SpotLight(A)).distance=h,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,a.angle=s.spot.outerConeAngle,a.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return a.position.set(0,0,0),a.decay=2,Nt(a,s),void 0!==s.intensity&&(a.intensity=s.intensity),a.name=t.createUniqueName(s.name||"light_"+e),n=Promise.resolve(a),t.cache.add(i,n),n}},{key:"getDependency",value:function(e,t){if("light"===e)return this._loadLight(t)}},{key:"createNodeAttachment",value:function(e){var t=this,r=this.parser,i=r.json.nodes[e],n=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then((function(e){return r._getNodeRef(t.cache,n,e)}))}}]),e}(),nt=function(){function e(){c(this,e),this.name=rt.KHR_MATERIALS_UNLIT}return g(e,[{key:"getMaterialType",value:function(){return r.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,i){var n=[];e.color=new r.Color(1,1,1),e.opacity=1;var a=t.pbrMetallicRoughness;if(a){if(Array.isArray(a.baseColorFactor)){var o=a.baseColorFactor;e.color.fromArray(o),e.opacity=o[3]}void 0!==a.baseColorTexture&&n.push(i.assignTexture(e,"map",a.baseColorTexture,r.sRGBEncoding))}return Promise.all(n)}}]),e}(),at=function(){function e(t){c(this,e),this.parser=t,this.name=rt.KHR_MATERIALS_EMISSIVE_STRENGTH}return g(e,[{key:"extendMaterialParams",value:function(e,t){var r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=r.extensions[this.name].emissiveStrength;return void 0!==i&&(t.emissiveIntensity=i),Promise.resolve()}}]),e}(),ot=function(){function e(t){c(this,e),this.parser=t,this.name=rt.KHR_MATERIALS_CLEARCOAT}return g(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var a=[],o=n.extensions[this.name];if(void 0!==o.clearcoatFactor&&(t.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&a.push(i.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&a.push(i.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(a.push(i.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var s=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new r.Vector2(s,s)}return Promise.all(a)}}]),e}(),st=function(){function e(t){c(this,e),this.parser=t,this.name=rt.KHR_MATERIALS_IRIDESCENCE}return g(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();var n=[],a=i.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&n.push(r.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),void 0!==a.iridescenceIor&&(t.iridescenceIOR=a.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==a.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),void 0!==a.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),void 0!==a.iridescenceThicknessTexture&&n.push(r.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(n)}}]),e}(),At=function(){function e(t){c(this,e),this.parser=t,this.name=rt.KHR_MATERIALS_SHEEN}return g(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var a=[];t.sheenColor=new r.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;var o=n.extensions[this.name];return void 0!==o.sheenColorFactor&&t.sheenColor.fromArray(o.sheenColorFactor),void 0!==o.sheenRoughnessFactor&&(t.sheenRoughness=o.sheenRoughnessFactor),void 0!==o.sheenColorTexture&&a.push(i.assignTexture(t,"sheenColorMap",o.sheenColorTexture,r.sRGBEncoding)),void 0!==o.sheenRoughnessTexture&&a.push(i.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(a)}}]),e}(),ht=function(){function e(t){c(this,e),this.parser=t,this.name=rt.KHR_MATERIALS_TRANSMISSION}return g(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();var n=[],a=i.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(n)}}]),e}(),lt=function(){function e(t){c(this,e),this.parser=t,this.name=rt.KHR_MATERIALS_VOLUME}return g(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var a=[],o=n.extensions[this.name];t.thickness=void 0!==o.thicknessFactor?o.thicknessFactor:0,void 0!==o.thicknessTexture&&a.push(i.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;var s=o.attenuationColor||[1,1,1];return t.attenuationColor=new r.Color(s[0],s[1],s[2]),Promise.all(a)}}]),e}(),ct=function(){function e(t){c(this,e),this.parser=t,this.name=rt.KHR_MATERIALS_IOR}return g(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=r.extensions[this.name];return t.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}]),e}(),ut=function(){function e(t){c(this,e),this.parser=t,this.name=rt.KHR_MATERIALS_SPECULAR}return g(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var a=[],o=n.extensions[this.name];t.specularIntensity=void 0!==o.specularFactor?o.specularFactor:1,void 0!==o.specularTexture&&a.push(i.assignTexture(t,"specularIntensityMap",o.specularTexture));var s=o.specularColorFactor||[1,1,1];return t.specularColor=new r.Color(s[0],s[1],s[2]),void 0!==o.specularColorTexture&&a.push(i.assignTexture(t,"specularColorMap",o.specularColorTexture,r.sRGBEncoding)),Promise.all(a)}}]),e}(),gt=function(){function e(t){c(this,e),this.parser=t,this.name=rt.KHR_TEXTURE_BASISU}return g(e,[{key:"loadTexture",value:function(e){var t=this.parser,r=t.json,i=r.textures[e];if(!i.extensions||!i.extensions[this.name])return null;var n=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){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 t.loadTextureImage(e,n.source,a)}}]),e}(),dt=function(){function e(t){c(this,e),this.parser=t,this.name=rt.EXT_TEXTURE_WEBP,this.isSupported=null}return g(e,[{key:"loadTexture",value:function(e){var t=this.name,r=this.parser,i=r.json,n=i.textures[e];if(!n.extensions||!n.extensions[t])return null;var a=n.extensions[t],o=i.images[a.source],s=r.textureLoader;if(o.uri){var A=r.options.manager.getHandler(o.uri);null!==A&&(s=A)}return this.detectSupport().then((function(n){if(n)return r.loadTextureImage(e,a.source,s);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}]),e}(),ft=function(){function e(t){c(this,e),this.name=rt.EXT_MESHOPT_COMPRESSION,this.parser=t}return g(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){var i=r.extensions[this.name],n=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return n.then((function(e){var t=i.byteOffset||0,r=i.byteLength||0,n=i.count,o=i.byteStride,s=new Uint8Array(e,t,r);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(n,o,s,i.mode,i.filter).then((function(e){return e.buffer})):a.ready.then((function(){var e=new ArrayBuffer(n*o);return a.decodeGltfBuffer(new Uint8Array(e),n,o,s,i.mode,i.filter),e}))}))}return null}}]),e}(),pt=function(){function e(t){c(this,e),this.name=rt.EXT_MESH_GPU_INSTANCING,this.parser=t}return g(e,[{key:"createNodeMesh",value:function(e){var t=this,i=this.parser.json,n=i.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;var a,o=b(i.meshes[n.mesh].primitives);try{for(o.s();!(a=o.n()).done;){var s=a.value;if(s.mode!==bt.TRIANGLES&&s.mode!==bt.TRIANGLE_STRIP&&s.mode!==bt.TRIANGLE_FAN&&void 0!==s.mode)return null}}catch(e){o.e(e)}finally{o.f()}var A=n.extensions[this.name].attributes,h=[],l={},c=function(e){h.push(t.parser.getDependency("accessor",A[e]).then((function(t){return l[e]=t,l[e]})))};for(var u in A)c(u);return h.length<1?null:(h.push(this.parser.createNodeMesh(e)),Promise.all(h).then((function(e){var i,n=e.pop(),a=n.isGroup?n.children:[n],o=e[0].count,s=[],A=b(a);try{for(A.s();!(i=A.n()).done;){for(var h=i.value,c=new r.Matrix4,u=new r.Vector3,g=new r.Quaternion,d=new r.Vector3(1,1,1),f=new r.InstancedMesh(h.geometry,h.material,o),p=0;p<o;p++)l.TRANSLATION&&u.fromBufferAttribute(l.TRANSLATION,p),l.ROTATION&&g.fromBufferAttribute(l.ROTATION,p),l.SCALE&&d.fromBufferAttribute(l.SCALE,p),f.setMatrixAt(p,c.compose(u,g,d));for(var v in l)"TRANSLATION"!==v&&"ROTATION"!==v&&"SCALE"!==v&&h.geometry.setAttribute(v,l[v]);r.Object3D.prototype.copy.call(f,h),f.frustumCulled=!1,t.parser.assignFinalMaterial(f),s.push(f)}}catch(e){A.e(e)}finally{A.f()}return n.isGroup?(n.clear(),n.add.apply(n,s),n):s[0]})))}}]),e}(),vt="glTF",mt=1313821514,It=5130562,yt=g((function e(t){c(this,e),this.name=rt.KHR_BINARY_GLTF,this.content=null,this.body=null;var i=new DataView(t,0,12);if(this.header={magic:r.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:i.getUint32(4,!0),length:i.getUint32(8,!0)},this.header.magic!==vt)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,a=new DataView(t,12),o=0;o<n;){var s=a.getUint32(o,!0);o+=4;var A=a.getUint32(o,!0);if(o+=4,A===mt){var h=new Uint8Array(t,12+o,s);this.content=r.LoaderUtils.decodeText(h)}else if(A===It){var l=12+o;this.body=t.slice(l,l+s)}o+=s}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),Ct=function(){function e(t,r){if(c(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=rt.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return g(e,[{key:"decodePrimitive",value:function(e,t){var r=this.json,i=this.dracoLoader,n=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},A={};for(var h in a){var l=Tt[h]||h.toLowerCase();o[l]=a[h]}for(var c in e.attributes){var u=Tt[c]||c.toLowerCase();if(void 0!==a[c]){var g=r.accessors[e.attributes[c]],d=St[g.componentType];A[u]=d.name,s[u]=!0===g.normalized}}return t.getDependency("bufferView",n).then((function(e){return new Promise((function(t){i.decodeDracoFile(e,(function(e){for(var r in e.attributes){var i=e.attributes[r],n=s[r];void 0!==n&&(i.normalized=n)}t(e)}),o,A)}))}))}}]),e}(),Et=function(){function e(){c(this,e),this.name=rt.KHR_TEXTURE_TRANSFORM}return g(e,[{key:"extendTexture",value:function(e,t){return void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}]),e}(),Bt=g((function e(){c(this,e),this.name=rt.KHR_MESH_QUANTIZATION})),wt=function(e){f(r,e);var t=I(r);function r(e,i,n,a){return c(this,r),t.call(this,e,i,n,a)}return g(r,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,n=e*i*3+i,a=0;a!==i;a++)t[a]=r[n+a];return t}},{key:"interpolate_",value:function(e,t,r,i){for(var n=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,A=3*o,h=i-t,l=(r-t)/h,c=l*l,u=c*l,g=e*A,d=g-A,f=-2*u+3*c,p=u-c,v=1-f,m=p-c+l,I=0;I!==o;I++){var y=a[d+I+o],C=a[d+I+s]*h,E=a[g+I+o],B=a[g+I]*h;n[I]=v*y+m*C+f*E+p*B}return n}}]),r}(r.Interpolant),Qt=new r.Quaternion,xt=function(e){f(r,e);var t=I(r);function r(){return c(this,r),t.apply(this,arguments)}return g(r,[{key:"interpolate_",value:function(e,t,i,n){var a=C(p(r.prototype),"interpolate_",this).call(this,e,t,i,n);return Qt.fromArray(a).normalize().toArray(a),a}}]),r}(wt),bt={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},St={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},kt={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},Mt={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},_t={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Tt={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Dt={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Lt={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete},Rt="OPAQUE",Ft="MASK",Ut="BLEND";function Gt(e,t,r){for(var i in r.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=r.extensions[i])}function Nt(e,t){void 0!==t.extras&&("object"===A(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Ot(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var r=0,i=t.weights.length;r<i;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){var n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(var a=0,o=n.length;a<o;a++)e.morphTargetDictionary[n[a]]=a}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Pt(e){for(var t="",r=Object.keys(e).sort(),i=0,n=r.length;i<n;i++)t+=r[i]+":"+e[r[i]]+";";return t}function Ht(e){switch(e){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 Vt=new r.Matrix4,jt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};c(this,e),this.json=t,this.extensions={},this.plugins={},this.options=i,this.cache=new tt,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,a=!1,o=-1;"undefined"!=typeof navigator&&(n=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),o=(a=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||a&&o<98?this.textureLoader=new r.TextureLoader(this.options.manager):this.textureLoader=new r.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return g(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var r=this,i=this.json,n=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){var a={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:r,userData:{}};Gt(n,a,i),Nt(a,i),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(a)}))).then((function(){e(a)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],i=0,n=t.length;i<n;i++)for(var a=t[i].joints,o=0,s=a.length;o<s;o++)e[a[o]].isBone=!0;for(var A=0,h=e.length;A<h;A++){var l=e[A];void 0!==l.mesh&&(this._addNodeRef(this.meshCache,l.mesh),void 0!==l.skin&&(r[l.mesh].isSkinnedMesh=!0)),void 0!==l.camera&&this._addNodeRef(this.cameraCache,l.camera)}}},{key:"_addNodeRef",value:function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}},{key:"_getNodeRef",value:function(e,t,r){var i=this;if(e.refs[t]<=1)return r;var n=r.clone();return function e(t,r){var n=i.associations.get(t);null!=n&&i.associations.set(r,n);var a,o=b(t.children.entries());try{for(o.s();!(a=o.n()).done;){var s=w(a.value,2),A=s[0];e(s[1],r.children[A])}}catch(e){o.e(e)}finally{o.f()}}(r,n),n.name+="_instance_"+e.uses[t]++,n}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var r=0;r<t.length;r++){var i=e(t[r]);if(i)return i}return null}},{key:"_invokeAll",value:function(e){var t=Object.values(this.plugins);t.unshift(this);for(var r=[],i=0;i<t.length;i++){var n=e(t[i]);n&&r.push(n)}return r}},{key:"getDependency",value:function(e,t){var r=e+":"+t,i=this.cache.get(r);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":i=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":i=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":i=this.loadCamera(t);break;default:if(!(i=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}))))throw new Error("Unknown type: "+e)}this.cache.add(r,i)}return i}},{key:"getDependencies",value:function(e){var t=this.cache.get(e);if(!t){var r=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map((function(t,i){return r.getDependency(e,i)}))),this.cache.add(e,t)}return t}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],i=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[rt.KHR_BINARY_GLTF].body);var n=this.options;return new Promise((function(e,a){i.load(r.LoaderUtils.resolveURL(t.uri,n.path),e,void 0,(function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}},{key:"loadBufferView",value:function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+r)}))}},{key:"loadAccessor",value:function(e){var t=this,i=this.json,n=this.json.accessors[e];if(void 0===n.bufferView&&void 0===n.sparse){var a=_t[n.type],o=St[n.componentType],s=!0===n.normalized,A=new o(n.count*a);return Promise.resolve(new r.BufferAttribute(A,a,s))}var h=[];return void 0!==n.bufferView?h.push(this.getDependency("bufferView",n.bufferView)):h.push(null),void 0!==n.sparse&&(h.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),h.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(h).then((function(e){var a,o,s=e[0],A=_t[n.type],h=St[n.componentType],l=h.BYTES_PER_ELEMENT,c=l*A,u=n.byteOffset||0,g=void 0!==n.bufferView?i.bufferViews[n.bufferView].byteStride:void 0,d=!0===n.normalized;if(g&&g!==c){var f=Math.floor(u/g),p="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+f+":"+n.count,v=t.cache.get(p);v||(a=new h(s,f*g,n.count*g/l),v=new r.InterleavedBuffer(a,g/l),t.cache.add(p,v)),o=new r.InterleavedBufferAttribute(v,A,u%g/l,d)}else a=null===s?new h(n.count*A):new h(s,u,n.count*A),o=new r.BufferAttribute(a,A,d);if(void 0!==n.sparse){var m=_t.SCALAR,I=St[n.sparse.indices.componentType],y=n.sparse.indices.byteOffset||0,C=n.sparse.values.byteOffset||0,E=new I(e[1],y,n.sparse.count*m),B=new h(e[2],C,n.sparse.count*A);null!==s&&(o=new r.BufferAttribute(o.array.slice(),o.itemSize,o.normalized));for(var w=0,Q=E.length;w<Q;w++){var x=E[w];if(o.setX(x,B[w*A]),A>=2&&o.setY(x,B[w*A+1]),A>=3&&o.setZ(x,B[w*A+2]),A>=4&&o.setW(x,B[w*A+3]),A>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o}))}},{key:"loadTexture",value:function(e){var t=this.json,r=this.options,i=t.textures[e].source,n=t.images[i],a=this.textureLoader;if(n.uri){var o=r.manager.getHandler(n.uri);null!==o&&(a=o)}return this.loadTextureImage(e,i,a)}},{key:"loadTextureImage",value:function(e,t,i){var n=this,a=this.json,o=a.textures[e],s=a.images[t],A=(s.uri||s.bufferView)+":"+o.sampler;if(this.textureCache[A])return this.textureCache[A];var h=this.loadImageSource(t,i).then((function(t){t.flipY=!1,t.name=o.name||s.name||"";var i=(a.samplers||{})[o.sampler]||{};return t.magFilter=kt[i.magFilter]||r.LinearFilter,t.minFilter=kt[i.minFilter]||r.LinearMipmapLinearFilter,t.wrapS=Mt[i.wrapS]||r.RepeatWrapping,t.wrapT=Mt[i.wrapT]||r.RepeatWrapping,n.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[A]=h,h}},{key:"loadImageSource",value:function(e,t){var i=this.json,n=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()}));var a=i.images[e],o=self.URL||self.webkitURL,s=a.uri||"",A=!1;if(void 0!==a.bufferView)s=this.getDependency("bufferView",a.bufferView).then((function(e){A=!0;var t=new Blob([e],{type:a.mimeType});return s=o.createObjectURL(t)}));else if(void 0===a.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");var h=Promise.resolve(s).then((function(e){return new Promise((function(i,a){var o=i;!0===t.isImageBitmapLoader&&(o=function(e){var t=new r.Texture(e);t.needsUpdate=!0,i(t)}),t.load(r.LoaderUtils.resolveURL(e,n.path),o,void 0,a)}))})).then((function(e){var t;return!0===A&&o.revokeObjectURL(s),e.userData.mimeType=a.mimeType||((t=a.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e}));return this.sourceCache[e]=h,h}},{key:"assignTexture",value:function(e,t,r,i){var n=this;return this.getDependency("texture",r.index).then((function(a){if(!a)return null;if(void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),n.extensions[rt.KHR_TEXTURE_TRANSFORM]){var o=void 0!==r.extensions?r.extensions[rt.KHR_TEXTURE_TRANSFORM]:void 0;if(o){var s=n.associations.get(a);a=n.extensions[rt.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),n.associations.set(a,s)}}return void 0!==i&&(a.encoding=i),e[t]=a,a}))}},{key:"assignFinalMaterial",value:function(e){var t=e.geometry,i=e.material,n=void 0===t.attributes.tangent,a=void 0!==t.attributes.color,o=void 0===t.attributes.normal;if(e.isPoints){var s="PointsMaterial:"+i.uuid,A=this.cache.get(s);A||(A=new r.PointsMaterial,r.Material.prototype.copy.call(A,i),A.color.copy(i.color),A.map=i.map,A.sizeAttenuation=!1,this.cache.add(s,A)),i=A}else if(e.isLine){var h="LineBasicMaterial:"+i.uuid,l=this.cache.get(h);l||(l=new r.LineBasicMaterial,r.Material.prototype.copy.call(l,i),l.color.copy(i.color),this.cache.add(h,l)),i=l}if(n||a||o){var c="ClonedMaterial:"+i.uuid+":";n&&(c+="derivative-tangents:"),a&&(c+="vertex-colors:"),o&&(c+="flat-shading:");var u=this.cache.get(c);u||(u=i.clone(),a&&(u.vertexColors=!0),o&&(u.flatShading=!0),n&&(u.normalScale&&(u.normalScale.y*=-1),u.clearcoatNormalScale&&(u.clearcoatNormalScale.y*=-1)),this.cache.add(c,u),this.associations.set(u,this.associations.get(i))),i=u}i.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),e.material=i}},{key:"getMaterialType",value:function(){return r.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,i=this,n=this.json,a=this.extensions,o=n.materials[e],s={},A=[];if((o.extensions||{})[rt.KHR_MATERIALS_UNLIT]){var h=a[rt.KHR_MATERIALS_UNLIT];t=h.getMaterialType(),A.push(h.extendParams(s,o,i))}else{var l=o.pbrMetallicRoughness||{};if(s.color=new r.Color(1,1,1),s.opacity=1,Array.isArray(l.baseColorFactor)){var c=l.baseColorFactor;s.color.fromArray(c),s.opacity=c[3]}void 0!==l.baseColorTexture&&A.push(i.assignTexture(s,"map",l.baseColorTexture,r.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(i.assignTexture(s,"metalnessMap",l.metallicRoughnessTexture)),A.push(i.assignTexture(s,"roughnessMap",l.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),A.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)}))))}!0===o.doubleSided&&(s.side=r.DoubleSide);var u=o.alphaMode||Rt;if(u===Ut?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,u===Ft&&(s.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==r.MeshBasicMaterial&&(A.push(i.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new r.Vector2(1,1),void 0!==o.normalTexture.scale)){var g=o.normalTexture.scale;s.normalScale.set(g,g)}return void 0!==o.occlusionTexture&&t!==r.MeshBasicMaterial&&(A.push(i.assignTexture(s,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(s.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==r.MeshBasicMaterial&&(s.emissive=(new r.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==r.MeshBasicMaterial&&A.push(i.assignTexture(s,"emissiveMap",o.emissiveTexture,r.sRGBEncoding)),Promise.all(A).then((function(){var r=new t(s);return o.name&&(r.name=o.name),Nt(r,o),i.associations.set(r,{materials:e}),o.extensions&&Gt(a,r,o),r}))}},{key:"createUniqueName",value:function(e){for(var t=r.PropertyBinding.sanitizeNodeName(e||""),i=t,n=1;this.nodeNamesUsed[i];++n)i=t+"_"+n;return this.nodeNamesUsed[i]=!0,i}},{key:"loadGeometries",value:function(e){var t=this,i=this.extensions,n=this.primitiveCache;function a(e){return i[rt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return qt(r,e,t)}))}for(var o,s,A=[],h=0,l=e.length;h<l;h++){var c=e[h],u=(s=void 0,(s=(o=c).extensions&&o.extensions[rt.KHR_DRACO_MESH_COMPRESSION])?"draco:"+s.bufferView+":"+s.indices+":"+Pt(s.attributes):o.indices+":"+Pt(o.attributes)+":"+o.mode),g=n[u];if(g)A.push(g.promise);else{var d=void 0;d=c.extensions&&c.extensions[rt.KHR_DRACO_MESH_COMPRESSION]?a(c):qt(new r.BufferGeometry,c,t),n[u]={primitive:c,promise:d},A.push(d)}}return Promise.all(A)}},{key:"loadMesh",value:function(e){for(var t,i=this,n=this.json,a=this.extensions,o=n.meshes[e],s=o.primitives,A=[],h=0,l=s.length;h<l;h++){var c=void 0===s[h].material?(void 0===(t=this.cache).DefaultMaterial&&(t.DefaultMaterial=new r.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),t.DefaultMaterial):this.getDependency("material",s[h].material);A.push(c)}return A.push(i.loadGeometries(s)),Promise.all(A).then((function(t){for(var n=t.slice(0,t.length-1),A=t[t.length-1],h=[],l=0,c=A.length;l<c;l++){var u=A[l],g=s[l],d=void 0,f=n[l];if(g.mode===bt.TRIANGLES||g.mode===bt.TRIANGLE_STRIP||g.mode===bt.TRIANGLE_FAN||void 0===g.mode)!0!==(d=!0===o.isSkinnedMesh?new r.SkinnedMesh(u,f):new r.Mesh(u,f)).isSkinnedMesh||d.geometry.attributes.skinWeight.normalized||d.normalizeSkinWeights(),g.mode===bt.TRIANGLE_STRIP?d.geometry=zt(d.geometry,r.TriangleStripDrawMode):g.mode===bt.TRIANGLE_FAN&&(d.geometry=zt(d.geometry,r.TriangleFanDrawMode));else if(g.mode===bt.LINES)d=new r.LineSegments(u,f);else if(g.mode===bt.LINE_STRIP)d=new r.Line(u,f);else if(g.mode===bt.LINE_LOOP)d=new r.LineLoop(u,f);else{if(g.mode!==bt.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+g.mode);d=new r.Points(u,f)}Object.keys(d.geometry.morphAttributes).length>0&&Ot(d,o),d.name=i.createUniqueName(o.name||"mesh_"+e),Nt(d,o),g.extensions&&Gt(a,d,g),i.assignFinalMaterial(d),h.push(d)}for(var p=0,v=h.length;p<v;p++)i.associations.set(h[p],{meshes:e,primitives:p});if(1===h.length)return h[0];var m=new r.Group;i.associations.set(m,{meshes:e});for(var I=0,y=h.length;I<y;I++)m.add(h[I]);return m}))}},{key:"loadCamera",value:function(e){var t,i=this.json.cameras[e],n=i[i.type];if(n)return"perspective"===i.type?t=new r.PerspectiveCamera(r.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===i.type&&(t=new r.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),Nt(t,i),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){for(var t=this.json.skins[e],i=[],n=0,a=t.joints.length;n<a;n++)i.push(this.getDependency("node",t.joints[n]));return void 0!==t.inverseBindMatrices?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then((function(e){for(var i=e.pop(),n=e,a=[],o=[],s=0,A=n.length;s<A;s++){var h=n[s];if(h){a.push(h);var l=new r.Matrix4;null!==i&&l.fromArray(i.array,16*s),o.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[s])}return new r.Skeleton(a,o)}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],i=[],n=[],a=[],o=[],s=[],A=0,h=t.channels.length;A<h;A++){var l=t.channels[A],c=t.samplers[l.sampler],u=l.target,g=u.node,d=void 0!==t.parameters?t.parameters[c.input]:c.input,f=void 0!==t.parameters?t.parameters[c.output]:c.output;i.push(this.getDependency("node",g)),n.push(this.getDependency("accessor",d)),a.push(this.getDependency("accessor",f)),o.push(c),s.push(u)}return Promise.all([Promise.all(i),Promise.all(n),Promise.all(a),Promise.all(o),Promise.all(s)]).then((function(i){for(var n=i[0],a=i[1],o=i[2],s=i[3],A=i[4],h=[],l=function(){var e,t=n[c],i=a[c],l=o[c],u=s[c],g=A[c];if(void 0===t)return"continue";switch(t.updateMatrix(),Dt[g.path]){case Dt.weights:e=r.NumberKeyframeTrack;break;case Dt.rotation:e=r.QuaternionKeyframeTrack;break;default:e=r.VectorKeyframeTrack}var d=t.name?t.name:t.uuid,f=void 0!==u.interpolation?Lt[u.interpolation]:r.InterpolateLinear,p=[];Dt[g.path]===Dt.weights?t.traverse((function(e){e.morphTargetInfluences&&p.push(e.name?e.name:e.uuid)})):p.push(d);var v=l.array;if(l.normalized){for(var m=Ht(v.constructor),I=new Float32Array(v.length),y=0,C=v.length;y<C;y++)I[y]=v[y]*m;v=I}for(var E=0,B=p.length;E<B;E++){var w=new e(p[E]+"."+Dt[g.path],i.array,v,f);"CUBICSPLINE"===u.interpolation&&(w.createInterpolant=function(e){return new(this instanceof r.QuaternionKeyframeTrack?xt:wt)(this.times,this.values,this.getValueSize()/3,e)},w.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),h.push(w)}},c=0,u=n.length;c<u;c++)l();var g=t.name?t.name:"animation_"+e;return new r.AnimationClip(g,void 0,h)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,r=this,i=t.nodes[e];return void 0===i.mesh?null:r.getDependency("mesh",i.mesh).then((function(e){var t=r._getNodeRef(r.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,r=i.weights.length;t<r;t++)e.morphTargetInfluences[t]=i.weights[t]})),t}))}},{key:"loadNode",value:function(e){var t=this.json,i=this.extensions,n=this,a=t.nodes[e],o=a.name?n.createUniqueName(a.name):"";return function(){var t=[],r=n._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));r&&t.push(r),void 0!==a.camera&&t.push(n.getDependency("camera",a.camera).then((function(e){return n._getNodeRef(n.cameraCache,a.camera,e)}))),n._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)}));for(var i=[],o=a.children||[],s=0,A=o.length;s<A;s++)i.push(n.getDependency("node",o[s]));var h=void 0===a.skin?Promise.resolve(null):n.getDependency("skin",a.skin);return Promise.all([Promise.all(t),Promise.all(i),h])}().then((function(t){var s,A=t[0],h=t[1],l=t[2];if((s=!0===a.isBone?new r.Bone:A.length>1?new r.Group:1===A.length?A[0]:new r.Object3D)!==A[0])for(var c=0,u=A.length;c<u;c++)s.add(A[c]);if(a.name&&(s.userData.name=a.name,s.name=o),Nt(s,a),a.extensions&&Gt(i,s,a),void 0!==a.matrix){var g=new r.Matrix4;g.fromArray(a.matrix),s.applyMatrix4(g)}else void 0!==a.translation&&s.position.fromArray(a.translation),void 0!==a.rotation&&s.quaternion.fromArray(a.rotation),void 0!==a.scale&&s.scale.fromArray(a.scale);n.associations.has(s)||n.associations.set(s,{}),n.associations.get(s).nodes=e,null!==l&&s.traverse((function(e){e.isSkinnedMesh&&e.bind(l,Vt)}));for(var d=0,f=h.length;d<f;d++)s.add(h[d]);return s}))}},{key:"loadScene",value:function(e){var t=this.extensions,i=this.json.scenes[e],n=this,a=new r.Group;i.name&&(a.name=n.createUniqueName(i.name)),Nt(a,i),i.extensions&&Gt(t,a,i);for(var o=i.nodes||[],s=[],A=0,h=o.length;A<h;A++)s.push(n.getDependency("node",o[A]));return Promise.all(s).then((function(e){for(var t=0,i=e.length;t<i;t++)a.add(e[t]);return n.associations=function(e){var t,i=new Map,a=b(n.associations);try{for(a.s();!(t=a.n()).done;){var o=w(t.value,2),s=o[0],A=o[1];(s instanceof r.Material||s instanceof r.Texture)&&i.set(s,A)}}catch(e){a.e(e)}finally{a.f()}return e.traverse((function(e){var t=n.associations.get(e);null!=t&&i.set(e,t)})),i}(a),a}))}}]),e}();function qt(e,t,i){var n=t.attributes,a=[];function o(t,r){return i.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}for(var s in n){var A=Tt[s]||s.toLowerCase();A in e.attributes||a.push(o(n[s],A))}if(void 0!==t.indices&&!e.index){var h=i.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));a.push(h)}return Nt(e,t),function(e,t,i){var n=t.attributes,a=new r.Box3;if(void 0!==n.POSITION){var o=i.json.accessors[n.POSITION],s=o.min,A=o.max;if(void 0!==s&&void 0!==A){if(a.set(new r.Vector3(s[0],s[1],s[2]),new r.Vector3(A[0],A[1],A[2])),o.normalized){var h=Ht(St[o.componentType]);a.min.multiplyScalar(h),a.max.multiplyScalar(h)}var l=t.targets;if(void 0!==l){for(var c=new r.Vector3,u=new r.Vector3,g=0,d=l.length;g<d;g++){var f=l[g];if(void 0!==f.POSITION){var p=i.json.accessors[f.POSITION],v=p.min,m=p.max;if(void 0!==v&&void 0!==m){if(u.setX(Math.max(Math.abs(v[0]),Math.abs(m[0]))),u.setY(Math.max(Math.abs(v[1]),Math.abs(m[1]))),u.setZ(Math.max(Math.abs(v[2]),Math.abs(m[2]))),p.normalized){var I=Ht(St[p.componentType]);u.multiplyScalar(I)}c.max(u)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}a.expandByVector(c)}e.boundingBox=a;var y=new r.Sphere;a.getCenter(y.center),y.radius=a.min.distanceTo(a.max)/2,e.boundingSphere=y}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,i),Promise.all(a).then((function(){return void 0!==t.targets?function(e,t,r){for(var i=!1,n=!1,a=!1,o=0,s=t.length;o<s;o++){var A=t[o];if(void 0!==A.POSITION&&(i=!0),void 0!==A.NORMAL&&(n=!0),void 0!==A.COLOR_0&&(a=!0),i&&n&&a)break}if(!i&&!n&&!a)return Promise.resolve(e);for(var h=[],l=[],c=[],u=0,g=t.length;u<g;u++){var d=t[u];if(i){var f=void 0!==d.POSITION?r.getDependency("accessor",d.POSITION):e.attributes.position;h.push(f)}if(n){var p=void 0!==d.NORMAL?r.getDependency("accessor",d.NORMAL):e.attributes.normal;l.push(p)}if(a){var v=void 0!==d.COLOR_0?r.getDependency("accessor",d.COLOR_0):e.attributes.color;c.push(v)}}return Promise.all([Promise.all(h),Promise.all(l),Promise.all(c)]).then((function(t){var r=t[0],o=t[1],s=t[2];return i&&(e.morphAttributes.position=r),n&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e}))}(e,t.targets,i):e}))}function zt(e,t){var i=e.getIndex();if(null===i){var n=[],a=e.getAttribute("position");if(void 0===a)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var o=0;o<a.count;o++)n.push(o);e.setIndex(n),i=e.getIndex()}var s=i.count-2,A=[];if(t===r.TriangleFanDrawMode)for(var h=1;h<=s;h++)A.push(i.getX(0)),A.push(i.getX(h)),A.push(i.getX(h+1));else for(var l=0;l<s;l++)l%2==0?(A.push(i.getX(l)),A.push(i.getX(l+1)),A.push(i.getX(l+2))):(A.push(i.getX(l+2)),A.push(i.getX(l+1)),A.push(i.getX(l)));A.length/3!==s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var c=e.clone();return c.setIndex(A),c}var Jt=function(e){f(i,e);var t=I(i);function i(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DefaultLoadingManager;return c(this,i),(e=t.call(this)).manager=n,e.adjustmentTransform=new r.Matrix4,e}return g(i,[{key:"parse",value:function(e){var t=this,r=C(p(i.prototype),"parse",this).call(this,e),n=r.glbBytes.slice().buffer;return new Promise((function(e,i){var a=t.manager,o=t.fetchOptions,s=a.getHandler("path.gltf")||new et(a);"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=t.workingPath;!/[\\/]$/.test(A)&&A.length&&(A+="/");var h=t.adjustmentTransform;s.parse(n,A,(function(t){var i=r.batchTable,n=r.featureTable,a=t.scene,o=n.getData("RTC_CENTER");o&&(a.position.x+=o[0],a.position.y+=o[1],a.position.z+=o[2]),t.scene.updateMatrix(),t.scene.matrix.multiply(h),t.scene.matrix.decompose(t.scene.position,t.scene.quaternion,t.scene.scale),t.batchTable=i,t.featureTable=n,a.batchTable=i,a.featureTable=n,e(t)}),i)}))}}]),i}($e),Kt=function(e){f(r,e);var t=I(r);function r(){return c(this,r),t.apply(this,arguments)}return g(r,[{key:"parse",value:function(e){var t=new DataView(e),r=Ze(t);console.assert("pnts"===r);var i=t.getUint32(4,!0);console.assert(1===i);var n=t.getUint32(8,!0);console.assert(n===e.byteLength);var a=t.getUint32(12,!0),o=t.getUint32(16,!0),s=t.getUint32(20,!0),A=t.getUint32(24,!0),h=e.slice(28,28+a+o),l=new Ye(h,0,a,o),c=28+a+o,u=e.slice(c,c+s+A),g=new We(u,l.getData("BATCH_LENGTH")||l.getData("POINTS_LENGTH"),0,s,A);return Promise.resolve({version:i,featureTable:l,batchTable:g})}}]),r}(Xe),Yt={RGB:"color",POSITION:"position"},Wt=function(e){f(i,e);var t=I(i);function i(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DefaultLoadingManager;return c(this,i),(e=t.call(this)).manager=n,e}return g(i,[{key:"parse",value:function(e){var t=this;return C(p(i.prototype),"parse",this).call(this,e).then(function(){var e=l(s().mark((function e(i){var n,a,o,A,h,l,c,u,g,d,f,p,v,m,I,y,C,E;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=i.featureTable,a=new r.PointsMaterial,!(o=n.header.extensions)||!o["3DTILES_draco_point_compression"]){e.next=18;break}if(h=o["3DTILES_draco_point_compression"],l=h.byteOffset,c=h.byteLength,u=h.properties,null!=(g=t.manager.getHandler("draco.drc"))){e.next=8;break}throw new Error("PNTSLoader: dracoLoader not available.");case 8:for(f in d={},u)f in Yt&&f in u&&(d[Yt[f]]=u[f]);return p={attributeIDs:d,attributeTypes:{position:"Float32Array",color:"Uint8Array"},useUniqueIDs:!0},v=n.getBuffer(l,c),e.next=14,g.decodeGeometry(v,p);case 14:(A=e.sent).attributes.color&&(a.vertexColors=!0),e.next=24;break;case 18:m=n.getData("POINTS_LENGTH"),I=n.getData("POSITION",m,"FLOAT","VEC3"),y=n.getData("RGB",m,"UNSIGNED_BYTE","VEC3"),(A=new r.BufferGeometry).setAttribute("position",new r.BufferAttribute(I,3,!1)),null!==y&&(A.setAttribute("color",new r.BufferAttribute(y,3,!0)),a.vertexColors=!0);case 24:return["QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","CONSTANT_RGBA","BATCH_LENGTH","POSITION_QUANTIZED","RGBA","RGB565","NORMAL","NORMAL_OCT16P"].forEach((function(e){e in n.header&&console.warn('PNTSLoader: Unsupported FeatureTable feature "'.concat(e,'" detected.'))})),C=new r.Points(A,a),i.scene=C,i.scene.featureTable=n,(E=n.getData("RTC_CENTER"))&&(i.scene.position.x+=E[0],i.scene.position.y+=E[1],i.scene.position.z+=E[2]),e.abrupt("return",i);case 31:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}}]),i}(Kt),Xt=function(e){f(r,e);var t=I(r);function r(){return c(this,r),t.apply(this,arguments)}return g(r,[{key:"parse",value:function(e){var t=new DataView(e),r=Ze(t);console.assert("i3dm"===r);var i=t.getUint32(4,!0);console.assert(1===i);var n=t.getUint32(8,!0);console.assert(n===e.byteLength);var a=t.getUint32(12,!0),o=t.getUint32(16,!0),s=t.getUint32(20,!0),A=t.getUint32(24,!0),h=t.getUint32(28,!0),l=e.slice(32,32+a+o),c=new Ye(l,0,a,o),u=32+a+o,g=e.slice(u,u+s+A),d=new We(g,c.getData("INSTANCES_LENGTH"),0,s,A),f=u+s+A,p=new Uint8Array(e,f,n-f),v=null,m=null;if(h)v=p,m=Promise.resolve();else{var I=this.resolveExternalURL(Ke(p));m=fetch(I,this.fetchOptions).then((function(e){if(!e.ok)throw new Error('I3DMLoaderBase : Failed to load file "'.concat(I,'" with status ').concat(e.status," : ").concat(e.statusText));return e.arrayBuffer()})).then((function(e){v=new Uint8Array(e)}))}return m.then((function(){return{version:i,featureTable:c,batchTable:d,glbBytes:v}}))}}]),r}(Xe),Zt=new r.Vector3,$t=new r.Vector3,er=new r.Vector3,tr=new r.Vector3,rr=new r.Quaternion,ir=new r.Vector3,nr=new r.Matrix4,ar=function(e){f(i,e);var t=I(i);function i(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DefaultLoadingManager;return c(this,i),(e=t.call(this)).manager=n,e.adjustmentTransform=new r.Matrix4,e}return g(i,[{key:"resolveExternalURL",value:function(e){return this.manager.resolveURL(C(p(i.prototype),"resolveExternalURL",this).call(this,e))}},{key:"parse",value:function(e){var t=this;return C(p(i.prototype),"parse",this).call(this,e).then((function(e){var i=e.featureTable,n=e.batchTable,a=e.glbBytes.slice().buffer;return new Promise((function(e,o){var s=t.fetchOptions,A=t.manager,h=A.getHandler("path.gltf")||new et(A);"include"===s.credentials&&"cors"===s.mode&&h.setCrossOrigin("use-credentials"),"credentials"in s&&h.setWithCredentials("include"===s.credentials),s.headers&&h.setRequestHeader(s.headers);var l=t.workingPath;/[\\/]$/.test(l)||(l+="/");var c=t.adjustmentTransform;h.parse(a,l,(function(t){var a=i.getData("INSTANCES_LENGTH"),o=i.getData("POSITION",a,"FLOAT","VEC3"),s=i.getData("NORMAL_UP",a,"FLOAT","VEC3"),A=i.getData("NORMAL_RIGHT",a,"FLOAT","VEC3"),h=i.getData("SCALE_NON_UNIFORM",a,"FLOAT","VEC3"),l=i.getData("SCALE",a,"FLOAT","SCALAR");["RTC_CENTER","QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","EAST_NORTH_UP","POSITION_QUANTIZED","NORMAL_UP_OCT32P","NORMAL_RIGHT_OCT32P"].forEach((function(e){e in i.header&&console.warn('I3DMLoader: Unsupported FeatureTable feature "'.concat(e,'" detected.'))}));var u=new Map,g=[];t.scene.traverse((function(e){if(e.isMesh){var t=e.geometry,i=e.material,n=new r.InstancedMesh(t,i,a);n.position.copy(e.position),n.rotation.copy(e.rotation),n.scale.copy(e.scale),g.push(n),u.set(e,n)}}));for(var d=new r.Vector3,f=0;f<a;f++)d.x+=o[3*f+0]/a,d.y+=o[3*f+1]/a,d.z+=o[3*f+2]/a;u.forEach((function(e,t){var r=t.parent;r&&(r.remove(t),r.add(e),e.updateMatrixWorld(),e.position.copy(d).applyMatrix4(e.matrixWorld))}));for(var p=0;p<a;p++){tr.set(o[3*p+0]-d.x,o[3*p+1]-d.y,o[3*p+2]-d.z),s?($t.set(s[3*p+0],s[3*p+1],s[3*p+2]),er.set(A[3*p+0],A[3*p+1],A[3*p+2]),Zt.crossVectors(er,$t).normalize(),nr.makeBasis(er,$t,Zt),rr.setFromRotationMatrix(nr)):rr.set(0,0,0,1),l?ir.setScalar(l[p]):h?ir.set(h[3*p+0],h[3*p+1],h[3*p+2]):ir.set(1,1,1),nr.compose(tr,rr,ir).multiply(c);for(var v=0,m=g.length;v<m;v++){g[v].setMatrixAt(p,nr)}}t.batchTable=n,t.featureTable=i,t.scene.batchTable=n,t.scene.featureTable=i,e(t)}),o)}))}))}}]),i}(Xt),or=function(e){f(r,e);var t=I(r);function r(){return c(this,r),t.apply(this,arguments)}return g(r,[{key:"parse",value:function(e){var t=new DataView(e),r=Ze(t);console.assert("cmpt"===r,'CMPTLoader: The magic bytes equal "cmpt".');var i=t.getUint32(4,!0);console.assert(1===i,'CMPTLoader: The version listed in the header is "1".');var n=t.getUint32(8,!0);console.assert(n===e.byteLength,"CMPTLoader: The contents buffer length listed in the header matches the file.");for(var a=t.getUint32(12,!0),o=[],s=16,A=0;A<a;A++){var h=new DataView(e,s,12),l=Ze(h),c=h.getUint32(4,!0),u=h.getUint32(8,!0),g=new Uint8Array(e,s,u);o.push({type:l,buffer:g,version:c}),s+=u}return{version:i,tiles:o}}}]),r}(Xe),sr=function(e){f(i,e);var t=I(i);function i(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DefaultLoadingManager;return c(this,i),(e=t.call(this)).manager=n,e.adjustmentTransform=new r.Matrix4,e}return g(i,[{key:"parse",value:function(e){var t=C(p(i.prototype),"parse",this).call(this,e),n=this.manager,a=this.adjustmentTransform,o=[];for(var s in t.tiles){var A=t.tiles[s],h=A.type,l=A.buffer;switch(h){case"b3dm":var c=l.slice(),u=new Jt(n);u.workingPath=this.workingPath,u.fetchOptions=this.fetchOptions,u.adjustmentTransform.copy(a);var g=u.parse(c.buffer);o.push(g);break;case"pnts":var d=l.slice(),f=new Wt(n);f.workingPath=this.workingPath,f.fetchOptions=this.fetchOptions;var v=f.parse(d.buffer);o.push(v);break;case"i3dm":var m=l.slice(),I=new ar(n);I.workingPath=this.workingPath,I.fetchOptions=this.fetchOptions,I.adjustmentTransform.copy(a);var y=I.parse(m.buffer);o.push(y)}}return Promise.all(o).then((function(e){var t=new r.Group;return e.forEach((function(e){t.add(e.scene)})),{tiles:e,scene:t}}))}}]),i}(or),Ar=function(){function e(){c(this,e),this.name="CESIUM_RTC"}return g(e,[{key:"afterRoot",value:function(e){if(e.parser.json.extensions&&e.parser.json.extensions.CESIUM_RTC){var t=e.parser.json.extensions.CESIUM_RTC.center;t&&(e.scene.position.x+=t[0],e.scene.position.y+=t[1],e.scene.position.z+=t[2])}}}]),e}(),hr=function(e){f(i,e);var t=I(i);function i(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DefaultLoadingManager;return c(this,i),(e=t.call(this)).manager=n,e}return g(i,[{key:"parse",value:function(e){var t=this;return new Promise((function(r,i){var n=t.manager,a=t.fetchOptions,o=n.getHandler("path.gltf")||n.getHandler("path.glb");o||((o=new et(n)).register((function(){return new Ar})),"include"===a.credentials&&"cors"===a.mode&&o.setCrossOrigin("use-credentials"),"credentials"in a&&o.setWithCredentials("include"===a.credentials),a.headers&&o.setRequestHeader(a.headers));var s=o.resourcePath||o.path||t.workingPath;!/[\\/]$/.test(s)&&s.length&&(s+="/"),o.parse(e,s,(function(e){r(e)}),i)}))}}]),i}(Xe),lr=new r.Matrix4,cr=function(e){f(r,e);var t=I(r);function r(e){var i;return c(this,r),(i=t.call(this)).name="TilesRenderer.TilesGroup",i.tilesRenderer=e,i}return g(r,[{key:"raycast",value:function(e,t){this.tilesRenderer.optimizeRaycast&&this.tilesRenderer.raycast(e,t)}},{key:"updateMatrixWorld",value:function(e){if(this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldNeedsUpdate||e){null===this.parent?lr.copy(this.matrix):lr.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1;for(var t=lr.elements,r=this.matrixWorld.elements,i=!1,n=0;n<16;n++){var a=t[n],o=r[n];if(Math.abs(a-o)>Number.EPSILON){i=!0;break}}if(i){this.matrixWorld.copy(lr);for(var s=this.children,A=0,h=s.length;A<h;A++)s[A].updateMatrixWorld()}}}}]),r}(r.Group);new r.Spherical,new r.Vector3;var ur=new r.Spherical,gr=new r.Vector3,dr=new r.Vector3,fr=new r.Vector3,pr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;c(this,e),this.radius=new r.Vector3(t,i,n)}return g(e,[{key:"getCartographicToPosition",value:function(e,t,r,i){this.getCartographicToNormal(e,t,gr);var n=this.radius;dr.copy(gr),dr.x*=Math.pow(n.x,2),dr.y*=Math.pow(n.y,2),dr.z*=Math.pow(n.z,2);var a=Math.sqrt(gr.dot(dr));return dr.divideScalar(a),i.copy(dr).addScaledVector(gr,r)}},{key:"getPositionToCartographic",value:function(e,t){this.getPositionToSurfacePoint(e,dr),this.getPositionToNormal(e,gr);var r=fr.subVectors(e,dr);return t.lon=Math.atan2(gr.y,gr.x),t.lat=Math.asin(gr.z),t.height=Math.sign(r.dot(e))*r.length(),t}},{key:"getCartographicToNormal",value:function(e,t,r){return ur.set(1,-e+Math.PI/2,t),r.setFromSpherical(ur).normalize(),function(e){var t=e.x,r=e.y,i=e.z;e.x=i,e.y=t,e.z=r}(r),r}},{key:"getPositionToNormal",value:function(e,t){var r=this.radius;return t.copy(e),t.x/=Math.pow(r.x,2),t.y/=Math.pow(r.y,2),t.z/=Math.pow(r.z,2),t.normalize(),t}},{key:"getPositionToSurfacePoint",value:function(e,t){var r=this.radius,i=1/Math.pow(r.x,2),n=1/Math.pow(r.y,2),a=1/Math.pow(r.z,2),o=e.x*e.x*i,s=e.y*e.y*n,A=e.z*e.z*a,h=o+s+A,l=Math.sqrt(1/h),c=dr.copy(e).multiplyScalar(l);if(h<.1)return isFinite(l)?t.copy(c):null;var u,g,d,f,p,v,m,I=fr.set(c.x*i*2,c.y*n*2,c.z*a*2),y=(1-l)*e.length()/(.5*I.length()),C=0;do{C=(u=o*(p=(g=1/(1+(y-=C)*i))*g)+s*(v=(d=1/(1+y*n))*d)+A*(m=(f=1/(1+y*a))*f)-1)/(-2*(o*(p*g)*i+s*(v*d)*n+A*(m*f)*a))}while(Math.abs(u)>1e-12);return t.set(e.x*g,e.y*d,e.z*f)}}]),e}(),vr=Math.PI,mr=vr/2,Ir=new r.Vector3,yr=new r.Vector3,Cr=new r.Vector3,Er=new r.Matrix4,Br=0,wr=[];function Qr(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?(wr[Br]||(wr[Br]=new r.Vector3),Br++,wr[Br-1]):new r.Vector3}function xr(){Br=0}var br=function(e){f(i,e);var t=I(i);function i(e,r,n){var a,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-mr,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:mr,A=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,h=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*vr,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,u=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0;return c(this,i),(a=t.call(this,e,r,n)).latStart=o,a.latEnd=s,a.lonStart=A,a.lonEnd=h,a.heightStart=l,a.heightEnd=u,a}return g(i,[{key:"_getPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.latStart,i=this.latEnd,n=this.lonStart,a=this.lonEnd,o=this.heightStart,s=this.heightEnd,A=r.MathUtils.mapLinear(.5,0,1,t,i),h=r.MathUtils.mapLinear(.5,0,1,n,a),l=Math.floor(n/mr)*mr,c=[[-vr/2,0],[vr/2,0],[0,l],[0,l+vr/2],[0,l+vr],[0,l+3*vr/2],[t,a],[i,a],[t,n],[i,n],[0,n],[0,a],[A,h],[t,h],[i,h],[A,n],[A,a]],u=[],g=c.length,d=0;d<=1;d++)for(var f=r.MathUtils.mapLinear(d,0,1,o,s),p=0,v=g;p<v;p++){var m=w(c[p],2),I=m[0],y=m[1];if(I>=t&&I<=i&&y>=n&&y<=a){var C=Qr(e);u.push(C),this.getCartographicToPosition(I,y,f,C)}}return u}},{key:"getBoundingBox",value:function(e,t){xr();var i=this.latStart,n=this.latEnd,a=this.lonStart,o=this.lonEnd;if(n-i<vr/2){var s=r.MathUtils.mapLinear(.5,0,1,i,n),A=r.MathUtils.mapLinear(.5,0,1,a,o);this.getCartographicToNormal(s,A,Cr),yr.set(0,0,1),Ir.crossVectors(yr,Cr),yr.crossVectors(Ir,Cr),t.makeBasis(Ir,yr,Cr)}else Ir.set(1,0,0),yr.set(0,1,0),Cr.set(0,0,1),t.makeBasis(Ir,yr,Cr);Er.copy(t).invert();for(var h=this._getPoints(!0),l=0,c=h.length;l<c;l++)h[l].applyMatrix4(Er);e.makeEmpty(),e.setFromPoints(h)}},{key:"getBoundingSphere",value:function(e,t){xr();var r=this._getPoints(!0);e.makeEmpty(),e.setFromPoints(r,t)}}]),i}(pr);function Sr(e){return Sr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sr(e)}function kr(e){var t=function(e,t){if("object"!==Sr(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!==Sr(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Sr(t)?t:String(t)}function Mr(e,t,r){return(t=kr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _r(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}const Tr=1/Math.PI*180,Dr=1/180*Math.PI,Lr={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function Rr(e,{precision:t=Lr.precision}={}){return e=function(e){return Math.round(e/Lr.EPSILON)*Lr.EPSILON}(e),"".concat(parseFloat(e.toPrecision(t)))}function Fr(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ur(e){return function(e,t){return Or(e,(e=>e*Dr),t)}(e)}function Gr(e){return function(e,t){return Or(e,(e=>e*Tr),t)}(e)}function Nr(e,t,r){const i=Lr.EPSILON;r&&(Lr.EPSILON=r);try{if(e===t)return!0;if(Fr(e)&&Fr(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!Nr(e[r],t[r]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):"number"==typeof e&&"number"==typeof t&&Math.abs(e-t)<=Lr.EPSILON*Math.max(1,Math.abs(e),Math.abs(t))}finally{Lr.EPSILON=i}}function Or(e,t,r){if(Fr(e)){const i=e;r=r||function(e){return e.clone?e.clone():new Array(e.length)}(i);for(let n=0;n<r.length&&n<i.length;++n)r[n]=t(e[n],n,r);return r}return t(e)}class Pr extends(function(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Array)){clone(){return(new this.constructor).copy(this)}fromArray(e,t=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=e[r+t];return this.check()}toArray(e=[],t=0){for(let r=0;r<this.ELEMENTS;++r)e[t+r]=this[r];return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:Fr(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Lr)}formatString(e){let t="";for(let r=0;r<this.ELEMENTS;++r)t+=(r>0?", ":"")+Rr(this[r],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(t,"]")}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!Nr(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,r){if(void 0===r)return this.lerp(this,e,t);for(let i=0;i<this.ELEMENTS;++i){const n=e[i];this[i]=n+r*(t[i]-n)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e[r]),t[r]);return this.check()}add(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]+=t[e];return this.check()}subtract(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]-=t[e];return this.check()}scale(e){if("number"==typeof e)for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;else for(let t=0;t<this.ELEMENTS&&t<e.length;++t)this[t]*=e[t];return this.check()}multiplyByScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}check(){if(Lr.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let e=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}addScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e),t);return this.check()}get elements(){return this}}function Hr(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(e));return e}function Vr(e,t,r=""){if(Lr.debug&&!function(e,t){if(e.length!==t)return!1;for(let t=0;t<e.length;++t)if(!Number.isFinite(e[t]))return!1;return!0}(e,t))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return e}class jr extends Pr{get x(){return this[0]}set x(e){this[0]=Hr(e)}get y(){return this[1]}set y(e){this[1]=Hr(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let t=0;for(let r=0;r<this.ELEMENTS;++r){const i=this[r]-e[r];t+=i*i}return Hr(t)}dot(e){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*e[r];return Hr(t)}normalize(){const e=this.magnitude();if(0!==e)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}multiply(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]*=t[e];return this.check()}divide(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t[e];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return _r(e>=0&&e<this.ELEMENTS,"index is out of range"),Hr(this[e])}setComponent(e,t){return _r(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}addVectors(e,t){return this.copy(e).add(t)}subVectors(e,t){return this.copy(e).subtract(t)}multiplyVectors(e,t){return this.copy(e).multiply(t)}addScaledVector(e,t){return this.add(new this.constructor(e).multiplyScalar(t))}}var qr,zr=1e-6,Jr="undefined"!=typeof Float32Array?Float32Array:Array;function Kr(e,t,r){const i=t[0],n=t[1],a=t[2],o=r[3]*i+r[7]*n+r[11]*a||1;return e[0]=(r[0]*i+r[4]*n+r[8]*a)/o,e[1]=(r[1]*i+r[5]*n+r[9]*a)/o,e[2]=(r[2]*i+r[6]*n+r[10]*a)/o,e}function Yr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Wr(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[3]*i+r[7]*n+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*i+r[4]*n+r[8]*a+r[12])/o,e[1]=(r[1]*i+r[5]*n+r[9]*a+r[13])/o,e[2]=(r[2]*i+r[6]*n+r[10]*a+r[14])/o,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),qr=new Jr(2),Jr!=Float32Array&&(qr[0]=0,qr[1]=0),function(){var e=function(){var e=new Jr(3);return Jr!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}()}();const Xr=[0,0,0];let Zr;class $r extends jr{static get ZERO(){return Zr||(Zr=new $r(0,0,0),Object.freeze(Zr)),Zr}constructor(e=0,t=0,r=0){super(-0,-0,-0),1===arguments.length&&Fr(e)?this.copy(e):(Lr.debug&&(Hr(e),Hr(t),Hr(r)),this[0]=e,this[1]=t,this[2]=r)}set(e,t,r){return this[0]=e,this[1]=t,this[2]=r,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return Lr.debug&&(Hr(e.x),Hr(e.y),Hr(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=Hr(e)}angle(e){return r=e,i=(t=this)[0],n=t[1],a=t[2],o=r[0],s=r[1],A=r[2],h=Math.sqrt(i*i+n*n+a*a)*Math.sqrt(o*o+s*s+A*A),l=h&&Yr(t,r)/h,Math.acos(Math.min(Math.max(l,-1),1));var t,r,i,n,a,o,s,A,h,l}cross(e){return function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],A=r[2];e[0]=n*A-a*s,e[1]=a*o-i*A,e[2]=i*s-n*o}(this,this,e),this.check()}rotateX({radians:e,origin:t=Xr}){return function(e,t,r,i){var n=[],a=[];n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0],a[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),a[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2]}(this,this,t,e),this.check()}rotateY({radians:e,origin:t=Xr}){return function(e,t,r,i){var n=[],a=[];n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),a[1]=n[1],a[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2]}(this,this,t,e),this.check()}rotateZ({radians:e,origin:t=Xr}){return function(e,t,r,i){var n=[],a=[];n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),a[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),a[2]=n[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2]}(this,this,t,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return Wr(this,this,e),this.check()}transformAsVector(e){return Kr(this,this,e),this.check()}transformByMatrix3(e){return function(e,t,r){var i=t[0],n=t[1],a=t[2];e[0]=i*r[0]+n*r[3]+a*r[6],e[1]=i*r[1]+n*r[4]+a*r[7],e[2]=i*r[2]+n*r[5]+a*r[8]}(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,r){const i=t[0],n=t[1];e[0]=r[0]*i+r[2]*n,e[1]=r[1]*i+r[3]*n,e[2]=t[2]}(this,this,e),this.check()}transformByQuaternion(e){return function(e,t,r){var i=r[0],n=r[1],a=r[2],o=r[3],s=t[0],A=t[1],h=t[2],l=n*h-a*A,c=a*s-i*h,u=i*A-n*s,g=n*u-a*c,d=a*l-i*u,f=i*c-n*l,p=2*o;l*=p,c*=p,u*=p,g*=2,d*=2,f*=2,e[0]=s+l+g,e[1]=A+c+d,e[2]=h+u+f}(this,this,e),this.check()}}class ei extends Pr{toString(){let e="[";if(Lr.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let r=0;r<this.RANK;++r)e+=" ".concat(this[r*this.RANK+t])}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=" ".concat(this[t])}return e+="]",e}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,r){return this[t*this.RANK+e]=Hr(r),this}getColumn(e,t=new Array(this.RANK).fill(-0)){const r=e*this.RANK;for(let e=0;e<this.RANK;++e)t[e]=this[r+e];return t}setColumn(e,t){const r=e*this.RANK;for(let e=0;e<this.RANK;++e)this[r+e]=t[e];return this}}function ti(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],A=t[5],h=t[6],l=t[7],c=t[8],u=t[9],g=t[10],d=t[11],f=t[12],p=t[13],v=t[14],m=t[15],I=r[0],y=r[1],C=r[2],E=r[3];return e[0]=I*i+y*s+C*c+E*f,e[1]=I*n+y*A+C*u+E*p,e[2]=I*a+y*h+C*g+E*v,e[3]=I*o+y*l+C*d+E*m,I=r[4],y=r[5],C=r[6],E=r[7],e[4]=I*i+y*s+C*c+E*f,e[5]=I*n+y*A+C*u+E*p,e[6]=I*a+y*h+C*g+E*v,e[7]=I*o+y*l+C*d+E*m,I=r[8],y=r[9],C=r[10],E=r[11],e[8]=I*i+y*s+C*c+E*f,e[9]=I*n+y*A+C*u+E*p,e[10]=I*a+y*h+C*g+E*v,e[11]=I*o+y*l+C*d+E*m,I=r[12],y=r[13],C=r[14],E=r[15],e[12]=I*i+y*s+C*c+E*f,e[13]=I*n+y*A+C*u+E*p,e[14]=I*a+y*h+C*g+E*v,e[15]=I*o+y*l+C*d+E*m,e}var ri=function(e,t,r,i,n){var a,o=1/Math.tan(t/2);return e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(a=1/(i-n),e[10]=(n+i)*a,e[14]=2*n*i*a):(e[10]=-1,e[14]=-2*i),e};var ii,ni=function(e,t,r,i,n,a,o){var s=1/(t-r),A=1/(i-n),h=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*A,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+r)*s,e[13]=(n+i)*A,e[14]=(o+a)*h,e[15]=1,e};!function(){var e=function(){var e=new Jr(4);return Jr!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}()}(),function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"}(ii||(ii={}));const ai=45*Math.PI/180,oi=1,si=.1,Ai=500,hi=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class li extends ei{static get IDENTITY(){return function(){ui||(ui=new li,Object.freeze(ui));return ui}()}static get ZERO(){return function(){ci||(ci=new li([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(ci));return ci}()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return ii}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,t,r,i,n,a,o,s,A,h,l,c,u,g,d,f){return this[0]=e,this[1]=t,this[2]=r,this[3]=i,this[4]=n,this[5]=a,this[6]=o,this[7]=s,this[8]=A,this[9]=h,this[10]=l,this[11]=c,this[12]=u,this[13]=g,this[14]=d,this[15]=f,this.check()}setRowMajor(e,t,r,i,n,a,o,s,A,h,l,c,u,g,d,f){return this[0]=e,this[1]=n,this[2]=A,this[3]=u,this[4]=t,this[5]=a,this[6]=h,this[7]=g,this[8]=r,this[9]=o,this[10]=l,this[11]=d,this[12]=i,this[13]=s,this[14]=c,this[15]=f,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(hi)}fromObject(e){return this.check()}fromQuaternion(e){return function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r+r,s=i+i,A=n+n,h=r*o,l=i*o,c=i*s,u=n*o,g=n*s,d=n*A,f=a*o,p=a*s,v=a*A;e[0]=1-c-d,e[1]=l+v,e[2]=u-p,e[3]=0,e[4]=l-v,e[5]=1-h-d,e[6]=g+f,e[7]=0,e[8]=u+p,e[9]=g-f,e[10]=1-h-c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(this,e),this.check()}frustum(e){const{left:t,right:r,bottom:i,top:n,near:a=si,far:o=Ai}=e;return o===1/0?function(e,t,r,i,n,a){const o=2*a/(r-t),s=2*a/(n-i),A=(r+t)/(r-t),h=(n+i)/(n-i),l=-1,c=-1,u=-2*a;e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=A,e[9]=h,e[10]=l,e[11]=c,e[12]=0,e[13]=0,e[14]=u,e[15]=0}(this,t,r,i,n,a):function(e,t,r,i,n,a,o){var s=1/(r-t),A=1/(n-i),h=1/(a-o);e[0]=2*a*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*a*A,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(n+i)*A,e[10]=(o+a)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*h,e[15]=0}(this,t,r,i,n,a,o),this.check()}lookAt(e){const{eye:t,center:r=[0,0,0],up:i=[0,1,0]}=e;return function(e,t,r,i){var n,a,o,s,A,h,l,c,u,g,d=t[0],f=t[1],p=t[2],v=i[0],m=i[1],I=i[2],y=r[0],C=r[1],E=r[2];Math.abs(d-y)<zr&&Math.abs(f-C)<zr&&Math.abs(p-E)<zr?function(e){e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(e):(l=d-y,c=f-C,u=p-E,n=m*(u*=g=1/Math.hypot(l,c,u))-I*(c*=g),a=I*(l*=g)-v*u,o=v*c-m*l,(g=Math.hypot(n,a,o))?(n*=g=1/g,a*=g,o*=g):(n=0,a=0,o=0),s=c*o-u*a,A=u*n-l*o,h=l*a-c*n,(g=Math.hypot(s,A,h))?(s*=g=1/g,A*=g,h*=g):(s=0,A=0,h=0),e[0]=n,e[1]=s,e[2]=l,e[3]=0,e[4]=a,e[5]=A,e[6]=c,e[7]=0,e[8]=o,e[9]=h,e[10]=u,e[11]=0,e[12]=-(n*d+a*f+o*p),e[13]=-(s*d+A*f+h*p),e[14]=-(l*d+c*f+u*p),e[15]=1)}(this,t,r,i),this.check()}ortho(e){const{left:t,right:r,bottom:i,top:n,near:a=si,far:o=Ai}=e;return ni(this,t,r,i,n,a,o),this.check()}orthographic(e){const{fovy:t=ai,aspect:r=oi,focalDistance:i=1,near:n=si,far:a=Ai}=e;gi(t);const o=t/2,s=i*Math.tan(o),A=s*r;return this.ortho({left:-A,right:A,bottom:-s,top:s,near:n,far:a})}perspective(e){const{fovy:t=45*Math.PI/180,aspect:r=1,near:i=.1,far:n=500}=e;return gi(t),ri(this,t,r,i,n),this.check()}determinant(){return t=(e=this)[0],r=e[1],i=e[2],n=e[3],a=e[4],o=e[5],s=e[6],A=e[7],h=e[8],l=e[9],c=e[10],u=e[11],g=e[12],d=e[13],f=e[14],p=e[15],(t*o-r*a)*(c*p-u*f)-(t*s-i*a)*(l*p-u*d)+(t*A-n*a)*(l*f-c*d)+(r*s-i*o)*(h*p-u*g)-(r*A-n*o)*(h*f-c*g)+(i*A-n*s)*(h*d-l*g);var e,t,r,i,n,a,o,s,A,h,l,c,u,g,d,f,p}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];const r=this.getScale(t),i=1/r[0],n=1/r[1],a=1/r[2];return e[0]=this[0]*i,e[1]=this[1]*n,e[2]=this[2]*a,e[3]=0,e[4]=this[4]*i,e[5]=this[5]*n,e[6]=this[6]*a,e[7]=0,e[8]=this[8]*i,e[9]=this[9]*n,e[10]=this[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];const r=this.getScale(t),i=1/r[0],n=1/r[1],a=1/r[2];return e[0]=this[0]*i,e[1]=this[1]*n,e[2]=this[2]*a,e[3]=this[4]*i,e[4]=this[5]*n,e[5]=this[6]*a,e[6]=this[8]*i,e[7]=this[9]*n,e[8]=this[10]*a,e}transpose(){return function(e,t){if(e===t){var r=t[1],i=t[2],n=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=a,e[11]=t[14],e[12]=n,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15]}(this,this),this.check()}invert(){return function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],A=t[6],h=t[7],l=t[8],c=t[9],u=t[10],g=t[11],d=t[12],f=t[13],p=t[14],v=t[15],m=r*s-i*o,I=r*A-n*o,y=r*h-a*o,C=i*A-n*s,E=i*h-a*s,B=n*h-a*A,w=l*f-c*d,Q=l*p-u*d,x=l*v-g*d,b=c*p-u*f,S=c*v-g*f,k=u*v-g*p,M=m*k-I*S+y*b+C*x-E*Q+B*w;M&&(M=1/M,e[0]=(s*k-A*S+h*b)*M,e[1]=(n*S-i*k-a*b)*M,e[2]=(f*B-p*E+v*C)*M,e[3]=(u*E-c*B-g*C)*M,e[4]=(A*x-o*k-h*Q)*M,e[5]=(r*k-n*x+a*Q)*M,e[6]=(p*y-d*B-v*I)*M,e[7]=(l*B-u*y+g*I)*M,e[8]=(o*S-s*x+h*w)*M,e[9]=(i*x-r*S-a*w)*M,e[10]=(d*E-f*y+v*m)*M,e[11]=(c*y-l*E-g*m)*M,e[12]=(s*Q-o*b-A*w)*M,e[13]=(r*b-i*Q+n*w)*M,e[14]=(f*I-d*C-p*m)*M,e[15]=(l*C-c*I+u*m)*M)}(this,this),this.check()}multiplyLeft(e){return ti(this,e,this),this.check()}multiplyRight(e){return ti(this,this,e),this.check()}rotateX(e){return function(e,t,r){var i=Math.sin(r),n=Math.cos(r),a=t[4],o=t[5],s=t[6],A=t[7],h=t[8],l=t[9],c=t[10],u=t[11];t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*n+h*i,e[5]=o*n+l*i,e[6]=s*n+c*i,e[7]=A*n+u*i,e[8]=h*n-a*i,e[9]=l*n-o*i,e[10]=c*n-s*i,e[11]=u*n-A*i}(this,this,e),this.check()}rotateY(e){return function(e,t,r){var i=Math.sin(r),n=Math.cos(r),a=t[0],o=t[1],s=t[2],A=t[3],h=t[8],l=t[9],c=t[10],u=t[11];t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n-h*i,e[1]=o*n-l*i,e[2]=s*n-c*i,e[3]=A*n-u*i,e[8]=a*i+h*n,e[9]=o*i+l*n,e[10]=s*i+c*n,e[11]=A*i+u*n}(this,this,e),this.check()}rotateZ(e){return function(e,t,r){var i=Math.sin(r),n=Math.cos(r),a=t[0],o=t[1],s=t[2],A=t[3],h=t[4],l=t[5],c=t[6],u=t[7];t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n+h*i,e[1]=o*n+l*i,e[2]=s*n+c*i,e[3]=A*n+u*i,e[4]=h*n-a*i,e[5]=l*n-o*i,e[6]=c*n-s*i,e[7]=u*n-A*i}(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,t){return function(e,t,r,i){var n,a,o,s,A,h,l,c,u,g,d,f,p,v,m,I,y,C,E,B,w,Q,x,b,S=i[0],k=i[1],M=i[2],_=Math.hypot(S,k,M);_<zr||(S*=_=1/_,k*=_,M*=_,n=Math.sin(r),o=1-(a=Math.cos(r)),s=t[0],A=t[1],h=t[2],l=t[3],c=t[4],u=t[5],g=t[6],d=t[7],f=t[8],p=t[9],v=t[10],m=t[11],I=S*S*o+a,y=k*S*o+M*n,C=M*S*o-k*n,E=S*k*o-M*n,B=k*k*o+a,w=M*k*o+S*n,Q=S*M*o+k*n,x=k*M*o-S*n,b=M*M*o+a,e[0]=s*I+c*y+f*C,e[1]=A*I+u*y+p*C,e[2]=h*I+g*y+v*C,e[3]=l*I+d*y+m*C,e[4]=s*E+c*B+f*w,e[5]=A*E+u*B+p*w,e[6]=h*E+g*B+v*w,e[7]=l*E+d*B+m*w,e[8]=s*Q+c*x+f*b,e[9]=A*Q+u*x+p*b,e[10]=h*Q+g*x+v*b,e[11]=l*Q+d*x+m*b,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]))}(this,this,e,t),this.check()}scale(e){return function(e,t,r){var i=r[0],n=r[1],a=r[2];e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]}(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return function(e,t,r){var i,n,a,o,s,A,h,l,c,u,g,d,f=r[0],p=r[1],v=r[2];t===e?(e[12]=t[0]*f+t[4]*p+t[8]*v+t[12],e[13]=t[1]*f+t[5]*p+t[9]*v+t[13],e[14]=t[2]*f+t[6]*p+t[10]*v+t[14],e[15]=t[3]*f+t[7]*p+t[11]*v+t[15]):(i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],A=t[5],h=t[6],l=t[7],c=t[8],u=t[9],g=t[10],d=t[11],e[0]=i,e[1]=n,e[2]=a,e[3]=o,e[4]=s,e[5]=A,e[6]=h,e[7]=l,e[8]=c,e[9]=u,e[10]=g,e[11]=d,e[12]=i*f+s*p+c*v+t[12],e[13]=n*f+A*p+u*v+t[13],e[14]=a*f+h*p+g*v+t[14],e[15]=o*f+l*p+d*v+t[15])}(this,this,e),this.check()}transform(e,t){return 4===e.length?(t=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3];return e[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*o,e[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*o,e[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*o,e[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*o,e}(t||[-0,-0,-0,-0],e,this),Vr(t,4),t):this.transformAsPoint(e,t)}transformAsPoint(e,t){const{length:r}=e;let i;switch(r){case 2:i=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[4]*n+r[12],e[1]=r[1]*i+r[5]*n+r[13],e}(t||[-0,-0],e,this);break;case 3:i=Wr(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Vr(i,e.length),i}transformAsVector(e,t){let r;switch(e.length){case 2:r=function(e,t,r){const i=t[0],n=t[1],a=r[3]*i+r[7]*n||1;return e[0]=(r[0]*i+r[4]*n)/a,e[1]=(r[1]*i+r[5]*n)/a,e}(t||[-0,-0],e,this);break;case 3:r=Kr(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Vr(r,e.length),r}transformPoint(e,t){return this.transformAsPoint(e,t)}transformVector(e,t){return this.transformAsPoint(e,t)}transformDirection(e,t){return this.transformAsVector(e,t)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,r){return this.identity().translate([e,t,r])}}let ci,ui;function gi(e){if(e>2*Math.PI)throw Error("expected radians")}var di=.1,fi=1e-12,pi=1e-15;Math.PI,Math.PI,Math.PI,Math.PI;function vi(e){return e}function mi(e,t=[]){return function(e,t=[],r=vi){return"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):"x"in e?(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}(e,t,Lr._cartographicRadians?vi:Ur)}function Ii(e,t){return function(e,t,r=vi){return"longitude"in t?(t.longitude=r(e[0]),t.latitude=r(e[1]),t.height=e[2]):"x"in t?(t.x=r(e[0]),t.y=r(e[1]),t.z=e[2]):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}(e,t,Lr._cartographicRadians?vi:Gr)}new $r;const yi=new $r,Ci=new $r,Ei=new $r;const Bi=new $r,wi={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"}},Qi={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},xi={east:new $r,north:new $r,up:new $r,west:new $r,south:new $r,down:new $r},bi=new $r,Si=new $r,ki=new $r;function Mi(e,t,r,i,n,a){const o=wi[t]&&wi[t][r];let s,A,h;_r(o&&(!i||i===o));const l=Bi.copy(n);if(Nr(l.x,0,1e-14)&&Nr(l.y,0,1e-14)){const e=Math.sign(l.z);s=bi.fromArray(Qi[t]),"east"!==t&&"west"!==t&&s.scale(e),A=Si.fromArray(Qi[r]),"east"!==r&&"west"!==r&&A.scale(e),h=ki.fromArray(Qi[i]),"east"!==i&&"west"!==i&&h.scale(e)}else{const{up:n,east:a,north:o}=xi;a.set(-l.y,l.x,0).normalize(),e.geodeticSurfaceNormal(l,n),o.copy(n).cross(a);const{down:c,west:u,south:g}=xi;c.copy(n).scale(-1),u.copy(a).scale(-1),g.copy(o).scale(-1),s=xi[t],A=xi[r],h=xi[i]}return a[0]=s.x,a[1]=s.y,a[2]=s.z,a[3]=0,a[4]=A.x,a[5]=A.y,a[6]=A.z,a[7]=0,a[8]=h.x,a[9]=h.y,a[10]=h.z,a[11]=0,a[12]=l.x,a[13]=l.y,a[14]=l.z,a[15]=1,a}const _i=new $r,Ti=new $r,Di=new $r,Li=new $r,Ri=new $r,Fi=new $r;class Ui{constructor(e=0,t=0,r=0){Mr(this,"radii",void 0),Mr(this,"radiiSquared",void 0),Mr(this,"radiiToTheFourth",void 0),Mr(this,"oneOverRadii",void 0),Mr(this,"oneOverRadiiSquared",void 0),Mr(this,"minimumRadius",void 0),Mr(this,"maximumRadius",void 0),Mr(this,"centerToleranceSquared",di),Mr(this,"squaredXOverSquaredZ",void 0),_r(e>=0),_r(t>=0),_r(r>=0),this.radii=new $r(e,t,r),this.radiiSquared=new $r(e*e,t*t,r*r),this.radiiToTheFourth=new $r(e*e*e*e,t*t*t*t,r*r*r*r),this.oneOverRadii=new $r(0===e?0:1/e,0===t?0:1/t,0===r?0:1/r),this.oneOverRadiiSquared=new $r(0===e?0:1/(e*e),0===t?0:1/(t*t),0===r?0:1/(r*r)),this.minimumRadius=Math.min(e,t,r),this.maximumRadius=Math.max(e,t,r),0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(e){return this===e||Boolean(e&&this.radii.equals(e.radii))}toString(){return this.radii.toString()}cartographicToCartesian(e,t=[0,0,0]){const r=Ti,i=Di,[,,n]=e;this.geodeticSurfaceNormalCartographic(e,r),i.copy(this.radiiSquared).scale(r);const a=Math.sqrt(r.dot(i));return i.scale(1/a),r.scale(n),i.add(r),i.to(t)}cartesianToCartographic(e,t=[0,0,0]){Fi.from(e);const r=this.scaleToGeodeticSurface(Fi,Li);if(!r)return;const i=this.geodeticSurfaceNormal(r,Ti),n=Ri;n.copy(Fi).subtract(r);const a=Math.atan2(i.y,i.x),o=Math.asin(i.z),s=Math.sign(Yr(n,Fi))*function(e){var t=e[0],r=e[1],i=e[2];return Math.hypot(t,r,i)}(n);return Ii([a,o,s],t)}eastNorthUpToFixedFrame(e,t=new li){return Mi(this,"east","north","up",e,t)}localFrameToFixedFrame(e,t,r,i,n=new li){return Mi(this,e,t,r,i,n)}geocentricSurfaceNormal(e,t=[0,0,0]){return _i.from(e).normalize().to(t)}geodeticSurfaceNormalCartographic(e,t=[0,0,0]){const r=mi(e),i=r[0],n=r[1],a=Math.cos(n);return _i.set(a*Math.cos(i),a*Math.sin(i),Math.sin(n)).normalize(),_i.to(t)}geodeticSurfaceNormal(e,t=[0,0,0]){return _i.from(e).scale(this.oneOverRadiiSquared).normalize().to(t)}scaleToGeodeticSurface(e,t){return function(e,t,r=[]){const{oneOverRadii:i,oneOverRadiiSquared:n,centerToleranceSquared:a}=t;yi.from(e);const o=yi.x,s=yi.y,A=yi.z,h=i.x,l=i.y,c=i.z,u=o*o*h*h,g=s*s*l*l,d=A*A*c*c,f=u+g+d,p=Math.sqrt(1/f);if(!Number.isFinite(p))return;const v=Ci;if(v.copy(e).scale(p),f<a)return v.to(r);const m=n.x,I=n.y,y=n.z,C=Ei;C.set(v.x*m*2,v.y*I*2,v.z*y*2);let E,B,w,Q,x=(1-p)*yi.len()/(.5*C.len()),b=0;do{x-=b,E=1/(1+x*m),B=1/(1+x*I),w=1/(1+x*y);const e=E*E,t=B*B,r=w*w;Q=u*e+g*t+d*r-1,b=Q/(-2*(u*(e*E)*m+g*(t*B)*I+d*(r*w)*y))}while(Math.abs(Q)>fi);return yi.scale([E,B,w]).to(r)}(e,this,t)}scaleToGeocentricSurface(e,t=[0,0,0]){Li.from(e);const r=Li.x,i=Li.y,n=Li.z,a=this.oneOverRadiiSquared,o=1/Math.sqrt(r*r*a.x+i*i*a.y+n*n*a.z);return Li.multiplyScalar(o).to(t)}transformPositionToScaledSpace(e,t=[0,0,0]){return Li.from(e).scale(this.oneOverRadii).to(t)}transformPositionFromScaledSpace(e,t=[0,0,0]){return Li.from(e).scale(this.radii).to(t)}getSurfaceNormalIntersectionWithZAxis(e,t=0,r=[0,0,0]){_r(Nr(this.radii.x,this.radii.y,pi)),_r(this.radii.z>0),Li.from(e);const i=Li.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(i)>=this.radii.z-t))return Li.set(0,0,i).to(r)}}Mr(Ui,"WGS84",new Ui(6378137,6378137,6356752.314245179));var Gi=new r.Sphere,Ni=new r.Matrix4,Oi=new r.Vector3,Pi=new r.Vector3,Hi=new r.Ray,Vi=[];function ji(e,t){return e.distance-t.distance}function qi(e,t,r){e.traverse((function(e){Object.getPrototypeOf(e).raycast.call(e,t,r)}))}function zi(e,t,r,i){if(r.has(e)){if(qi(e.cached.scene,i,Vi),Vi.length>0){Vi.length>1&&Vi.sort(ji);var n=Vi[0];return Vi.length=0,n}return null}for(var a=[],o=e.children,s=0,A=o.length;s<A;s++){var h=o[s],l=h.cached,c=t.matrixWorld;Ni.copy(c);var u=l.sphere;if(!u||(Gi.copy(u),Gi.applyMatrix4(Ni),i.ray.intersectsSphere(Gi))){var g=l.box,d=l.boxTransform;if(g){if(Ni.multiply(d).invert(),Hi.copy(i.ray),Hi.applyMatrix4(Ni),!Hi.intersectBox(g,Oi))continue;Pi.setFromMatrixScale(Ni);var f=Pi.x;Math.abs(Math.max(Pi.x-Pi.y,Pi.x-Pi.z))>1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when raycasting.");var p={distance:1/0,tile:null};a.push(p),g.containsPoint(Hi.origin)?p.distance=0:p.distance=Oi.distanceToSquared(Hi.origin)*f*f,p.tile=h}}}a.sort(ji);for(var v=1/0,m=null,I=0,y=a.length;I<y;I++){var C=a[I];if(C.distance>v)break;var E=C.tile,B=E.cached.scene,w=null;if(r.has(E)?(qi(B,i,Vi),Vi.length>0&&(Vi.length>1&&Vi.sort(ji),w=Vi[0])):w=zi(E,t,r,i),w){var Q=w.distance*w.distance;Q<v&&(v=Q,m=w),Vi.length=0}}return m}function Ji(e,t,r,i,n){var a=e.cached,o=t.matrixWorld;Ni.copy(o);var s=a.sphere;if(!s||(Gi.copy(s),Gi.applyMatrix4(Ni),i.ray.intersectsSphere(Gi))){var A=a.box,h=a.boxTransform;if(!A||(Ni.multiply(h).invert(),Hi.copy(i.ray).applyMatrix4(Ni),Hi.intersectsBox(A))){var l=a.scene;if(r.has(e))qi(l,i,n);else for(var c=e.children,u=0,g=c.length;u<g;u++)Ji(c[u],t,r,i,n)}}}var Ki=Symbol("INITIAL_FRUSTUM_CULLED"),Yi=new r.Matrix4,Wi=new r.Matrix4,Xi=new r.Matrix4,Zi=new r.Vector3,$i=new r.Vector3,en=new r.Vector3,tn=new r.Vector3,rn=new r.Vector3,nn=new r.Vector3,an=new r.Vector3,on=new r.Quaternion,sn=new r.Vector3,An=new r.Vector3,hn=new r.Vector3(1,0,0),ln=new r.Vector3(0,1,0);function cn(e,t){e.traverse((function(e){e.frustumCulled=e[Ki]&&t}))}var un=function(e){f(i,e);var t=I(i);function i(){var e;c(this,i);for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];(e=t.call.apply(t,[this].concat(a))).group=new cr(m(e)),e.cameras=[],e.cameraMap=new Map,e.cameraInfo=[],e.activeTiles=new Set,e.visibleTiles=new Set,e._autoDisableRendererCulling=!0,e.optimizeRaycast=!0,e.onLoadTileSet=null,e.onLoadModel=null,e.onDisposeModel=null,e.onTileVisibilityChange=null;var s=new r.LoadingManager;s.setURLModifier((function(t){return e.preprocessURL?e.preprocessURL(t):t})),e.manager=s;var A=m(e);return e._overridenRaycast=function(e,t){A.optimizeRaycast||Object.getPrototypeOf(this).raycast.call(this,e,t)},e}return g(i,[{key:"autoDisableRendererCulling",get:function(){return this._autoDisableRendererCulling},set:function(e){this._autoDisableRendererCulling!==e&&(B(p(i.prototype),"_autoDisableRendererCulling",e,this,!0),this.forEachLoadedModel((function(t){cn(t,!e)})))}},{key:"getBounds",value:function(e){if(!this.root)return!1;var t=this.root.cached,r=t.box,i=t.boxTransform;if(r)return e.copy(r),e.applyMatrix4(i),!0;var n=t.sphere;return!!n&&(n.getBoundingBox(e),!0)}},{key:"getOrientedBounds",value:function(e,t){if(!this.root)return!1;var r=this.root.cached,i=r.box,n=r.boxTransform;if(i)return e.copy(i),t.copy(n),!0;var a=r.sphere;return!!a&&(a.getBoundingBox(e),t.identity(),!0)}},{key:"getBoundingSphere",value:function(e){if(!this.root)return!1;var t=this.root.cached.sphere;return!!t&&(e.copy(t),!0)}},{key:"forEachLoadedModel",value:function(e){this.traverse((function(t){var r=t.cached.scene;r&&e(r,t)}))}},{key:"raycast",value:function(e,t){if(this.root)if(e.firstHitOnly){var r=zi(this.root,this.group,this.activeTiles,e);r&&t.push(r)}else Ji(this.root,this.group,this.activeTiles,e,t)}},{key:"hasCamera",value:function(e){return this.cameraMap.has(e)}},{key:"setCamera",value:function(e){var t=this.cameras,i=this.cameraMap;return!i.has(e)&&(i.set(e,new r.Vector2),t.push(e),!0)}},{key:"setResolution",value:function(e,t,i){var n=this.cameraMap;return!!n.has(e)&&(t instanceof r.Vector2?n.get(e).copy(t):n.get(e).set(t,i),!0)}},{key:"setResolutionFromRenderer",value:function(e,t){var r=this.cameraMap;if(!r.has(e))return!1;var i=r.get(e);return t.getSize(i),i.multiplyScalar(t.getPixelRatio()),!0}},{key:"deleteCamera",value:function(e){var t=this.cameras,r=this.cameraMap;if(r.has(e)){var i=t.indexOf(e);return t.splice(i,1),r.delete(e),!0}return!1}},{key:"fetchTileSet",value:function(e){for(var t,r=this,n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];var s=(t=C(p(i.prototype),"fetchTileSet",this)).call.apply(t,[this,e].concat(a));return s.then((function(t){r.onLoadTileSet&&Promise.resolve().then((function(){r.onLoadTileSet(t,e)}))})),s}},{key:"update",value:function(){var e=this.group,t=this.cameras,n=this.cameraMap,a=this.cameraInfo;if(0!==t.length){for(;a.length>t.length;)a.pop();for(;a.length<t.length;)a.push({frustum:new r.Frustum,isOrthographic:!1,sseDenominator:-1,position:new r.Vector3,invScale:-1,pixelSize:0});Wi.copy(e.matrixWorld).invert(),Zi.setFromMatrixScale(Wi);var o=Zi.x;Math.abs(Math.max(Zi.x-Zi.y,Zi.x-Zi.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=a.length;s<A;s++){var h=t[s],l=a[s],c=l.frustum,u=l.position,g=n.get(h);0!==g.width&&0!==g.height||console.warn("TilesRenderer: resolution for camera error calculation is not set.");var d=h.projectionMatrix.elements;if(l.isOrthographic=1===d[15],l.isOrthographic){var f=2/d[0],v=2/d[5];l.pixelSize=Math.max(v/g.height,f/g.width)}else l.sseDenominator=2/d[5]/g.height;l.invScale=o,Yi.copy(e.matrixWorld),Yi.premultiply(h.matrixWorldInverse),Yi.premultiply(h.projectionMatrix),c.setFromProjectionMatrix(Yi),u.set(0,0,0),u.applyMatrix4(h.matrixWorld),u.applyMatrix4(Wi)}C(p(i.prototype),"update",this).call(this)}else console.warn("TilesRenderer: no cameras defined. Cannot update 3d tiles.")}},{key:"preprocessNode",value:function(e,t,n){C(p(i.prototype),"preprocessNode",this).call(this,e,t,n);var a=new r.Matrix4;if(e.transform)for(var o=e.transform,s=0;s<16;s++)a.elements[s]=o[s];else a.identity();t&&a.premultiply(t.cached.transform);var A=(new r.Matrix4).copy(a).invert(),h=null,l=null,c=null,u=null;if("box"in e.boundingVolume){var g=e.boundingVolume.box;h=new r.Box3,l=new r.Matrix4,c=new r.Matrix4,u=new r.Vector3;var d=this.threeLayer.distanceToVector3(g[3],g[3]).x,f=this.threeLayer.distanceToVector3(g[4],g[4]).x,v=this.threeLayer.distanceToVector3(g[5],g[5]).x;$i.set(d,f,v);var m=this.threeLayer.distanceToVector3(g[6],g[6]).x,I=this.threeLayer.distanceToVector3(g[7],g[7]).x,y=this.threeLayer.distanceToVector3(g[8],g[8]).x;en.set(m,I,y);var E=this.threeLayer.distanceToVector3(g[9],g[9]).x,B=this.threeLayer.distanceToVector3(g[10],g[10]).x,Q=this.threeLayer.distanceToVector3(g[11],g[11]).x;tn.set(E,B,Q),rn.set(g[3],g[4],g[5]),nn.set(g[6],g[7],g[8]),an.set(g[9],g[10],g[11]);var x=$i.length(),b=en.length(),S=tn.length(),k=rn.length(),M=nn.length(),_=an.length();u.set(x/k,b/M,S/_),$i.normalize(),en.normalize(),tn.normalize(),0===x&&$i.crossVectors(en,tn),0===b&&en.crossVectors($i,tn),0===S&&tn.crossVectors($i,en),l.set($i.x,en.x,tn.x,g[0],$i.y,en.y,tn.y,g[1],$i.z,en.z,tn.z,g[2],0,0,0,1),l.premultiply(a),A.decompose(An,on,sn);var T=Xi.makeRotationFromQuaternion(on);l.multiply(T);var D=Ui.WGS84.cartesianToCartographic([l.elements[12],l.elements[13],l.elements[14]],Zi),L=this.threeLayer.coordinateToVector3([D.x,D.y],D.z),R=this.threeLayer.distanceToVector3(L.z+this.heightOffset,L.z+this.heightOffset).x;l.elements[12]=L.x+this.xOffset,l.elements[13]=L.y+this.yOffset,l.elements[14]=R,c.copy(l).invert(),h.min.set(-x,-b,-S),h.max.set(x,b,S)}var F=null;if("sphere"in e.boundingVolume){var U=e.boundingVolume.sphere;(F=new r.Sphere).center.set(U[0],U[1],U[2]),F.radius=U[3],F.applyMatrix4(a)}else if("box"in e.boundingVolume){var G=e.boundingVolume.box;F=new r.Sphere,h.getBoundingSphere(F),F.center.set(G[0],G[1],G[2]),F.applyMatrix4(a);var N=Ui.WGS84.cartesianToCartographic([F.center.x,F.center.y,F.center.z],Zi),O=this.threeLayer.coordinateToVector3([N.x,N.y],N.z);F.center.x=O.x+this.xOffset,F.center.y=O.y+this.yOffset,F.center.z=this.threeLayer.distanceToVector3(O.z+this.heightOffset,O.z+this.heightOffset).x}var P=null;if("region"in e.boundingVolume){var H=w(e.boundingVolume.region,6),V=H[0],j=H[1],q=H[2],z=H[3],J=H[4],K=H[5];P=new br(De,De,Le,j,z,V,q,J,K),null===F&&(F=new r.Sphere,P.getBoundingSphere(F)),null===h&&(h=new r.Box3,l=new r.Matrix4,c=new r.Matrix4,P.getBoundingBox(h,l),c.copy(l).invert())}e.cached={loadIndex:0,transform:a,transformInverse:A,active:!1,inFrustum:[],box:h,boxTransform:l,boxTransformInverse:c,sphere:F,region:P,scene:null,geometry:null,material:null,scale:u}}},{key:"parseTile",value:function(e,t,i){var n=this;t._loadIndex=t._loadIndex||0,t._loadIndex++;var a=t.content.uri.split(/[\\\/]/g);a.pop();var o=a.join("/"),s=this.fetchOptions,A=this.manager,h=t._loadIndex,l=null,c=this.rootTileSet.asset&&this.rootTileSet.asset.gltfUpAxis||"y",u=t.cached,g=u.transform,d=u.scale,f=u.transformInverse,p=new r.Matrix4;switch(c.toLowerCase()){case"x":p.makeRotationAxis(ln,-Math.PI/2);break;case"y":p.makeRotationAxis(hn,Math.PI/2);break;case"z":p.identity()}var v=(Ze(e)||i).toLowerCase();switch(v){case"b3dm":var m=new Jt(A);m.workingPath=o,m.fetchOptions=s,m.adjustmentTransform.copy(p),l=m.parse(e);break;case"pnts":var I=new Wt(A);I.workingPath=o,I.fetchOptions=s,l=I.parse(e);break;case"i3dm":var y=new ar(A);y.workingPath=o,y.fetchOptions=s,y.adjustmentTransform.copy(p),l=y.parse(e);break;case"cmpt":var C=new sr(A);C.workingPath=o,C.fetchOptions=s,C.adjustmentTransform.copy(p),l=C.parse(e).then((function(e){return e.scene}));break;case"gltf":case"glb":var E=new hr(A);E.workingPath=o,E.fetchOptions=s,l=E.parse(e);break;default:console.warn('TilesRenderer: Content type "'.concat(v,'" not supported.')),l=Promise.resolve(null)}return l.then((function(e){var r,i;if(e.isObject3D?(r=e,i=null):(r=e.scene,i=e),t._loadIndex===h){r.updateMatrix(),"glb"!==v&&"gltf"!==v||r.matrix.multiply(p),r.matrix.premultiply(g);var a=Ui.WGS84.cartesianToCartographic([r.matrix.elements[12],r.matrix.elements[13],r.matrix.elements[14]],Zi),o=n.threeLayer.coordinateToVector3([a.x,a.y],a.z),s=n.threeLayer.distanceToVector3(o.z+n.heightOffset,o.z+n.heightOffset).x;r.matrix.elements[12]=o.x+n.xOffset,r.matrix.elements[13]=o.y+n.yOffset,r.matrix.elements[14]=s,r.matrix.decompose(r.position,r.quaternion,r.scale),f.decompose($i,on,en),r.applyQuaternion(on),r.scale.copy(d),r.traverse((function(e){e[Ki]=e.frustumCulled})),cn(r,!n.autoDisableRendererCulling),r.traverse((function(e){e.raycast=n._overridenRaycast}));var A=[],l=[],c=[];r.traverse((function(e){if(e.geometry&&l.push(e.geometry),e.material){var t=e.material;for(var r in A.push(e.material),t){var i=t[r];i&&i.isTexture&&c.push(i)}}})),u.materials=A,u.geometry=l,u.textures=c,u.scene=r,u.metadata=i,n.onLoadModel&&n.onLoadModel(r,t)}}))}},{key:"disposeTile",value:function(e){var t=e.cached;if(t.scene){for(var r=t.materials,i=t.geometry,n=t.textures,a=t.scene.parent,o=0,s=i.length;o<s;o++)i[o].dispose();for(var A=0,h=r.length;A<h;A++)r[A].dispose();for(var l=0,c=n.length;l<c;l++){n[l].dispose()}a&&a.remove(t.scene),this.onDisposeModel&&this.onDisposeModel(t.scene,e),t.scene=null,t.materials=null,t.textures=null,t.geometry=null,t.metadata=null}this.activeTiles.delete(e),this.visibleTiles.delete(e),e._loadIndex++}},{key:"setTileVisible",value:function(e,t){var r=e.cached.scene,i=this.visibleTiles,n=this.group;t?(n.add(r),i.add(e),r.updateMatrixWorld(!0)):(n.remove(r),i.delete(e)),this.onTileVisibilityChange&&this.onTileVisibilityChange(r,e,t)}},{key:"setTileActive",value:function(e,t){var r=this.activeTiles;t?r.add(e):r.delete(e)}},{key:"calculateError",value:function(e){for(var t=e.cached,r=t.inFrustum,i=this.cameras,n=this.cameraInfo,a=t.sphere,o=t.box,s=t.boxTransformInverse,A=o&&s,h=-1/0,l=1/0,c=0,u=i.length;c<u;c++)if(r[c]){var g=n[c],d=g.invScale,f=void 0;if(g.isOrthographic){var p=g.pixelSize;f=e.geometricError/(p*d)}else{Zi.copy(g.position);var v=void 0;A?(Zi.applyMatrix4(s),v=o.distanceToPoint(Zi)):v=Math.max(a.distanceToPoint(Zi),0);var m=v*d,I=g.sseDenominator;f=e.geometricError/(m*I),l=Math.min(l,m)}h=Math.max(h,f)}e.__distanceFromCamera=l,e.__error=h}},{key:"tileInView",value:function(e){var t=e.cached,r=t.sphere,i=t.inFrustum;if(r){for(var n=this.cameraInfo,a=!1,o=0,s=n.length;o<s;o++){n[o].frustum.intersectsSphere(r)?(a=!0,i[o]=!0):i[o]=!1}return a}return!0}}]),i}(Je);new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new pr(De,De,Le);var gn=new WeakMap,dn=function(e){f(i,e);var t=I(i);function i(e){var r;return c(this,i),(r=t.call(this,e)).decoderPath="",r.decoderConfig={},r.decoderBinary=null,r.decoderPending=null,r.workerLimit=4,r.workerPool=[],r.workerNextTaskID=1,r.workerSourceURL="",r.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},r.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},r}return g(i,[{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(e,t,i,n){var a=this,o=new r.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(e){a.decodeDracoFile(e,t).catch(n)}),i,n)}},{key:"decodeDracoFile",value:function(e,t,r,i){var n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!r};return this.decodeGeometry(e,n).then(t)}},{key:"decodeGeometry",value:function(e,t){var r,i=this,n=JSON.stringify(t);if(gn.has(e)){var a=gn.get(e);if(a.key===n)return a.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var o=this.workerNextTaskID++,s=e.byteLength,A=this._getWorker(o,s).then((function(i){return r=i,new Promise((function(i,n){r._callbacks[o]={resolve:i,reject:n},r.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))})).then((function(e){return i._createGeometry(e.geometry)}));return A.catch((function(){return!0})).then((function(){r&&o&&i._releaseTask(r,o)})),gn.set(e,{key:n,promise:A}),A}},{key:"_createGeometry",value:function(e){var t=new r.BufferGeometry;e.index&&t.setIndex(new r.BufferAttribute(e.index.array,1));for(var i=0;i<e.attributes.length;i++){var n=e.attributes[i],a=n.name,o=n.array,s=n.itemSize;t.setAttribute(a,new r.BufferAttribute(o,s))}return t}},{key:"_loadLibrary",value:function(e,t){var i=new r.FileLoader(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((function(t,r){i.load(e,t,void 0,r)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!==("undefined"==typeof WebAssembly?"undefined":A(WebAssembly))||"js"===this.decoderConfig.type,r=[];return t?r.push(this._loadLibrary("draco_decoder.js","text")):(r.push(this._loadLibrary("draco_wasm_wrapper.js","text")),r.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(r).then((function(r){var i=r[0];t||(e.decoderConfig.wasmBinary=r[1]);var n=fn.toString(),a=["/* draco decoder */",i,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");e.workerSourceURL=URL.createObjectURL(new Blob([a]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var r=this;return this._initDecoder().then((function(){if(r.workerPool.length<r.workerLimit){var i=new Worker(r.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:r.decoderConfig}),i.onmessage=function(e){var t=e.data;switch(t.type){case"decode":i._callbacks[t.id].resolve(t);break;case"error":i._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},r.workerPool.push(i)}else r.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var n=r.workerPool[r.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}]),i}(r.Loader);function fn(){var e,t;function r(e,t,r,i,n,a){var o=a.num_components(),s=r.num_points()*o,A=s*n.BYTES_PER_ELEMENT,h=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,n),l=e._malloc(A);t.GetAttributeDataArrayForAllPoints(r,a,h,A,l);var c=new n(e.HEAPF32.buffer,l,s).slice();return e._free(l),{name:i,array:c,itemSize:o}}onmessage=function(i){var n=i.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var a=n.buffer,o=n.taskConfig;t.then((function(e){var t=e.draco,i=new t.Decoder,s=new t.DecoderBuffer;s.Init(new Int8Array(a),a.byteLength);try{var A=function(e,t,i,n){var a,o,s=n.attributeIDs,A=n.attributeTypes,h=t.GetEncodedGeometryType(i);if(h===e.TRIANGULAR_MESH)a=new e.Mesh,o=t.DecodeBufferToMesh(i,a);else{if(h!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,o=t.DecodeBufferToPointCloud(i,a)}if(!o.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+o.error_msg());var l={index:null,attributes:[]};for(var c in s){var u=self[A[c]],g=void 0,d=void 0;if(n.useUniqueIDs)d=s[c],g=t.GetAttributeByUniqueId(a,d);else{if(-1===(d=t.GetAttributeId(a,e[s[c]])))continue;g=t.GetAttribute(a,d)}l.attributes.push(r(e,t,a,c,u,g))}h===e.TRIANGULAR_MESH&&(l.index=function(e,t,r){var i=r.num_faces(),n=3*i,a=4*n,o=e._malloc(a);t.GetTrianglesUInt32Array(r,a,o);var s=new Uint32Array(e.HEAPF32.buffer,o,n).slice();return e._free(o),{array:s,itemSize:1}}(e,t,a));return e.destroy(a),l}(t,i,s,o),h=A.attributes.map((function(e){return e.array.buffer}));A.index&&h.push(A.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:A},h)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{t.destroy(s),t.destroy(i)}}))}}}var pn,vn,mn,In=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4;c(this,e),this.pool=t,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}return g(e,[{key:"_initWorker",value:function(e){if(!this.workers[e]){var t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}},{key:"_getIdleWorker",value:function(){for(var e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}},{key:"_onMessage",value:function(e,t){var r=this.workersResolve[e];if(r&&r(t),this.queue.length){var i=this.queue.shift(),n=i.resolve,a=i.msg,o=i.transfer;this.workersResolve[e]=n,this.workers[e].postMessage(a,o)}else this.workerStatus^=1<<e}},{key:"setWorkerCreator",value:function(e){this.workerCreator=e}},{key:"setWorkerLimit",value:function(e){this.pool=e}},{key:"postMessage",value:function(e,t){var r=this;return new Promise((function(i){var n=r._getIdleWorker();-1!==n?(r._initWorker(n),r.workerStatus|=1<<n,r.workersResolve[n]=i,r.workers[n].postMessage(e,t)):r.queue.push({resolve:i,msg:e,transfer:t})}))}},{key:"dispose",value:function(){this.workers.forEach((function(e){return e.terminate()})),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}]),e}(),yn=0,Cn=2,En=g((function e(){c(this,e),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})),Bn=function(){function e(t,r,i,n){c(this,e),this._dataView=new DataView(t.buffer,t.byteOffset+r,i),this._littleEndian=n,this._offset=0}return g(e,[{key:"_nextUint8",value:function(){var e=this._dataView.getUint8(this._offset);return this._offset+=1,e}},{key:"_nextUint16",value:function(){var e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}},{key:"_nextUint32",value:function(){var e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}},{key:"_nextUint64",value:function(){var e=this._dataView.getUint32(this._offset,this._littleEndian)+Math.pow(2,32)*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}},{key:"_nextInt32",value:function(){var e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}},{key:"_skip",value:function(e){return this._offset+=e,this}},{key:"_scan",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this._offset,i=0;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,i)}}]),e}(),wn=[171,75,84,88,32,50,48,187,13,10,26,10];function Qn(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Buffer.from(e).toString("utf8")}function xn(e){var t=new Uint8Array(e.buffer,e.byteOffset,wn.length);if(t[0]!==wn[0]||t[1]!==wn[1]||t[2]!==wn[2]||t[3]!==wn[3]||t[4]!==wn[4]||t[5]!==wn[5]||t[6]!==wn[6]||t[7]!==wn[7]||t[8]!==wn[8]||t[9]!==wn[9]||t[10]!==wn[10]||t[11]!==wn[11])throw new Error("Missing KTX 2.0 identifier.");var r=new En,i=17*Uint32Array.BYTES_PER_ELEMENT,n=new Bn(e,wn.length,i,!0);r.vkFormat=n._nextUint32(),r.typeSize=n._nextUint32(),r.pixelWidth=n._nextUint32(),r.pixelHeight=n._nextUint32(),r.pixelDepth=n._nextUint32(),r.layerCount=n._nextUint32(),r.faceCount=n._nextUint32();var a=n._nextUint32();r.supercompressionScheme=n._nextUint32();for(var o=n._nextUint32(),s=n._nextUint32(),A=n._nextUint32(),h=n._nextUint32(),l=n._nextUint64(),c=n._nextUint64(),u=new Bn(e,wn.length+i,3*a*8,!0),g=0;g<a;g++)r.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+u._nextUint64(),u._nextUint64()),uncompressedByteLength:u._nextUint64()});for(var d=new Bn(e,o,s,!0),f={vendorId:d._skip(4)._nextUint16(),descriptorType:d._nextUint16(),versionNumber:d._nextUint16(),descriptorBlockSize:d._nextUint16(),colorModel:d._nextUint8(),colorPrimaries:d._nextUint8(),transferFunction:d._nextUint8(),flags:d._nextUint8(),texelBlockDimension:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],bytesPlane:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],samples:[]},p=(f.descriptorBlockSize/4-6)/4,v=0;v<p;v++){var m={bitOffset:d._nextUint16(),bitLength:d._nextUint8(),channelType:d._nextUint8(),samplePosition:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&m.channelType?(m.sampleLower=d._nextInt32(),m.sampleUpper=d._nextInt32()):(m.sampleLower=d._nextUint32(),m.sampleUpper=d._nextUint32()),f.samples[v]=m}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(f);for(var I=new Bn(e,A,h,!0);I._offset<h;){var y=I._nextUint32(),C=I._scan(y),E=Qn(C),B=I._scan(y-C.byteLength);r.keyValue[E]=E.match(/^ktx/i)?Qn(B):B,I._offset%4&&I._skip(4-I._offset%4)}if(c<=0)return r;for(var w=new Bn(e,l,c,!0),Q=w._nextUint16(),x=w._nextUint16(),b=w._nextUint32(),S=w._nextUint32(),k=w._nextUint32(),M=w._nextUint32(),_=[],T=0;T<a;T++)_.push({imageFlags:w._nextUint32(),rgbSliceByteOffset:w._nextUint32(),rgbSliceByteLength:w._nextUint32(),alphaSliceByteOffset:w._nextUint32(),alphaSliceByteLength:w._nextUint32()});var D=l+w._offset,L=D+b,R=L+S,F=R+k,U=new Uint8Array(e.buffer,e.byteOffset+D,b),G=new Uint8Array(e.buffer,e.byteOffset+L,S),N=new Uint8Array(e.buffer,e.byteOffset+R,k),O=new Uint8Array(e.buffer,e.byteOffset+F,M);return r.globalData={endpointCount:Q,selectorCount:x,imageDescs:_,endpointsData:U,selectorsData:G,tablesData:N,extendedData:O},r}var bn,Sn,kn,Mn,_n={env:{emscripten_notify_memory_growth:function(e){mn=new Uint8Array(vn.exports.memory.buffer)}}},Tn=function(){function e(){c(this,e)}return g(e,[{key:"init",value:function(){return pn||(pn="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Dn).then((function(e){return e.arrayBuffer()})).then((function(e){return WebAssembly.instantiate(e,_n)})).then(this._init):WebAssembly.instantiate(Buffer.from(Dn,"base64"),_n).then(this._init))}},{key:"_init",value:function(e){vn=e.instance,_n.env.emscripten_notify_memory_growth(0)}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!vn)throw new Error("ZSTDDecoder: Await .init() before decoding.");var r=e.byteLength,i=vn.exports.malloc(r);mn.set(e,i),t=t||Number(vn.exports.ZSTD_findDecompressedSize(i,r));var n=vn.exports.malloc(t),a=vn.exports.ZSTD_decompress(n,t,i,r),o=mn.slice(n,n+a);return vn.exports.free(i),vn.exports.free(n),o}}]),e}(),Dn="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IAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQh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ASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigC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C0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdB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IAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY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wOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEE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",Ln=new WeakMap,Rn=0,Fn=function(e){f(n,e);var t,i=I(n);function n(e){var t;return c(this,n),(t=i.call(this,e)).transcoderPath="",t.transcoderBinary=null,t.transcoderPending=null,t.workerPool=new In,t.workerSourceURL="",t.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+.'),t}return g(n,[{key:"setTranscoderPath",value:function(e){return this.transcoderPath=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerPool.setWorkerLimit(e),this}},{key:"detectSupport",value:function(e){return this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},e.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1),this}},{key:"init",value:function(){var e=this;if(!this.transcoderPending){var t=new r.FileLoader(this.manager);t.setPath(this.transcoderPath),t.setWithCredentials(this.withCredentials);var i=t.loadAsync("basis_transcoder.js"),a=new r.FileLoader(this.manager);a.setPath(this.transcoderPath),a.setResponseType("arraybuffer"),a.setWithCredentials(this.withCredentials);var o=a.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([i,o]).then((function(t){var r=w(t,2),i=r[0],a=r[1],o=n.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(n.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(n.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(n.BasisFormat),"/* basis_transcoder.js */",i,"/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join("\n");e.workerSourceURL=URL.createObjectURL(new Blob([s])),e.transcoderBinary=a,e.workerPool.setWorkerCreator((function(){var t=new Worker(e.workerSourceURL),r=e.transcoderBinary.slice(0);return t.postMessage({type:"init",config:e.workerConfig,transcoderBinary:r},[r]),t}))})),Rn>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Rn++}return this.transcoderPending}},{key:"load",value:function(e,t,i,n){var a=this;if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");var o=new r.FileLoader(this.manager);o.setResponseType("arraybuffer"),o.setWithCredentials(this.withCredentials),o.load(e,(function(e){if(Ln.has(e))return Ln.get(e).promise.then(t).catch(n);a._createTexture(e).then((function(e){return t?t(e):null})).catch(n)}),i,n)}},{key:"_createTextureFrom",value:function(e,t){var i=e.mipmaps,n=e.width,a=e.height,o=e.format,s=e.type,A=e.error,h=e.dfdTransferFn,l=e.dfdFlags;if("error"===s)return Promise.reject(A);var c=t.layerCount>1?new r.CompressedArrayTexture(i,n,a,t.layerCount,o,r.UnsignedByteType):new r.CompressedTexture(i,n,a,o,r.UnsignedByteType);return c.minFilter=1===i.length?r.LinearFilter:r.LinearMipmapLinearFilter,c.magFilter=r.LinearFilter,c.generateMipmaps=!1,c.needsUpdate=!0,c.encoding=2===h?r.sRGBEncoding:r.LinearEncoding,c.premultiplyAlpha=!!(1&l),c}},{key:"_createTexture",value:(t=l(s().mark((function e(t){var r,i,n,a,o=this,A=arguments;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=A.length>1&&void 0!==A[1]?A[1]:{},0===(i=xn(new Uint8Array(t))).vkFormat){e.next=4;break}return e.abrupt("return",On(i));case 4:return n=r,a=this.init().then((function(){return o.workerPool.postMessage({type:"transcode",buffer:t,taskConfig:n},[t])})).then((function(e){return o._createTextureFrom(e.data,i)})),Ln.set(t,{promise:a}),e.abrupt("return",a);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"dispose",value:function(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Rn--,this}}]),n}(r.Loader);Fn.BasisFormat={ETC1S:0,UASTC_4x4:1},Fn.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},Fn.EngineFormat={RGBAFormat:r.RGBAFormat,RGBA_ASTC_4x4_Format:r.RGBA_ASTC_4x4_Format,RGBA_BPTC_Format:r.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:r.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:r.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:r.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:r.RGB_ETC1_Format,RGB_ETC2_Format:r.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:r.RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format:r.RGB_S3TC_DXT1_Format},Fn.BasisWorker=function(){var e,t,r,i=_EngineFormat,n=_TranscoderFormat,a=_BasisFormat;self.addEventListener("message",(function(o){var c,u=o.data;switch(u.type){case"init":e=u.config,c=u.transcoderBinary,t=new Promise((function(e){r={wasmBinary:c,onRuntimeInitialized:e},BASIS(r)})).then((function(){r.initializeBasis(),void 0===r.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}));break;case"transcode":t.then((function(){try{for(var t=function(t){var o=new r.KTX2File(new Uint8Array(t));function c(){o.close(),o.delete()}if(!o.isValid())throw c(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");var u=o.isUASTC()?a.UASTC_4x4:a.ETC1S,g=o.getWidth(),d=o.getHeight(),f=o.getLayers()||1,p=o.getLevels(),v=o.getHasAlpha(),m=o.getDFDTransferFunc(),I=o.getDFDFlags(),y=function(t,r,o,l){for(var c,u,g=t===a.ETC1S?s:A,d=0;d<g.length;d++){var f=g[d];if(e[f.if]&&(f.basisFormat.includes(t)&&!(l&&f.transcoderFormat.length<2)&&(!f.needsPowerOfTwo||h(r)&&h(o))))return{transcoderFormat:c=f.transcoderFormat[l?1:0],engineFormat:u=f.engineFormat[l?1:0]}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),c=n.RGBA32,u=i.RGBAFormat,{transcoderFormat:c,engineFormat:u}}(u,g,d,v),C=y.transcoderFormat,E=y.engineFormat;if(!g||!d||!p)throw c(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!o.startTranscoding())throw c(),new Error("THREE.KTX2Loader: .startTranscoding failed");for(var B=[],w=0;w<p;w++){for(var Q=[],x=void 0,b=void 0,S=0;S<f;S++){var k=o.getImageLevelInfo(w,S,0);x=k.origWidth,b=k.origHeight;var M=new Uint8Array(o.getImageTranscodedSizeInBytes(w,S,0,C));if(!o.transcodeImage(M,w,S,0,C,0,-1,-1))throw c(),new Error("THREE.KTX2Loader: .transcodeImage failed.");Q.push(M)}B.push({data:l(Q),width:x,height:b})}return c(),{width:g,height:d,hasAlpha:v,mipmaps:B,format:E,dfdTransferFn:m,dfdFlags:I}}(u.buffer),o=t.width,c=t.height,g=t.hasAlpha,d=t.mipmaps,f=t.format,p=t.dfdTransferFn,v=t.dfdFlags,m=[],I=0;I<d.length;++I)m.push(d[I].data.buffer);self.postMessage({type:"transcode",id:u.id,width:o,height:c,hasAlpha:g,mipmaps:d,format:f,dfdTransferFn:p,dfdFlags:v},m)}catch(e){console.error(e),self.postMessage({type:"error",id:u.id,error:e.message})}}))}}));var o=[{if:"astcSupported",basisFormat:[a.UASTC_4x4],transcoderFormat:[n.ASTC_4x4,n.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[n.BC7_M5,n.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[n.BC1,n.BC3],engineFormat:[i.RGB_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[n.ETC1,n.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[n.ETC1],engineFormat:[i.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[n.PVRTC1_4_RGB,n.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],s=o.sort((function(e,t){return e.priorityETC1S-t.priorityETC1S})),A=o.sort((function(e,t){return e.priorityUASTC-t.priorityUASTC}));function h(e){return e<=2||0==(e&e-1)&&0!==e}function l(e){var t,r=0,i=b(e);try{for(i.s();!(t=i.n()).done;){r+=t.value.byteLength}}catch(e){i.e(e)}finally{i.f()}var n,a=new Uint8Array(r),o=0,s=b(e);try{for(s.s();!(n=s.n()).done;){var A=n.value;a.set(A,o),o+=A.byteLength}}catch(e){s.e(e)}finally{s.f()}return a}};var Un=(d(bn={},109,r.RGBAFormat),d(bn,97,r.RGBAFormat),d(bn,37,r.RGBAFormat),d(bn,43,r.RGBAFormat),d(bn,103,r.RGFormat),d(bn,83,r.RGFormat),d(bn,16,r.RGFormat),d(bn,22,r.RGFormat),d(bn,100,r.RedFormat),d(bn,76,r.RedFormat),d(bn,15,r.RedFormat),d(bn,9,r.RedFormat),bn),Gn=(d(Sn={},109,r.FloatType),d(Sn,97,r.HalfFloatType),d(Sn,37,r.UnsignedByteType),d(Sn,43,r.UnsignedByteType),d(Sn,103,r.FloatType),d(Sn,83,r.HalfFloatType),d(Sn,16,r.UnsignedByteType),d(Sn,22,r.UnsignedByteType),d(Sn,100,r.FloatType),d(Sn,76,r.HalfFloatType),d(Sn,15,r.UnsignedByteType),d(Sn,9,r.UnsignedByteType),Sn),Nn=(d(kn={},43,r.sRGBEncoding),d(kn,22,r.sRGBEncoding),d(kn,15,r.sRGBEncoding),kn);function On(e){return Pn.apply(this,arguments)}function Pn(){return Pn=l(s().mark((function e(t){var i,n,a,o,A,h,c,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.vkFormat,n=t.pixelWidth,a=t.pixelHeight,o=t.pixelDepth,void 0!==Un[i]){e.next=3;break}throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");case 3:if(A=t.levels[0],t.supercompressionScheme!==yn){e.next=8;break}h=A.levelData,e.next=16;break;case 8:if(t.supercompressionScheme!==Cn){e.next=15;break}return Mn||(Mn=new Promise(function(){var e=l(s().mark((function e(t){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new Tn,e.next=3,r.init();case 3:t(r);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())),e.next=12,Mn;case 12:h=e.sent.decode(A.levelData,A.uncompressedByteLength),e.next=16;break;case 15:throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");case 16:return c=Gn[i]===r.FloatType?new Float32Array(h.buffer,h.byteOffset,h.byteLength/Float32Array.BYTES_PER_ELEMENT):Gn[i]===r.HalfFloatType?new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT):h,(u=0===o?new r.DataTexture(c,n,a):new r.Data3DTexture(c,n,a,o)).type=Gn[i],u.format=Un[i],u.encoding=Nn[i]||r.LinearEncoding,u.needsUpdate=!0,e.abrupt("return",Promise.resolve(u));case 23:case"end":return e.stop()}}),e)}))),Pn.apply(this,arguments)}var Hn={altitude:0},Vn=function(e){f(r,e);var t=I(r);function r(e,i){var n;return c(this,r),(n=t.call(this))._initOptions(Hn),n.object3d=e,n.object3d.__parent=m(n),n._raycaster=new o.Raycaster,n._mouse=new o.Vector2,n.camera=i,n.selectMesh=null,n}return g(r,[{key:"getSelectMesh",value:function(){return this.selectMesh}},{key:"identify",value:function(e){var t=this.getMap().coordToContainerPoint(e),r=t.x,i=t.y,n=this._raycaster,a=this._mouse,o=this.camera,s=this.getMap().getSize(),A=s.width,h=s.height;a.x=r/A*2-1,a.y=-i/h*2+1,n.setFromCamera(a,o);var l=n.intersectObject(this.object3d,!0);return l.length?(this.selectMesh=l[0],!0):(this.selectMesh=null,!1)}}]),r}(i.BaseObject),jn=6,qn=!1,zn=!1,Jn=0,Kn=function(){function e(t,r,i,n){var a=this;c(this,e),this.threelayer=i,this.map=i.map,this.layerClass=n,this.statsUpdate=r.statsUpdate;var o=i.getScene(),s=i.getRenderer().context;s.outputEncoding=THREE.sRGBEncoding;var A=i.getCamera();this.scene=o,this.renderer=s,this.camera=A,this.multiles=[],this.meshs=[];var h=new dn;h.setDecoderPath(r.decoderPath);var l=new Fn;l.setTranscoderPath(r.transcoderPath),l.detectSupport(s),t.forEach((function(e){var t=new un(e.url,i);if(t.errorTarget=jn,t.displayBoxBounds=qn,t.displaySphereBounds=zn,t.colorMode=parseFloat(Jn),t.heightOffset=e.heightOffset||0,t.xOffset=e.xOffset||0,t.yOffset=e.yOffset||0,t.setCamera(A),t.setResolutionFromRenderer(A,s),a.multiles.length>0){var r=a.multiles[0];t.lruCache=r.lruCache,t.downloadQueue=r.downloadQueue}t.fetchOptions.mode="cors";var n=new et(t.manager);n.setDRACOLoader(h),n.setKTX2Loader(l),t.manager.addHandler(/\.gltf$/,n);var o=new Vn(t.group,A);a.meshs.push(o),a.multiles.push(t)})),this.threelayer.addMesh(this.meshs),this.layerClass.updatables.push(this),this._bindMapEvents()}return g(e,[{key:"tick",value:function(e){this.multiles.forEach((function(e){e.update()})),this.statsUpdate&&this.statsUpdate()}},{key:"_bindMapEvents",value:function(){var e=this;this.meshs.forEach((function(t){t.on("click empty mousemove mouseout",e._setPointEvent,e)}))}},{key:"_setPointEvent",value:function(e){var t=e.selectMesh;if("click"===e.type&&t){console.log(t);var r=t.object;if(r.geometry.getAttribute("_batchid")){for(var i=r;!i.batchTable;)i=i.parent;var n=i.batchTable;console.log(n.header)}}}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,1)}},{key:"dispose",value:function(){this.threelayer.removeMesh(this.meshs),this.multiles.forEach((function(e){e.dispose()})),this.removeAnimation()}}]),e}(),Yn={radius:100,altitude:0},Wn=function(e){f(r,e);var t=I(r);function r(e,i,n,o){var s;c(this,r),n=a.Util.extend({},Yn,n,{layer:o,coordinate:e}),(s=t.call(this))._initOptions(n);var A=n.altitude;s._createGroup(),s.getObject3d().add(i);var h=o.distanceToVector3(A,A).x,l=o.coordinateToVector3(e,h);return s.getObject3d().position.copy(l),o.addMesh(m(s)),s}return g(r)}(i.BaseObject),Xn=function(){function e(t,r){c(this,e),this.threeLayer=r;var i=new o.LoadingManager,n=new et(i),a=new dn(i);a.setDecoderPath(t),n.setDRACOLoader(a),i.addHandler(/\.gltf$/,n),i.addHandler(/\.glb$/,n),this.loader=new hr(i)}var t;return g(e,[{key:"addModel",value:(t=l(s().mark((function e(t,r,i){var n,a;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.loader.workingPath=this.loader.workingPathForURL(t),e.next=3,this.loader.load(t);case 3:return n=e.sent,a=new Wn(r,n.scene,i,this.threeLayer),e.abrupt("return",a);case 6:case"end":return e.stop()}}),e,this)}))),function(e,r,i){return t.apply(this,arguments)})}]),e}(),Zn=function(e){f(r,e);var t=I(r);function r(e,i){var n;return c(this,r),(n=t.call(this)).name=i,n.customId=D(),e.add(m(n)),n.customType="layer",n}return g(r)}(o.Group),$n=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL($n(""))}catch(e){$n=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}var ea=Uint8Array,ta=Uint16Array,ra=Uint32Array,ia=new ea([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]),na=new ea([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]),aa=new ea([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),oa=function(e,t){for(var r=new ta(31),i=0;i<31;++i)r[i]=t+=1<<e[i-1];var n=new ra(r[30]);for(i=1;i<30;++i)for(var a=r[i];a<r[i+1];++a)n[a]=a-r[i]<<5|i;return[r,n]},sa=oa(ia,2),Aa=sa[0],ha=sa[1];Aa[28]=258,ha[258]=28;for(var la=oa(na,0)[0],ca=new ta(32768),ua=0;ua<32768;++ua){var ga=(43690&ua)>>>1|(21845&ua)<<1;ga=(61680&(ga=(52428&ga)>>>2|(13107&ga)<<2))>>>4|(3855&ga)<<4,ca[ua]=((65280&ga)>>>8|(255&ga)<<8)>>>1}var da=function(e,t,r){for(var i=e.length,n=0,a=new ta(t);n<i;++n)++a[e[n]-1];var o,s=new ta(t);for(n=0;n<t;++n)s[n]=s[n-1]+a[n-1]<<1;if(r){o=new ta(1<<t);var A=15-t;for(n=0;n<i;++n)if(e[n])for(var h=n<<4|e[n],l=t-e[n],c=s[e[n]-1]++<<l,u=c|(1<<l)-1;c<=u;++c)o[ca[c]>>>A]=h}else for(o=new ta(i),n=0;n<i;++n)e[n]&&(o[n]=ca[s[e[n]-1]++]>>>15-e[n]);return o},fa=new ea(288);for(ua=0;ua<144;++ua)fa[ua]=8;for(ua=144;ua<256;++ua)fa[ua]=9;for(ua=256;ua<280;++ua)fa[ua]=7;for(ua=280;ua<288;++ua)fa[ua]=8;var pa=new ea(32);for(ua=0;ua<32;++ua)pa[ua]=5;var va=da(fa,9,1),ma=da(pa,5,1),Ia=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},ya=function(e,t,r){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&r},Ca=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&t)},Ea=function(e){return(e/8|0)+(7&e&&1)},Ba=function(e,t,r){var i=e.length;if(!i||r&&!r.l&&i<5)return t||new ea(0);var n=!t||r,a=!r||r.i;r||(r={}),t||(t=new ea(3*i));var o=function(e){var r=t.length;if(e>r){var i=new ea(Math.max(2*r,e));i.set(t),t=i}},s=r.f||0,A=r.p||0,h=r.b||0,l=r.l,c=r.d,u=r.m,g=r.n,d=8*i;do{if(!l){r.f=s=ya(e,A,1);var f=ya(e,A+1,3);if(A+=3,!f){var p=e[(b=Ea(A)+4)-4]|e[b-3]<<8,v=b+p;if(v>i){if(a)throw"unexpected EOF";break}n&&o(h+p),t.set(e.subarray(b,v),h),r.b=h+=p,r.p=A=8*v;continue}if(1==f)l=va,c=ma,u=9,g=5;else{if(2!=f)throw"invalid block type";var m=ya(e,A,31)+257,I=ya(e,A+10,15)+4,y=m+ya(e,A+5,31)+1;A+=14;for(var C=new ea(y),E=new ea(19),B=0;B<I;++B)E[aa[B]]=ya(e,A+3*B,7);A+=3*I;var w=Ia(E),Q=(1<<w)-1,x=da(E,w,1);for(B=0;B<y;){var b,S=x[ya(e,A,Q)];if(A+=15&S,(b=S>>>4)<16)C[B++]=b;else{var k=0,M=0;for(16==b?(M=3+ya(e,A,3),A+=2,k=C[B-1]):17==b?(M=3+ya(e,A,7),A+=3):18==b&&(M=11+ya(e,A,127),A+=7);M--;)C[B++]=k}}var _=C.subarray(0,m),T=C.subarray(m);u=Ia(_),g=Ia(T),l=da(_,u,1),c=da(T,g,1)}if(A>d){if(a)throw"unexpected EOF";break}}n&&o(h+131072);for(var D=(1<<u)-1,L=(1<<g)-1,R=A;;R=A){var F=(k=l[Ca(e,A)&D])>>>4;if((A+=15&k)>d){if(a)throw"unexpected EOF";break}if(!k)throw"invalid length/literal";if(F<256)t[h++]=F;else{if(256==F){R=A,l=null;break}var U=F-254;if(F>264){var G=ia[B=F-257];U=ya(e,A,(1<<G)-1)+Aa[B],A+=G}var N=c[Ca(e,A)&L],O=N>>>4;if(!N)throw"invalid distance";A+=15&N;T=la[O];if(O>3){G=na[O];T+=Ca(e,A)&(1<<G)-1,A+=G}if(A>d){if(a)throw"unexpected EOF";break}n&&o(h+131072);for(var P=h+U;h<P;h+=4)t[h]=t[h-T],t[h+1]=t[h+1-T],t[h+2]=t[h+2-T],t[h+3]=t[h+3-T];h=P}}r.l=l,r.p=R,r.b=h,l&&(s=1,r.m=u,r.d=c,r.n=g)}while(!s);return h==t.length?t:function(e,t,r){(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length);var i=new(e instanceof ta?ta:e instanceof ra?ra:ea)(r-t);return i.set(e.subarray(t,r)),i}(t,0,h)},wa=new ea(0);var Qa="undefined"!=typeof TextDecoder&&new TextDecoder;try{Qa.decode(wa,{stream:!0}),1}catch(e){}function xa(e,t,r){var i=r.length-e-1;if(t>=r[i])return i-1;if(t<=r[e])return e;for(var n=e,a=i,o=Math.floor((n+a)/2);t<r[o]||t>=r[o+1];)t<r[o]?a=o:n=o,o=Math.floor((n+a)/2);return o}function ba(e,t){for(var r=1,i=2;i<=e;++i)r*=i;for(var n=1,a=2;a<=t;++a)n*=a;for(var o=2;o<=e-t;++o)n*=o;return r/n}function Sa(e,t,i,n,a){var o=function(e,t,i,n,a){for(var o=a<e?a:e,s=[],A=xa(e,n,t),h=function(e,t,r,i,n){for(var a=[],o=0;o<=r;++o)a[o]=0;for(var s=[],A=0;A<=i;++A)s[A]=a.slice(0);for(var h=[],l=0;l<=r;++l)h[l]=a.slice(0);h[0][0]=1;for(var c=a.slice(0),u=a.slice(0),g=1;g<=r;++g){c[g]=t-n[e+1-g],u[g]=n[e+g]-t;for(var d=0,f=0;f<g;++f){var p=u[f+1],v=c[g-f];h[g][f]=p+v;var m=h[f][g-1]/h[g][f];h[f][g]=d+p*m,d=v*m}h[g][g]=d}for(var I=0;I<=r;++I)s[0][I]=h[I][r];for(var y=0;y<=r;++y){for(var C=0,E=1,B=[],w=0;w<=r;++w)B[w]=a.slice(0);B[0][0]=1;for(var Q=1;Q<=i;++Q){var x=0,b=y-Q,S=r-Q;y>=Q&&(B[E][0]=B[C][0]/h[S+1][b],x=B[E][0]*h[b][S]);for(var k=y-1<=S?Q-1:r-y,M=b>=-1?1:-b;M<=k;++M)B[E][M]=(B[C][M]-B[C][M-1])/h[S+1][b+M],x+=B[E][M]*h[b+M][S];y<=S&&(B[E][Q]=-B[C][Q-1]/h[S+1][y],x+=B[E][Q]*h[y][S]),s[Q][y]=x;var _=C;C=E,E=_}}for(var T=r,D=1;D<=i;++D){for(var L=0;L<=r;++L)s[D][L]*=T;T*=r-D}return s}(A,n,e,o,t),l=[],c=0;c<i.length;++c){var u=i[c].clone(),g=u.w;u.x*=g,u.y*=g,u.z*=g,l[c]=u}for(var d=0;d<=o;++d){for(var f=l[A-e].clone().multiplyScalar(h[d][0]),p=1;p<=e;++p)f.add(l[A-e+p].clone().multiplyScalar(h[d][p]));s[d]=f}for(var v=o+1;v<=a+1;++v)s[v]=new r.Vector4(0,0,0);return s}(e,t,i,n,a);return function(e){for(var t=e.length,i=[],n=[],a=0;a<t;++a){var o=e[a];i[a]=new r.Vector3(o.x,o.y,o.z),n[a]=o.w}for(var s=[],A=0;A<t;++A){for(var h=i[A].clone(),l=1;l<=A;++l)h.sub(s[A-l].clone().multiplyScalar(ba(A,l)*n[l]));s[A]=h.divideScalar(n[0])}return s}(o)}var ka,Ma,_a,Ta=function(e){f(i,e);var t=I(i);function i(e,n,a,o,s){var A;c(this,i),(A=t.call(this)).degree=e,A.knots=n,A.controlPoints=[],A.startKnot=o||0,A.endKnot=s||A.knots.length-1;for(var h=0;h<a.length;++h){var l=a[h];A.controlPoints[h]=new r.Vector4(l.x,l.y,l.z,l.w)}return A}return g(i,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new r.Vector3,i=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),n=function(e,t,i,n){for(var a=xa(e,n,t),o=function(e,t,r,i){var n=[],a=[],o=[];n[0]=1;for(var s=1;s<=r;++s){a[s]=t-i[e+1-s],o[s]=i[e+s]-t;for(var A=0,h=0;h<s;++h){var l=o[h+1],c=a[s-h],u=n[h]/(l+c);n[h]=A+l*u,A=c*u}n[s]=A}return n}(a,n,e,t),s=new r.Vector4(0,0,0,0),A=0;A<=e;++A){var h=i[a-e+A],l=o[A],c=h.w*l;s.x+=h.x*c,s.y+=h.y*c,s.z+=h.z*c,s.w+=h.w*l}return s}(this.degree,this.knots,this.controlPoints,i);return 1!==n.w&&n.divideScalar(n.w),t.set(n.x,n.y,n.z)}},{key:"getTangent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new r.Vector3,i=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),n=Sa(this.degree,this.knots,this.controlPoints,i,1);return t.copy(n[1]).normalize(),t}}]),i}(r.Curve),Da=function(e){f(i,e);var t=I(i);function i(e){return c(this,i),t.call(this,e)}return g(i,[{key:"load",value:function(e,t,i,n){var a=this,o=""===a.path?r.LoaderUtils.extractUrlBase(e):a.path,s=new r.FileLoader(this.manager);s.setPath(a.path),s.setResponseType("arraybuffer"),s.setRequestHeader(a.requestHeader),s.setWithCredentials(a.withCredentials),s.load(e,(function(r){try{t(a.parse(r,o))}catch(t){n?n(t):console.error(t),a.manager.itemError(e)}}),i,n)}},{key:"parse",value:function(e,t){if(function(e){var t="Kaydara FBX Binary \0";return e.byteLength>=t.length&&t===Wa(e,0,t.length)}(e))ka=(new Ga).parse(e);else{var i=Wa(e);if(!function(e){var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0;function i(t){var i=e[t-1];return e=e.slice(r+t),r++,i}for(var n=0;n<t.length;++n){if(i(1)===t[n])return!1}return!0}(i))throw new Error("THREE.FBXLoader: Unknown format.");if(Pa(i)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Pa(i));ka=(new Ua).parse(i)}var n=new r.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new La(n,this.manager).parse(ka)}}]),i}(r.Loader),La=function(){function e(t,r){c(this,e),this.textureLoader=t,this.manager=r}return g(e,[{key:"parse",value:function(){Ma=this.parseConnections();var e=this.parseImages(),t=this.parseTextures(e),r=this.parseMaterials(t),i=this.parseDeformers(),n=(new Ra).parse(i);return this.parseScene(i,n,r),_a}},{key:"parseConnections",value:function(){var e=new Map;"Connections"in ka&&ka.Connections.connections.forEach((function(t){var r=t[0],i=t[1],n=t[2];e.has(r)||e.set(r,{parents:[],children:[]});var a={ID:i,relationship:n};e.get(r).parents.push(a),e.has(i)||e.set(i,{parents:[],children:[]});var o={ID:r,relationship:n};e.get(i).children.push(o)}));return e}},{key:"parseImages",value:function(){var e={},t={};if("Video"in ka.Objects){var r=ka.Objects.Video;for(var i in r){var n=r[i];if(e[parseInt(i)]=n.RelativeFilename||n.Filename,"Content"in n){var a=n.Content instanceof ArrayBuffer&&n.Content.byteLength>0,o="string"==typeof n.Content&&""!==n.Content;if(a||o){var s=this.parseImage(r[i]);t[n.RelativeFilename||n.Filename]=s}}}}for(var A in e){var h=e[A];void 0!==t[h]?e[A]=t[h]:e[A]=e[A].split("\\").pop()}return e}},{key:"parseImage",value:function(e){var t,r=e.Content,i=e.RelativeFilename||e.Filename,n=i.slice(i.lastIndexOf(".")+1).toLowerCase();switch(n){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",i),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+n+'" is not supported.')}if("string"==typeof r)return"data:"+t+";base64,"+r;var a=new Uint8Array(r);return window.URL.createObjectURL(new Blob([a],{type:t}))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in ka.Objects){var r=ka.Objects.Texture;for(var i in r){var n=this.parseTexture(r[i],e);t.set(parseInt(i),n)}}return t}},{key:"parseTexture",value:function(e,t){var i=this.loadTexture(e,t);i.ID=e.id,i.name=e.attrName;var n=e.WrapModeU,a=e.WrapModeV,o=void 0!==n?n.value:0,s=void 0!==a?a.value:0;if(i.wrapS=0===o?r.RepeatWrapping:r.ClampToEdgeWrapping,i.wrapT=0===s?r.RepeatWrapping:r.ClampToEdgeWrapping,"Scaling"in e){var A=e.Scaling.value;i.repeat.x=A[0],i.repeat.y=A[1]}if("Translation"in e){var h=e.Translation.value;i.offset.x=h[0],i.offset.y=h[1]}return i}},{key:"loadTexture",value:function(e,t){var i,n,a=this.textureLoader.path,o=Ma.get(e.id).children;void 0!==o&&o.length>0&&void 0!==t[o[0].ID]&&(0!==(i=t[o[0].ID]).indexOf("blob:")&&0!==i.indexOf("data:")||this.textureLoader.setPath(void 0));var s=e.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",e.RelativeFilename),n=new r.Texture):(A.setPath(this.textureLoader.path),n=A.load(i))}else"psd"===s?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),n=new r.Texture):n=this.textureLoader.load(i);return this.textureLoader.setPath(a),n}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in ka.Objects){var r=ka.Objects.Material;for(var i in r){var n=this.parseMaterial(r[i],e);null!==n&&t.set(parseInt(i),n)}}return t}},{key:"parseMaterial",value:function(e,t){var i=e.id,n=e.attrName,a=e.ShadingModel;if("object"===A(a)&&(a=a.value),!Ma.has(i))return null;var o,s=this.parseParameters(e,t,i);switch(a.toLowerCase()){case"phong":o=new r.MeshPhongMaterial;break;case"lambert":o=new r.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),o=new r.MeshPhongMaterial}return o.setValues(s),o.name=n,o}},{key:"parseParameters",value:function(e,t,i){var n={};e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=(new r.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(n.color=(new r.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=(new r.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(n.emissive=(new r.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=(new r.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(n.specular=(new r.Color).fromArray(e.SpecularColor.value));var a=this;return Ma.get(i).children.forEach((function(e){var i=e.relationship;switch(i){case"Bump":n.bumpMap=a.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":n.aoMap=a.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=a.getTexture(t,e.ID),void 0!==n.map&&(n.map.encoding=r.sRGBEncoding);break;case"DisplacementColor":n.displacementMap=a.getTexture(t,e.ID);break;case"EmissiveColor":n.emissiveMap=a.getTexture(t,e.ID),void 0!==n.emissiveMap&&(n.emissiveMap.encoding=r.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=a.getTexture(t,e.ID);break;case"ReflectionColor":n.envMap=a.getTexture(t,e.ID),void 0!==n.envMap&&(n.envMap.mapping=r.EquirectangularReflectionMapping,n.envMap.encoding=r.sRGBEncoding);break;case"SpecularColor":n.specularMap=a.getTexture(t,e.ID),void 0!==n.specularMap&&(n.specularMap.encoding=r.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=a.getTexture(t,e.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",i)}})),n}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in ka.Objects&&t in ka.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ma.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in ka.Objects){var r=ka.Objects.Deformer;for(var i in r){var n=r[i],a=Ma.get(parseInt(i));if("Skin"===n.attrType){var o=this.parseSkeleton(a,r);o.ID=i,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),o.geometryID=a.parents[0].ID,e[i]=o}else if("BlendShape"===n.attrType){var s={id:i};s.rawTargets=this.parseMorphTargets(a,r),s.id=i,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=s}}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var i=[];return e.children.forEach((function(e){var n=t[e.ID];if("Cluster"===n.attrType){var a={ID:e.ID,indices:[],weights:[],transformLink:(new r.Matrix4).fromArray(n.TransformLink.a)};"Indexes"in n&&(a.indices=n.Indexes.a,a.weights=n.Weights.a),i.push(a)}})),{rawBones:i,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var r=[],i=0;i<e.children.length;i++){var n=e.children[i],a=t[n.ID],o={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if("BlendShapeChannel"!==a.attrType)return;o.geoID=Ma.get(parseInt(n.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(o)}return r}},{key:"parseScene",value:function(e,t,i){_a=new r.Group;var n=this.parseModels(e.skeletons,t,i),a=ka.Objects.Model,o=this;n.forEach((function(e){var t=a[e.ID];o.setLookAtProperties(e,t),Ma.get(e.ID).parents.forEach((function(t){var r=n.get(t.ID);void 0!==r&&r.add(e)})),null===e.parent&&_a.add(e)})),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),_a.traverse((function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);var t=Ja(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix()}}));var s=(new Fa).parse();1===_a.children.length&&_a.children[0].isGroup&&(_a.children[0].animations=s,_a=_a.children[0]),_a.animations=s}},{key:"parseModels",value:function(e,t,i){var n=new Map,a=ka.Objects.Model;for(var o in a){var s=parseInt(o),A=a[o],h=Ma.get(s),l=this.buildSkeleton(h,e,s,A.attrName);if(!l){switch(A.attrType){case"Camera":l=this.createCamera(h);break;case"Light":l=this.createLight(h);break;case"Mesh":l=this.createMesh(h,t,i);break;case"NurbsCurve":l=this.createCurve(h,t);break;case"LimbNode":case"Root":l=new r.Bone;break;default:l=new r.Group}l.name=A.attrName?r.PropertyBinding.sanitizeNodeName(A.attrName):"",l.ID=s}this.getTransformData(l,A),n.set(s,l)}return n}},{key:"buildSkeleton",value:function(e,t,i,n){var a=null;return e.parents.forEach((function(e){var o=function(){var o=t[s];o.rawBones.forEach((function(t,s){if(t.ID===e.ID){var A=a;(a=new r.Bone).matrixWorld.copy(t.transformLink),a.name=n?r.PropertyBinding.sanitizeNodeName(n):"",a.ID=i,o.bones[s]=a,null!==A&&a.add(A)}}))};for(var s in t)o()})),a}},{key:"createCamera",value:function(e){var t,i;if(e.children.forEach((function(e){var t=ka.Objects.NodeAttribute[e.ID];void 0!==t&&(i=t)})),void 0===i)t=new r.Object3D;else{var n=0;void 0!==i.CameraProjectionType&&1===i.CameraProjectionType.value&&(n=1);var a=1;void 0!==i.NearPlane&&(a=i.NearPlane.value/1e3);var o=1e3;void 0!==i.FarPlane&&(o=i.FarPlane.value/1e3);var s=window.innerWidth,A=window.innerHeight;void 0!==i.AspectWidth&&void 0!==i.AspectHeight&&(s=i.AspectWidth.value,A=i.AspectHeight.value);var h=s/A,l=45;void 0!==i.FieldOfView&&(l=i.FieldOfView.value);var c=i.FocalLength?i.FocalLength.value:null;switch(n){case 0:t=new r.PerspectiveCamera(l,h,a,o),null!==c&&t.setFocalLength(c);break;case 1:t=new r.OrthographicCamera(-s/2,s/2,A/2,-A/2,a,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new r.Object3D}}return t}},{key:"createLight",value:function(e){var t,i;if(e.children.forEach((function(e){var t=ka.Objects.NodeAttribute[e.ID];void 0!==t&&(i=t)})),void 0===i)t=new r.Object3D;else{var n;n=void 0===i.LightType?0:i.LightType.value;var a=16777215;void 0!==i.Color&&(a=(new r.Color).fromArray(i.Color.value));var o=void 0===i.Intensity?1:i.Intensity.value/100;void 0!==i.CastLightOnObject&&0===i.CastLightOnObject.value&&(o=0);var s=0;void 0!==i.FarAttenuationEnd&&(s=void 0!==i.EnableFarAttenuation&&0===i.EnableFarAttenuation.value?0:i.FarAttenuationEnd.value);switch(n){case 0:t=new r.PointLight(a,o,s,1);break;case 1:t=new r.DirectionalLight(a,o);break;case 2:var A=Math.PI/3;void 0!==i.InnerAngle&&(A=r.MathUtils.degToRad(i.InnerAngle.value));var h=0;void 0!==i.OuterAngle&&(h=r.MathUtils.degToRad(i.OuterAngle.value),h=Math.max(h,1)),t=new r.SpotLight(a,o,s,A,h,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+i.LightType.value+", defaulting to a PointLight."),t=new r.PointLight(a,o)}void 0!==i.CastShadows&&1===i.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,i){var n,a=null,o=null,s=[];return e.children.forEach((function(e){t.has(e.ID)&&(a=t.get(e.ID)),i.has(e.ID)&&s.push(i.get(e.ID))})),s.length>1?o=s:s.length>0?o=s[0]:(o=new r.MeshPhongMaterial({color:13421772}),s.push(o)),"color"in a.attributes&&s.forEach((function(e){e.vertexColors=!0})),a.FBX_Deformer?(n=new r.SkinnedMesh(a,o)).normalizeSkinWeights():n=new r.Mesh(a,o),n}},{key:"createCurve",value:function(e,t){var i=e.children.reduce((function(e,r){return t.has(r.ID)&&(e=t.get(r.ID)),e}),null),n=new r.LineBasicMaterial({color:3342591,linewidth:1});return new r.Line(i,n)}},{key:"getTransformData",value:function(e,t){var r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),r.eulerOrder="RotationOrder"in t?Ka(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&Ma.get(e.ID).children.forEach((function(t){if("LookAtProperty"===t.relationship){var i=ka.Objects.Model[t.ID];if("Lcl_Translation"in i){var n=i.Lcl_Translation.value;void 0!==e.target?(e.target.position.fromArray(n),_a.add(e.target)):e.lookAt((new r.Vector3).fromArray(n))}}}))}},{key:"bindSkeleton",value:function(e,t,i){var n=this.parsePoseNodes(),a=function(){var a=e[o];Ma.get(parseInt(a.ID)).parents.forEach((function(e){if(t.has(e.ID)){var o=e.ID;Ma.get(o).parents.forEach((function(e){i.has(e.ID)&&i.get(e.ID).bind(new r.Skeleton(a.bones),n[e.ID])}))}}))};for(var o in e)a()}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in ka.Objects){var t=ka.Objects.Pose;for(var i in t)if("BindPose"===t[i].attrType&&t[i].NbPoseNodes>0){var n=t[i].PoseNode;Array.isArray(n)?n.forEach((function(t){e[t.Node]=(new r.Matrix4).fromArray(t.Matrix.a)})):e[n.Node]=(new r.Matrix4).fromArray(n.Matrix.a)}}return e}},{key:"createAmbientLight",value:function(){if("GlobalSettings"in ka&&"AmbientColor"in ka.GlobalSettings){var e=ka.GlobalSettings.AmbientColor.value,t=e[0],i=e[1],n=e[2];if(0!==t||0!==i||0!==n){var a=new r.Color(t,i,n);_a.add(new r.AmbientLight(a,1))}}}}]),e}(),Ra=function(){function e(){c(this,e),this.negativeMaterialIndices=!1}return g(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in ka.Objects){var r=ka.Objects.Geometry;for(var i in r){var n=Ma.get(parseInt(i)),a=this.parseGeometry(n,r[i],e);t.set(parseInt(i),a)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}},{key:"parseGeometry",value:function(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,r){var i=r.skeletons,n=[],a=e.parents.map((function(e){return ka.Objects.Model[e.ID]}));if(0!==a.length){var o=e.children.reduce((function(e,t){return void 0!==i[t.ID]&&(e=i[t.ID]),e}),null);e.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&n.push(r.morphTargets[e.ID])}));var s=a[0],A={};"RotationOrder"in s&&(A.eulerOrder=Ka(s.RotationOrder.value)),"InheritType"in s&&(A.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(A.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(A.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(A.scale=s.GeometricScaling.value);var h=Ja(A);return this.genGeometry(t,o,n,h)}}},{key:"genGeometry",value:function(e,t,i,n){var a=new r.BufferGeometry;e.attrName&&(a.name=e.attrName);var o=this.parseGeoNode(e,t),s=this.genBuffers(o),A=new r.Float32BufferAttribute(s.vertex,3);if(A.applyMatrix4(n),a.setAttribute("position",A),s.colors.length>0&&a.setAttribute("color",new r.Float32BufferAttribute(s.colors,3)),t&&(a.setAttribute("skinIndex",new r.Uint16BufferAttribute(s.weightsIndices,4)),a.setAttribute("skinWeight",new r.Float32BufferAttribute(s.vertexWeights,4)),a.FBX_Deformer=t),s.normal.length>0){var h=(new r.Matrix3).getNormalMatrix(n),l=new r.Float32BufferAttribute(s.normal,3);l.applyNormalMatrix(h),a.setAttribute("normal",l)}if(s.uvs.forEach((function(e,t){var i="uv"+(t+1).toString();0===t&&(i="uv"),a.setAttribute(i,new r.Float32BufferAttribute(s.uvs[t],2))})),o.material&&"AllSame"!==o.material.mappingType){var c=s.materialIndex[0],u=0;if(s.materialIndex.forEach((function(e,t){e!==c&&(a.addGroup(u,t-u,c),c=e,u=t)})),a.groups.length>0){var g=a.groups[a.groups.length-1],d=g.start+g.count;d!==s.materialIndex.length&&a.addGroup(d,s.materialIndex.length-d,c)}0===a.groups.length&&a.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(a,e,i,n),a}},{key:"parseGeoNode",value:function(e,t){var r={};if(r.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],r.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];for(var i=0;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return r.weightTable={},null!==t&&(r.skeleton=t,t.rawBones.forEach((function(e,t){e.indices.forEach((function(i,n){void 0===r.weightTable[i]&&(r.weightTable[i]=[]),r.weightTable[i].push({id:t,weight:e.weights[n]})}))}))),r}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,i=0,n=!1,a=[],o=[],s=[],A=[],h=[],l=[],c=this;return e.vertexIndices.forEach((function(u,g){var d,f=!1;u<0&&(u^=-1,f=!0);var p=[],v=[];if(a.push(3*u,3*u+1,3*u+2),e.color){var m=ja(g,r,u,e.color);s.push(m[0],m[1],m[2])}if(e.skeleton){if(void 0!==e.weightTable[u]&&e.weightTable[u].forEach((function(e){v.push(e.weight),p.push(e.id)})),v.length>4){n||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),n=!0);var I=[0,0,0,0],y=[0,0,0,0];v.forEach((function(e,t){var r=e,i=p[t];y.forEach((function(e,t,n){if(r>e){n[t]=r,r=e;var a=I[t];I[t]=i,i=a}}))})),p=I,v=y}for(;v.length<4;)v.push(0),p.push(0);for(var C=0;C<4;++C)h.push(v[C]),l.push(p[C])}if(e.normal){var E=ja(g,r,u,e.normal);o.push(E[0],E[1],E[2])}e.material&&"AllSame"!==e.material.mappingType&&(d=ja(g,r,u,e.material)[0])<0&&(c.negativeMaterialIndices=!0,d=0),e.uv&&e.uv.forEach((function(e,t){var i=ja(g,r,u,e);void 0===A[t]&&(A[t]=[]),A[t].push(i[0]),A[t].push(i[1])})),i++,f&&(i>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),c.genFace(t,e,a,d,o,s,A,h,l,i),r++,i=0,a=[],o=[],s=[],A=[],h=[],l=[])})),t}},{key:"genFace",value:function(e,t,r,i,n,a,o,s,A,h){for(var l=function(h){e.vertex.push(t.vertexPositions[r[0]]),e.vertex.push(t.vertexPositions[r[1]]),e.vertex.push(t.vertexPositions[r[2]]),e.vertex.push(t.vertexPositions[r[3*(h-1)]]),e.vertex.push(t.vertexPositions[r[3*(h-1)+1]]),e.vertex.push(t.vertexPositions[r[3*(h-1)+2]]),e.vertex.push(t.vertexPositions[r[3*h]]),e.vertex.push(t.vertexPositions[r[3*h+1]]),e.vertex.push(t.vertexPositions[r[3*h+2]]),t.skeleton&&(e.vertexWeights.push(s[0]),e.vertexWeights.push(s[1]),e.vertexWeights.push(s[2]),e.vertexWeights.push(s[3]),e.vertexWeights.push(s[4*(h-1)]),e.vertexWeights.push(s[4*(h-1)+1]),e.vertexWeights.push(s[4*(h-1)+2]),e.vertexWeights.push(s[4*(h-1)+3]),e.vertexWeights.push(s[4*h]),e.vertexWeights.push(s[4*h+1]),e.vertexWeights.push(s[4*h+2]),e.vertexWeights.push(s[4*h+3]),e.weightsIndices.push(A[0]),e.weightsIndices.push(A[1]),e.weightsIndices.push(A[2]),e.weightsIndices.push(A[3]),e.weightsIndices.push(A[4*(h-1)]),e.weightsIndices.push(A[4*(h-1)+1]),e.weightsIndices.push(A[4*(h-1)+2]),e.weightsIndices.push(A[4*(h-1)+3]),e.weightsIndices.push(A[4*h]),e.weightsIndices.push(A[4*h+1]),e.weightsIndices.push(A[4*h+2]),e.weightsIndices.push(A[4*h+3])),t.color&&(e.colors.push(a[0]),e.colors.push(a[1]),e.colors.push(a[2]),e.colors.push(a[3*(h-1)]),e.colors.push(a[3*(h-1)+1]),e.colors.push(a[3*(h-1)+2]),e.colors.push(a[3*h]),e.colors.push(a[3*h+1]),e.colors.push(a[3*h+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(i),e.materialIndex.push(i),e.materialIndex.push(i)),t.normal&&(e.normal.push(n[0]),e.normal.push(n[1]),e.normal.push(n[2]),e.normal.push(n[3*(h-1)]),e.normal.push(n[3*(h-1)+1]),e.normal.push(n[3*(h-1)+2]),e.normal.push(n[3*h]),e.normal.push(n[3*h+1]),e.normal.push(n[3*h+2])),t.uv&&t.uv.forEach((function(t,r){void 0===e.uvs[r]&&(e.uvs[r]=[]),e.uvs[r].push(o[r][0]),e.uvs[r].push(o[r][1]),e.uvs[r].push(o[r][2*(h-1)]),e.uvs[r].push(o[r][2*(h-1)+1]),e.uvs[r].push(o[r][2*h]),e.uvs[r].push(o[r][2*h+1])}))},c=2;c<h;c++)l(c)}},{key:"addMorphTargets",value:function(e,t,r,i){if(0!==r.length){e.morphTargetsRelative=!0,e.morphAttributes.position=[];var n=this;r.forEach((function(r){r.rawTargets.forEach((function(r){var a=ka.Objects.Geometry[r.geoID];void 0!==a&&n.genMorphGeometry(e,t,a,i,r.name)}))}))}}},{key:"genMorphGeometry",value:function(e,t,i,n,a){for(var o=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],s=void 0!==i.Vertices?i.Vertices.a:[],A=void 0!==i.Indexes?i.Indexes.a:[],h=3*e.attributes.position.count,l=new Float32Array(h),c=0;c<A.length;c++){var u=3*A[c];l[u]=s[3*c],l[u+1]=s[3*c+1],l[u+2]=s[3*c+2]}var g={vertexIndices:o,vertexPositions:l},d=this.genBuffers(g),f=new r.Float32BufferAttribute(d.vertex,3);f.name=a||i.attrName,f.applyMatrix4(n),e.morphAttributes.position.push(f)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,i=e.Normals.a,n=[];return"IndexToDirect"===r&&("NormalIndex"in e?n=e.NormalIndex.a:"NormalsIndex"in e&&(n=e.NormalsIndex.a)),{dataSize:3,buffer:i,indices:n,mappingType:t,referenceType:r}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,i=e.UV.a,n=[];return"IndexToDirect"===r&&(n=e.UVIndex.a),{dataSize:2,buffer:i,indices:n,mappingType:t,referenceType:r}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,i=e.Colors.a,n=[];return"IndexToDirect"===r&&(n=e.ColorIndex.a),{dataSize:4,buffer:i,indices:n,mappingType:t,referenceType:r}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var i=e.Materials.a,n=[],a=0;a<i.length;++a)n.push(a);return{dataSize:1,buffer:i,indices:n,mappingType:t,referenceType:r}}},{key:"parseNurbsGeometry",value:function(e){var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new r.BufferGeometry;for(var i,n,a=t-1,o=e.KnotVector.a,s=[],A=e.Points.a,h=0,l=A.length;h<l;h+=4)s.push((new r.Vector4).fromArray(A,h));if("Closed"===e.Form)s.push(s[0]);else if("Periodic"===e.Form){i=a,n=o.length-1-i;for(var c=0;c<a;++c)s.push(s[c])}var u=new Ta(a,o,s,i,n).getPoints(12*s.length);return(new r.BufferGeometry).setFromPoints(u)}}]),e}(),Fa=function(){function e(){c(this,e)}return g(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var r in t){var i=t[r],n=this.addClip(i);e.push(n)}return e}},{key:"parseClips",value:function(){if(void 0!==ka.Objects.AnimationCurve){var e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);var t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}}},{key:"parseAnimationCurveNodes",value:function(){var e=ka.Objects.AnimationCurveNode,t=new Map;for(var r in e){var i=e[r];if(null!==i.attrName.match(/S|R|T|DeformPercent/)){var n={id:i.id,attr:i.attrName,curves:{}};t.set(n.id,n)}}return t}},{key:"parseAnimationCurves",value:function(e){var t=ka.Objects.AnimationCurve;for(var r in t){var i={id:t[r].id,times:t[r].KeyTime.a.map(Ha),values:t[r].KeyValueFloat.a},n=Ma.get(i.id);if(void 0!==n){var a=n.parents[0].ID,o=n.parents[0].relationship;o.match(/X/)?e.get(a).curves.x=i:o.match(/Y/)?e.get(a).curves.y=i:o.match(/Z/)?e.get(a).curves.z=i:o.match(/d|DeformPercent/)&&e.has(a)&&(e.get(a).curves.morph=i)}}}},{key:"parseAnimationLayers",value:function(e){var t=ka.Objects.AnimationLayer,i=new Map,n=function(){var t=[],n=Ma.get(parseInt(a));void 0!==n&&(n.children.forEach((function(i,n){if(e.has(i.ID)){var a=e.get(i.ID);if(void 0!==a.curves.x||void 0!==a.curves.y||void 0!==a.curves.z){if(void 0===t[n]){var o=Ma.get(i.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==o){var s=ka.Objects.Model[o.toString()];if(void 0===s)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",i);var A={modelName:s.attrName?r.PropertyBinding.sanitizeNodeName(s.attrName):"",ID:s.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};_a.traverse((function(e){e.ID===s.id&&(A.transform=e.matrix,e.userData.transformData&&(A.eulerOrder=e.userData.transformData.eulerOrder))})),A.transform||(A.transform=new r.Matrix4),"PreRotation"in s&&(A.preRotation=s.PreRotation.value),"PostRotation"in s&&(A.postRotation=s.PostRotation.value),t[n]=A}}t[n]&&(t[n][a.attr]=a)}else if(void 0!==a.curves.morph){if(void 0===t[n]){var h=Ma.get(i.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,l=Ma.get(h).parents[0].ID,c=Ma.get(l).parents[0].ID,u=Ma.get(c).parents[0].ID,g=ka.Objects.Model[u],d={modelName:g.attrName?r.PropertyBinding.sanitizeNodeName(g.attrName):"",morphName:ka.Objects.Deformer[h].attrName};t[n]=d}t[n][a.attr]=a}}})),i.set(parseInt(a),t))};for(var a in t)n();return i}},{key:"parseAnimStacks",value:function(e){var t=ka.Objects.AnimationStack,r={};for(var i in t){var n=Ma.get(parseInt(i)).children;n.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var a=e.get(n[0].ID);r[i]={name:t[i].attrName,layer:a}}return r}},{key:"addClip",value:function(e){var t=[],i=this;return e.layer.forEach((function(e){t=t.concat(i.generateTracks(e))})),new r.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],i=new r.Vector3,n=new r.Quaternion,a=new r.Vector3;if(e.transform&&e.transform.decompose(i,n,a),i=i.toArray(),n=(new r.Euler).setFromQuaternion(n,e.eulerOrder).toArray(),a=a.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){var o=this.generateVectorTrack(e.modelName,e.T.curves,i,"position");void 0!==o&&t.push(o)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){var s=this.generateRotationTrack(e.modelName,e.R.curves,n,e.preRotation,e.postRotation,e.eulerOrder);void 0!==s&&t.push(s)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){var A=this.generateVectorTrack(e.modelName,e.S.curves,a,"scale");void 0!==A&&t.push(A)}if(void 0!==e.DeformPercent){var h=this.generateMorphTrack(e);void 0!==h&&t.push(h)}return t}},{key:"generateVectorTrack",value:function(e,t,i,n){var a=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(a,t,i);return new r.VectorKeyframeTrack(e+"."+n,a,o)}},{key:"generateRotationTrack",value:function(e,t,i,n,a,o){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(r.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(r.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(r.MathUtils.degToRad));var s=this.getTimesForAllAxes(t),A=this.getKeyframeTrackValues(s,t,i);void 0!==n&&((n=n.map(r.MathUtils.degToRad)).push(o),n=(new r.Euler).fromArray(n),n=(new r.Quaternion).setFromEuler(n)),void 0!==a&&((a=a.map(r.MathUtils.degToRad)).push(o),a=(new r.Euler).fromArray(a),a=(new r.Quaternion).setFromEuler(a).invert());for(var h=new r.Quaternion,l=new r.Euler,c=[],u=0;u<A.length;u+=3)l.set(A[u],A[u+1],A[u+2],o),h.setFromEuler(l),void 0!==n&&h.premultiply(n),void 0!==a&&h.multiply(a),h.toArray(c,u/3*4);return new r.QuaternionKeyframeTrack(e+".quaternion",s,c)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,i=t.values.map((function(e){return e/100})),n=_a.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new r.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",t.times,i)}},{key:"getTimesForAllAxes",value:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),(t=t.sort((function(e,t){return e-t}))).length>1){for(var r=1,i=t[0],n=1;n<t.length;n++){var a=t[n];a!==i&&(t[r]=a,i=a,r++)}t=t.slice(0,r)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,r){var i=r,n=[],a=-1,o=-1,s=-1;return e.forEach((function(e){if(t.x&&(a=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),-1!==a){var r=t.x.values[a];n.push(r),i[0]=r}else n.push(i[0]);if(-1!==o){var A=t.y.values[o];n.push(A),i[1]=A}else n.push(i[1]);if(-1!==s){var h=t.z.values[s];n.push(h),i[2]=h}else n.push(i[2])})),n}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var r=e.values[t-1],i=e.values[t]-r,n=Math.abs(i);if(n>=180){for(var a=n/180,o=i/a,s=r+o,A=e.times[t-1],h=(e.times[t]-A)/a,l=A+h,c=[],u=[];l<e.times[t];)c.push(l),l+=h,u.push(s),s+=o;e.times=Xa(e.times,t,c),e.values=Xa(e.values,t,u)}}}}]),e}(),Ua=function(){function e(){c(this,e)}return g(e,[{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(e){this.nodeStack.push(e),this.currentIndent+=1}},{key:"popStack",value:function(){this.nodeStack.pop(),this.currentIndent-=1}},{key:"setCurrentProp",value:function(e,t){this.currentProp=e,this.currentPropName=t}},{key:"parse",value:function(e){this.currentIndent=0,this.allNodes=new Oa,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,r=e.split(/[\r\n]+/);return r.forEach((function(e,i){var n=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);if(!n&&!a){var o=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),A=e.match("^\\t{"+(t.currentIndent-1)+"}}");o?t.parseNodeBegin(e,o):s?t.parseNodeProperty(e,s,r[++i]):A?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var r=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),n={name:r},a=this.parseNodeAttr(i),o=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(r,n):r in o?("PoseNode"===r?o.PoseNode.push(n):void 0!==o[r].id&&(o[r]={},o[r][o[r].id]=o[r]),""!==a.id&&(o[r][a.id]=n)):"number"==typeof a.id?(o[r]={},o[r][a.id]=n):"Properties70"!==r&&(o[r]="PoseNode"===r?[n]:n),"number"==typeof a.id&&(n.id=a.id),""!==a.name&&(n.attrName=a.name),""!==a.type&&(n.attrType=a.type),this.pushStack(n)}},{key:"parseNodeAttr",value:function(e){var t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));var r="",i="";return e.length>1&&(r=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:r,type:i}}},{key:"parseNodeProperty",value:function(e,t,r){var i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),n=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===i&&","===n&&(n=r.replace(/"/g,"").replace(/,$/,"").trim());var a=this.getCurrentNode();if("Properties70"!==a.name){if("C"===i){var o=n.split(",").slice(1),s=parseInt(o[0]),A=parseInt(o[1]),h=n.split(",").slice(3);i="connections",function(e,t){for(var r=0,i=e.length,n=t.length;r<n;r++,i++)e[i]=t[r]}(n=[s,A],h=h.map((function(e){return e.trim().replace(/^"/,"")}))),void 0===a[i]&&(a[i]=[])}"Node"===i&&(a.id=n),i in a&&Array.isArray(a[i])?a[i].push(n):"a"!==i?a[i]=n:a.a=n,this.setCurrentProp(a,i),"a"===i&&","!==n.slice(-1)&&(a.a=Ya(n))}else this.parseNodeSpecialProperty(e,i,n)}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=Ya(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,r){var i=r.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")})),n=i[0],a=i[1],o=i[2],s=i[3],A=i[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":A=parseFloat(A);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":A=Ya(A)}this.getPrevNode()[n]={type:a,type2:o,flag:s,value:A},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),Ga=function(){function e(){c(this,e)}return g(e,[{key:"parse",value:function(e){var t=new Na(e);t.skip(23);var r=t.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var i=new Oa;!this.endOfContent(t);){var n=this.parseNode(t,r);null!==n&&i.add(n.name,n)}return i}},{key:"endOfContent",value:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}},{key:"parseNode",value:function(e,t){var r={},i=t>=7500?e.getUint64():e.getUint32(),n=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();var a=e.getUint8(),o=e.getString(a);if(0===i)return null;for(var s=[],A=0;A<n;A++)s.push(this.parseProperty(e));var h=s.length>0?s[0]:"",l=s.length>1?s[1]:"",c=s.length>2?s[2]:"";for(r.singleProperty=1===n&&e.getOffset()===i;i>e.getOffset();){var u=this.parseNode(e,t);null!==u&&this.parseSubNode(o,r,u)}return r.propertyList=s,"number"==typeof h&&(r.id=h),""!==l&&(r.attrName=l),""!==c&&(r.attrType=c),""!==o&&(r.name=o),r}},{key:"parseSubNode",value:function(e,t,r){if(!0===r.singleProperty){var i=r.propertyList[0];Array.isArray(i)?(t[r.name]=r,r.a=i):t[r.name]=i}else if("Connections"===e&&"C"===r.name){var n=[];r.propertyList.forEach((function(e,t){0!==t&&n.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(n)}else if("Properties70"===r.name){Object.keys(r).forEach((function(e){t[e]=r[e]}))}else if("Properties70"===e&&"P"===r.name){var a,o=r.propertyList[0],s=r.propertyList[1],A=r.propertyList[2],h=r.propertyList[3];0===o.indexOf("Lcl ")&&(o=o.replace("Lcl ","Lcl_")),0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),a="Color"===s||"ColorRGB"===s||"Vector"===s||"Vector3D"===s||0===s.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],t[o]={type:s,type2:A,flag:h,value:a}}else void 0===t[r.name]?"number"==typeof r.id?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:"PoseNode"===r.name?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):void 0===t[r.name][r.id]&&(t[r.name][r.id]=r)}},{key:"parseProperty",value:function(e){var t,r=e.getString(1);switch(r){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return t=e.getUint32(),e.getArrayBuffer(t);case"S":return t=e.getUint32(),e.getString(t);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var i=e.getUint32(),n=e.getUint32(),a=e.getUint32();if(0===n)switch(r){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}var o=function(e,t){return Ba((function(e){if(8!=(15&e[0])||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(e),e.subarray(2,-4)),t)}(new Uint8Array(e.getArrayBuffer(a))),s=new Na(o.buffer);switch(r){case"b":case"c":return s.getBooleanArray(i);case"d":return s.getFloat64Array(i);case"f":return s.getFloat32Array(i);case"i":return s.getInt32Array(i);case"l":return s.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+r)}}}]),e}(),Na=function(){function e(t,r){c(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r}return g(e,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(e){this.offset+=e}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getBoolean());return t}},{key:"getUint8",value:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e}},{key:"getInt16",value:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}},{key:"getInt32",value:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt32());return t}},{key:"getUint32",value:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,4294967295===(e=4294967295&~e)&&(t=t+1&4294967295),-(4294967296*t+(e=e+1&4294967295))):4294967296*t+e}},{key:"getInt64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt64());return t}},{key:"getUint64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}},{key:"getFloat32",value:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getFloat32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat32());return t}},{key:"getFloat64",value:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}},{key:"getFloat64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat64());return t}},{key:"getArrayBuffer",value:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"getString",value:function(e){for(var t=[],i=0;i<e;i++)t[i]=this.getUint8();var n=t.indexOf(0);return n>=0&&(t=t.slice(0,n)),r.LoaderUtils.decodeText(new Uint8Array(t))}}]),e}(),Oa=function(){function e(){c(this,e)}return g(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function Pa(e){var t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Ha(e){return e/46186158e3}var Va=[];function ja(e,t,r,i){var n;switch(i.mappingType){case"ByPolygonVertex":n=e;break;case"ByPolygon":n=t;break;case"ByVertice":n=r;break;case"AllSame":n=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}"IndexToDirect"===i.referenceType&&(n=i.indices[n]);var a=n*i.dataSize,o=a+i.dataSize;return function(e,t,r,i){for(var n=r,a=0;n<i;n++,a++)e[a]=t[n];return e}(Va,i.buffer,a,o)}var qa=new r.Euler,za=new r.Vector3;function Ja(e){var t=new r.Matrix4,i=new r.Matrix4,n=new r.Matrix4,a=new r.Matrix4,o=new r.Matrix4,s=new r.Matrix4,A=new r.Matrix4,h=new r.Matrix4,l=new r.Matrix4,c=new r.Matrix4,u=new r.Matrix4,g=new r.Matrix4,d=e.inheritType?e.inheritType:0;if(e.translation&&t.setPosition(za.fromArray(e.translation)),e.preRotation){var f=e.preRotation.map(r.MathUtils.degToRad);f.push(e.eulerOrder||r.Euler.DefaultOrder),i.makeRotationFromEuler(qa.fromArray(f))}if(e.rotation){var p=e.rotation.map(r.MathUtils.degToRad);p.push(e.eulerOrder||r.Euler.DefaultOrder),n.makeRotationFromEuler(qa.fromArray(p))}if(e.postRotation){var v=e.postRotation.map(r.MathUtils.degToRad);v.push(e.eulerOrder||r.Euler.DefaultOrder),a.makeRotationFromEuler(qa.fromArray(v)),a.invert()}e.scale&&o.scale(za.fromArray(e.scale)),e.scalingOffset&&A.setPosition(za.fromArray(e.scalingOffset)),e.scalingPivot&&s.setPosition(za.fromArray(e.scalingPivot)),e.rotationOffset&&h.setPosition(za.fromArray(e.rotationOffset)),e.rotationPivot&&l.setPosition(za.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(u.copy(e.parentMatrix),c.copy(e.parentMatrixWorld));var m=i.clone().multiply(n).multiply(a),I=new r.Matrix4;I.extractRotation(c);var y=new r.Matrix4;y.copyPosition(c);var C=y.clone().invert().multiply(c),E=I.clone().invert().multiply(C),B=o,w=new r.Matrix4;if(0===d)w.copy(I).multiply(m).multiply(E).multiply(B);else if(1===d)w.copy(I).multiply(E).multiply(m).multiply(B);else{var Q=(new r.Matrix4).scale((new r.Vector3).setFromMatrixScale(u)).clone().invert(),x=E.clone().multiply(Q);w.copy(I).multiply(m).multiply(x).multiply(B)}var b=l.clone().invert(),S=s.clone().invert(),k=t.clone().multiply(h).multiply(l).multiply(i).multiply(n).multiply(a).multiply(b).multiply(A).multiply(s).multiply(o).multiply(S),M=(new r.Matrix4).copyPosition(k),_=c.clone().multiply(M);return g.copyPosition(_),(k=g.clone().multiply(w)).premultiply(c.invert()),k}function Ka(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function Ya(e){return e.split(",").map((function(e){return parseFloat(e)}))}function Wa(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=e.byteLength),r.LoaderUtils.decodeText(new Uint8Array(e,t,i))}function Xa(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}var Za=function(){function e(t,r,i,n,a){c(this,e),this.threelayer=n,this.map=n.map,this.groupId=a,this.loader=new Da,this.loader.load(t,(function(e){e.traverse((function(e){e instanceof o.Mesh&&(e.geometry.computeVertexNormals(),e.scale.set(.04,.04,.04),e.rotation.set(1*Math.PI/2,1*-Math.PI/2,0))}));var t=n.toModel(e,{coordinate:r,altitude:i.altitude||0});a?n.addMesh1(t,a):n.addMesh(t),t.object3d.rotation.z=Math.PI/2}))}return g(e,[{key:"dispose",value:function(){}}]),e}(),$a={altitude:0,speed:.015,height:10},eo=function(e){f(r,e);var t=I(r);function r(e,i,n,o,s){var A;c(this,r),Array.isArray(e)&&(e=new a.Polygon([e])),i=a.Util.extend({},$a,i,{layer:o,polygon:e}),(A=t.call(this)).parent=s,A._initOptions(i);var h=i,l=h.altitude,u=h.height,g=A.createGeometry(e,o,u);A._createMesh(g,n);var d=o.altitudeToVector3(l,l).x,f=o.coordinateToVector3(e.getCenter(),d);return A.getObject3d().position.copy(f),A}return g(r,[{key:"createGeometry",value:function(e,t,r){r=t.altitudeToVector3(r,r).x;var i=t.coordinateToVector3(e.getCenter()),n=e.getShell(),a=[],s=[];n.forEach((function(e){var r=t.coordinateToVector3(e).sub(i);a.push(r),s.push(r.x),s.push(r.y)}));for(var A=s,h=[],l=0,c=0;l<A.length-2;l+=2,c++)0===l?h[0]=Math.sqrt((A[2]-A[0])*(A[2]-A[0])+(A[3]-A[1])*(A[3]-A[1])):h[c]=h[c-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 u=[],g=[],d=h[h.length-1],f=0,p=u.length,v=g.length;f<a.length-1;f++){var m=a[f],I=a[f+1],y=h[f];u[p++]=m.x,u[p++]=m.y,u[p++]=0,g[v++]=0===f?0:h[f-1]/d,g[v++]=0,u[p++]=I.x,u[p++]=I.y,u[p++]=0,g[v++]=y/d,g[v++]=0,u[p++]=m.x,u[p++]=m.y,u[p++]=r,g[v++]=0===f?0:h[f-1]/d,g[v++]=1,u[p++]=m.x,u[p++]=m.y,u[p++]=r,g[v++]=0===f?0:h[f-1]/d,g[v++]=1,u[p++]=I.x,u[p++]=I.y,u[p++]=0,g[v++]=y/d,g[v++]=0,u[p++]=I.x,u[p++]=I.y,u[p++]=r,g[v++]=y/d,g[v++]=1}var C=new o.BufferGeometry;return C.setAttribute("position",new o.BufferAttribute(new Float32Array(u),3)),C.setAttribute("uv",new o.BufferAttribute(new Float32Array(g),2)),C}}]),r}(i.BaseObject),to=function(){function e(t,r,i,n,a){c(this,e),this.threelayer=i,this.map=i.map,this.groupId=n,this.layerClass=a,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=t.data,this.coords=t.coords,this._uniforms={time:{type:"pv2",value:0},color:{type:"uvs",value:new o.Color(this.color)},fadeColor:{type:"uvs",value:new o.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 s=new o.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:o.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:o.DoubleSide});this.interactive=void 0===r.interactive||r.interactive,this.groundWall=new eo(this.coords,{height:r.height||1e3,interactive:this.interactive},s,i,this),n?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this),this.clickFunc=r.clickFunc,this._bindMapEvents()}return g(e,[{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(e){var t=e.target.parent.data;"click"===e.type&&t&&this.clickFunc&&this.clickFunc(t)}},{key:"tick",value:function(e){this._uniforms.time.value+=this.hiz/10*60*e}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,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))}}]),e}(),ro=function(){function e(t,r,i,n,a){if(c(this,e),this.threelayer=i,this.map=i.map,this.layerClass=a,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 o.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 s=new o.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:o.DoubleSide});this.groundWall=new eo(t,{height:r.height||1e3},s,i),n?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this)}}return g(e,[{key:"setUvTransform",value:function(e,t,r,i,n,a,o){this.elements=1}},{key:"tick",value:function(e){this._uniforms.time.value+=60*this.speed*e}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,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())}}]),e}();r.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new r.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},r.ShaderLib.line={uniforms:r.UniformsUtils.merge([r.UniformsLib.common,r.UniformsLib.fog,r.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 io,no,ao=function(e){f(i,e);var t=I(i);function i(e){var n;return c(this,i),(n=t.call(this,{type:"LineMaterial",uniforms:r.UniformsUtils.clone(r.ShaderLib.line.uniforms),vertexShader:r.ShaderLib.line.vertexShader,fragmentShader:r.ShaderLib.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(m(n),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),n.setValues(e),n}return g(i)}(r.ShaderMaterial),oo=function(){function e(t,r,i,n){c(this,e),this.map=i.map,this.threeLayer=i,this.groupId=n,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 ao({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 ao({color:r.lineColor||"rgb(15,159,190)",transparent:!0,linewidth:r.linewidth||1});var a=[];t.features.forEach((function(e){var t=e.geometry;a.push(t)})),this.lineItems=a}var t;return g(e,[{key:"addLine",value:(t=l(s().mark((function e(){var t,r,i=this;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],this.lineItems.forEach((function(e){"Polygon"===e.type?e.coordinates.forEach((function(e){var r=new a.LineString(e);t.push(r)})):e.coordinates.forEach((function(e){var r=new a.LineString(e[0]);t.push(r)}))})),t.length>0&&(r=this.threeLayer.toFatLines(t,{altitude:1,interactive:!1},this.lineMaterial),this.dashed&&(r.zoomChange=function(){if(i.map){var e=i.map.pixelToDistance(1,0);i.lineMaterial.dashScale=18.93/e}}),this.groupId?this.threeLayer.addMesh1(r,this.groupId):this.threeLayer.addMesh(r),this.line=r),e.abrupt("return",this);case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),so={altitude:0},Ao=function(e){f(r,e);var t=I(r);function r(e,i,n,s){var A;c(this,r),i=a.Util.extend({layer:s},so,i),(A=t.call(this))._initOptions(i),A.height=i.height||50;for(var h=1/0,l=1/0,u=-1/0,g=-1/0,d=0;d<e.length;d++){var f=e[d].getCenter();h=Math.min(h,f.x),l=Math.min(l,f.y),u=Math.max(u,f.x),g=Math.max(g,f.y)}var p=new a.Coordinate((h+u)/2,(l+g)/2),v=s.coordinateToVector3(p),m=s.altitudeToVector3(A.height,A.height).x,I=[];A._geometriesAttributes=[],A._colorMap={};for(var y=0;y<e.length;y++){var C=G(v,e[y],s,m),E=C.attributes.position.array;A._geometriesAttributes[y]={position:{count:E.length/3}},I.push(C)}A._datas=e,A._uniforms={time:{type:"pv2",value:0},color:{type:"uvs",value:new o.Color("#0099FF")},fadeColor:{type:"uvs",value:new o.Color("#000")},opacity:{type:"pv2",value:A.opacity},num:{type:"pv2",value:5},hiz:{type:"pv2",value:.15}},new o.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:o.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:o.DoubleSide});var B=new o.MeshBasicMaterial({side:o.DoubleSide,transparent:!0,opacity:.5,depthTest:!1,color:"blue"});A._createMesh(I[0],B);var w=s.coordinateToVector3(p,0);return A.getObject3d().position.copy(w),A._setPickObject3d(),A._init(),A}return g(r,[{key:"_init",value:function(){var e=this,t=this.getLayer().getPick();this.on("add",(function(){t.add(e.pickObject3d)})),this.on("remove",(function(){t.remove(e.pickObject3d)}))}},{key:"_setPickObject3d",value:function(){if(this._colorMap){for(var e=this.getObject3d().geometry.clone(),t=this.getLayer().getPick(),r=this._geometriesAttributes.length,i=function(e){for(var t=e.length,r=0,i=0;i<t;i++)r+=e[i].position.count;return new Float32Array(3*r)}(this._geometriesAttributes),n=0,a=0;a<r;a++){var s=t.getColor(),A=s.getHex();this._colorMap[A]=a;var h=this._geometriesAttributes[a].position.count;this._datas[a].colorIndex=A;for(var l=0;l<h;l++)i[n]=s.r,i[n+1]=s.g,i[n+2]=s.b,n+=3}e.setAttribute("pickColor",new o.BufferAttribute(i,3,!0));var c=new o.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:o.DoubleSide,transparent:!0}),u=t.getColor().getHex(),g=new o.Mesh(e,c);g.position.copy(this.getObject3d().position),g._colorIndex=u,this.setPickObject3d(g)}}},{key:"getSelectMesh",value:function(){return console.log(this._datas[this.index]),this._datas[this.index]}},{key:"identify",value:function(e){return this.picked}}]),r}(i.BaseObject),ho=function(){function e(t,r,i,n,a){c(this,e),this.map=i.map,this.threeLayer=i,this.groupId=n,this.layerClass=a;var o=[];t.features.forEach((function(e){var t=e.geometry;o.push(t)})),this.lineItems=o}var t;return g(e,[{key:"addLine",value:(t=l(s().mark((function e(){var t,r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],this.lineItems.forEach((function(e){"Polygon"===e.type?t.push(e):e.coordinates.forEach((function(e){var r=new a.Polygon(e);t.push(r)}))})),r=new Ao(t,{},null,this.threeLayer),this.groupId?this.threeLayer.addMesh1(r,this.groupId):this.threeLayer.addMesh(r);case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),lo=new r.Box3,co=new r.Vector3,uo=function(e){f(i,e);var t=I(i);function i(){var e;c(this,i),(e=t.call(this)).isLineSegmentsGeometry=!0,e.type="LineSegmentsGeometry";return e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new r.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)),e.setAttribute("uv",new r.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return g(i,[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var i=new r.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new r.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new r.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var i=new r.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new r.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new r.InterleavedBufferAttribute(i,3,3)),this}},{key:"fromWireframeGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromMesh",value:function(e){return this.fromWireframeGeometry(new r.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegments",value:function(e){var t=e.geometry;return this.setPositions(t.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new r.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),lo.setFromBufferAttribute(t),this.boundingBox.union(lo))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new r.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var n=0,a=0,o=e.count;a<o;a++)co.fromBufferAttribute(e,a),n=Math.max(n,i.distanceToSquared(co)),co.fromBufferAttribute(t,a),n=Math.max(n,i.distanceToSquared(co));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(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}]),i}(r.InstancedBufferGeometry),go=new r.Vector3,fo=new r.Vector3,po=new r.Vector4,vo=new r.Vector4,mo=new r.Vector4,Io=new r.Vector3,yo=new r.Matrix4,Co=new r.Line3,Eo=new r.Vector3,Bo=new r.Box3,wo=new r.Sphere,Qo=new r.Vector4;function xo(e,t,r){return Qo.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),Qo.multiplyScalar(1/Qo.w),Qo.x=no/r.width,Qo.y=no/r.height,Qo.applyMatrix4(e.projectionMatrixInverse),Qo.multiplyScalar(1/Qo.w),Math.abs(Math.max(Qo.x,Qo.y))}var bo=function(e){f(i,e);var t=I(i);function i(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new uo,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ao({color:16777215*Math.random()});return c(this,i),(e=t.call(this,r,n)).isLineSegments2=!0,e.type="LineSegments2",e}return g(i,[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,n=new Float32Array(2*t.count),a=0,o=0,s=t.count;a<s;a++,o+=2)go.fromBufferAttribute(t,a),fo.fromBufferAttribute(i,a),n[o]=0===o?0:n[o-1],n[o+1]=n[o]+go.distanceTo(fo);var A=new r.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new r.InterleavedBufferAttribute(A,1,0)),e.setAttribute("instanceDistanceEnd",new r.InterleavedBufferAttribute(A,1,1)),this}},{key:"raycast",value:function(e,t){var i=this.material.worldUnits,n=e.camera;null!==n||i||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');var a=void 0!==e.params.Line2&&e.params.Line2.threshold||0;io=e.ray;var o,s=this.matrixWorld,A=this.geometry,h=this.material;(no=h.linewidth+a,null===A.boundingSphere&&A.computeBoundingSphere(),wo.copy(A.boundingSphere).applyMatrix4(s),i)?o=.5*no:o=xo(n,Math.max(n.near,wo.distanceToPoint(io.origin)),h.resolution);if(wo.radius+=o,!1!==io.intersectsSphere(wo)){var l;if(null===A.boundingBox&&A.computeBoundingBox(),Bo.copy(A.boundingBox).applyMatrix4(s),i)l=.5*no;else l=xo(n,Math.max(n.near,Bo.distanceToPoint(io.origin)),h.resolution);Bo.expandByScalar(l),!1!==io.intersectsBox(Bo)&&(i?function(e,t){for(var i=e.matrixWorld,n=e.geometry,a=n.attributes.instanceStart,o=n.attributes.instanceEnd,s=0,A=Math.min(n.instanceCount,a.count);s<A;s++){Co.start.fromBufferAttribute(a,s),Co.end.fromBufferAttribute(o,s),Co.applyMatrix4(i);var h=new r.Vector3,l=new r.Vector3;io.distanceSqToSegment(Co.start,Co.end,l,h),l.distanceTo(h)<.5*no&&t.push({point:l,pointOnLine:h,distance:io.origin.distanceTo(l),object:e,face:null,faceIndex:s,uv:null,uv2:null})}}(this,t):function(e,t,i){var n=t.projectionMatrix,a=e.material.resolution,o=e.matrixWorld,s=e.geometry,A=s.attributes.instanceStart,h=s.attributes.instanceEnd,l=Math.min(s.instanceCount,A.count),c=-t.near;io.at(1,mo),mo.w=1,mo.applyMatrix4(t.matrixWorldInverse),mo.applyMatrix4(n),mo.multiplyScalar(1/mo.w),mo.x*=a.x/2,mo.y*=a.y/2,mo.z=0,Io.copy(mo),yo.multiplyMatrices(t.matrixWorldInverse,o);for(var u=0,g=l;u<g;u++)if(po.fromBufferAttribute(A,u),vo.fromBufferAttribute(h,u),po.w=1,vo.w=1,po.applyMatrix4(yo),vo.applyMatrix4(yo),!(po.z>c&&vo.z>c)){if(po.z>c){var d=po.z-vo.z,f=(po.z-c)/d;po.lerp(vo,f)}else if(vo.z>c){var p=vo.z-po.z,v=(vo.z-c)/p;vo.lerp(po,v)}po.applyMatrix4(n),vo.applyMatrix4(n),po.multiplyScalar(1/po.w),vo.multiplyScalar(1/vo.w),po.x*=a.x/2,po.y*=a.y/2,vo.x*=a.x/2,vo.y*=a.y/2,Co.start.copy(po),Co.start.z=0,Co.end.copy(vo),Co.end.z=0;var m=Co.closestPointToPointParameter(Io,!0);Co.at(m,Eo);var I=r.MathUtils.lerp(po.z,vo.z,m),y=I>=-1&&I<=1,C=Io.distanceTo(Eo)<.5*no;if(y&&C){Co.start.fromBufferAttribute(A,u),Co.end.fromBufferAttribute(h,u),Co.start.applyMatrix4(o),Co.end.applyMatrix4(o);var E=new r.Vector3,B=new r.Vector3;io.distanceSqToSegment(Co.start,Co.end,B,E),i.push({point:B,pointOnLine:E,distance:io.origin.distanceTo(B),object:e,face:null,faceIndex:u,uv:null,uv2:null})}}}(this,n,t))}}}]),i}(r.Mesh),So=function(e){f(r,e);var t=I(r);function r(){var e;return c(this,r),(e=t.call(this)).isLineGeometry=!0,e.type="LineGeometry",e}return g(r,[{key:"setPositions",value:function(e){for(var t=e.length-3,i=new Float32Array(2*t),n=0;n<t;n+=3)i[2*n]=e[n],i[2*n+1]=e[n+1],i[2*n+2]=e[n+2],i[2*n+3]=e[n+3],i[2*n+4]=e[n+4],i[2*n+5]=e[n+5];return C(p(r.prototype),"setPositions",this).call(this,i),this}},{key:"setColors",value:function(e){for(var t=e.length-3,i=new Float32Array(2*t),n=0;n<t;n+=3)i[2*n]=e[n],i[2*n+1]=e[n+1],i[2*n+2]=e[n+2],i[2*n+3]=e[n+3],i[2*n+4]=e[n+4],i[2*n+5]=e[n+5];return C(p(r.prototype),"setColors",this).call(this,i),this}},{key:"fromLine",value:function(e){var t=e.geometry;return this.setPositions(t.attributes.position.array),this}}]),r}(uo),ko=function(e){f(r,e);var t=I(r);function r(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new So,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ao({color:16777215*Math.random()});return c(this,r),(e=t.call(this,i,n)).isLine2=!0,e.type="Line2",e}return g(r)}(bo),Mo={altitude:0,height:10},_o=function(e){f(r,e);var t=I(r);function r(e,i,n,o){var s;c(this,r),i=a.Util.extend({},Mo,i,{layer:o,coordinate:e}),s=t.call(this);var A=i,h=A.altitude,l=A.height;s._initOptions(i),s.map=o.map;var u=o.altitudeToVector3(l,l).x;s.beginSizeZoom=i.beginSizeZoom||3,s.endSizeZoom=i.endSizeZoom||12,s.spanSizeZoom=s.endSizeZoom-s.beginSizeZoom,s.stepSize=1/(s.endSizeZoom-s.beginSizeZoom+1);var g=[];g.push(0,0,u),g.push(0,0,0);var d=new So;d.setPositions(g),s.object3d=new ko(d,n),s.object3d.computeLineDistances(),s.object3d.scale.set(1,1,1),s.object3d.__parent=m(s);var f=o.distanceToVector3(h,h).x,p=o.coordinateToVector3(e,f);return s.getObject3d().position.copy(p),i.closeZoomChange||(s.zoomChange=function(){var e=s.getMap();if(e){var t=e.pixelToDistance(1,0);d.attributes.instanceStart.data.array[2]=u*t*s._getRate(),d.attributes.instanceStart.needsUpdate=!0}}),s}return g(r,[{key:"_getRate",value:function(){var e=this.map.getZoom()-this.beginSizeZoom;return(e=e>this.spanSizeZoom?this.spanSizeZoom:e)*this.stepSize+this.stepSize}}]),r}(i.BaseObject),To=function(){function e(t,r,i,n){var a=this;c(this,e),0!=t.length?(this.map=i.map,this.threeLayer=i,this.groupId=n,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=[],t.forEach((function(e){var t;t=a.dashed?new ao({color:e.color||"#35FFAC",transparent:!0,linewidth:r.linewidth||4,dashed:!0,defines:{USE_DASH:""},dashScale:a.dashScale,dashSize:a.dashSize,gapSize:a.gapSize}):new ao({color:e.color||"#35FFAC",linewidth:r.lineWidth||4,dashed:!1,transparent:!0,opacity:r.opacity||1}),a._setMaterialRes(i,t);var n=new _o([e.longitude,e.latitude],{height:e.height||a.height,interactive:!1,beginSizeZoom:r.beginSizeZoom||9,endSizeZoom:r.endSizeZoom||16,closeZoomChange:a.closeZoomChange},t,i);n.object3d.renderOrder=a.renderOrder,a.dashed&&(n.zoomChange=function(){if(a.map){var e=a.map.pixelToDistance(1,0);t.dashScale=18.93/e}}),a.isGradient&&(t.onBeforeCompile=function(e){e.vertexShader=e.vertexShader.replace("uniform float linewidth;","\n varying vec3 vPos;\n uniform float linewidth;\n "),e.vertexShader=e.vertexShader.replace("void main() {","\n void main() {\n vPos = position;\n "),e.fragmentShader=e.fragmentShader.replace("#include <common>","\n varying vec3 vPos;\n #include <common>\n "),e.fragmentShader=e.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!==e.visible&&!1===e.visible&&n.hide(),a.meshs.push(n)})),n?this.threeLayer.addMesh1(this.meshs,this.groupId):this.threeLayer.addMesh(this.meshs),this.dataItems=t):console.error("需要绘制的点位数量为0")}return g(e,[{key:"_setMaterialRes",value:function(e,t){var r=e.getMap().getSize(),i=r.width,n=r.height;t.resolution.set(i,n)}},{key:"_getRate",value:function(){var e=this.map.getZoom()-this.beginSizeZoom;return(e=e>this.spanSizeZoom?this.spanSizeZoom:e)*this.stepSize+this.stepSize}},{key:"_bindMapEvents",value:function(e){e&&e.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setPointEvent",value:function(e){"click"===e.type&&this.callback&&this.callback(e.target.data)}},{key:"show",value:function(){this.meshs.forEach((function(e){e.show()}))}},{key:"hide",value:function(){this.meshs.forEach((function(e){e.hide()}))}},{key:"pointShowHideByCode",value:function(e,t,r){for(var i=1/0,n=1/0,o=-1/0,s=-1/0,A=0;A<this.dataItems.length;A++){var h=this.dataItems[A];e.includes(h.code)?(i=Math.min(i,this.dataItems[A].longitude),n=Math.min(n,this.dataItems[A].latitude),o=Math.max(o,this.dataItems[A].longitude),s=Math.max(s,this.dataItems[A].latitude),h.visibility=1):h.visibility=.1}this.updateByVisibility(),t&&this.map.fitExtent(new a.Extent(i,n,o,s),r||0)}},{key:"updateByVisibility",value:function(){var e=this;this.meshs.forEach((function(t,r){.1===e.dataItems[r].visibility?t.hide():t.show()}))}},{key:"dispose",value:function(){var e=this;this.meshs.forEach((function(t){e.groupId?e.threeLayer.removeMesh1(t,e.groupId):e.threeLayer.removeMesh(t),t.object3d.geometry&&t.object3d.geometry.dispose(),t.object3d.material&&t.object3d.material.dispose()}))}}]),e}(),Do={altitude:0,height:0},Lo=function(e){f(r,e);var t=I(r);function r(e,i,n,s){var A;c(this,r),n=a.Util.extend({},Do,n,{layer:s}),A=t.call(this);var h=n,l=h.width,u=h.height,g=h.altitude;A._initOptions(n);var d=new o.PlaneGeometry(l,u);A._createMesh(d,i);var f=s.distanceToVector3(g,g).x,p=s.coordinateToVector3(e,f);return A.getObject3d().position.copy(p),A}return g(r)}(i.BaseObject),Ro=function(){function e(t,r,i,n,s,A,h){var l=this;c(this,e),this.threelayer=s,this.map=s.map,this.layerClass=A,this.groupId=h,this.millsec=n.millsec||1e3,this.duration=n.duration||75;var u=t.split(","),g=r.split(","),d=parseFloat(u[0]),f=parseFloat(u[1]),p=parseFloat(g[0]),v=parseFloat(g[1]),m=new a.Extent(d,f,p,v),I=1/0,y=1/0,C=-1/0,E=-1/0;[[d,f],[d,v],[p,v],[p,f]].forEach((function(e){var t=l.threelayer.coordinateToVector3(e),r=t.x,i=t.y;I=Math.min(r,I),y=Math.min(i,y),C=Math.max(r,C),E=Math.max(i,E)}));var B=Math.abs(C-I),w=Math.abs(E-y);i.length>1&&ce.generateGifTexture(i,n.width,n.height).then((function(e){l.texture=e.texture,l.annie=new $(e.texture,e.colNum,e.rowNum,i.length,l.duration,e.colNum==e.rowNum);var t=new o.MeshBasicMaterial({map:e.texture,transparent:!0,opacity:void 0!==n.opacity?parseFloat(n.opacity):1}),r=new Lo(m.getCenter(),t,{width:B,height:w,interactive:!1},s);l.groupId?l.threelayer.addMesh1(r,l.groupId):l.threelayer.addMesh(r),l.imgObj=r,l.layerClass.updatables.push(l)}))}return g(e,[{key:"show",value:function(){var e;null===(e=this.imgObj)||void 0===e||e.show()}},{key:"hide",value:function(){var e;null===(e=this.imgObj)||void 0===e||e.hide()}},{key:"tick",value:function(e){var t;null===(t=this.annie)||void 0===t||t.update(this.millsec*e)}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,1)}},{key:"dispose",value:function(){var e;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===(e=this.texture)||void 0===e||e.dispose()}}]),e}(),Fo={radius:50,altitude:0},Uo=function(e){f(r,e);var t=I(r);function r(e,i,n,s){var A;c(this,r),i=a.Util.extend({},Fo,i,{layer:s}),A=t.call(this),i.altitude,A._initOptions(i);var h=U(e),l=s.coordinateToVector3(h),u=[];e.forEach((function(e){var t=s.coordinateToVector3(e);t.sub(l),u.push(t)}));var g=new o.CatmullRomCurve3(u),d=s.distanceToVector3(i.radius,i.radius).x,f=new o.TubeGeometry(g,2,d,20,!1);return A._createMesh(f,n),A.parent=null,A.getObject3d().position.set(l.x,l.y,d/2),A}return g(r)}(i.BaseObject),Go=function(){function e(t,r,i,n){c(this,e),this.threelayer=i,this.map=i.map,this.groupId=n;var a=new o.MeshMatcapMaterial({color:r.color||"red",side:o.DoubleSide});this.m=a;var s=new Uo(t,{radius:r.radius||2},a,i);s.parent=this,this.groupId?this.threelayer.addMesh1(s,this.groupId):this.threelayer.addMesh(s),this.mesh=s}return g(e,[{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)}}]),e}(),No={radius:100,altitude:0},Oo=function(e){f(r,e);var t=I(r);function r(e,i,n,o,s){var A;c(this,r),i=a.Util.extend({},No,i,{layer:s,coordinate:e}),(A=t.call(this))._initOptions(i);var h=i.altitude;A.object3d=new ko(n,o),A.object3d.computeLineDistances(),A.object3d.scale.set(1,1,1),A.object3d.__parent=m(A);var l=s.distanceToVector3(h,h).x,u=s.coordinateToVector3(e,l);return A.getObject3d().position.copy(u),A}return g(r)}(i.BaseObject),Po={altitude:0,height:0},Ho=function(e){f(r,e);var t=I(r);function r(e,i,n,s){var A;c(this,r),n=a.Util.extend({},Po,n,{layer:s}),A=t.call(this);var h=n.altitude;A._initOptions(n);var l=n.scaleFactor||1,u=[],g=new o.ConeGeometry(1*l,2*l,10);g.translate(0,2.5*l,0),u.push(g);var d=new o.CylinderGeometry(.4*l,.6*l,3*l,10);u.push(d);var f=k(u);f.computeVertexNormals(),A._createMesh(f,i);var p=s.distanceToVector3(h,h).x,v=s.coordinateToVector3(e,p);return A.getObject3d().position.copy(v),A}return g(r)}(i.BaseObject),Vo=function(){function e(t,r,i,n,s){c(this,e),this.threelayer=i,this.map=i.map,this.layerClass=n,this.groupId=s;var A=void 0===r.lineFlag||!1!==r.lineFlag,h=r.heightDiv||4,l=r.pointsLen||20,u=r.arrowColor||"rgb(0,255,255)",g=r.arrowNum||5;this.speedFactor=r.speedFactor||2e-4,this.material=null,this.curve=null,this.meshs=[],this.arrows=[],this.up=new o.Vector3(0,1,0),this.axis=new o.Vector3,A&&(this.lineMaterial=new ao({color:r.lineColor||"red",transparent:!0,linewidth:r.linewidth||4}),this._setMaterialRes(i,this.lineMaterial));var d=new o.MeshBasicMaterial({color:u,side:o.DoubleSide,transparent:!0});this.material=d;var f=new a.LineString(t),p=P(f)/h,v=i.distanceToVector3(p,p).x,m=t[0],I=t[1],y=[m[0]/2+I[0]/2,m[1]/2+I[1]/2],C=i.coordinateToVector3(f.getCenter()),E=i.coordinateToVector3(m).sub(C),B=i.coordinateToVector3(I).sub(C),w=i.coordinateToVector3(y,v).sub(C),Q=new o.CatmullRomCurve3([E,w,B],!1,"catmullrom");this.curve=Q,this.centerPt=C;var x=Q.getPoints(l),b=[];x.forEach((function(e){b.push(e.x,e.y,e.z)}));var S=new So;S.setPositions(b);var k=new Oo(f.getCenter(),{interactive:!1},S,this.lineMaterial,i);this.meshs.push(k),this.ArrowNum=g;var M=1/this.ArrowNum;this.addSpan=Math.floor(100*M)/100;for(var _=0;_<this.ArrowNum;_++){var T=new Ho(t[0],d,{scaleFactor:r.scaleFactor||1},i);T.object3d.renderOrder=r.arrowOrder||1,this.arrows.push(T)}this.groupId?(this.threelayer.addMesh1(k,this.groupId),this.threelayer.addMesh1(this.arrows,this.groupId)):(this.threelayer.addMesh(k),this.threelayer.addMesh(this.arrows)),this.layerClass.updatables.push(this)}var t;return g(e,[{key:"tick",value:function(e){if(this.curve)for(var t=this.speedFactor*performance.now(),r=0;r<this.ArrowNum;r++){var i=(t+this.addSpan*r)%1,n=this.curve.getPointAt(i).add(this.centerPt);this.arrows[r].getObject3d().position.copy(n);var a=this.curve.getTangentAt(i);this.axis.crossVectors(this.up,a).normalize();var o=Math.acos(this.up.dot(a));this.arrows[r].getObject3d().quaternion.setFromAxisAngle(this.axis,o)}}},{key:"_setMaterialRes",value:function(e,t){var r=e.getMap().getSize(),i=r.width,n=r.height;t.resolution.set(i,n)}},{key:"loadTexture",value:(t=l(s().mark((function e(t){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.promiseToDoSomething(t);case 2:return r=e.sent,this.texture=new o.CanvasTexture(r.canvas),this.material=new o.MeshBasicMaterial({map:this.texture,side:o.DoubleSide,transparent:!0}),e.abrupt("return",this.material);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"promiseToDoSomething",value:function(e){return new Promise((function(t){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=e,r.textAlign="center",r.textBaseline="middle",r.font="48px sans-serif",r.fillText("➡︎",0,0),setTimeout((function(){return t(r)}),4)}))}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,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(e){e.object3d.geometry&&e.object3d.geometry.dispose()}))),this.arrows&&(this.groupId?this.threelayer.removeMesh1(this.arrows,this.groupId):this.threelayer.removeMesh(this.arrows),this.arrows.forEach((function(e){e.object3d.geometry&&e.object3d.geometry.dispose()}))),this.material&&this.material.dispose(),this.lineMaterial&&this.lineMaterial.dispose(),this.texture&&this.texture.dispose(),this.curve&&delete this.curve}}]),e}(),jo=function(){function e(t,r,i,n,s){var A=this;c(this,e),this.threelayer=i,this.map=i.map,this.layerClass=n,this.groupId=s;var h=r.heightDiv||4,l=r.pointsLen||20;this.speedFactor=r.speedFactor||.01,this.sum=0,this.meshs=[];var u=new a.LineString(t),g=P(u)/h,d=i.distanceToVector3(g,g).x,f=t[0],p=t[1],v=[f[0]/2+p[0]/2,f[1]/2+p[1]/2],m=i.coordinateToVector3(u.getCenter()),I=i.coordinateToVector3(f).sub(m),y=i.coordinateToVector3(p).sub(m),C=i.coordinateToVector3(v,d).sub(m);this.lineMaterialDash=new ao({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 ao({color:r.lineColor||"red",transparent:!0,linewidth:r.lineWidth||2,opacity:r.lineOpacity||.4}),this._setMaterialRes(i,this.lineMaterialDash),this._setMaterialRes(i,this.lineMaterial);var E=new o.CatmullRomCurve3([I,C,y],!1,"catmullrom").getPoints(l),B=[];E.forEach((function(e){B.push(e.x,e.y,e.z)}));var w=new So;w.setPositions(B);var Q=new Oo(u.getCenter(),{interactive:!1},w,this.lineMaterialDash,i),x=new Oo(u.getCenter(),{interactive:!1},w,this.lineMaterial,i),b=x.object3d.geometry.attributes.instanceDistanceEnd.array;this.len=b[b.length-1],this.dur=this.len/3,this.lineMaterialDash.onBeforeCompile=function(e){e.uniforms.actionRatio={value:0},e.uniforms.lineLength={value:A.len},e.fragmentShader=e.fragmentShader.replace("#include <common>","\n uniform float actionRatio;\n uniform float lineLength;\n #include <common>\n "),e.fragmentShader=e.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=e},this.groupId?(this.threelayer.addMesh1(x,this.groupId),this.threelayer.addMesh1(Q,this.groupId)):(this.threelayer.addMesh(x),this.threelayer.addMesh(Q)),this.meshs.push(x),this.meshs.push(Q),this.layerClass.updatables.push(this)}return g(e,[{key:"tick",value:function(e){this.shaderDash&&(this.sum+=this.dur*e*this.speedFactor,this.sum%=1,this.shaderDash.uniforms.actionRatio.value=this.sum)}},{key:"setPath",value:function(e,t,r,i){for(var n=e.geometry.attributes.position,a=new o.CatmullRomCurve3([t,i,r],!1,"catmullrom").getPoints(20),s=0;s<=19;s++){var A=a[s];n.setXYZ(s,A.x,A.y,A.z)}n.needsUpdate=!0,e.computeLineDistances(),e.geometry.attributes.lineDistance.needsUpdate=!0,e.material.dashSize=20}},{key:"_setMaterialRes",value:function(e,t){var r=e.getMap().getSize(),i=r.width,n=r.height;t.resolution.set(i,n)}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,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(e){e.object3d.geometry&&e.object3d.geometry.dispose()}))),this.lineMaterialDash&&this.lineMaterialDash.dispose(),this.lineMaterial&&this.lineMaterial.dispose()}}]),e}();i.ThreeLayer.prototype._recursionMesh=function(e){for(;e&&e.parent!==this.getScene()&&!e.parent.customType;)e=e.parent;return e},i.ThreeLayer.prototype.identify=function(e,t){var r=this;if(!e)return console.error("coordinate is null,it should be Coordinate"),[];if(Array.isArray(e)&&(e=new a.Coordinate(e)),!(e instanceof a.Coordinate))return console.error("coordinate type is error,it should be Coordinate"),[];var i=this.getMap().coordToContainerPoint(e);this._containerPoint=i;var n=i.x,s=i.y;this._initRaycaster(),this.fire("identify",{coordinate:e,options:t});var A=this._raycaster,h=this._mouse,l=this.getCamera(),c=this.getScene(),u=this.getMap().getSize();if(!c)return[];var g=u.width,d=u.height;h.x=n/g*2-1,h.y=-s/d*2+1,A.setFromCamera(h,l),A.layers&&A.layers.enableAll&&A.layers.enableAll(),function(e,t){e.linePrecision=t}(A,this._getLinePrecision(this.getMap().getResolution()));var f=[],p=[];c.children.forEach((function(e){var t=e.__parent;if(t&&t.getOptions){var r=t;r.getOptions().interactive&&r.isVisible()&&(r.identify&&a.Util.isFunction(r.identify)?p.push(r):f.push(e))}else(e instanceof o.Mesh||e instanceof o.Group)&&(e.customType?e.children.forEach((function(e){var t=e.__parent;if(t&&t.getOptions){var r=t;r.getOptions().interactive&&r.isVisible()&&(r.identify&&a.Util.isFunction(r.identify)?p.push(r):f.push(e))}})):f.push(e))}));var v=[],m=A.intersectObjects(f,!0);m&&Array.isArray(m)&&m.length&&(v=m.map((function(e){var t=e.object,i=e.instanceId,n=(t=r._recursionMesh(t)||{}).__parent||t;return n.faceIndex=e.faceIndex,n.index=e.index,n.intersect=e,a.Util.isNumber(i)&&(n.instanceId=i),n}))),this.renderPickScene(),p.length&&p.forEach((function(t){t.identify(e)&&v.push(t)}));for(var I=v.length,y=0;y<I;y++)if(v[y])for(var C=y+1;C<I;C++)v[y]===v[C]&&v.splice(C,1);var E=(t=a.Util.extend({},t)).count;return a.Util.isNumber(E)&&E>0?v.slice(0,E):v},i.ThreeLayer.prototype._zoomend=function(){var e=this.getScene();if(e){var t=this.getMap().getZoom();e.children.forEach((function(e){if(e.customType)e.children.forEach((function(e){var r=e.__parent;if(r&&r.getOptions){var i=r;i.zoomChange&&a.Util.isFunction(i.zoomChange)&&i.zoomChange(t);var n=i.getMinZoom(),o=i.getMaxZoom();t<n||t>o?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):n<=t&&t<=o&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}));else{var r=e.__parent;if(r&&r.getOptions){var i=r;i.zoomChange&&a.Util.isFunction(i.zoomChange)&&i.zoomChange(t);var n=i.getMinZoom(),o=i.getMaxZoom();t<n||t>o?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):n<=t&&t<=o&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}}))}},i.ThreeLayer.prototype.addMesh1=function(e,t){var r=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return this;Array.isArray(e)||(e=[e]);var a=this.getScene(),o=void 0;if(t&&(o=a.getObjectByProperty("customId",t)),e.forEach((function(e){if(e instanceof i.BaseObject){var t;if(o)o.add(e.getObject3d());else console.log("组不存在,销毁创建的对象"),null===(t=e.parent)||void 0===t||t.dispose();e.isAdd||(e.isAdd=!0,e.options.layer=r,e._fire("add",{target:e}))}})),this._zoomend(),n){var s=this._getRenderer();s&&s.setToRedraw()}return this},i.ThreeLayer.prototype.removeMesh1=function(e,t){var r=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return this;Array.isArray(e)||(e=[e]);var s=this.getScene(),A=s.getObjectByProperty("customId",t);if(e.forEach((function(e){if(e instanceof i.BaseObject){A?A.remove(e.getObject3d()):s.remove(e.getObject3d()),e.isAdd&&(e.isAdd=!1,e._fire("remove",{target:e})),e._animation&&a.Util.isFunction(e._animation)&&delete r._animationBaseObjectMap[e.getObject3d().uuid];var t=r._delayMeshes;if(t.length)for(var n=0,h=t.length;n<h;n++)if(t[n]===e){t.splice(n,1);break}}else e instanceof o.Object3D&&s.remove(e)})),n){var h=this._getRenderer();h&&h.setToRedraw()}return this};var qo=function(){function e(t,r){var n=this;c(this,e),this.map=r,this.animationId=null,this.updatables=[];var a=D();this.threeLayer=new i.ThreeLayer(a,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new o.Clock;var s=function e(){var t,r;(n.threeLayer._needsUpdate=!n.threeLayer._needsUpdate,n.threeLayer._needsUpdate)&&(null===(t=n.threeLayer)||void 0===t||null===(r=t.getRenderer())||void 0===r||r.clearCanvas(),n.threeLayer.renderScene());var i,a=n.clock.getDelta(),o=b(n.updatables);try{for(o.s();!(i=o.n()).done;){i.value.tick(a)}}catch(e){o.e(e)}finally{o.f()}n.animationId=requestAnimationFrame(e)};this.threeLayer.prepareToDraw=function(e,t,r){var i=new o.DirectionalLight(16777215);i.position.set(0,-10,10).normalize(),t.add(i),s()},this.threeLayer.addTo(r),this.layerId=a,this.layerName=t,this.dirty=!1,this.initFlag=!1}var t;return g(e,[{key:"createGroup",value:(t=l(s().mark((function e(t){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.threeLayer.getScene()){e.next=4;break}return e.abrupt("return",this.getIdByName(this.threeLayer.getScene(),t));case 4:if(!0!==this.initFlag){e.next=10;break}return e.next=7,L(200);case 7:case 13:return e.abrupt("return",this.getIdByName(this.threeLayer.getScene(),t));case 10:return this.initFlag=!0,e.next=13,this.prepareToDraw();case 14:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"removeGroup",value:function(e){if(this.threeLayer.getScene()){var t=this.threeLayer.getScene().getObjectByName(e);this.threeLayer.getScene().remove(t)}}},{key:"getIdByName",value:function(e,t){var r=e.getObjectByName(t);return r||(r=new Zn(e,t)),r.customId}},{key:"setGroupVisible",value:function(e,t){this.threeLayer.getScene().getObjectByProperty("customId",e).visible=t}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var e=D();this.threeLayer.setId(e),this.layerId=e}}},{key:"setVisible",value:function(e,t){this.threeLayer&&(!0===e?(this.threeLayer.show(),t&&t()):(this.threeLayer.hide(),t&&t()))}},{key:"prepareToDraw",value:function(){var e=this,t=function t(){var r,i;(e.threeLayer._needsUpdate=!e.threeLayer._needsUpdate,e.threeLayer._needsUpdate)&&(null===(r=e.threeLayer)||void 0===r||null===(i=r.getRenderer())||void 0===i||i.clearCanvas(),e.threeLayer.renderScene());var n,a=e.clock.getDelta(),o=b(e.updatables);try{for(o.s();!(n=o.n()).done;){n.value.tick(a)}}catch(e){o.e(e)}finally{o.f()}e.animationId=requestAnimationFrame(t)};return new Promise((function(r){e.threeLayer.prepareToDraw=function(e,i,n){var a=new o.DirectionalLight(16777215);a.position.set(0,-10,10).normalize(),i.add(a),i.add(new o.AmbientLight(16777215)),t(),r()}}))}},{key:"drawRadar",value:function(e,t,r){var i=this;return new Promise((function(n){if(i.threeLayer.getScene()){var a=new J(e,t,r||{},i.threeLayer,i);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new J(e,t,r||{},i.threeLayer,i);n(a)}))}))}},{key:"drawSector",value:function(e,t,r){var i=this;return new Promise((function(n){if(i.threeLayer.getScene()){var a=new W(e,t,r||{},i.threeLayer,i);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new W(e,t,r||{},i.threeLayer,i);n(a)}))}))}},{key:"drawSectorImg",value:function(e,t,r){var i=this;return new Promise((function(n){if(i.threeLayer.getScene()){var a=new ee(e,t,r||{},i.threeLayer,i);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new ee(e,t,r||{},i.threeLayer,i);n(a)}))}))}},{key:"drawImage",value:function(e,t,r,i,n){var a=this;return new Promise((function(o){if(a.threeLayer.getScene()){var s=new j(e,t,r,i,a.threeLayer,n);o(s)}else a.initFlag=!0,a.prepareToDraw().then((function(){var s=new j(e,t,r,i,a.threeLayer,n);o(s)}))}))}},{key:"drawShock",value:function(e,t){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var n=new ie(e,t||{},r.threeLayer,r);i(n)}else r.initFlag=!0,r.prepareToDraw().then((function(){var n=new ie(e,t||{},r.threeLayer,r);i(n)}))}))}},{key:"drawPlaneMarker",value:function(e,t,r){var i=this;return new Promise((function(n){if(i.threeLayer.getScene()){var a=null;e.length>0?(a=new be(e,t,i.threeLayer,r)).addPoint().then((function(){n(a)})):n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=null;e.length>0?(a=new be(e,t,i.threeLayer,r)).addPoint().then((function(){n(a)})):n(a)}))}))}},{key:"draw3dtiles",value:function(e,t){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var n=new Kn(e,t,r.threeLayer,r);i(n)}else r.initFlag=!0,r.prepareToDraw().then((function(){var n=new Kn(e,t,r.threeLayer,r);i(n)}))}))}},{key:"createGltfLoadTool",value:function(e){var t=this;return new Promise((function(r){if(t.threeLayer.getScene()){var i=new Xn(e,t.threeLayer);r(i)}else t.initFlag=!0,t.prepareToDraw().then((function(){var i=new Xn(e,t.threeLayer);r(i)}))}))}},{key:"drawFbxModel",value:function(e,t,r,i){var n=this;return new Promise((function(a){if(n.threeLayer.getScene()){var o=new Za(e,t,r,n.threeLayer,i);a(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Za(e,t,r,n.threeLayer,i);a(o)}))}))}},{key:"drawRippleWall",value:function(e,t,r){var i=this;return new Promise((function(n){if(i.threeLayer.getScene()){var a=new to(e,t||{},i.threeLayer,r,i);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new to(e,t||{},i.threeLayer,r,i);n(a)}))}))}},{key:"drawRippleWallImg",value:function(e,t,r){var i=this;return new Promise((function(n){if(i.threeLayer.getScene()){var a=new ro(e,t||{},i.threeLayer,r,i);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new ro(e,t||{},i.threeLayer,r,i);n(a)}))}))}},{key:"drawPolyline",value:function(e,t,r){var i=this;return new Promise((function(n){if(i.threeLayer.getScene()){var a=new oo(e,t,i.threeLayer,r);a.addLine().then((function(){n(a)}))}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new oo(e,t,i.threeLayer,r);a.addLine().then((function(){n(a)}))}))}))}},{key:"drawLinePlane",value:function(e,t,r){var i=this;return new Promise((function(n){if(i.threeLayer.getScene()){var a=new ho(e,t,i.threeLayer,r,i);a.addLine().then((function(){n(a)}))}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new ho(e,t,i.threeLayer,r,i);a.addLine().then((function(){n(a)}))}))}))}},{key:"drawVerticalFatLine",value:function(e,t,r){var i=this;return new Promise((function(n){if(i.threeLayer.getScene()){var a=new To(e,t||{},i.threeLayer,r);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new To(e,t||{},i.threeLayer,r);n(a)}))}))}},{key:"drawTube",value:function(e,t,r){var i=this;return new Promise((function(n){if(i.threeLayer.getScene()){var a=new Go(e,t||{},i.threeLayer,r);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new Go(e,t||{},i.threeLayer,r);n(a)}))}))}},{key:"drawPlaneGif",value:function(e,t,r,i,n){var a=this;return new Promise((function(o){if(a.threeLayer.getScene()){var s=new Ro(e,t,r,i||{},a.threeLayer,a,n);o(s)}else a.initFlag=!0,a.prepareToDraw().then((function(){var s=new Ro(e,t,r,i||{},a.threeLayer,a,n);o(s)}))}))}},{key:"drawTripHeight",value:function(e,t,r){var i=this;return new Promise((function(n){if(i.threeLayer.getScene()){var a=new Vo(e,t||{},i.threeLayer,i,r);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new Vo(e,t||{},i.threeLayer,i,r);n(a)}))}))}},{key:"drawTripLine",value:function(e,t,r){var i=this;return new Promise((function(n){if(i.threeLayer.getScene()){var a=new jo(e,t||{},i.threeLayer,i,r);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new jo(e,t||{},i.threeLayer,i,r);n(a)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var e=this.threeLayer.getMeshes();this.threeLayer.clear(),e.forEach((function(e){}));var t=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),i=this.threeLayer.getPick(),n=i.pickingTexture;i.pickingScene;var a=this.threeLayer.getRenderer();r.remove(t),t=null,r=null,n.dispose(),n=null,a.context.dispose(),a.context.forceContextLoss(),a.context=null,a.remove(),a=null,this.map.removeLayer(this.threeLayer)}}]),e}(),zo=function(){function e(t,r,i,n){c(this,e),this.map=n,this.geometry=null,this.selectGeometry=null,this.isEndSelect=!1,this.drawTool=new a.DrawTool({mode:t,symbol:{lineColor:i.lineColor||"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:i.polygonFill||"#E40D56",polygonOpacity:.2}}).addTo(this.map).enable(),this._bindEvent(),this._drawEnd=r,this.mode=t,this.toolLayer=new a.VectorLayer(a.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()))),i.zIndex&&this.toolLayer.setZIndex(i.zIndex),this.type="drawTool"}return g(e,[{key:"getZIndex",value:function(){this.toolLayer&&this.toolLayer.getZIndex()}},{key:"setZIndex",value:function(e){this.toolLayer&&this.toolLayer.setZIndex(e)}},{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(e){if(this.disableTool(),this.toolLayer){var t=this.toolLayer.identify(e.coordinate);this.selectGeometry&&(this.selectGeometry.endEdit(),this._changeSymbol(!1)),t&&(this.selectGeometry=t[0]),this.selectGeometry&&this._changeSymbol(!0)}}},{key:"_closeMapEvent",value:function(){this.map.off("click",this._selectGeometry,this)}},{key:"_changeSymbol",value:function(e){e?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 e=this.toolLayer.getGeometries();if(e.length<1)return;this.toolLayer.removeGeometry(e[e.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(e){this.toolLayer&&this.toolLayer.addGeometry(e.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(e.geometry.getCoordinates(),e.geometry.getRadius()):this._drawEnd(e.geometry.getCoordinates())),this.geometry=e.geometry}},{key:"disableTool",value:function(){this.drawTool.disable()}},{key:"clearGeometry",value:function(){this.toolLayer&&this.toolLayer.clear()}},{key:"setMode",value:function(e,t){this._drawEnd&&delete this._drawEnd,this._drawEnd=t,this.drawTool.setMode(e).enable(),this.mode=e}},{key:"startEdit",value:function(){this.disableTool(),this.selectGeometry&&this.selectGeometry.startEdit()}},{key:"endEdit",value:function(e){this.selectGeometry&&(this.selectGeometry.endEdit(),e&&("Circle"===this.mode?e(this.selectGeometry.getCoordinates(),this.geometry.getRadius()):e(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}}]),e}();e.Arrow3D=Ho,e.LineGeometry=So,e.LineMaterial=ao,e.TextureAnimator=$,e.drawTool=zo,e.gisCommon=ce,e.gltfLoadClass=Xn,e.imgClass=j,e.layerClass=qo,e.line2Object=Oo,e.lineLength=P,e.planeGifClass=Ro,e.planeMark=be,e.planeSectorClass=ee,e.radarClass=J,e.rippleWallClass=to,e.sectorClass=W,e.shockClass=ie,e.sleep=L,e.tileClass=Kn,e.tripHeight=Vo,e.tripLineClass=jo,e.tubeClass=Go,e.verticalFatLineClass=To}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("maptalks"),require("three"),require("maptalks.three")):"function"==typeof define&&define.amd?define(["exports","maptalks","three","maptalks.three"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).mapcore=t.mapcore||{},t.maptalks,t.THREE,t.maptalks)}(this,(function(t,e,r,n){function i(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var o=i(e),s=i(r);function a(){a=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function c(t,e,r,i){var o=e&&e.prototype instanceof p?e:p,s=Object.create(o.prototype),a=new b(i||[]);return n(s,"_invoke",{value:E(t,r,a)}),s}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function p(){}function g(){}function A(){}var d={};l(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(B([])));v&&v!==e&&r.call(v,o)&&(d=v);var m=A.prototype=p.prototype=Object.create(d);function _(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function i(n,o,s,a){var u=h(t[n],t,o);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"==typeof c&&r.call(c,"__await")?e.resolve(c.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(c).then((function(t){l.value=t,s(l)}),(function(t){return i("throw",t,s,a)}))}a(u.arg)}var o;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return o=o?o.then(n,n):n()}})}function E(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return S()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=x(s,r);if(a){if(a===f)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=h(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function x(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var i=h(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,f;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function C(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 w(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function b(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function B(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:S}}function S(){return{value:void 0,done:!0}}return g.prototype=A,n(m,"constructor",{value:A,configurable:!0}),n(A,"constructor",{value:g,configurable:!0}),g.displayName=l(A,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,A):(t.__proto__=A,l(t,u,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},_(I.prototype),l(I.prototype,s,(function(){return this})),t.AsyncIterator=I,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var s=new I(c(e,r,n,i),o);return t.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},_(m),l(m,u,"Generator"),l(m,o,(function(){return this})),l(m,"toString",(function(){return"[object Generator]"})),t.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}},t.values=B,b.prototype={constructor:b,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},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 e=this;function n(r,n){return s.type="throw",s.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var a=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;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,f):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),f},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),w(r),f}},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;w(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:B(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function u(t){return u="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},u(t)}function l(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 c(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function s(t){l(o,n,i,s,a,"next",t)}function a(t){l(o,n,i,s,a,"throw",t)}s(void 0)}))}}function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f(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,S(n.key),n)}}function p(t,e,r){return e&&f(t.prototype,e),r&&f(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function g(t,e,r){return(e=S(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function A(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&&y(t,e)}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}function y(t,e){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},y(t,e)}function v(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function m(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=d(t);if(e){var i=d(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 v(t)}(this,r)}}function _(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=d(t)););return t}function I(){return I="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=_(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},I.apply(this,arguments)}function E(t,e,r,n){return E="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,r,n){var i,o=_(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 g(n,e,r);return!0},E(t,e,r,n)}function x(t,e,r,n,i){if(!E(t,e,r,n||t)&&i)throw new TypeError("failed to set property");return r}function C(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)||w(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 w(t,e){if(t){if("string"==typeof t)return b(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)?b(t,e):void 0}}function b(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 B(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=w(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 S(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 M(t){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=null!==t[0].index,i=new Set(Object.keys(t[0].attributes)),o=new Set(Object.keys(t[0].morphAttributes)),s={},a={},u=t[0].morphTargetsRelative,l=new r.BufferGeometry,c=0,h=0;h<t.length;++h){var f=t[h],p=0;if(n!==(null!==f.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 g in f.attributes){if(!i.has(g))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+g+'" attribute exists among all geometries, or in none of them.'),null;void 0===s[g]&&(s[g]=[]),s[g].push(f.attributes[g]),p++}if(p!==i.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(u!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(var A in f.morphAttributes){if(!o.has(A))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;void 0===a[A]&&(a[A]=[]),a[A].push(f.morphAttributes[A])}if(e){var d=void 0;if(n)d=f.index.count;else{if(void 0===f.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=f.attributes.position.count}l.addGroup(c,d,h),c+=d}}if(n){for(var y=0,v=[],m=0;m<t.length;++m){for(var _=t[m].index,I=0;I<_.count;++I)v.push(_.getX(I)+y);y+=t[m].attributes.position.count}l.setIndex(v)}for(var E in s){var x=L(s[E]);if(!x)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+E+" attribute."),null;l.setAttribute(E,x)}for(var C in a){var w=a[C][0].length;if(0===w)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[C]=[];for(var b=0;b<w;++b){for(var B=[],S=0;S<a[C].length;++S)B.push(a[C][S][b]);var M=L(B);if(!M)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+C+" morphAttribute."),null;l.morphAttributes[C].push(M)}}return l}function L(t){for(var e,n,i,o=0,s=0;s<t.length;++s){var a=t[s];if(a.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(void 0===e&&(e=a.array.constructor),e!==a.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===n&&(n=a.itemSize),n!==a.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===i&&(i=a.normalized),i!==a.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;o+=a.array.length}for(var u=new e(o),l=0,c=0;c<t.length;++c)u.set(t[c].array,l),l+=t[c].array.length;return new r.BufferAttribute(u,n,i)}var N=Math.PI/180,T=6378137;function R(){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 D(t){return new Promise((function(e){return setTimeout(e,t)}))}function Q(t,e){return e.split("").forEach((function(e){-1===t.indexOf(e)&&(t+=e)})),t}function P(t,e){return 256*(t=s.MathUtils.clamp(Math.floor(t),0,255))+(e=s.MathUtils.clamp(Math.floor(e),0,255))}function k(t){for(var e=1/0,r=1/0,n=-1/0,i=-1/0,s=0,a=t.length;s<a;s++){var u=t[s],l=u.coordinate,c=u.lnglat,h=u.lnglats,f=u.xy,p=u.xys,g=l||c||h||f||p||t[s],A=void 0,d=void 0;Array.isArray(g)?(A=g[0],d=g[1]):g instanceof o.Coordinate&&(A=g.x,d=g.y),e=Math.min(e,A),r=Math.min(r,d),n=Math.max(n,A),i=Math.max(i,d)}return new o.Coordinate((e+n)/2,(r+i)/2)}function O(t,e,r,n){var i=t,o=e.getShell(),a=[];o.forEach((function(t){var e=r.coordinateToVector3(t).sub(i);a.push(e)}));for(var u=[],l=0,c=a.length;l<c;l++)if(l!==a.length-1){var h=new Float32Array(12),f=a[l],p=a[l+1];h[0]=f.x,h[1]=f.y,h[2]=n,h[6]=f.x,h[7]=f.y,h[8]=0,h[3]=p.x,h[4]=p.y,h[5]=n,h[9]=p.x,h[10]=p.y,h[11]=0;var g=new s.BufferGeometry;g.setAttribute("position",new s.BufferAttribute(h,3)),g.setIndex([0,2,1,2,3,1]),u.push(g)}var A=new Float32Array(12),d=a[a.length-1],y=a[0];A[0]=d.x,A[1]=d.y,A[2]=n,A[6]=d.x,A[7]=d.y,A[8]=0,A[3]=y.x,A[4]=y.y,A[5]=n,A[9]=y.x,A[10]=y.y,A[11]=0;var v=new s.BufferGeometry;v.setAttribute("position",new s.BufferAttribute(A,3)),v.setIndex([0,2,1,2,3,1]),u.push(v);var m=M(u);return m.computeVertexNormals(),m}function F(t){return t*N}function G(t,e){if(!t||!e)return 0;Array.isArray(t)||(t=t.toArray()),Array.isArray(e)||(e=e.toArray());var r=F(t[1]),n=F(e[1]),i=r-n,o=F(t[0])-F(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*=T,Math.round(1e5*r)/1e5}function U(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+=G(e[n],e[n+1]);return r}var q={altitude:0,imageWidth:512,imageHeight:512,texture:null},j=function(t){A(r,t);var e=m(r);function r(t,n,i,a){var u;h(this,r);var l=n=o.Util.extend({},q,n),c=l.altitude;l.imageHeight,l.imageWidth,t instanceof o.Extent||(t=new o.Extent(t));var f=t,p=f.xmin,g=f.ymin,A=f.xmax,d=f.ymax,y=1/0,v=1/0,m=-1/0,_=-1/0;[[p,g],[p,d],[A,d],[A,g]].forEach((function(t){var e=a.coordinateToVector3(t),r=e.x,n=e.y;y=Math.min(r,y),v=Math.min(n,v),m=Math.max(r,m),_=Math.max(n,_)}));var I=Math.abs(m-y),E=Math.abs(_-v),x=new s.PlaneGeometry(I,E);(u=e.call(this))._initOptions(n),u._createMesh(x,i);var C=a.distanceToVector3(c,c).x,w=a.coordinateToVector3(t.getCenter(),C);return u.getObject3d().position.copy(w),u.parent=null,u.type="Image",u}return p(r)}(n.BaseObject),V=function(){function t(e,r,n,i,a,u){var l=this;h(this,t),this.threelayer=a,this.map=a.map,this.groupId=u,this.textureLoader=new s.TextureLoader;var c=e.split(","),f=r.split(","),p=parseFloat(c[0]),g=parseFloat(c[1]),A=parseFloat(f[0]),d=parseFloat(f[1]),y=i.maxZoom||11,v=i.renderOrder||0,m=i.opacity||1,_=i.minZoom||3,I=new o.Extent(p,g,A,d);this.xmin_g=p,this.ymin_g=g,this.xmax_g=A,this.ymax_g=d,this.cacheTextureFlag=i.cacheTextureFlag,this.cacheTexture={},this.textureLoader.load(n,(function(t){var e=new s.MeshBasicMaterial({map:t,transparent:!0,opacity:m}),r=new j(I,{imageWidth:512,imageHeight:512,maxZoom:y,minZoom:_,interactive:void 0!==i.interactive&&i.interactive},e,l.threelayer);r.object3d.renderOrder=v,l.imgMesh=r,l.imgMesh.parent=l,l.m=e,l.texture=t,l.groupId?l.threelayer.addMesh1(l.imgMesh,l.groupId):l.threelayer.addMesh(l.imgMesh),i.opacityItems&&i.opacityItems.length>0&&!isNaN(i.opacityItems[0])&&!isNaN(i.opacityItems[1])&&i.opacityItems[0]>3&&i.opacityItems[0]<=18&&i.opacityItems[1]>=0&&i.opacityItems[1]<=1&&(l.opacityItems=i.opacityItems,l._bindMapEvents(),l._viewChange()),l.cacheTextureFlag&&void 0===l.cacheTexture[n]&&(l.cacheTexture[n]=t)}))}return p(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]),a=parseFloat(e.righttop[0]),u=parseFloat(e.righttop[1]);if(n!==this.xmin_g||i!==this.ymin_g||a!==this.xmax_g||u!==this.ymax_g){var l=new o.Extent(n,i,a,u),c=1/0,h=1/0,f=-1/0,p=-1/0;[[n,i],[n,u],[a,u],[a,i]].forEach((function(t){var e=r.threelayer.coordinateToVector3(t),n=e.x,i=e.y;c=Math.min(n,c),h=Math.min(i,h),f=Math.max(n,f),p=Math.max(i,p)}));for(var g=Math.abs(f-c),A=Math.abs(p-h),d=new s.PlaneBufferGeometry(g,A),y=d.attributes.position.array,v=this.imgMesh.object3d.geometry.attributes.position.array,m=0;m<v.length;m++)v[m]=y[m];this.imgMesh.object3d.geometry.attributes.position.needsUpdate=!0;var _=this.threelayer.coordinateToVector3(l.getCenter(),0);this.imgMesh.getObject3d().position.copy(_),d.dispose(),this.xmin_g=n,this.ymin_g=i,this.xmax_g=a,this.ymax_g=u}}this.cacheTextureFlag?void 0===this.cacheTexture[t]?this.textureLoader.load(t,(function(e){e.magFilter=s.NearestFilter,e.minFilter=s.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=s.NearestFilter,t.minFilter=s.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}(),z={interactive:!1,altitude:0,imageWidth:512,imageHeight:512,texture:null},Y=function(t){A(r,t);var e=m(r);function r(t,n,i,a,u){var l;h(this,r);var c=(i=o.Util.extend({},z,i)).altitude,f=u.distanceToVector3(n,n).x,p=new s.CircleGeometry(f,32);(l=e.call(this))._initOptions(i),l._createMesh(p,a);var g=u.distanceToVector3(c,c).x,A=u.coordinateToVector3(t,g);return l.getObject3d().position.copy(A),l.parent=null,l.type="radarObject",l}return p(r)}(n.BaseObject),H=function(){function t(e,r,n,i,o,a){h(this,t),this.threelayer=i,this.map=i.map,this.layerClass=o,this.groupId=a,this.imgUrl=n.imgUrl,this.loader=new s.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var u=new s.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:s.DoubleSide,transparent:!0});this.radar=new Y(e,r,{},u,i),this.radar.parent=this,this.groupId?this.threelayer.addMesh1(this.radar,this.groupId):this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return p(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}(),X={radius:100,altitude:0},J=function(t){A(r,t);var e=m(r);function r(t,n,i,a){var u;h(this,r),n=o.Util.extend({},X,n,{layer:a,coordinate:t}),(u=e.call(this))._initOptions(n);var l=n,c=l.altitude,f=l.radius,p=a.distanceToVector3(f,f).x,g=n.thetaStart||0,A=n.thetaLength||90,d=new s.CircleGeometry(p,128,g*Math.PI/180,A*Math.PI/180);u._createMesh(d,i);var y=a.distanceToVector3(c,c).x,v=a.coordinateToVector3(t,y);return u.getObject3d().position.copy(v),u}return p(r)}(n.BaseObject),W=function(){function t(e,r,n,i,o){h(this,t),this.threelayer=i,this.map=i.map,this.layerClass=o;var a=n.thetaLength||90,u=n.rotation||0,l=a/2;this.imgUrl=n.imgUrl,this.loader=new s.TextureLoader,this.texture=this.loader.load(this.imgUrl);var c=u-l;c=c<0?c+360:c,this._uniforms={map:{value:this.texture},time:{value:0}};var f=new s.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:s.DoubleSide,transparent:!0,depthTest:!1});this.sector=new J(e,{thetaStart:c,thetaLength:n.thetaLength,radius:r},f,i),this.threelayer.addMesh(this.sector)}return p(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"dispose",value:function(){}}]),t}(),K={altitude:0,height:0},Z=function(t){A(r,t);var e=m(r);function r(t,n,i,a){var u;h(this,r),i=o.Util.extend({},K,i,{layer:a}),u=e.call(this);var l=i,c=l.width,f=l.height,p=l.altitude;u._initOptions(i);var g=new s.PlaneGeometry(c,f);g.computeBoundingBox();var A=new s.Mesh(g,n);u._createGroup(),u.getObject3d().add(A);var d=a.distanceToVector3(p,p).x,y=a.coordinateToVector3(t,d);return A.position.set(0,g.boundingBox.max.y,0),u.getObject3d().position.copy(y),u}return p(r)}(n.BaseObject);function $(t,e,r,n,i,o){this.tilesHorizontal=e,this.tilesVertical=r,this.numberOfTiles=n,t.wrapS=t.wrapT=s.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 tt=function(){function t(e,r,n,i,o){var a=this;h(this,t),this.threelayer=i,this.map=i.map,this.layerClass=o;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,c=u/2,f=i.distanceToVector3(r,r).x,p=Math.sin(c*Math.PI/180)*f*2,g=void 0===n.flag;this.imgUrl=n.imgUrl,this.textureLoader=new s.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){a.texture=t,a.annie=new $(t,a.tilesHoriz,a.tilesVert,a.numTiles,a.duration,g);var r=new s.MeshBasicMaterial({transparent:!0,map:t,side:s.DoubleSide,depthTest:!1});a.imgObj=new Z(e,r,{width:p,height:f},i),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 p(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}(),et={radius:100,altitude:0},rt=function(t){A(r,t);var e=m(r);function r(t,n,i,a){var u;h(this,r),n=o.Util.extend({},et,n,{layer:a}),u=e.call(this);var l=n,c=l.width;l.height;var f=l.altitude;u._initOptions(n);var p=new s.CircleGeometry(c,32);u._createMesh(p,i);var g=a.distanceToVector3(f,f).x,A=a.coordinateToVector3(t,g);return u.getObject3d().position.copy(A),u}return p(r)}(n.BaseObject),nt=function(){function t(e,r,n,i){var o=this;h(this,t),this.threelayer=n,this.map=n.map,this.layerClass=i,this.time=0,n.coordinateToVector3(e,0),this.imgUrl=r.imgUrl,this.textureLoader=new s.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){o.texture=t,o._uniforms={impactPosition:{value:new s.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:o.texture}};var r=new s.ShaderMaterial({uniforms:o._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:s.DoubleSide,transparent:!0,depthTest:!1}),i=new rt(e,{width:2,height:2},r,n);o.threelayer.addMesh(i),o.layerClass.updatables.push(o)}))}return p(t,[{key:"tick",value:function(t){this.time+=.2*t,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),t}(),it=6371008.8,ot={centimeters:100*it,centimetres:100*it,degrees:it/111325,feet:3.28084*it,inches:39.37*it,kilometers:it/1e3,kilometres:it/1e3,meters:it,metres:it,miles:it/1609.344,millimeters:1e3*it,millimetres:1e3*it,nauticalmiles:it/1852,radians:1,yards:1.0936*it},st={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/it,yards:1.0936133},at={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 ut(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 lt(t,e,r){switch(t){case"Point":return ct(e).geometry;case"LineString":return gt(e).geometry;case"Polygon":return ft(e).geometry;case"MultiPoint":return vt(e).geometry;case"MultiLineString":return yt(e).geometry;case"MultiPolygon":return mt(e).geometry;default:throw new Error(t+" is invalid")}}function ct(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(!Lt(t[0])||!Lt(t[1]))throw new Error("coordinates must contain numbers");return ut({type:"Point",coordinates:t},e,r)}function ht(t,e,r){return void 0===r&&(r={}),dt(t.map((function(t){return ct(t,e)})),r)}function ft(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 ut({type:"Polygon",coordinates:t},e,r)}function pt(t,e,r){return void 0===r&&(r={}),dt(t.map((function(t){return ft(t,e)})),r)}function gt(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 ut({type:"LineString",coordinates:t},e,r)}function At(t,e,r){return void 0===r&&(r={}),dt(t.map((function(t){return gt(t,e)})),r)}function dt(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 yt(t,e,r){return void 0===r&&(r={}),ut({type:"MultiLineString",coordinates:t},e,r)}function vt(t,e,r){return void 0===r&&(r={}),ut({type:"MultiPoint",coordinates:t},e,r)}function mt(t,e,r){return void 0===r&&(r={}),ut({type:"MultiPolygon",coordinates:t},e,r)}function _t(t,e,r){return void 0===r&&(r={}),ut({type:"GeometryCollection",geometries:t},e,r)}function It(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 Et(t,e){void 0===e&&(e="kilometers");var r=ot[e];if(!r)throw new Error(e+" units is invalid");return t*r}function xt(t,e){void 0===e&&(e="kilometers");var r=ot[e];if(!r)throw new Error(e+" units is invalid");return t/r}function Ct(t,e){return bt(xt(t,e))}function wt(t){var e=t%360;return e<0&&(e+=360),e}function bt(t){return 180*(t%(2*Math.PI))/Math.PI}function Bt(t){return t%360*Math.PI/180}function St(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 Et(xt(t,e),r)}function Mt(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=at[e];if(!n)throw new Error("invalid original units");var i=at[r];if(!i)throw new Error("invalid final units");return t/n*i}function Lt(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function Nt(t){return!!t&&t.constructor===Object}function Tt(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(!Lt(t))throw new Error("bbox must only contain numbers")}))}function Rt(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 Dt=Object.freeze({__proto__:null,earthRadius:it,factors:ot,unitsFactors:st,areaFactors:at,feature:ut,geometry:lt,point:ct,points:ht,polygon:ft,polygons:pt,lineString:gt,lineStrings:At,featureCollection:dt,multiLineString:yt,multiPoint:vt,multiPolygon:mt,geometryCollection:_t,round:It,radiansToLength:Et,lengthToRadians:xt,lengthToDegrees:Ct,bearingToAzimuth:wt,radiansToDegrees:bt,degreesToRadians:Bt,convertLength:St,convertArea:Mt,isNumber:Lt,isObject:Nt,validateBBox:Tt,validateId:Rt});function Qt(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 Pt(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 kt(t){if(t.length>1&&Lt(t[0])&&Lt(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return kt(t[0]);throw new Error("coordinates must only contain numbers")}function Ot(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 Ft(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 Gt(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 Ut(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 jt=Object.freeze({__proto__:null,getCoord:Qt,getCoords:Pt,containsNumber:kt,geojsonType:Ot,featureOf:Ft,collectionOf:Gt,getGeom:Ut,getType:qt});function Vt(t,e,r){void 0===r&&(r={});var n=Qt(t),i=Qt(e),o=Bt(i[1]-n[1]),s=Bt(i[0]-n[0]),a=Bt(n[1]),u=Bt(i[1]),l=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(u);return Et(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),r.units)}function zt(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=Qt(t),i=Ut(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(Yt(n,a[l][0],r.ignoreBoundary)){for(var c=!1,h=1;h<a[l].length&&!c;)Yt(n,a[l][h],!r.ignoreBoundary)&&(c=!0),h++;c||(u=!0)}return u}function Yt(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"),Xt=function(){function t(){h(this,t),this.type="gisCommon"}var e;return p(t,null,[{key:"getTexture",value:function(t,e,r,n){var i=t.getContext("2d");i.drawImage(e,r,n);var o=new s.Texture(i.getImageData(0,0,t.width,t.height));return o.minFilter=s.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 a=new s.Texture(o.getImageData(0,0,Ht.width,Ht.height));return a.minFilter=s.LinearFilter,a.generateMipmaps=!1,a.needsUpdate=!0,a}},{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*Vt({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,a=new s.Vector3(n.x,n.y+o,0).sub(n).normalize(),u=((i.clone().cross(a).z<0?-1:1)*Math.acos(i.dot(a))*180/Math.PI).toFixed(2);(u=parseFloat(u))<0&&(u=u+180+180);var l=parseFloat(e.begin),c=parseFloat(e.end);if(l>c){if(u>=l||u<=c)return!0}else if(u>=l&&u<=c)return!0;return!1}return!1}},{key:"containsCoordinate1",value:function(t,e){return 1e3*Vt({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 zt({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 o.Coordinate&&(r=t.x,n=t.y);var i=e.xmin,s=e.ymin,a=e.xmax,u=e.ymax;return i<=r&&r<=a&&s<=n&&n<=u}},{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 s.Texture(n.getImageData(0,0,Ht.width,Ht.height));return i.magFilter=s.NearestFilter,i.minFilter=s.NearestFilter,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,a=0,u=0;u<e.length;u++){if(o<e[u]){a=e[u];break}a=1024}Ht.width=Ht.height=a;for(var l=Ht.getContext("2d"),c=0,h=0,f=[],p=0;p<n;p++){for(var g=5*(p+1)+p*c,A=0;A<n;A++){var d=5*(A+1)+A*t[h].w;if("img"===t[h].type){var y=(t[h].w-t[h].iw)/2,v=(t[h].h-t[h].ih)/2;l.drawImage(t[h].src,d+y,g+v,t[h].iw,t[h].ih)}else if("txt"===t[h].type)l.fillStyle=t[h].color,"#fff"===t[h].color?(l.font="lighter "+t[h].size+"px Microsoft YaHei",l.fillText(t[h].src,d+t[h].offx,g+t[h].offy),l.strokeStyle=t[h].color,l.strokeText(t[h].src,d+t[h].offx,g+t[h].offy)):(l.font="normal "+t[h].size+"px Microsoft YaHei",l.fillText(t[h].src,d+t[h].offx,g+t[h].offy));else{var m=(t[h].w-t[h].iw)/2,_=(t[h].h-t[h].ih)/2,I=t[h].offx||0,E=t[h].offy||0;l.drawImage(t[h].src,d+m+I,g+_+E,t[h].iw,t[h].ih)}if(f.push({w:t[h].w,h:t[h].h,u:d/a,v:g/a}),c=Math.max(c,t[h].h),(h+=1)>=t.length)break}if(h>=t.length)break}var x=new s.Texture(l.getImageData(0,0,Ht.width,Ht.height));return x.minFilter=s.LinearFilter,x.generateMipmaps=!1,x.needsUpdate=!0,{xys:f,texture:x,textureSize:a}}},{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,a=0,u=0;u<e.length;u++){if(o<e[u]){a=e[u];break}a=1024}Ht.width=Ht.height=a;for(var l=Ht.getContext("2d"),c=0,h=0,f=0,p=[],g=0;g<n;g++){for(var A=5*(g+1)+g*c,d=0;d<n;d++){var y=5*(d+1)+f;if("img"===t[h].type){var v=(t[h].w-t[h].iw)/2,m=(t[h].h-t[h].ih)/2;l.drawImage(t[h].src,y+v,A+m,t[h].iw,t[h].ih)}else if("txt"===t[h].type)l.fillStyle=t[h].color,"#fff"===t[h].color?(l.font="lighter "+t[h].size+"px Microsoft YaHei",l.fillText(t[h].src,y+t[h].offx,A+t[h].offy),l.strokeStyle=t[h].color,l.strokeText(t[h].src,y+t[h].offx,A+t[h].offy)):(l.font="normal "+t[h].size+"px Microsoft YaHei",l.fillText(t[h].src,y+t[h].offx,A+t[h].offy));else{var _=(t[h].w-t[h].iw)/2,I=(t[h].h-t[h].ih)/2,E=t[h].offx||0,x=t[h].offy||0;l.drawImage(t[h].src,y+_+E,A+I+x,t[h].iw,t[h].ih)}if(p.push({w:t[h].w,h:t[h].h,u:y/a,v:A/a}),c=Math.max(c,t[h].h),f+=t[h].w,(h+=1)>=t.length)break}if(h>=t.length)break}var C=new s.Texture(l.getImageData(0,0,Ht.width,Ht.height));return C.minFilter=s.LinearFilter,C.generateMipmaps=!1,C.needsUpdate=!0,{xys:p,texture:C,textureSize:a}}},{key:"generateGifTexture",value:(e=c(a().mark((function e(r,n,i){var o,u,l,c,h,f,p,g,A,d,y,v,m;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=Math.sqrt(r.length),u=parseInt(o),l=u,o>u&&(l+=1),(c=document.createElement("canvas")).width=u*n,c.height=l*i,h=c.getContext("2d"),f=0,p=0;case 10:if(!(p<o)){e.next=32;break}g=p*i,A=0,d=0;case 14:if(!(d<o)){e.next=27;break}return y=A,e.next=18,t.addImageProcessImage(r[f]);case 18:if(v=e.sent,h.drawImage(v,y,g,n,i),A+=n,!((f+=1)>=r.length)){e.next=24;break}return e.abrupt("break",27);case 24:d++,e.next=14;break;case 27:if(!(f>=r.length)){e.next=29;break}return e.abrupt("break",32);case 29:p++,e.next=10;break;case 32:return(m=new s.Texture(h.getImageData(0,0,c.width,c.height))).generateMipmaps=!1,m.needsUpdate=!0,e.abrupt("return",{texture:m,colNum:u,rowNum:l});case 36:case"end":return e.stop()}}),e)}))),function(t,r,n){return e.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,a=0,u=0;u<e.length;u++){if(o<e[u]){a=e[u];break}a=1024}Ht.width=Ht.height=a;for(var l=Ht.getContext("2d"),c=0,h=0,f={},p=0;p<n;p++){for(var g=5*(p+1)+p*c,A=0,d=0;d<n;d++){var y=5*(d+1)+A,v=(t[h].w-t[h].iw)/2,m=(t[h].h-t[h].ih)/2;if(l.drawImage(t[h].src,y+v,g+m,t[h].iw,t[h].ih),f[t[h].key]={w:t[h].w,h:t[h].h,u:y/a,v:g/a},c=Math.max(c,t[h].h),A+=t[h].w,(h+=1)>=t.length)break}if(h>=t.length)break}var _=new s.Texture(l.getImageData(0,0,Ht.width,Ht.height));return _.minFilter=s.LinearFilter,_.generateMipmaps=!1,_.needsUpdate=!0,{xys:f,texture:_,textureSize:a}}},{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 s.Texture(Ht);return o.minFilter=s.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 a=i.width/2,u=i.height/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle="#FFF",o.font="".concat(n.fontsize,"px Arial"),o.fillText(n.txt,a,u);var l=new s.Texture(i);return l.magFilter=s.NearestFilter,l.minFilter=s.NearestFilter,l.needsUpdate=!0,l}},{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 s.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}}]),t}();function Jt(t,e,r,n,i,o,s,a,u,l){var c=t.split("\n"),h=[],f={positionedGlyphs:h,text:t,top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:l,lineCount:c.length};return function(t,e,r,n,i,o,s,a,u){var l=0,c=-17,h=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:c+0,vertical:!1,scale:1,fontStack:u}),l+=i.metrics.advance+a)})),f.length!==g){var r=l-a;h=Math.max(r,h),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,c=r;c<=n;c++)t[c].x-=l}}(f,e,g,f.length-1,p)}l=0,c+=n}));var A=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),d=A.horizontalAlign,y=A.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,d,y,h,n,r.length);var v=c- -17;t.top+=-y*v,t.bottom=t.top+v,t.left+=-d*h,t.right=t.left+h}(f,e,c,i,o,s,0,a,r),!!h.length&&f}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Wt(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 Kt=Zt;function Zt(t,e){this.x=t,this.y=e}Zt.prototype={clone:function(){return new Zt(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}},Zt.convert=function(t){return t instanceof Zt?t:Array.isArray(t)?new Zt(t[0],t[1]):t};var $t={radius:40,altitude:0},te=function(t){A(r,t);var e=m(r);function r(t,n,i,a,u,l,c,f){var p;h(this,r);var g=k(t);p=e.call(this),n=o.Util.extend({center:g,layer:f},$t,n),p._initOptions(n);var A=p.getLayer().getPick();p._colorMap={},p._datas=t,p._childCount=c;var d=f.coordinateToVector3(g);p.glyphMap=u,p.glyphAtlas=l;for(var y=new s.InstancedBufferGeometry,v=new Uint16Array([0,1,2,2,3,0]),m=new Float32Array([0,1,-.5,-.5,1,1,.5,-.5,1,0,.5,.5,0,0,-.5,.5]),_=new s.InstancedBufferAttribute(new Float32Array(4*p._childCount),4,!0),I=new s.InstancedBufferAttribute(new Float32Array(4*p._childCount),4,!0),E=new s.InstancedBufferAttribute(new Float32Array(4*p._childCount),4,!0),x=new s.InstancedBufferAttribute(new Float32Array(4*p._childCount),4,!0),C=new s.InstancedBufferAttribute(new Float32Array(3*p._childCount),3,!0),w=0,b=function(e){var r=t[e],n=r.texts,i=r.markers,o=A.getColor(),s=o.getHex();p._colorMap[s]=e,p._datas[e].colorIndex=s,i&&i.forEach((function(r){if(_.setXYZW(w,r.markerWidth,r.markerHeight,r.markerDx,r.markerDy),I.setXYZW(w,r.u,r.v,-16,16),r.markerColor){var n=P(0,255);x.setXYZW(w,n,0,0,0);var i=p.getColorVector2(r.markerColor,r.markerOpacity);E.setXYZW(w,i[0],i[1],r.w,r.h)}else{var s=P(0,0);x.setXYZW(w,s,0,0,0);var a=p.getColorVector2("#fff",r.markerOpacity);E.setXYZW(w,a[0],a[1],r.w,r.h)}C.setXYZ(w,o.r,o.g,o.b),r.markerIndex=w,w+=1,t[e].childNum+=1})),n&&n.forEach((function(r){var n=p.getColorVector2(r.textColor,r.textOpacity),i=P(255,0);p.buildTextBuffers("".concat(r.text),r.textAnchor,"center",r.textSpacing).forEach((function(s){if(_.setXYZW(w,r.textSize,0,r.textDx,r.textDy),I.setXYZW(w,s[0],s[1],s[2],s[3]),r.textHaloColor){var a=p.getColorVector2(r.textHaloColor,r.textHaloOpacity);E.setXYZW(w,n[0],n[1],a[0],a[1]);var u=r.textHaloRadius;x.setXYZW(w,i,u,0,0)}else E.setXYZW(w,n[0],n[1],0,0),x.setXYZW(w,i,-1.9,0,0);C.setXYZ(w,o.r,o.g,o.b),r.textIndex.push(w),w+=1,t[e].childNum+=1}))}))},B=0;B<t.length;B++)b(B);y.setIndex(new s.Uint16BufferAttribute(v,1)),y.setAttribute("uv_offset",new s.Float32BufferAttribute(m,4,!0)),y.setAttribute("size",_),y.setAttribute("uv_image",I),y.setAttribute("color",E),y.setAttribute("util",x),y.setAttribute("pickingColor",C),p._createInstancedMesh(y,i,p._childCount),p.getObject3d().instanceMatrix.setUsage(s.DynamicDrawUsage);var S=new s.InstancedMesh(y,a,p._childCount);S.instanceMatrix.setUsage(s.DynamicDrawUsage);var M=A.getColor().getHex();S._colorIndex=M,p.setPickObject3d(S);var L=new s.Object3D;w=0,t.forEach((function(e,r){var n=f.coordinateToVector3(e.coordinate);n.sub(d),e.height&&(n.z=f.altitudeToVector3(e.height).x);for(var i=0;i<t[r].childNum;i++)!1===e.visible?L.position.set(-999,-999,0):L.position.set(n.x,n.y,0),L.updateMatrix(),p.getObject3d().setMatrixAt(w,L.matrix),S.setMatrixAt(w,L.matrix),w+=1}));var N=f.altitudeToVector3(n.altitude,n.altitude).x;return d.z=N,p.getObject3d().position.copy(d),S.position.copy(p.getObject3d().position),p.parent=null,p.pickMesh=S,p.threeLayer=f,p.center=d,p._init(),p}return p(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 s.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[P(i.r,i.g),P(o,void 0!==e?e:255)]}},{key:"buildTextBuffers",value:function(t,e,r,n){var i=[],o=[0,0],s=Jt(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 c=l.rect;if(c){var h=l.metrics.advance*a.scale/2,f=r?[a.x+h,a.y]:[0,0],p=r?[0,0]:[a.x+h+e[0],a.y+e[1]],g=(l.metrics.left-4)*a.scale-h+p[0],A=(-l.metrics.top-4)*a.scale+p[1],d=g+c.w*a.scale,y=A+c.h*a.scale,v=new Kt(g,A),m=new Kt(d,A),_=new Kt(g,y),I=new Kt(d,y);o.push({tl:v,tr:m,bl:_,br:I,tex:c,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 s.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(-999,-999,0):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}(n.BaseObject),ee=function(){function t(e,r){h(this,t),this.createImage(e,1,r)}return p(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,c=((n.y+u)*e.width+n.x)*o,h=0;h<i.width*o;h++)a[c+h]=s[l+h];return e}}]),t}();var re=p((function t(e){h(this,t);var r={},n=[];for(var i in e){var o=e[i],s=r[i]={};for(var a in o){var u=o[+a];if(u&&0!==u.bitmap.width&&0!==u.bitmap.height){var l={x:0,y:0,w:u.bitmap.width+2,h:u.bitmap.height+2};n.push(l),s[a]={rect:l,metrics:u.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 ee({width:f||1,height:p||1});for(var A in e){var d=e[A];for(var y in d){var v=d[+y];if(v&&0!==v.bitmap.width&&0!==v.bitmap.height){var m=r[A][y].rect;ee.copy(v.bitmap,g,{x:0,y:0},{x:m.x+1,y:m.y+1},v.bitmap)}}}this.image=g,this.positions=r})),ne={exports:{}};ne.exports=oe,ne.exports.default=oe;var ie=1e20;function oe(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 se(t,e,r,n,i,o){for(var s=0;s<e;s++)ae(t,s,e,r,n,i,o);for(var a=0;a<r;a++)ae(t,a*e,1,e,n,i,o)}function ae(t,e,r,n,i,o,s){var a,u,l,c;for(o[0]=0,s[0]=-ie,s[1]=ie,a=0;a<n;a++)i[a]=t[e+a*r];for(a=1,u=0,l=0;a<n;a++){do{c=o[u],l=(i[a]-i[c]+a*a-c*c)/(a-c)/2}while(l<=s[u]&&--u>-1);o[++u]=a,s[u]=l,s[u+1]=ie}for(a=0,u=0;a<n;a++){for(;s[u+1]<a;)u++;c=o[u],t[e+a*r]=i[c]+(a-c)*(a-c)}}oe.prototype._draw=function(t,e){var r,n,i,o,s,a,u,l,c,h=this.ctx.measureText(t),f=h.width,p=2*this.buffer;e&&this.useMetrics?(s=Math.floor(h.actualBoundingBoxAscent),l=this.buffer+Math.ceil(h.actualBoundingBoxAscent),a=this.buffer,u=this.buffer,r=(n=Math.min(this.size,Math.ceil(h.actualBoundingBoxRight-h.actualBoundingBoxLeft)))+p,i=(o=Math.min(this.size-a,Math.ceil(h.actualBoundingBoxAscent+h.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),c=this.ctx.getImageData(u,a,n,o));var g=new Uint8ClampedArray(r*i);return function(t,e,r,n,i,o,s){o.fill(ie,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 c=(u+a)*e+l+a,h=t.data[4*(u*n+l)+3]/255;if(1===h)o[c]=0,s[c]=ie;else if(0===h)o[c]=ie,s[c]=0;else{var f=Math.max(0,.5-h),p=Math.max(0,h-.5);o[c]=f*f,s[c]=p*p}}}(c,r,i,n,o,this.gridOuter,this.gridInner),se(this.gridOuter,r,i,this.f,this.v,this.z),se(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}}},oe.prototype.draw=function(t){return this._draw(t,!1).data},oe.prototype.drawWithMetrics=function(t){return this._draw(t,!0)};var ue=ne.exports,le={},ce={};var he=function(){function t(e,r,n,i){var o=this;h(this,t);var s=r.pointMinZoom,a=r.pointOrder;if(0!=e.length){var u=[];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=i,"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,e.slice(0,1/0).map((function(t){1*t.longitude>70&&1*t.longitude<138&&1*t.latitude>0&&1*t.latitude<56&&o._bindDataItem(u,t)})),this.textures=null,this.glyphMap=null,this.glyphAtlas=null,this.dataItems=u,this.point=null,this.shader=null,this.minZoom=s||8,this.maxZoom=r.pointMaxZoom||20,this.order=a||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}else console.error("需要绘制的点位数量为0")}var e,r,n,i;return p(t,[{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=Q(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,c=0;c<u.length;c++){var h=u[c];h.imgSrc&&(l+=1,this._putImgToDict(h.imgSrc,h.markerWidth||40,h.markerHeight||40),r.markers.push({markerWidth:1*h.markerWidth||40,markerHeight:1*h.markerHeight||40,markerDx:1*h.markerDx||0,markerDy:1*h.markerDy||0,markerColor:h.markerColor,markerOpacity:1*h.markerOpacity||255,key:h.imgSrc,markerIndex:-1}))}this.childCount+=l}t.push(r)}},{key:"_loadTexture",value:(i=c(a().mark((function t(){var e,r,n,i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],t.t0=a().keys(this.imgDict);case 2:if((t.t1=t.t0()).done){t.next=18;break}if(r=t.t1.value,n=r,!r.includes(".svg")){t.next=12;break}return t.next=8,fetch(r);case 8:return i=t.sent,t.next=11,i.text();case 11:n=t.sent;case 12:return t.next=14,Xt.addImageProcess(n);case 14:o=t.sent,e.push({key:r,src:o,w:this.imgDict[r].width,h:this.imgDict[r].height,iw:this.imgDict[r].width,ih:this.imgDict[r].height}),t.next=2;break;case 18:return t.abrupt("return",Xt.generateTextureOptimize(e));case 19:case"end":return t.stop()}}),t,this)}))),function(){return i.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=le[e];return a||(a=le[e]=new ue(24,3,8,.25,i,o)),ce[e]||(ce[e]={}),ce[e][r]||(ce[e][r]=a.ctx.measureText(r).width),{id:s,bitmap:new ee({width:30,height:30},a.draw(r)),metrics:{width:24,height:24,left:0,top:-5,advance:(t=s,t>=19968&&t<=40959?24:ce[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 re(this.glyphMap)}},{key:"addPoint",value:(n=c(a().mark((function t(){var e,r,n,i,o,u,l,c=this;return a().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 e=t.sent,this.textures||(this.textures=[]),this.textures.push(e.texture),this.initGlyphAtlas(),r=this.glyphAtlas.image,n=r.width,i=r.height,o=r.data,(u=new s.DataTexture(o,n,i)).needsUpdate=!0,u.magFilter=s.LinearFilter,u.minFilter=s.LinearFilter,u.format=s.RedFormat,this.textures.push(u),this.m=this._getRawShaderMaterial(e,u,n,i),this.m.depthTest=!1,this.hasAlign&&(this.m.vertexShader="#define HAS_ALIGN\n"+this.m.vertexShader),this.m_pick=this._getRawShaderMaterial(e,u,n,i),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,e.xys[t.key])}))})),(l=new te(this.dataItems,{minZoom:this.minZoom,maxZoom:this.maxZoom,interactive:this.interactive,altitude:this.altitude},this.m,this.m_pick,this.glyphMap,this.glyphAtlas,this.childCount,this.threeLayer)).zoomChange=function(){c.m.uniforms.cameraToCenterDistance.value=c.map.cameraToCenterDistance,c.m.uniforms.zoomScale.value=c.tileResolution/c.map.getResolution(),c.m_pick.uniforms.cameraToCenterDistance.value=c.map.cameraToCenterDistance,c.m_pick.uniforms.zoomScale.value=c.tileResolution/c.map.getResolution();for(var t=c._getRate(),e=c.point.object3d.geometry.attributes.size.array,r=0,n=0;n<c.dataItems.length;n++){var i=c.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()}c.point.object3d.geometry.attributes.size.needsUpdate=!0,c.zoomChangeCallback&&c.zoomChangeCallback()},this.isToolTip&&l.setToolTip("hello",{showTimeout:0,eventsPropagation:!0,dx:10}),l.object3d.renderOrder=this.order,this.point=l,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()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"_getRawShaderMaterial",value:function(t,e,r,n){return new s.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:s.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:(r=c(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.clickFunc(e);case 2:this.iconFile&&this._addIcon(e);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return r.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:(e=c(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))),function(t){return e.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,s=1/0,a=-1/0,u=-1/0,l=0;l<this.dataItems.length;l++){var c=this.dataItems[l];t.includes(c.code)?(i=Math.min(i,this.dataItems[l].coordinate[0]),s=Math.min(s,this.dataItems[l].coordinate[1]),a=Math.max(a,this.dataItems[l].coordinate[0]),u=Math.max(u,this.dataItems[l].coordinate[1]),c.visible=!0):c.visible=!1}null===(n=this.point)||void 0===n||n.changeVisible(),e&&this.map.fitExtent(new o.Extent(i,s,a,u),r||0)}},{key:"updateByZoom",value:function(){var t=this,e=this.map.getZoom(),r=new s.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}}]),t}();function fe(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 pe=function(){function t(){h(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 p(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),c=Math.max(e*t,l*t),h=Math.min(c,s);h=Math.ceil(h);for(var f=r.splice(0,h),p=0,g=f.length;p<g;p++){var A=f[p];o.get(A)(A),n.delete(A),o.delete(A)}}}},{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}(),ge=function(){function t(){var e=this;h(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 p(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}(),Ae=3,de=4,ye=6378137,ve=6356752.314245179;function me(t){return t===Ae||t===de}function _e(t,e){return t.__lastFrameVisited===e&&t.__used}function Ie(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 Ee(t,e,r){if(Ie(t,e),t.__used=!0,r.markUsed(t),t.__contentEmpty)for(var n=t.children,i=0,o=n.length;i<o;i++)Ee(n[i],e,r)}function xe(t,e,r){if(t.__contentEmpty&&(!t.__externalTileSet||me(t.__loadingState)))for(var n=t.children,i=0,o=n.length;i<o;i++){var s=n[i];s.__depthFromRenderedParent=e,xe(s,e,r)}else r.requestTileContents(t)}function Ce(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++)Ce(o[s],e,r,t,i+1);r&&r(t,n,i)}}function we(t,e){var r=e.stats,n=e.frameCount,i=e.errorTarget,o=e.maxDepth,s=e.loadSiblings,a=e.lruCache,u=e.stopAtEmptyTiles;if(Ie(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,c=t.children,h=0,f=c.length;h<f;h++){var p=we(c[h],e);l=l||p}if(l&&s)for(var g=0,A=c.length;g<A;g++){Ee(c[g],n,a)}return!0}function be(t,e){var r=e.stats,n=e.frameCount;if(_e(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||_e(u,n)}if(o){for(var l=!1,c=!0,h=0,f=i.length;h<f;h++){var p=i[h];if(be(p,e),l=l||p.__wasSetVisible||p.__childrenWereVisible,_e(p,n)){var g=p.__allChildrenLoaded||!p.__contentEmpty&&me(p.__loadingState)||p.__externalTileSet&&p.__loadingState===de;c=c&&g}}t.__childrenWereVisible=l,t.__allChildrenLoaded=c}else t.__isLeaf=!0}}function Be(t,e){var r=e.stats,n=e.frameCount;if(_e(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===Ae?(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,c=!t.__contentEmpty,h=c||t.__externalTileSet,f=me(t.__loadingState)&&h,p=t.__childrenWereVisible,g=t.children,A=t.__allChildrenLoaded;if(l&&c&&t.__depthFromRenderedParent++,l&&!f&&!s.isFull()&&h&&e.requestTileContents(t),(u&&!A&&!p&&f||"ADD"===t.refine&&f)&&(t.__inFrustum&&(t.__visible=!0,r.visible++),t.__active=!0,r.active++),"ADD"!==t.refine&&u&&!A&&f)for(var d=0,y=g.length;d<y;d++){var v=g[d];_e(v,n)&&!s.isFull()&&(v.__depthFromRenderedParent=t.__depthFromRenderedParent+1,xe(v,v.__depthFromRenderedParent,e))}else for(var m=0,_=g.length;m<_;m++){var I=g[m];_e(I,n)&&Be(I,e)}}}function Se(t,e){var r=_e(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!==Ae||(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++){Se(o[s],e)}}}var Me=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},Le=function(t){return 1/(t.__depthFromRenderedParent+1)},Ne=function(){function t(e,r){h(this,t),this.tileSets={},this.rootURL=e,this.fetchOptions={},this.preprocessURL=null;var n=new pe;n.unloadPriorityCallback=Le;var i=new ge;i.maxJobs=4,i.priorityCallback=Me;var o=new ge;o.maxJobs=1,o.priorityCallback=Me,this.lruCache=n,this.downloadQueue=i,this.parseQueue=o,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 p(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.tileSets[this.rootURL];r&&r.root&&Ce(r.root,t,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++,we(i,this),be(i,this),Be(i,this),Se(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,r){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,r+"/").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=e,t.children=t.children||[],t.content&&t.content.uri){var n=fe(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===e?(t.__depth=0,t.refine=t.refine||"REPLACE"):(t.__depth=e.__depth+1,t.refine=t.refine||e.refine)}},{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:"resetFailedTiles",value:function(){var t=this.stats;0!==t.failed&&(this.traverse((function(t){t.__loadingState===de&&(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(),Ce(e.root,(function(t,e){return r.preprocessNode(t,e,o)}),null,n,n?n.__depth:0),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 c=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=de):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=Ae,t.children.push(e.root))})).catch(c):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=fe(t.content.uri);return e.parseTile(n,t,r)}))})).then((function(){t.__loadIndex===a&&(r.parsing--,t.__loadingState=Ae,t.__wasSetVisible&&e.setTileVisible(t,!0),t.__wasSetActive&&e.setTileActive(t,!0))})).catch(c)}}},{key:"dispose",value:function(){var t=this.lruCache,e=[];this.traverse((function(t){return e.push(t)}));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 Te(t){return(new TextDecoder).decode(t)}var Re=function(){function t(e,r,n,i){h(this,t),this.buffer=e,this.binOffset=r+n,this.binLength=i;var o=null;if(0!==n){var s=new Uint8Array(e,r,n);o=JSON.parse(Te(s))}else o={};this.header=o}return p(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,c=this.binLength,h=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+h,A=e*s;switch(p){case"BYTE":a=new Int8Array(u,g,A);break;case"UNSIGNED_BYTE":a=new Uint8Array(u,g,A);break;case"SHORT":a=new Int16Array(u,g,A);break;case"UNSIGNED_SHORT":a=new Uint16Array(u,g,A);break;case"INT":a=new Int32Array(u,g,A);break;case"UNSIGNED_INT":a=new Uint32Array(u,g,A);break;case"FLOAT":a=new Float32Array(u,g,A);break;case"DOUBLE":a=new Float64Array(u,g,A);break;default:throw new Error('FeatureTable : Feature component type not provided for "'.concat(t,'".'))}if(g+A*a.BYTES_PER_ELEMENT>l+c)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}(),De=function(t){A(r,t);var e=m(r);function r(t,n,i,o,s){var a;return h(this,r),(a=e.call(this,t,i,o,s)).batchSize=n,a}return p(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 I(d(r.prototype),"getData",this).call(this,t,this.batchSize,e,n)}}]),r}(Re),Qe=function(){function t(){h(this,t),this.fetchOptions={},this.workingPath=""}return p(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 Pe(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 ke=function(t){A(r,t);var e=m(r);function r(){return h(this,r),e.apply(this,arguments)}return p(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Pe(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),c=new Re(l,0,o,s),h=28+o+s,f=t.slice(h,h+a+u),p=new De(f,c.getData("BATCH_LENGTH"),0,a,u),g=h+a+u;return{version:n,featureTable:c,batchTable:p,glbBytes:new Uint8Array(t,g,i-g)}}}]),r}(Qe),Oe=function(t){A(n,t);var e=m(n);function n(t){var r;return h(this,n),(r=e.call(this,t)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(t){return new Ve(t)})),r.register((function(t){return new Ke(t)})),r.register((function(t){return new Ze(t)})),r.register((function(t){return new Ye(t)})),r.register((function(t){return new He(t)})),r.register((function(t){return new Xe(t)})),r.register((function(t){return new Je(t)})),r.register((function(t){return new je(t)})),r.register((function(t){return new We(t)})),r.register((function(t){return new ze(t)})),r.register((function(t){return new Ue(t)})),r.register((function(t){return new $e(t)})),r.register((function(t){return new tr(t)})),r}return p(n,[{key:"load",value:function(t,e,n,i){var o,s=this;o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:r.LoaderUtils.extractUrlBase(t),this.manager.itemStart(t);var a=function(e){i?i(e):console.error(e),s.manager.itemError(t),s.manager.itemEnd(t)},u=new r.FileLoader(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials),u.load(t,(function(r){try{s.parse(r,o,(function(r){e(r),s.manager.itemEnd(t)}),a)}catch(t){a(t)}}),n,a)}},{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,n,i){var o,s={},a={};if("string"==typeof t)o=JSON.parse(t);else if(t instanceof ArrayBuffer){if(r.LoaderUtils.decodeText(new Uint8Array(t,0,4))===er){try{s[Ge.KHR_BINARY_GLTF]=new ir(t)}catch(t){return void(i&&i(t))}o=JSON.parse(s[Ge.KHR_BINARY_GLTF].content)}else o=JSON.parse(r.LoaderUtils.decodeText(new Uint8Array(t)))}else o=t;if(void 0===o.asset||o.asset.version[0]<2)i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var u=new Sr(o,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(var l=0;l<this.pluginCallbacks.length;l++){var c=this.pluginCallbacks[l](u);a[c.name]=c,s[c.name]=!0}if(o.extensionsUsed)for(var h=0;h<o.extensionsUsed.length;++h){var f=o.extensionsUsed[h],p=o.extensionsRequired||[];switch(f){case Ge.KHR_MATERIALS_UNLIT:s[f]=new qe;break;case Ge.KHR_DRACO_MESH_COMPRESSION:s[f]=new or(o,this.dracoLoader);break;case Ge.KHR_TEXTURE_TRANSFORM:s[f]=new sr;break;case Ge.KHR_MESH_QUANTIZATION:s[f]=new ar;break;default:p.indexOf(f)>=0&&void 0===a[f]&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}u.setExtensions(s),u.setPlugins(a),u.parse(n,i)}}},{key:"parseAsync",value:function(t,e){var r=this;return new Promise((function(n,i){r.parse(t,e,n,i)}))}}]),n}(r.Loader);function Fe(){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 Ge={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"},Ue=function(){function t(e){h(this,t),this.parser=e,this.name=Ge.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return p(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,n="light:"+t,i=e.cache.get(n);if(i)return i;var o,s=e.json,a=((s.extensions&&s.extensions[this.name]||{}).lights||[])[t],u=new r.Color(16777215);void 0!==a.color&&u.fromArray(a.color);var l=void 0!==a.range?a.range:0;switch(a.type){case"directional":(o=new r.DirectionalLight(u)).target.position.set(0,0,-1),o.add(o.target);break;case"point":(o=new r.PointLight(u)).distance=l;break;case"spot":(o=new r.SpotLight(u)).distance=l,a.spot=a.spot||{},a.spot.innerConeAngle=void 0!==a.spot.innerConeAngle?a.spot.innerConeAngle:0,a.spot.outerConeAngle=void 0!==a.spot.outerConeAngle?a.spot.outerConeAngle:Math.PI/4,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return o.position.set(0,0,0),o.decay=2,xr(o,a),void 0!==a.intensity&&(o.intensity=a.intensity),o.name=e.createUniqueName(a.name||"light_"+t),i=Promise.resolve(o),e.cache.add(n,i),i}},{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(){h(this,t),this.name=Ge.KHR_MATERIALS_UNLIT}return p(t,[{key:"getMaterialType",value:function(){return r.MeshBasicMaterial}},{key:"extendParams",value:function(t,e,n){var i=[];t.color=new r.Color(1,1,1),t.opacity=1;var o=e.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){var s=o.baseColorFactor;t.color.fromArray(s),t.opacity=s[3]}void 0!==o.baseColorTexture&&i.push(n.assignTexture(t,"map",o.baseColorTexture,r.sRGBEncoding))}return Promise.all(i)}}]),t}(),je=function(){function t(e){h(this,t),this.parser=e,this.name=Ge.KHR_MATERIALS_EMISSIVE_STRENGTH}return p(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}(),Ve=function(){function t(e){h(this,t),this.parser=e,this.name=Ge.KHR_MATERIALS_CLEARCOAT}return p(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();var o=[],s=i.extensions[this.name];if(void 0!==s.clearcoatFactor&&(e.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&o.push(n.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&o.push(n.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(o.push(n.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){var a=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new r.Vector2(a,a)}return Promise.all(o)}}]),t}(),ze=function(){function t(e){h(this,t),this.parser=e,this.name=Ge.KHR_MATERIALS_IRIDESCENCE}return p(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?r.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}(),Ye=function(){function t(e){h(this,t),this.parser=e,this.name=Ge.KHR_MATERIALS_SHEEN}return p(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();var o=[];e.sheenColor=new r.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;var s=i.extensions[this.name];return void 0!==s.sheenColorFactor&&e.sheenColor.fromArray(s.sheenColorFactor),void 0!==s.sheenRoughnessFactor&&(e.sheenRoughness=s.sheenRoughnessFactor),void 0!==s.sheenColorTexture&&o.push(n.assignTexture(e,"sheenColorMap",s.sheenColorTexture,r.sRGBEncoding)),void 0!==s.sheenRoughnessTexture&&o.push(n.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(o)}}]),t}(),He=function(){function t(e){h(this,t),this.parser=e,this.name=Ge.KHR_MATERIALS_TRANSMISSION}return p(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?r.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}(),Xe=function(){function t(e){h(this,t),this.parser=e,this.name=Ge.KHR_MATERIALS_VOLUME}return p(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();var o=[],s=i.extensions[this.name];e.thickness=void 0!==s.thicknessFactor?s.thicknessFactor:0,void 0!==s.thicknessTexture&&o.push(n.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;var a=s.attenuationColor||[1,1,1];return e.attenuationColor=new r.Color(a[0],a[1],a[2]),Promise.all(o)}}]),t}(),Je=function(){function t(e){h(this,t),this.parser=e,this.name=Ge.KHR_MATERIALS_IOR}return p(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?r.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}(),We=function(){function t(e){h(this,t),this.parser=e,this.name=Ge.KHR_MATERIALS_SPECULAR}return p(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(t,e){var n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();var o=[],s=i.extensions[this.name];e.specularIntensity=void 0!==s.specularFactor?s.specularFactor:1,void 0!==s.specularTexture&&o.push(n.assignTexture(e,"specularIntensityMap",s.specularTexture));var a=s.specularColorFactor||[1,1,1];return e.specularColor=new r.Color(a[0],a[1],a[2]),void 0!==s.specularColorTexture&&o.push(n.assignTexture(e,"specularColorMap",s.specularColorTexture,r.sRGBEncoding)),Promise.all(o)}}]),t}(),Ke=function(){function t(e){h(this,t),this.parser=e,this.name=Ge.KHR_TEXTURE_BASISU}return p(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}(),Ze=function(){function t(e){h(this,t),this.parser=e,this.name=Ge.EXT_TEXTURE_WEBP,this.isSupported=null}return p(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}(),$e=function(){function t(e){h(this,t),this.name=Ge.EXT_MESHOPT_COMPRESSION,this.parser=e}return p(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}(),tr=function(){function t(e){h(this,t),this.name=Ge.EXT_MESH_GPU_INSTANCING,this.parser=e}return p(t,[{key:"createNodeMesh",value:function(t){var e=this,n=this.parser.json,i=n.nodes[t];if(!i.extensions||!i.extensions[this.name]||void 0===i.mesh)return null;var o,s=B(n.meshes[i.mesh].primitives);try{for(s.s();!(o=s.n()).done;){var a=o.value;if(a.mode!==hr.TRIANGLES&&a.mode!==hr.TRIANGLE_STRIP&&a.mode!==hr.TRIANGLE_FAN&&void 0!==a.mode)return null}}catch(t){s.e(t)}finally{s.f()}var u=i.extensions[this.name].attributes,l=[],c={},h=function(t){l.push(e.parser.getDependency("accessor",u[t]).then((function(e){return c[t]=e,c[t]})))};for(var f in u)h(f);return l.length<1?null:(l.push(this.parser.createNodeMesh(t)),Promise.all(l).then((function(t){var n,i=t.pop(),o=i.isGroup?i.children:[i],s=t[0].count,a=[],u=B(o);try{for(u.s();!(n=u.n()).done;){for(var l=n.value,h=new r.Matrix4,f=new r.Vector3,p=new r.Quaternion,g=new r.Vector3(1,1,1),A=new r.InstancedMesh(l.geometry,l.material,s),d=0;d<s;d++)c.TRANSLATION&&f.fromBufferAttribute(c.TRANSLATION,d),c.ROTATION&&p.fromBufferAttribute(c.ROTATION,d),c.SCALE&&g.fromBufferAttribute(c.SCALE,d),A.setMatrixAt(d,h.compose(f,p,g));for(var y in c)"TRANSLATION"!==y&&"ROTATION"!==y&&"SCALE"!==y&&l.geometry.setAttribute(y,c[y]);r.Object3D.prototype.copy.call(A,l),A.frustumCulled=!1,e.parser.assignFinalMaterial(A),a.push(A)}}catch(t){u.e(t)}finally{u.f()}return i.isGroup?(i.clear(),i.add.apply(i,a),i):a[0]})))}}]),t}(),er="glTF",rr=1313821514,nr=5130562,ir=p((function t(e){h(this,t),this.name=Ge.KHR_BINARY_GLTF,this.content=null,this.body=null;var n=new DataView(e,0,12);if(this.header={magic:r.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==er)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 i=this.header.length-12,o=new DataView(e,12),s=0;s<i;){var a=o.getUint32(s,!0);s+=4;var u=o.getUint32(s,!0);if(s+=4,u===rr){var l=new Uint8Array(e,12+s,a);this.content=r.LoaderUtils.decodeText(l)}else if(u===nr){var c=12+s;this.body=e.slice(c,c+a)}s+=a}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),or=function(){function t(e,r){if(h(this,t),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Ge.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=r,this.dracoLoader.preload()}return p(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 c=dr[l]||l.toLowerCase();s[c]=o[l]}for(var h in t.attributes){var f=dr[h]||h.toLowerCase();if(void 0!==o[h]){var p=r.accessors[t.attributes[h]],g=fr[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}(),sr=function(){function t(){h(this,t),this.name=Ge.KHR_TEXTURE_TRANSFORM}return p(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}(),ar=p((function t(){h(this,t),this.name=Ge.KHR_MESH_QUANTIZATION})),ur=function(t){A(r,t);var e=m(r);function r(t,n,i,o){return h(this,r),e.call(this,t,n,i,o)}return p(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,c=(r-e)/l,h=c*c,f=h*c,p=t*u,g=p-u,A=-2*f+3*h,d=f-h,y=1-A,v=d-h+c,m=0;m!==s;m++){var _=o[g+m+s],I=o[g+m+a]*l,E=o[p+m+s],x=o[p+m]*l;i[m]=y*_+v*I+A*E+d*x}return i}}]),r}(r.Interpolant),lr=new r.Quaternion,cr=function(t){A(r,t);var e=m(r);function r(){return h(this,r),e.apply(this,arguments)}return p(r,[{key:"interpolate_",value:function(t,e,n,i){var o=I(d(r.prototype),"interpolate_",this).call(this,t,e,n,i);return lr.fromArray(o).normalize().toArray(o),o}}]),r}(ur),hr={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},fr={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},pr={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},gr={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},Ar={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},dr={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},yr={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},vr={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete},mr="OPAQUE",_r="MASK",Ir="BLEND";function Er(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 xr(t,e){void 0!==e.extras&&("object"===u(e.extras)?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Cr(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 wr(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 br(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 Br=new r.Matrix4,Sr=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};h(this,t),this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new Fe,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 i=!1,o=!1,s=-1;"undefined"!=typeof navigator&&(i=!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||i||o&&s<98?this.textureLoader=new r.TextureLoader(this.options.manager):this.textureLoader=new r.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return p(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:{}};Er(i,o,n),xr(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 c=t[u];void 0!==c.mesh&&(this._addNodeRef(this.meshCache,c.mesh),void 0!==c.skin&&(r[c.mesh].isSkinnedMesh=!0)),void 0!==c.camera&&this._addNodeRef(this.cameraCache,c.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=B(e.children.entries());try{for(s.s();!(o=s.n()).done;){var a=C(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],n=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[Ge.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(t,o){n.load(r.LoaderUtils.resolveURL(e.uri,i.path),t,void 0,(function(){o(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,n=this.json,i=this.json.accessors[t];if(void 0===i.bufferView&&void 0===i.sparse){var o=Ar[i.type],s=fr[i.componentType],a=!0===i.normalized,u=new s(i.count*o);return Promise.resolve(new r.BufferAttribute(u,o,a))}var l=[];return void 0!==i.bufferView?l.push(this.getDependency("bufferView",i.bufferView)):l.push(null),void 0!==i.sparse&&(l.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),l.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(l).then((function(t){var o,s,a=t[0],u=Ar[i.type],l=fr[i.componentType],c=l.BYTES_PER_ELEMENT,h=c*u,f=i.byteOffset||0,p=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,g=!0===i.normalized;if(p&&p!==h){var A=Math.floor(f/p),d="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+A+":"+i.count,y=e.cache.get(d);y||(o=new l(a,A*p,i.count*p/c),y=new r.InterleavedBuffer(o,p/c),e.cache.add(d,y)),s=new r.InterleavedBufferAttribute(y,u,f%p/c,g)}else o=null===a?new l(i.count*u):new l(a,f,i.count*u),s=new r.BufferAttribute(o,u,g);if(void 0!==i.sparse){var v=Ar.SCALAR,m=fr[i.sparse.indices.componentType],_=i.sparse.indices.byteOffset||0,I=i.sparse.values.byteOffset||0,E=new m(t[1],_,i.sparse.count*v),x=new l(t[2],I,i.sparse.count*u);null!==a&&(s=new r.BufferAttribute(s.array.slice(),s.itemSize,s.normalized));for(var C=0,w=E.length;C<w;C++){var b=E[C];if(s.setX(b,x[C*u]),u>=2&&s.setY(b,x[C*u+1]),u>=3&&s.setZ(b,x[C*u+2]),u>=4&&s.setW(b,x[C*u+3]),u>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return s}))}},{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,n){var i=this,o=this.json,s=o.textures[t],a=o.images[e],u=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[u])return this.textureCache[u];var l=this.loadImageSource(e,n).then((function(e){e.flipY=!1,e.name=s.name||a.name||"";var n=(o.samplers||{})[s.sampler]||{};return e.magFilter=pr[n.magFilter]||r.LinearFilter,e.minFilter=pr[n.minFilter]||r.LinearMipmapLinearFilter,e.wrapS=gr[n.wrapS]||r.RepeatWrapping,e.wrapT=gr[n.wrapT]||r.RepeatWrapping,i.associations.set(e,{textures:t}),e})).catch((function(){return null}));return this.textureCache[u]=l,l}},{key:"loadImageSource",value:function(t,e){var n=this.json,i=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then((function(t){return t.clone()}));var o=n.images[t],s=self.URL||self.webkitURL,a=o.uri||"",u=!1;if(void 0!==o.bufferView)a=this.getDependency("bufferView",o.bufferView).then((function(t){u=!0;var e=new Blob([t],{type:o.mimeType});return a=s.createObjectURL(e)}));else if(void 0===o.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");var l=Promise.resolve(a).then((function(t){return new Promise((function(n,o){var s=n;!0===e.isImageBitmapLoader&&(s=function(t){var e=new r.Texture(t);e.needsUpdate=!0,n(e)}),e.load(r.LoaderUtils.resolveURL(t,i.path),s,void 0,o)}))})).then((function(t){var e;return!0===u&&s.revokeObjectURL(a),t.userData.mimeType=o.mimeType||((e=o.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",a),t}));return this.sourceCache[t]=l,l}},{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[Ge.KHR_TEXTURE_TRANSFORM]){var s=void 0!==r.extensions?r.extensions[Ge.KHR_TEXTURE_TRANSFORM]:void 0;if(s){var a=i.associations.get(o);o=i.extensions[Ge.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,n=t.material,i=void 0===e.attributes.tangent,o=void 0!==e.attributes.color,s=void 0===e.attributes.normal;if(t.isPoints){var a="PointsMaterial:"+n.uuid,u=this.cache.get(a);u||(u=new r.PointsMaterial,r.Material.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,u.sizeAttenuation=!1,this.cache.add(a,u)),n=u}else if(t.isLine){var l="LineBasicMaterial:"+n.uuid,c=this.cache.get(l);c||(c=new r.LineBasicMaterial,r.Material.prototype.copy.call(c,n),c.color.copy(n.color),this.cache.add(l,c)),n=c}if(i||o||s){var h="ClonedMaterial:"+n.uuid+":";i&&(h+="derivative-tangents:"),o&&(h+="vertex-colors:"),s&&(h+="flat-shading:");var f=this.cache.get(h);f||(f=n.clone(),o&&(f.vertexColors=!0),s&&(f.flatShading=!0),i&&(f.normalScale&&(f.normalScale.y*=-1),f.clearcoatNormalScale&&(f.clearcoatNormalScale.y*=-1)),this.cache.add(h,f),this.associations.set(f,this.associations.get(n))),n=f}n.aoMap&&void 0===e.attributes.uv2&&void 0!==e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv),t.material=n}},{key:"getMaterialType",value:function(){return r.MeshStandardMaterial}},{key:"loadMaterial",value:function(t){var e,n=this,i=this.json,o=this.extensions,s=i.materials[t],a={},u=[];if((s.extensions||{})[Ge.KHR_MATERIALS_UNLIT]){var l=o[Ge.KHR_MATERIALS_UNLIT];e=l.getMaterialType(),u.push(l.extendParams(a,s,n))}else{var c=s.pbrMetallicRoughness||{};if(a.color=new r.Color(1,1,1),a.opacity=1,Array.isArray(c.baseColorFactor)){var h=c.baseColorFactor;a.color.fromArray(h),a.opacity=h[3]}void 0!==c.baseColorTexture&&u.push(n.assignTexture(a,"map",c.baseColorTexture,r.sRGBEncoding)),a.metalness=void 0!==c.metallicFactor?c.metallicFactor:1,a.roughness=void 0!==c.roughnessFactor?c.roughnessFactor:1,void 0!==c.metallicRoughnessTexture&&(u.push(n.assignTexture(a,"metalnessMap",c.metallicRoughnessTexture)),u.push(n.assignTexture(a,"roughnessMap",c.metallicRoughnessTexture))),e=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),u.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,a)}))))}!0===s.doubleSided&&(a.side=r.DoubleSide);var f=s.alphaMode||mr;if(f===Ir?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,f===_r&&(a.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&e!==r.MeshBasicMaterial&&(u.push(n.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new r.Vector2(1,1),void 0!==s.normalTexture.scale)){var p=s.normalTexture.scale;a.normalScale.set(p,p)}return void 0!==s.occlusionTexture&&e!==r.MeshBasicMaterial&&(u.push(n.assignTexture(a,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(a.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&e!==r.MeshBasicMaterial&&(a.emissive=(new r.Color).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&e!==r.MeshBasicMaterial&&u.push(n.assignTexture(a,"emissiveMap",s.emissiveTexture,r.sRGBEncoding)),Promise.all(u).then((function(){var r=new e(a);return s.name&&(r.name=s.name),xr(r,s),n.associations.set(r,{materials:t}),s.extensions&&Er(o,r,s),r}))}},{key:"createUniqueName",value:function(t){for(var e=r.PropertyBinding.sanitizeNodeName(t||""),n=e,i=1;this.nodeNamesUsed[n];++i)n=e+"_"+i;return this.nodeNamesUsed[n]=!0,n}},{key:"loadGeometries",value:function(t){var e=this,n=this.extensions,i=this.primitiveCache;function o(t){return n[Ge.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(r){return Mr(r,t,e)}))}for(var s,a,u=[],l=0,c=t.length;l<c;l++){var h=t[l],f=(a=void 0,(a=(s=h).extensions&&s.extensions[Ge.KHR_DRACO_MESH_COMPRESSION])?"draco:"+a.bufferView+":"+a.indices+":"+wr(a.attributes):s.indices+":"+wr(s.attributes)+":"+s.mode),p=i[f];if(p)u.push(p.promise);else{var g=void 0;g=h.extensions&&h.extensions[Ge.KHR_DRACO_MESH_COMPRESSION]?o(h):Mr(new r.BufferGeometry,h,e),i[f]={primitive:h,promise:g},u.push(g)}}return Promise.all(u)}},{key:"loadMesh",value:function(t){for(var e,n=this,i=this.json,o=this.extensions,s=i.meshes[t],a=s.primitives,u=[],l=0,c=a.length;l<c;l++){var h=void 0===a[l].material?(void 0===(e=this.cache).DefaultMaterial&&(e.DefaultMaterial=new r.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),e.DefaultMaterial):this.getDependency("material",a[l].material);u.push(h)}return u.push(n.loadGeometries(a)),Promise.all(u).then((function(e){for(var i=e.slice(0,e.length-1),u=e[e.length-1],l=[],c=0,h=u.length;c<h;c++){var f=u[c],p=a[c],g=void 0,A=i[c];if(p.mode===hr.TRIANGLES||p.mode===hr.TRIANGLE_STRIP||p.mode===hr.TRIANGLE_FAN||void 0===p.mode)!0!==(g=!0===s.isSkinnedMesh?new r.SkinnedMesh(f,A):new r.Mesh(f,A)).isSkinnedMesh||g.geometry.attributes.skinWeight.normalized||g.normalizeSkinWeights(),p.mode===hr.TRIANGLE_STRIP?g.geometry=Lr(g.geometry,r.TriangleStripDrawMode):p.mode===hr.TRIANGLE_FAN&&(g.geometry=Lr(g.geometry,r.TriangleFanDrawMode));else if(p.mode===hr.LINES)g=new r.LineSegments(f,A);else if(p.mode===hr.LINE_STRIP)g=new r.Line(f,A);else if(p.mode===hr.LINE_LOOP)g=new r.LineLoop(f,A);else{if(p.mode!==hr.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);g=new r.Points(f,A)}Object.keys(g.geometry.morphAttributes).length>0&&Cr(g,s),g.name=n.createUniqueName(s.name||"mesh_"+t),xr(g,s),p.extensions&&Er(o,g,p),n.assignFinalMaterial(g),l.push(g)}for(var d=0,y=l.length;d<y;d++)n.associations.set(l[d],{meshes:t,primitives:d});if(1===l.length)return l[0];var v=new r.Group;n.associations.set(v,{meshes:t});for(var m=0,_=l.length;m<_;m++)v.add(l[m]);return v}))}},{key:"loadCamera",value:function(t){var e,n=this.json.cameras[t],i=n[n.type];if(i)return"perspective"===n.type?e=new r.PerspectiveCamera(r.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(e=new r.OrthographicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),xr(e,n),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(t){for(var e=this.json.skins[t],n=[],i=0,o=e.joints.length;i<o;i++)n.push(this.getDependency("node",e.joints[i]));return void 0!==e.inverseBindMatrices?n.push(this.getDependency("accessor",e.inverseBindMatrices)):n.push(null),Promise.all(n).then((function(t){for(var n=t.pop(),i=t,o=[],s=[],a=0,u=i.length;a<u;a++){var l=i[a];if(l){o.push(l);var c=new r.Matrix4;null!==n&&c.fromArray(n.array,16*a),s.push(c)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[a])}return new r.Skeleton(o,s)}))}},{key:"loadAnimation",value:function(t){for(var e=this.json.animations[t],n=[],i=[],o=[],s=[],a=[],u=0,l=e.channels.length;u<l;u++){var c=e.channels[u],h=e.samplers[c.sampler],f=c.target,p=f.node,g=void 0!==e.parameters?e.parameters[h.input]:h.input,A=void 0!==e.parameters?e.parameters[h.output]:h.output;n.push(this.getDependency("node",p)),i.push(this.getDependency("accessor",g)),o.push(this.getDependency("accessor",A)),s.push(h),a.push(f)}return Promise.all([Promise.all(n),Promise.all(i),Promise.all(o),Promise.all(s),Promise.all(a)]).then((function(n){for(var i=n[0],o=n[1],s=n[2],a=n[3],u=n[4],l=[],c=function(){var t,e=i[h],n=o[h],c=s[h],f=a[h],p=u[h];if(void 0===e)return"continue";switch(e.updateMatrix(),yr[p.path]){case yr.weights:t=r.NumberKeyframeTrack;break;case yr.rotation:t=r.QuaternionKeyframeTrack;break;default:t=r.VectorKeyframeTrack}var g=e.name?e.name:e.uuid,A=void 0!==f.interpolation?vr[f.interpolation]:r.InterpolateLinear,d=[];yr[p.path]===yr.weights?e.traverse((function(t){t.morphTargetInfluences&&d.push(t.name?t.name:t.uuid)})):d.push(g);var y=c.array;if(c.normalized){for(var v=br(y.constructor),m=new Float32Array(y.length),_=0,I=y.length;_<I;_++)m[_]=y[_]*v;y=m}for(var E=0,x=d.length;E<x;E++){var C=new t(d[E]+"."+yr[p.path],n.array,y,A);"CUBICSPLINE"===f.interpolation&&(C.createInterpolant=function(t){return new(this instanceof r.QuaternionKeyframeTrack?cr:ur)(this.times,this.values,this.getValueSize()/3,t)},C.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(C)}},h=0,f=i.length;h<f;h++)c();var p=e.name?e.name:"animation_"+t;return new r.AnimationClip(p,void 0,l)}))}},{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,n=this.extensions,i=this,o=e.nodes[t],s=o.name?i.createUniqueName(o.name):"";return function(){var e=[],r=i._invokeOne((function(e){return e.createNodeMesh&&e.createNodeMesh(t)}));r&&e.push(r),void 0!==o.camera&&e.push(i.getDependency("camera",o.camera).then((function(t){return i._getNodeRef(i.cameraCache,o.camera,t)}))),i._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){e.push(t)}));for(var n=[],s=o.children||[],a=0,u=s.length;a<u;a++)n.push(i.getDependency("node",s[a]));var l=void 0===o.skin?Promise.resolve(null):i.getDependency("skin",o.skin);return Promise.all([Promise.all(e),Promise.all(n),l])}().then((function(e){var a,u=e[0],l=e[1],c=e[2];if((a=!0===o.isBone?new r.Bone:u.length>1?new r.Group:1===u.length?u[0]:new r.Object3D)!==u[0])for(var h=0,f=u.length;h<f;h++)a.add(u[h]);if(o.name&&(a.userData.name=o.name,a.name=s),xr(a,o),o.extensions&&Er(n,a,o),void 0!==o.matrix){var p=new r.Matrix4;p.fromArray(o.matrix),a.applyMatrix4(p)}else void 0!==o.translation&&a.position.fromArray(o.translation),void 0!==o.rotation&&a.quaternion.fromArray(o.rotation),void 0!==o.scale&&a.scale.fromArray(o.scale);i.associations.has(a)||i.associations.set(a,{}),i.associations.get(a).nodes=t,null!==c&&a.traverse((function(t){t.isSkinnedMesh&&t.bind(c,Br)}));for(var g=0,A=l.length;g<A;g++)a.add(l[g]);return a}))}},{key:"loadScene",value:function(t){var e=this.extensions,n=this.json.scenes[t],i=this,o=new r.Group;n.name&&(o.name=i.createUniqueName(n.name)),xr(o,n),n.extensions&&Er(e,o,n);for(var s=n.nodes||[],a=[],u=0,l=s.length;u<l;u++)a.push(i.getDependency("node",s[u]));return Promise.all(a).then((function(t){for(var e=0,n=t.length;e<n;e++)o.add(t[e]);return i.associations=function(t){var e,n=new Map,o=B(i.associations);try{for(o.s();!(e=o.n()).done;){var s=C(e.value,2),a=s[0],u=s[1];(a instanceof r.Material||a instanceof r.Texture)&&n.set(a,u)}}catch(t){o.e(t)}finally{o.f()}return t.traverse((function(t){var e=i.associations.get(t);null!=e&&n.set(t,e)})),n}(o),o}))}}]),t}();function Mr(t,e,n){var i=e.attributes,o=[];function s(e,r){return n.getDependency("accessor",e).then((function(e){t.setAttribute(r,e)}))}for(var a in i){var u=dr[a]||a.toLowerCase();u in t.attributes||o.push(s(i[a],u))}if(void 0!==e.indices&&!t.index){var l=n.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));o.push(l)}return xr(t,e),function(t,e,n){var i=e.attributes,o=new r.Box3;if(void 0!==i.POSITION){var s=n.json.accessors[i.POSITION],a=s.min,u=s.max;if(void 0!==a&&void 0!==u){if(o.set(new r.Vector3(a[0],a[1],a[2]),new r.Vector3(u[0],u[1],u[2])),s.normalized){var l=br(fr[s.componentType]);o.min.multiplyScalar(l),o.max.multiplyScalar(l)}var c=e.targets;if(void 0!==c){for(var h=new r.Vector3,f=new r.Vector3,p=0,g=c.length;p<g;p++){var A=c[p];if(void 0!==A.POSITION){var d=n.json.accessors[A.POSITION],y=d.min,v=d.max;if(void 0!==y&&void 0!==v){if(f.setX(Math.max(Math.abs(y[0]),Math.abs(v[0]))),f.setY(Math.max(Math.abs(y[1]),Math.abs(v[1]))),f.setZ(Math.max(Math.abs(y[2]),Math.abs(v[2]))),d.normalized){var m=br(fr[d.componentType]);f.multiplyScalar(m)}h.max(f)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}o.expandByVector(h)}t.boundingBox=o;var _=new r.Sphere;o.getCenter(_.center),_.radius=o.min.distanceTo(o.max)/2,t.boundingSphere=_}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,e,n),Promise.all(o).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=[],c=[],h=[],f=0,p=e.length;f<p;f++){var g=e[f];if(n){var A=void 0!==g.POSITION?r.getDependency("accessor",g.POSITION):t.attributes.position;l.push(A)}if(i){var d=void 0!==g.NORMAL?r.getDependency("accessor",g.NORMAL):t.attributes.normal;c.push(d)}if(o){var y=void 0!==g.COLOR_0?r.getDependency("accessor",g.COLOR_0):t.attributes.color;h.push(y)}}return Promise.all([Promise.all(l),Promise.all(c),Promise.all(h)]).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,n):t}))}function Lr(t,e){var n=t.getIndex();if(null===n){var i=[],o=t.getAttribute("position");if(void 0===o)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var s=0;s<o.count;s++)i.push(s);t.setIndex(i),n=t.getIndex()}var a=n.count-2,u=[];if(e===r.TriangleFanDrawMode)for(var l=1;l<=a;l++)u.push(n.getX(0)),u.push(n.getX(l)),u.push(n.getX(l+1));else for(var c=0;c<a;c++)c%2==0?(u.push(n.getX(c)),u.push(n.getX(c+1)),u.push(n.getX(c+2))):(u.push(n.getX(c+2)),u.push(n.getX(c+1)),u.push(n.getX(c)));u.length/3!==a&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var h=t.clone();return h.setIndex(u),h}var Nr=function(t){A(n,t);var e=m(n);function n(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DefaultLoadingManager;return h(this,n),(t=e.call(this)).manager=i,t.adjustmentTransform=new r.Matrix4,t}return p(n,[{key:"parse",value:function(t){var e=this,r=I(d(n.prototype),"parse",this).call(this,t),i=r.glbBytes.slice().buffer;return new Promise((function(t,n){var o=e.manager,s=e.fetchOptions,a=o.getHandler("path.gltf")||new Oe(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 n=r.batchTable,i=r.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=n,e.featureTable=i,o.batchTable=n,o.featureTable=i,t(e)}),n)}))}}]),n}(ke),Tr=function(t){A(r,t);var e=m(r);function r(){return h(this,r),e.apply(this,arguments)}return p(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Pe(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),c=new Re(l,0,o,s),h=28+o+s,f=t.slice(h,h+a+u),p=new De(f,c.getData("BATCH_LENGTH")||c.getData("POINTS_LENGTH"),0,a,u);return Promise.resolve({version:n,featureTable:c,batchTable:p})}}]),r}(Qe),Rr={RGB:"color",POSITION:"position"},Dr=function(t){A(n,t);var e=m(n);function n(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DefaultLoadingManager;return h(this,n),(t=e.call(this)).manager=i,t}return p(n,[{key:"parse",value:function(t){var e=this;return I(d(n.prototype),"parse",this).call(this,t).then(function(){var t=c(a().mark((function t(n){var i,o,s,u,l,c,h,f,p,g,A,d,y,v,m,_,I,E;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=n.featureTable,o=new r.PointsMaterial,!(s=i.header.extensions)||!s["3DTILES_draco_point_compression"]){t.next=18;break}if(l=s["3DTILES_draco_point_compression"],c=l.byteOffset,h=l.byteLength,f=l.properties,null!=(p=e.manager.getHandler("draco.drc"))){t.next=8;break}throw new Error("PNTSLoader: dracoLoader not available.");case 8:for(A in g={},f)A in Rr&&A in f&&(g[Rr[A]]=f[A]);return d={attributeIDs:g,attributeTypes:{position:"Float32Array",color:"Uint8Array"},useUniqueIDs:!0},y=i.getBuffer(c,h),t.next=14,p.decodeGeometry(y,d);case 14:(u=t.sent).attributes.color&&(o.vertexColors=!0),t.next=24;break;case 18:v=i.getData("POINTS_LENGTH"),m=i.getData("POSITION",v,"FLOAT","VEC3"),_=i.getData("RGB",v,"UNSIGNED_BYTE","VEC3"),(u=new r.BufferGeometry).setAttribute("position",new r.BufferAttribute(m,3,!1)),null!==_&&(u.setAttribute("color",new r.BufferAttribute(_,3,!0)),o.vertexColors=!0);case 24:return["QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","CONSTANT_RGBA","BATCH_LENGTH","POSITION_QUANTIZED","RGBA","RGB565","NORMAL","NORMAL_OCT16P"].forEach((function(t){t in i.header&&console.warn('PNTSLoader: Unsupported FeatureTable feature "'.concat(t,'" detected.'))})),I=new r.Points(u,o),n.scene=I,n.scene.featureTable=i,(E=i.getData("RTC_CENTER"))&&(n.scene.position.x+=E[0],n.scene.position.y+=E[1],n.scene.position.z+=E[2]),t.abrupt("return",n);case 31:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}}]),n}(Tr),Qr=function(t){A(r,t);var e=m(r);function r(){return h(this,r),e.apply(this,arguments)}return p(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Pe(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),c=t.slice(32,32+o+s),h=new Re(c,0,o,s),f=32+o+s,p=t.slice(f,f+a+u),g=new De(p,h.getData("INSTANCES_LENGTH"),0,a,u),A=f+a+u,d=new Uint8Array(t,A,i-A),y=null,v=null;if(l)y=d,v=Promise.resolve();else{var m=this.resolveExternalURL(Te(d));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:h,batchTable:g,glbBytes:y}}))}}]),r}(Qe),Pr=new r.Vector3,kr=new r.Vector3,Or=new r.Vector3,Fr=new r.Vector3,Gr=new r.Quaternion,Ur=new r.Vector3,qr=new r.Matrix4,jr=function(t){A(n,t);var e=m(n);function n(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DefaultLoadingManager;return h(this,n),(t=e.call(this)).manager=i,t.adjustmentTransform=new r.Matrix4,t}return p(n,[{key:"resolveExternalURL",value:function(t){return this.manager.resolveURL(I(d(n.prototype),"resolveExternalURL",this).call(this,t))}},{key:"parse",value:function(t){var e=this;return I(d(n.prototype),"parse",this).call(this,t).then((function(t){var n=t.featureTable,i=t.batchTable,o=t.glbBytes.slice().buffer;return new Promise((function(t,s){var a=e.fetchOptions,u=e.manager,l=u.getHandler("path.gltf")||new Oe(u);"include"===a.credentials&&"cors"===a.mode&&l.setCrossOrigin("use-credentials"),"credentials"in a&&l.setWithCredentials("include"===a.credentials),a.headers&&l.setRequestHeader(a.headers);var c=e.workingPath;/[\\/]$/.test(c)||(c+="/");var h=e.adjustmentTransform;l.parse(o,c,(function(e){var o=n.getData("INSTANCES_LENGTH"),s=n.getData("POSITION",o,"FLOAT","VEC3"),a=n.getData("NORMAL_UP",o,"FLOAT","VEC3"),u=n.getData("NORMAL_RIGHT",o,"FLOAT","VEC3"),l=n.getData("SCALE_NON_UNIFORM",o,"FLOAT","VEC3"),c=n.getData("SCALE",o,"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 n.header&&console.warn('I3DMLoader: Unsupported FeatureTable feature "'.concat(t,'" detected.'))}));var f=new Map,p=[];e.scene.traverse((function(t){if(t.isMesh){var e=t.geometry,n=t.material,i=new r.InstancedMesh(e,n,o);i.position.copy(t.position),i.rotation.copy(t.rotation),i.scale.copy(t.scale),p.push(i),f.set(t,i)}}));for(var g=new r.Vector3,A=0;A<o;A++)g.x+=s[3*A+0]/o,g.y+=s[3*A+1]/o,g.z+=s[3*A+2]/o;f.forEach((function(t,e){var r=e.parent;r&&(r.remove(e),r.add(t),t.updateMatrixWorld(),t.position.copy(g).applyMatrix4(t.matrixWorld))}));for(var d=0;d<o;d++){Fr.set(s[3*d+0]-g.x,s[3*d+1]-g.y,s[3*d+2]-g.z),a?(kr.set(a[3*d+0],a[3*d+1],a[3*d+2]),Or.set(u[3*d+0],u[3*d+1],u[3*d+2]),Pr.crossVectors(Or,kr).normalize(),qr.makeBasis(Or,kr,Pr),Gr.setFromRotationMatrix(qr)):Gr.set(0,0,0,1),c?Ur.setScalar(c[d]):l?Ur.set(l[3*d+0],l[3*d+1],l[3*d+2]):Ur.set(1,1,1),qr.compose(Fr,Gr,Ur).multiply(h);for(var y=0,v=p.length;y<v;y++){p[y].setMatrixAt(d,qr)}}e.batchTable=i,e.featureTable=n,e.scene.batchTable=i,e.scene.featureTable=n,t(e)}),s)}))}))}}]),n}(Qr),Vr=function(t){A(r,t);var e=m(r);function r(){return h(this,r),e.apply(this,arguments)}return p(r,[{key:"parse",value:function(t){var e=new DataView(t),r=Pe(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),c=Pe(l),h=l.getUint32(4,!0),f=l.getUint32(8,!0),p=new Uint8Array(t,a,f);s.push({type:c,buffer:p,version:h}),a+=f}return{version:n,tiles:s}}}]),r}(Qe),zr=function(t){A(n,t);var e=m(n);function n(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DefaultLoadingManager;return h(this,n),(t=e.call(this)).manager=i,t.adjustmentTransform=new r.Matrix4,t}return p(n,[{key:"parse",value:function(t){var e=I(d(n.prototype),"parse",this).call(this,t),i=this.manager,o=this.adjustmentTransform,s=[];for(var a in e.tiles){var u=e.tiles[a],l=u.type,c=u.buffer;switch(l){case"b3dm":var h=c.slice(),f=new Nr(i);f.workingPath=this.workingPath,f.fetchOptions=this.fetchOptions,f.adjustmentTransform.copy(o);var p=f.parse(h.buffer);s.push(p);break;case"pnts":var g=c.slice(),A=new Dr(i);A.workingPath=this.workingPath,A.fetchOptions=this.fetchOptions;var y=A.parse(g.buffer);s.push(y);break;case"i3dm":var v=c.slice(),m=new jr(i);m.workingPath=this.workingPath,m.fetchOptions=this.fetchOptions,m.adjustmentTransform.copy(o);var _=m.parse(v.buffer);s.push(_)}}return Promise.all(s).then((function(t){var e=new r.Group;return t.forEach((function(t){e.add(t.scene)})),{tiles:t,scene:e}}))}}]),n}(Vr),Yr=function(){function t(){h(this,t),this.name="CESIUM_RTC"}return p(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){A(n,t);var e=m(n);function n(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.DefaultLoadingManager;return h(this,n),(t=e.call(this)).manager=i,t}return p(n,[{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 Oe(i)).register((function(){return new Yr})),"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)}))}}]),n}(Qe),Xr=new r.Matrix4,Jr=function(t){A(r,t);var e=m(r);function r(t){var n;return h(this,r),(n=e.call(this)).name="TilesRenderer.TilesGroup",n.tilesRenderer=t,n}return p(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?Xr.copy(this.matrix):Xr.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1;for(var e=Xr.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(Xr);for(var a=this.children,u=0,l=a.length;u<l;u++)a[u].updateMatrixWorld()}}}}]),r}(r.Group);new r.Spherical,new r.Vector3;var Wr=new r.Spherical,Kr=new r.Vector3,Zr=new r.Vector3,$r=new r.Vector3,tn=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;h(this,t),this.radius=new r.Vector3(e,n,i)}return p(t,[{key:"getCartographicToPosition",value:function(t,e,r,n){this.getCartographicToNormal(t,e,Kr);var i=this.radius;Zr.copy(Kr),Zr.x*=Math.pow(i.x,2),Zr.y*=Math.pow(i.y,2),Zr.z*=Math.pow(i.z,2);var o=Math.sqrt(Kr.dot(Zr));return Zr.divideScalar(o),n.copy(Zr).addScaledVector(Kr,r)}},{key:"getPositionToCartographic",value:function(t,e){this.getPositionToSurfacePoint(t,Zr),this.getPositionToNormal(t,Kr);var r=$r.subVectors(t,Zr);return e.lon=Math.atan2(Kr.y,Kr.x),e.lat=Math.asin(Kr.z),e.height=Math.sign(r.dot(t))*r.length(),e}},{key:"getCartographicToNormal",value:function(t,e,r){return Wr.set(1,-t+Math.PI/2,e),r.setFromSpherical(Wr).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,c=Math.sqrt(1/l),h=Zr.copy(t).multiplyScalar(c);if(l<.1)return isFinite(c)?e.copy(h):null;var f,p,g,A,d,y,v,m=$r.set(h.x*n*2,h.y*i*2,h.z*o*2),_=(1-c)*t.length()/(.5*m.length()),I=0;do{I=(f=s*(d=(p=1/(1+(_-=I)*n))*p)+a*(y=(g=1/(1+_*i))*g)+u*(v=(A=1/(1+_*o))*A)-1)/(-2*(s*(d*p)*n+a*(y*g)*i+u*(v*A)*o))}while(Math.abs(f)>1e-12);return e.set(t.x*p,t.y*g,t.z*A)}}]),t}(),en=Math.PI,rn=en/2,nn=new r.Vector3,on=new r.Vector3,sn=new r.Vector3,an=new r.Matrix4,un=0,ln=[];function cn(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?(ln[un]||(ln[un]=new r.Vector3),un++,ln[un-1]):new r.Vector3}function hn(){un=0}var fn=function(t){A(n,t);var e=m(n);function n(t,r,i){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-rn,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:rn,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*en,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0;return h(this,n),(o=e.call(this,t,r,i)).latStart=s,o.latEnd=a,o.lonStart=u,o.lonEnd=l,o.heightStart=c,o.heightEnd=f,o}return p(n,[{key:"_getPoints",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.latStart,n=this.latEnd,i=this.lonStart,o=this.lonEnd,s=this.heightStart,a=this.heightEnd,u=r.MathUtils.mapLinear(.5,0,1,e,n),l=r.MathUtils.mapLinear(.5,0,1,i,o),c=Math.floor(i/rn)*rn,h=[[-en/2,0],[en/2,0],[0,c],[0,c+en/2],[0,c+en],[0,c+3*en/2],[e,o],[n,o],[e,i],[n,i],[0,i],[0,o],[u,l],[e,l],[n,l],[u,i],[u,o]],f=[],p=h.length,g=0;g<=1;g++)for(var A=r.MathUtils.mapLinear(g,0,1,s,a),d=0,y=p;d<y;d++){var v=C(h[d],2),m=v[0],_=v[1];if(m>=e&&m<=n&&_>=i&&_<=o){var I=cn(t);f.push(I),this.getCartographicToPosition(m,_,A,I)}}return f}},{key:"getBoundingBox",value:function(t,e){hn();var n=this.latStart,i=this.latEnd,o=this.lonStart,s=this.lonEnd;if(i-n<en/2){var a=r.MathUtils.mapLinear(.5,0,1,n,i),u=r.MathUtils.mapLinear(.5,0,1,o,s);this.getCartographicToNormal(a,u,sn),on.set(0,0,1),nn.crossVectors(on,sn),on.crossVectors(nn,sn),e.makeBasis(nn,on,sn)}else nn.set(1,0,0),on.set(0,1,0),sn.set(0,0,1),e.makeBasis(nn,on,sn);an.copy(e).invert();for(var l=this._getPoints(!0),c=0,h=l.length;c<h;c++)l[c].applyMatrix4(an);t.makeEmpty(),t.setFromPoints(l)}},{key:"getBoundingSphere",value:function(t,e){hn();var r=this._getPoints(!0);t.makeEmpty(),t.setFromPoints(r,e)}}]),n}(tn);function pn(t){return pn="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},pn(t)}function gn(t){var e=function(t,e){if("object"!==pn(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==pn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===pn(e)?e:String(e)}function An(t,e,r){return(e=gn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dn(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}const yn=1/Math.PI*180,vn=1/180*Math.PI,mn={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function _n(t,{precision:e=mn.precision}={}){return t=function(t){return Math.round(t/mn.EPSILON)*mn.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function In(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function En(t){return function(t,e){return wn(t,(t=>t*vn),e)}(t)}function xn(t){return function(t,e){return wn(t,(t=>t*yn),e)}(t)}function Cn(t,e,r){const n=mn.EPSILON;r&&(mn.EPSILON=r);try{if(t===e)return!0;if(In(t)&&In(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!Cn(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)<=mn.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))}finally{mn.EPSILON=n}}function wn(t,e,r){if(In(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 bn 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:In(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(mn)}formatString(t){let e="";for(let r=0;r<this.ELEMENTS;++r)e+=(r>0?", ":"")+_n(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(!Cn(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(mn.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 Bn(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(t));return t}function Sn(t,e,r=""){if(mn.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 Mn extends bn{get x(){return this[0]}set x(t){this[0]=Bn(t)}get y(){return this[1]}set y(t){this[1]=Bn(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 Bn(e)}dot(t){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*t[r];return Bn(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 dn(t>=0&&t<this.ELEMENTS,"index is out of range"),Bn(this[t])}setComponent(t,e){return dn(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 Ln,Nn=1e-6,Tn="undefined"!=typeof Float32Array?Float32Array:Array;function Rn(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 Dn(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)}),Ln=new Tn(2),Tn!=Float32Array&&(Ln[0]=0,Ln[1]=0),function(){var t=function(){var t=new Tn(3);return Tn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}()}();const Pn=[0,0,0];let kn;class On extends Mn{static get ZERO(){return kn||(kn=new On(0,0,0),Object.freeze(kn)),kn}constructor(t=0,e=0,r=0){super(-0,-0,-0),1===arguments.length&&In(t)?this.copy(t):(mn.debug&&(Bn(t),Bn(e),Bn(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 mn.debug&&(Bn(t.x),Bn(t.y),Bn(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]=Bn(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),c=l&&Dn(e,r)/l,Math.acos(Math.min(Math.max(c,-1),1));var e,r,n,i,o,s,a,u,l,c}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=Pn}){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=Pn}){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=Pn}){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 Rn(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],c=i*l-o*u,h=o*a-n*l,f=n*u-i*a,p=i*f-o*h,g=o*c-n*f,A=n*h-i*c,d=2*s;c*=d,h*=d,f*=d,p*=2,g*=2,A*=2,t[0]=a+c+p,t[1]=u+h+g,t[2]=l+f+A}(this,this,t),this.check()}}class Fn extends bn{toString(){let t="[";if(mn.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]=Bn(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 Gn(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],c=e[7],h=e[8],f=e[9],p=e[10],g=e[11],A=e[12],d=e[13],y=e[14],v=e[15],m=r[0],_=r[1],I=r[2],E=r[3];return t[0]=m*n+_*a+I*h+E*A,t[1]=m*i+_*u+I*f+E*d,t[2]=m*o+_*l+I*p+E*y,t[3]=m*s+_*c+I*g+E*v,m=r[4],_=r[5],I=r[6],E=r[7],t[4]=m*n+_*a+I*h+E*A,t[5]=m*i+_*u+I*f+E*d,t[6]=m*o+_*l+I*p+E*y,t[7]=m*s+_*c+I*g+E*v,m=r[8],_=r[9],I=r[10],E=r[11],t[8]=m*n+_*a+I*h+E*A,t[9]=m*i+_*u+I*f+E*d,t[10]=m*o+_*l+I*p+E*y,t[11]=m*s+_*c+I*g+E*v,m=r[12],_=r[13],I=r[14],E=r[15],t[12]=m*n+_*a+I*h+E*A,t[13]=m*i+_*u+I*f+E*d,t[14]=m*o+_*l+I*p+E*y,t[15]=m*s+_*c+I*g+E*v,t}var Un=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 qn,jn=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 Tn(4);return Tn!=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"}(qn||(qn={}));const Vn=45*Math.PI/180,zn=1,Yn=.1,Hn=500,Xn=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class Jn extends Fn{static get IDENTITY(){return function(){Kn||(Kn=new Jn,Object.freeze(Kn));return Kn}()}static get ZERO(){return function(){Wn||(Wn=new Jn([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Wn));return Wn}()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return qn}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,c,h,f,p,g,A){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]=c,this[11]=h,this[12]=f,this[13]=p,this[14]=g,this[15]=A,this.check()}setRowMajor(t,e,r,n,i,o,s,a,u,l,c,h,f,p,g,A){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]=c,this[11]=g,this[12]=n,this[13]=a,this[14]=h,this[15]=A,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(Xn)}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,c=n*s,h=n*a,f=i*s,p=i*a,g=i*u,A=o*s,d=o*a,y=o*u;t[0]=1-h-g,t[1]=c+y,t[2]=f-d,t[3]=0,t[4]=c-y,t[5]=1-l-g,t[6]=p+A,t[7]=0,t[8]=f+d,t[9]=p-A,t[10]=1-l-h,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=Yn,far:s=Hn}=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),c=-1,h=-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]=c,t[11]=h,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,c,h,f,p,g=e[0],A=e[1],d=e[2],y=n[0],v=n[1],m=n[2],_=r[0],I=r[1],E=r[2];Math.abs(g-_)<Nn&&Math.abs(A-I)<Nn&&Math.abs(d-E)<Nn?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):(c=g-_,h=A-I,f=d-E,i=v*(f*=p=1/Math.hypot(c,h,f))-m*(h*=p),o=m*(c*=p)-y*f,s=y*h-v*c,(p=Math.hypot(i,o,s))?(i*=p=1/p,o*=p,s*=p):(i=0,o=0,s=0),a=h*s-f*o,u=f*i-c*s,l=c*o-h*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]=c,t[3]=0,t[4]=o,t[5]=u,t[6]=h,t[7]=0,t[8]=s,t[9]=l,t[10]=f,t[11]=0,t[12]=-(i*g+o*A+s*d),t[13]=-(a*g+u*A+l*d),t[14]=-(c*g+h*A+f*d),t[15]=1)}(this,e,r,n),this.check()}ortho(t){const{left:e,right:r,bottom:n,top:i,near:o=Yn,far:s=Hn}=t;return jn(this,e,r,n,i,o,s),this.check()}orthographic(t){const{fovy:e=Vn,aspect:r=zn,focalDistance:n=1,near:i=Yn,far:o=Hn}=t;Zn(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 Zn(e),Un(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],c=t[9],h=t[10],f=t[11],p=t[12],g=t[13],A=t[14],d=t[15],(e*s-r*o)*(h*d-f*A)-(e*a-n*o)*(c*d-f*g)+(e*u-i*o)*(c*A-h*g)+(r*a-n*s)*(l*d-f*p)-(r*u-i*s)*(l*A-h*p)+(n*u-i*a)*(l*g-c*p);var t,e,r,n,i,o,s,a,u,l,c,h,f,p,g,A,d}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],c=e[8],h=e[9],f=e[10],p=e[11],g=e[12],A=e[13],d=e[14],y=e[15],v=r*a-n*s,m=r*u-i*s,_=r*l-o*s,I=n*u-i*a,E=n*l-o*a,x=i*l-o*u,C=c*A-h*g,w=c*d-f*g,b=c*y-p*g,B=h*d-f*A,S=h*y-p*A,M=f*y-p*d,L=v*M-m*S+_*B+I*b-E*w+x*C;L&&(L=1/L,t[0]=(a*M-u*S+l*B)*L,t[1]=(i*S-n*M-o*B)*L,t[2]=(A*x-d*E+y*I)*L,t[3]=(f*E-h*x-p*I)*L,t[4]=(u*b-s*M-l*w)*L,t[5]=(r*M-i*b+o*w)*L,t[6]=(d*_-g*x-y*m)*L,t[7]=(c*x-f*_+p*m)*L,t[8]=(s*S-a*b+l*C)*L,t[9]=(n*b-r*S-o*C)*L,t[10]=(g*E-A*_+y*v)*L,t[11]=(h*_-c*E-p*v)*L,t[12]=(a*w-s*B-u*C)*L,t[13]=(r*B-n*w+i*C)*L,t[14]=(A*m-g*I-d*v)*L,t[15]=(c*I-h*m+f*v)*L)}(this,this),this.check()}multiplyLeft(t){return Gn(this,t,this),this.check()}multiplyRight(t){return Gn(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],c=e[9],h=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+c*n,t[6]=a*i+h*n,t[7]=u*i+f*n,t[8]=l*i-o*n,t[9]=c*i-s*n,t[10]=h*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],c=e[9],h=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-c*n,t[2]=a*i-h*n,t[3]=u*i-f*n,t[8]=o*n+l*i,t[9]=s*n+c*i,t[10]=a*n+h*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],c=e[5],h=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+c*n,t[2]=a*i+h*n,t[3]=u*i+f*n,t[4]=l*i-o*n,t[5]=c*i-s*n,t[6]=h*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,c,h,f,p,g,A,d,y,v,m,_,I,E,x,C,w,b,B,S=n[0],M=n[1],L=n[2],N=Math.hypot(S,M,L);N<Nn||(S*=N=1/N,M*=N,L*=N,i=Math.sin(r),s=1-(o=Math.cos(r)),a=e[0],u=e[1],l=e[2],c=e[3],h=e[4],f=e[5],p=e[6],g=e[7],A=e[8],d=e[9],y=e[10],v=e[11],m=S*S*s+o,_=M*S*s+L*i,I=L*S*s-M*i,E=S*M*s-L*i,x=M*M*s+o,C=L*M*s+S*i,w=S*L*s+M*i,b=M*L*s-S*i,B=L*L*s+o,t[0]=a*m+h*_+A*I,t[1]=u*m+f*_+d*I,t[2]=l*m+p*_+y*I,t[3]=c*m+g*_+v*I,t[4]=a*E+h*x+A*C,t[5]=u*E+f*x+d*C,t[6]=l*E+p*x+y*C,t[7]=c*E+g*x+v*C,t[8]=a*w+h*b+A*B,t[9]=u*w+f*b+d*B,t[10]=l*w+p*b+y*B,t[11]=c*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,c,h,f,p,g,A=r[0],d=r[1],y=r[2];e===t?(t[12]=e[0]*A+e[4]*d+e[8]*y+e[12],t[13]=e[1]*A+e[5]*d+e[9]*y+e[13],t[14]=e[2]*A+e[6]*d+e[10]*y+e[14],t[15]=e[3]*A+e[7]*d+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],c=e[7],h=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]=c,t[8]=h,t[9]=f,t[10]=p,t[11]=g,t[12]=n*A+a*d+h*y+e[12],t[13]=i*A+u*d+f*y+e[13],t[14]=o*A+l*d+p*y+e[14],t[15]=s*A+c*d+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),Sn(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 Sn(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=Rn(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Sn(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 Wn,Kn;function Zn(t){if(t>2*Math.PI)throw Error("expected radians")}var $n=.1,ti=1e-12,ei=1e-15;Math.PI,Math.PI,Math.PI,Math.PI;function ri(t){return t}function ni(t,e=[]){return function(t,e=[],r=ri){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,mn._cartographicRadians?ri:En)}function ii(t,e){return function(t,e,r=ri){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,mn._cartographicRadians?ri:xn)}new On;const oi=new On,si=new On,ai=new On;const ui=new On,li={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"}},ci={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},hi={east:new On,north:new On,up:new On,west:new On,south:new On,down:new On},fi=new On,pi=new On,gi=new On;function Ai(t,e,r,n,i,o){const s=li[e]&&li[e][r];let a,u,l;dn(s&&(!n||n===s));const c=ui.copy(i);if(Cn(c.x,0,1e-14)&&Cn(c.y,0,1e-14)){const t=Math.sign(c.z);a=fi.fromArray(ci[e]),"east"!==e&&"west"!==e&&a.scale(t),u=pi.fromArray(ci[r]),"east"!==r&&"west"!==r&&u.scale(t),l=gi.fromArray(ci[n]),"east"!==n&&"west"!==n&&l.scale(t)}else{const{up:i,east:o,north:s}=hi;o.set(-c.y,c.x,0).normalize(),t.geodeticSurfaceNormal(c,i),s.copy(i).cross(o);const{down:h,west:f,south:p}=hi;h.copy(i).scale(-1),f.copy(o).scale(-1),p.copy(s).scale(-1),a=hi[e],u=hi[r],l=hi[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]=c.x,o[13]=c.y,o[14]=c.z,o[15]=1,o}const di=new On,yi=new On,vi=new On,mi=new On,_i=new On,Ii=new On;class Ei{constructor(t=0,e=0,r=0){An(this,"radii",void 0),An(this,"radiiSquared",void 0),An(this,"radiiToTheFourth",void 0),An(this,"oneOverRadii",void 0),An(this,"oneOverRadiiSquared",void 0),An(this,"minimumRadius",void 0),An(this,"maximumRadius",void 0),An(this,"centerToleranceSquared",$n),An(this,"squaredXOverSquaredZ",void 0),dn(t>=0),dn(e>=0),dn(r>=0),this.radii=new On(t,e,r),this.radiiSquared=new On(t*t,e*e,r*r),this.radiiToTheFourth=new On(t*t*t*t,e*e*e*e,r*r*r*r),this.oneOverRadii=new On(0===t?0:1/t,0===e?0:1/e,0===r?0:1/r),this.oneOverRadiiSquared=new On(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=yi,n=vi,[,,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]){Ii.from(t);const r=this.scaleToGeodeticSurface(Ii,mi);if(!r)return;const n=this.geodeticSurfaceNormal(r,yi),i=_i;i.copy(Ii).subtract(r);const o=Math.atan2(n.y,n.x),s=Math.asin(n.z),a=Math.sign(Dn(i,Ii))*function(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}(i);return ii([o,s,a],e)}eastNorthUpToFixedFrame(t,e=new Jn){return Ai(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,r,n,i=new Jn){return Ai(this,t,e,r,n,i)}geocentricSurfaceNormal(t,e=[0,0,0]){return di.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const r=ni(t),n=r[0],i=r[1],o=Math.cos(i);return di.set(o*Math.cos(n),o*Math.sin(n),Math.sin(i)).normalize(),di.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return di.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,r=[]){const{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:o}=e;oi.from(t);const s=oi.x,a=oi.y,u=oi.z,l=n.x,c=n.y,h=n.z,f=s*s*l*l,p=a*a*c*c,g=u*u*h*h,A=f+p+g,d=Math.sqrt(1/A);if(!Number.isFinite(d))return;const y=si;if(y.copy(t).scale(d),A<o)return y.to(r);const v=i.x,m=i.y,_=i.z,I=ai;I.set(y.x*v*2,y.y*m*2,y.z*_*2);let E,x,C,w,b=(1-d)*oi.len()/(.5*I.len()),B=0;do{b-=B,E=1/(1+b*v),x=1/(1+b*m),C=1/(1+b*_);const t=E*E,e=x*x,r=C*C;w=f*t+p*e+g*r-1,B=w/(-2*(f*(t*E)*v+p*(e*x)*m+g*(r*C)*_))}while(Math.abs(w)>ti);return oi.scale([E,x,C]).to(r)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){mi.from(t);const r=mi.x,n=mi.y,i=mi.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(r*r*o.x+n*n*o.y+i*i*o.z);return mi.multiplyScalar(s).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return mi.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return mi.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,r=[0,0,0]){dn(Cn(this.radii.x,this.radii.y,ei)),dn(this.radii.z>0),mi.from(t);const n=mi.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-e))return mi.set(0,0,n).to(r)}}An(Ei,"WGS84",new Ei(6378137,6378137,6356752.314245179));var xi=new r.Sphere,Ci=new r.Matrix4,wi=new r.Vector3,bi=new r.Vector3,Bi=new r.Ray,Si=[];function Mi(t,e){return t.distance-e.distance}function Li(t,e,r){t.traverse((function(t){Object.getPrototypeOf(t).raycast.call(t,e,r)}))}function Ni(t,e,r,n){if(r.has(t)){if(Li(t.cached.scene,n,Si),Si.length>0){Si.length>1&&Si.sort(Mi);var i=Si[0];return Si.length=0,i}return null}for(var o=[],s=t.children,a=0,u=s.length;a<u;a++){var l=s[a],c=l.cached,h=e.matrixWorld;Ci.copy(h);var f=c.sphere;if(!f||(xi.copy(f),xi.applyMatrix4(Ci),n.ray.intersectsSphere(xi))){var p=c.box,g=c.boxTransform;if(p){if(Ci.multiply(g).invert(),Bi.copy(n.ray),Bi.applyMatrix4(Ci),!Bi.intersectBox(p,wi))continue;bi.setFromMatrixScale(Ci);var A=bi.x;Math.abs(Math.max(bi.x-bi.y,bi.x-bi.z))>1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when raycasting.");var d={distance:1/0,tile:null};o.push(d),p.containsPoint(Bi.origin)?d.distance=0:d.distance=wi.distanceToSquared(Bi.origin)*A*A,d.tile=l}}}o.sort(Mi);for(var y=1/0,v=null,m=0,_=o.length;m<_;m++){var I=o[m];if(I.distance>y)break;var E=I.tile,x=E.cached.scene,C=null;if(r.has(E)?(Li(x,n,Si),Si.length>0&&(Si.length>1&&Si.sort(Mi),C=Si[0])):C=Ni(E,e,r,n),C){var w=C.distance*C.distance;w<y&&(y=w,v=C),Si.length=0}}return v}function Ti(t,e,r,n,i){var o=t.cached,s=e.matrixWorld;Ci.copy(s);var a=o.sphere;if(!a||(xi.copy(a),xi.applyMatrix4(Ci),n.ray.intersectsSphere(xi))){var u=o.box,l=o.boxTransform;if(!u||(Ci.multiply(l).invert(),Bi.copy(n.ray).applyMatrix4(Ci),Bi.intersectsBox(u))){var c=o.scene;if(r.has(t))Li(c,n,i);else for(var h=t.children,f=0,p=h.length;f<p;f++)Ti(h[f],e,r,n,i)}}}var Ri=Symbol("INITIAL_FRUSTUM_CULLED"),Di=new r.Matrix4,Qi=new r.Matrix4,Pi=new r.Matrix4,ki=new r.Vector3,Oi=new r.Vector3,Fi=new r.Vector3,Gi=new r.Vector3,Ui=new r.Vector3,qi=new r.Vector3,ji=new r.Vector3,Vi=new r.Quaternion,zi=new r.Vector3,Yi=new r.Vector3,Hi=new r.Vector3(1,0,0),Xi=new r.Vector3(0,1,0);function Ji(t,e){t.traverse((function(t){t.frustumCulled=t[Ri]&&e}))}var Wi=function(t){A(n,t);var e=m(n);function n(){var t;h(this,n);for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];(t=e.call.apply(e,[this].concat(o))).group=new Jr(v(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 r.LoadingManager;a.setURLModifier((function(e){return t.preprocessURL?t.preprocessURL(e):e})),t.manager=a;var u=v(t);return t._overridenRaycast=function(t,e){u.optimizeRaycast||Object.getPrototypeOf(this).raycast.call(this,t,e)},t}return p(n,[{key:"autoDisableRendererCulling",get:function(){return this._autoDisableRendererCulling},set:function(t){this._autoDisableRendererCulling!==t&&(x(d(n.prototype),"_autoDisableRendererCulling",t,this,!0),this.forEachLoadedModel((function(e){Ji(e,!t)})))}},{key:"getBounds",value:function(t){if(!this.root)return!1;var e=this.root.cached,r=e.box,n=e.boxTransform;if(r)return t.copy(r),t.applyMatrix4(n),!0;var i=e.sphere;return!!i&&(i.getBoundingBox(t),!0)}},{key:"getOrientedBounds",value:function(t,e){if(!this.root)return!1;var r=this.root.cached,n=r.box,i=r.boxTransform;if(n)return t.copy(n),e.copy(i),!0;var o=r.sphere;return!!o&&(o.getBoundingBox(t),e.identity(),!0)}},{key:"getBoundingSphere",value:function(t){if(!this.root)return!1;var e=this.root.cached.sphere;return!!e&&(t.copy(e),!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=Ni(this.root,this.group,this.activeTiles,t);r&&e.push(r)}else Ti(this.root,this.group,this.activeTiles,t,e)}},{key:"hasCamera",value:function(t){return this.cameraMap.has(t)}},{key:"setCamera",value:function(t){var e=this.cameras,n=this.cameraMap;return!n.has(t)&&(n.set(t,new r.Vector2),e.push(t),!0)}},{key:"setResolution",value:function(t,e,n){var i=this.cameraMap;return!!i.has(t)&&(e instanceof r.Vector2?i.get(t).copy(e):i.get(t).set(e,n),!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,r=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=I(d(n.prototype),"fetchTileSet",this)).call.apply(e,[this,t].concat(o));return a.then((function(e){r.onLoadTileSet&&Promise.resolve().then((function(){r.onLoadTileSet(e,t)}))})),a}},{key:"update",value:function(){var t=this.group,e=this.cameras,i=this.cameraMap,o=this.cameraInfo;if(0!==e.length){for(;o.length>e.length;)o.pop();for(;o.length<e.length;)o.push({frustum:new r.Frustum,isOrthographic:!1,sseDenominator:-1,position:new r.Vector3,invScale:-1,pixelSize:0});Qi.copy(t.matrixWorld).invert(),ki.setFromMatrixScale(Qi);var s=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 a=0,u=o.length;a<u;a++){var l=e[a],c=o[a],h=c.frustum,f=c.position,p=i.get(l);0!==p.width&&0!==p.height||console.warn("TilesRenderer: resolution for camera error calculation is not set.");var g=l.projectionMatrix.elements;if(c.isOrthographic=1===g[15],c.isOrthographic){var A=2/g[0],y=2/g[5];c.pixelSize=Math.max(y/p.height,A/p.width)}else c.sseDenominator=2/g[5]/p.height;c.invScale=s,Di.copy(t.matrixWorld),Di.premultiply(l.matrixWorldInverse),Di.premultiply(l.projectionMatrix),h.setFromProjectionMatrix(Di),f.set(0,0,0),f.applyMatrix4(l.matrixWorld),f.applyMatrix4(Qi)}I(d(n.prototype),"update",this).call(this)}else console.warn("TilesRenderer: no cameras defined. Cannot update 3d tiles.")}},{key:"preprocessNode",value:function(t,e,i){I(d(n.prototype),"preprocessNode",this).call(this,t,e,i);var o=new r.Matrix4;if(t.transform)for(var s=t.transform,a=0;a<16;a++)o.elements[a]=s[a];else o.identity();e&&o.premultiply(e.cached.transform);var u=(new r.Matrix4).copy(o).invert(),l=null,c=null,h=null,f=null;if("box"in t.boundingVolume){var p=t.boundingVolume.box;l=new r.Box3,c=new r.Matrix4,h=new r.Matrix4,f=new r.Vector3;var g=this.threeLayer.distanceToVector3(p[3],p[3]).x,A=this.threeLayer.distanceToVector3(p[4],p[4]).x,y=this.threeLayer.distanceToVector3(p[5],p[5]).x;Oi.set(g,A,y);var v=this.threeLayer.distanceToVector3(p[6],p[6]).x,m=this.threeLayer.distanceToVector3(p[7],p[7]).x,_=this.threeLayer.distanceToVector3(p[8],p[8]).x;Fi.set(v,m,_);var E=this.threeLayer.distanceToVector3(p[9],p[9]).x,x=this.threeLayer.distanceToVector3(p[10],p[10]).x,w=this.threeLayer.distanceToVector3(p[11],p[11]).x;Gi.set(E,x,w),Ui.set(p[3],p[4],p[5]),qi.set(p[6],p[7],p[8]),ji.set(p[9],p[10],p[11]);var b=Oi.length(),B=Fi.length(),S=Gi.length(),M=Ui.length(),L=qi.length(),N=ji.length();f.set(b/M,B/L,S/N),Oi.normalize(),Fi.normalize(),Gi.normalize(),0===b&&Oi.crossVectors(Fi,Gi),0===B&&Fi.crossVectors(Oi,Gi),0===S&&Gi.crossVectors(Oi,Fi),c.set(Oi.x,Fi.x,Gi.x,p[0],Oi.y,Fi.y,Gi.y,p[1],Oi.z,Fi.z,Gi.z,p[2],0,0,0,1),c.premultiply(o),u.decompose(Yi,Vi,zi);var T=Pi.makeRotationFromQuaternion(Vi);c.multiply(T);var R=Ei.WGS84.cartesianToCartographic([c.elements[12],c.elements[13],c.elements[14]],ki),D=this.threeLayer.coordinateToVector3([R.x,R.y],R.z),Q=this.threeLayer.distanceToVector3(D.z+this.heightOffset,D.z+this.heightOffset).x;c.elements[12]=D.x+this.xOffset,c.elements[13]=D.y+this.yOffset,c.elements[14]=Q,h.copy(c).invert(),l.min.set(-b,-B,-S),l.max.set(b,B,S)}var P=null;if("sphere"in t.boundingVolume){var k=t.boundingVolume.sphere;(P=new r.Sphere).center.set(k[0],k[1],k[2]),P.radius=k[3],P.applyMatrix4(o)}else if("box"in t.boundingVolume){var O=t.boundingVolume.box;P=new r.Sphere,l.getBoundingSphere(P),P.center.set(O[0],O[1],O[2]),P.applyMatrix4(o);var F=Ei.WGS84.cartesianToCartographic([P.center.x,P.center.y,P.center.z],ki),G=this.threeLayer.coordinateToVector3([F.x,F.y],F.z);P.center.x=G.x+this.xOffset,P.center.y=G.y+this.yOffset,P.center.z=this.threeLayer.distanceToVector3(G.z+this.heightOffset,G.z+this.heightOffset).x}var U=null;if("region"in t.boundingVolume){var q=C(t.boundingVolume.region,6),j=q[0],V=q[1],z=q[2],Y=q[3],H=q[4],X=q[5];U=new fn(ye,ye,ve,V,Y,j,z,H,X),null===P&&(P=new r.Sphere,U.getBoundingSphere(P)),null===l&&(l=new r.Box3,c=new r.Matrix4,h=new r.Matrix4,U.getBoundingBox(l,c),h.copy(c).invert())}t.cached={loadIndex:0,transform:o,transformInverse:u,active:!1,inFrustum:[],box:l,boxTransform:c,boxTransformInverse:h,sphere:P,region:U,scene:null,geometry:null,material:null,scale:f}}},{key:"parseTile",value:function(t,e,n){var i=this;e._loadIndex=e._loadIndex||0,e._loadIndex++;var o=e.content.uri.split(/[\\\/]/g);o.pop();var s=o.join("/"),a=this.fetchOptions,u=this.manager,l=e._loadIndex,c=null,h=this.rootTileSet.asset&&this.rootTileSet.asset.gltfUpAxis||"y",f=e.cached,p=f.transform,g=f.scale,A=f.transformInverse,d=new r.Matrix4;switch(h.toLowerCase()){case"x":d.makeRotationAxis(Xi,-Math.PI/2);break;case"y":d.makeRotationAxis(Hi,Math.PI/2);break;case"z":d.identity()}var y=(Pe(t)||n).toLowerCase();switch(y){case"b3dm":var v=new Nr(u);v.workingPath=s,v.fetchOptions=a,v.adjustmentTransform.copy(d),c=v.parse(t);break;case"pnts":var m=new Dr(u);m.workingPath=s,m.fetchOptions=a,c=m.parse(t);break;case"i3dm":var _=new jr(u);_.workingPath=s,_.fetchOptions=a,_.adjustmentTransform.copy(d),c=_.parse(t);break;case"cmpt":var I=new zr(u);I.workingPath=s,I.fetchOptions=a,I.adjustmentTransform.copy(d),c=I.parse(t).then((function(t){return t.scene}));break;case"gltf":case"glb":var E=new Hr(u);E.workingPath=s,E.fetchOptions=a,c=E.parse(t);break;default:console.warn('TilesRenderer: Content type "'.concat(y,'" not supported.')),c=Promise.resolve(null)}return c.then((function(t){var r,n;if(t.isObject3D?(r=t,n=null):(r=t.scene,n=t),e._loadIndex===l){r.updateMatrix(),"glb"!==y&&"gltf"!==y||r.matrix.multiply(d),r.matrix.premultiply(p);var o=Ei.WGS84.cartesianToCartographic([r.matrix.elements[12],r.matrix.elements[13],r.matrix.elements[14]],ki),s=i.threeLayer.coordinateToVector3([o.x,o.y],o.z),a=i.threeLayer.distanceToVector3(s.z+i.heightOffset,s.z+i.heightOffset).x;r.matrix.elements[12]=s.x+i.xOffset,r.matrix.elements[13]=s.y+i.yOffset,r.matrix.elements[14]=a,r.matrix.decompose(r.position,r.quaternion,r.scale),A.decompose(Oi,Vi,Fi),r.applyQuaternion(Vi),r.scale.copy(g),r.traverse((function(t){t[Ri]=t.frustumCulled})),Ji(r,!i.autoDisableRendererCulling),r.traverse((function(t){t.raycast=i._overridenRaycast}));var u=[],c=[],h=[];r.traverse((function(t){if(t.geometry&&c.push(t.geometry),t.material){var e=t.material;for(var r in u.push(t.material),e){var n=e[r];n&&n.isTexture&&h.push(n)}}})),f.materials=u,f.geometry=c,f.textures=h,f.scene=r,f.metadata=n,i.onLoadModel&&i.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 c=0,h=i.length;c<h;c++){i[c].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.sphere,s=e.box,a=e.boxTransformInverse,u=s&&a,l=-1/0,c=1/0,h=0,f=n.length;h<f;h++)if(r[h]){var p=i[h],g=p.invScale,A=void 0;if(p.isOrthographic){var d=p.pixelSize;A=t.geometricError/(d*g)}else{ki.copy(p.position);var y=void 0;u?(ki.applyMatrix4(a),y=s.distanceToPoint(ki)):y=Math.max(o.distanceToPoint(ki),0);var v=y*g,m=p.sseDenominator;A=t.geometricError/(v*m),c=Math.min(c,v)}l=Math.max(l,A)}t.__distanceFromCamera=c,t.__error=l}},{key:"tileInView",value:function(t){var e=t.cached,r=e.sphere,n=e.inFrustum;if(r){for(var i=this.cameraInfo,o=!1,s=0,a=i.length;s<a;s++){i[s].frustum.intersectsSphere(r)?(o=!0,n[s]=!0):n[s]=!1}return o}return!0}}]),n}(Ne);new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new tn(ye,ye,ve);var Ki=new WeakMap,Zi=function(t){A(n,t);var e=m(n);function n(t){var r;return h(this,n),(r=e.call(this,t)).decoderPath="",r.decoderConfig={},r.decoderBinary=null,r.decoderPending=null,r.workerLimit=4,r.workerPool=[],r.workerNextTaskID=1,r.workerSourceURL="",r.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},r.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},r}return p(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,n,i){var o=this,s=new r.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(t){o.decodeDracoFile(t,e).catch(i)}),n,i)}},{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(Ki.has(t)){var o=Ki.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)})),Ki.set(t,{key:i,promise:u}),u}},{key:"_createGeometry",value:function(t){var e=new r.BufferGeometry;t.index&&e.setIndex(new r.BufferAttribute(t.index.array,1));for(var n=0;n<t.attributes.length;n++){var i=t.attributes[n],o=i.name,s=i.array,a=i.itemSize;e.setAttribute(o,new r.BufferAttribute(s,a))}return e}},{key:"_loadLibrary",value:function(t,e){var n=new r.FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(e),n.setWithCredentials(this.withCredentials),new Promise((function(e,r){n.load(t,e,void 0,r)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var t=this;if(this.decoderPending)return this.decoderPending;var e="object"!==("undefined"==typeof WebAssembly?"undefined":u(WebAssembly))||"js"===this.decoderConfig.type,r=[];return e?r.push(this._loadLibrary("draco_decoder.js","text")):(r.push(this._loadLibrary("draco_wasm_wrapper.js","text")),r.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(r).then((function(r){var n=r[0];e||(t.decoderConfig.wasmBinary=r[1]);var i=$i.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}(r.Loader);function $i(){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),c=t._malloc(u);e.GetAttributeDataArrayForAllPoints(r,o,l,u,c);var h=new i(t.HEAPF32.buffer,c,a).slice();return t._free(c),{name:n,array:h,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 c={index:null,attributes:[]};for(var h in a){var f=self[u[h]],p=void 0,g=void 0;if(i.useUniqueIDs)g=a[h],p=e.GetAttributeByUniqueId(o,g);else{if(-1===(g=e.GetAttributeId(o,t[a[h]])))continue;p=e.GetAttribute(o,g)}c.attributes.push(r(t,e,o,h,f,p))}l===t.TRIANGULAR_MESH&&(c.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),c}(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 to,eo,ro,no=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4;h(this,t),this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}return p(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}(),io=0,oo=2,so=p((function t(){h(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,i){h(this,t),this._dataView=new DataView(e.buffer,e.byteOffset+r,n),this._littleEndian=i,this._offset=0}return p(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}(),uo=[171,75,84,88,32,50,48,187,13,10,26,10];function lo(t){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(t):Buffer.from(t).toString("utf8")}function co(t){var e=new Uint8Array(t.buffer,t.byteOffset,uo.length);if(e[0]!==uo[0]||e[1]!==uo[1]||e[2]!==uo[2]||e[3]!==uo[3]||e[4]!==uo[4]||e[5]!==uo[5]||e[6]!==uo[6]||e[7]!==uo[7]||e[8]!==uo[8]||e[9]!==uo[9]||e[10]!==uo[10]||e[11]!==uo[11])throw new Error("Missing KTX 2.0 identifier.");var r=new so,n=17*Uint32Array.BYTES_PER_ELEMENT,i=new ao(t,uo.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(),c=i._nextUint64(),h=i._nextUint64(),f=new ao(t,uo.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),A={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:[]},d=(A.descriptorBlockSize/4-6)/4,y=0;y<d;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()),A.samples[y]=v}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(A);for(var m=new ao(t,u,l,!0);m._offset<l;){var _=m._nextUint32(),I=m._scan(_),E=lo(I),x=m._scan(_-I.byteLength);r.keyValue[E]=E.match(/^ktx/i)?lo(x):x,m._offset%4&&m._skip(4-m._offset%4)}if(h<=0)return r;for(var C=new ao(t,c,h,!0),w=C._nextUint16(),b=C._nextUint16(),B=C._nextUint32(),S=C._nextUint32(),M=C._nextUint32(),L=C._nextUint32(),N=[],T=0;T<o;T++)N.push({imageFlags:C._nextUint32(),rgbSliceByteOffset:C._nextUint32(),rgbSliceByteLength:C._nextUint32(),alphaSliceByteOffset:C._nextUint32(),alphaSliceByteLength:C._nextUint32()});var R=c+C._offset,D=R+B,Q=D+S,P=Q+M,k=new Uint8Array(t.buffer,t.byteOffset+R,B),O=new Uint8Array(t.buffer,t.byteOffset+D,S),F=new Uint8Array(t.buffer,t.byteOffset+Q,M),G=new Uint8Array(t.buffer,t.byteOffset+P,L);return r.globalData={endpointCount:w,selectorCount:b,imageDescs:N,endpointsData:k,selectorsData:O,tablesData:F,extendedData:G},r}var ho,fo,po,go,Ao={env:{emscripten_notify_memory_growth:function(t){ro=new Uint8Array(eo.exports.memory.buffer)}}},yo=function(){function t(){h(this,t)}return p(t,[{key:"init",value:function(){return to||(to="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+vo).then((function(t){return t.arrayBuffer()})).then((function(t){return WebAssembly.instantiate(t,Ao)})).then(this._init):WebAssembly.instantiate(Buffer.from(vo,"base64"),Ao).then(this._init))}},{key:"_init",value:function(t){eo=t.instance,Ao.env.emscripten_notify_memory_growth(0)}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!eo)throw new Error("ZSTDDecoder: Await .init() before decoding.");var r=t.byteLength,n=eo.exports.malloc(r);ro.set(t,n),e=e||Number(eo.exports.ZSTD_findDecompressedSize(n,r));var i=eo.exports.malloc(e),o=eo.exports.ZSTD_decompress(i,e,n,r),s=ro.slice(i,i+o);return eo.exports.free(n),eo.exports.free(i),s}}]),t}(),vo="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IAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQh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ASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigC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C0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdB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IAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY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wOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEE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",mo=new WeakMap,_o=0,Io=function(t){A(i,t);var e,n=m(i);function i(t){var e;return h(this,i),(e=n.call(this,t)).transcoderPath="",e.transcoderBinary=null,e.transcoderPending=null,e.workerPool=new no,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 p(i,[{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 r.FileLoader(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);var n=e.loadAsync("basis_transcoder.js"),o=new r.FileLoader(this.manager);o.setPath(this.transcoderPath),o.setResponseType("arraybuffer"),o.setWithCredentials(this.withCredentials);var s=o.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([n,s]).then((function(e){var r=C(e,2),n=r[0],o=r[1],s=i.BasisWorker.toString(),a=["/* constants */","let _EngineFormat = "+JSON.stringify(i.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(i.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(i.BasisFormat),"/* basis_transcoder.js */",n,"/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([a])),t.transcoderBinary=o,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}))})),_o>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),_o++}return this.transcoderPending}},{key:"load",value:function(t,e,n,i){var o=this;if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");var s=new r.FileLoader(this.manager);s.setResponseType("arraybuffer"),s.setWithCredentials(this.withCredentials),s.load(t,(function(t){if(mo.has(t))return mo.get(t).promise.then(e).catch(i);o._createTexture(t).then((function(t){return e?e(t):null})).catch(i)}),n,i)}},{key:"_createTextureFrom",value:function(t,e){var n=t.mipmaps,i=t.width,o=t.height,s=t.format,a=t.type,u=t.error,l=t.dfdTransferFn,c=t.dfdFlags;if("error"===a)return Promise.reject(u);var h=e.layerCount>1?new r.CompressedArrayTexture(n,i,o,e.layerCount,s,r.UnsignedByteType):new r.CompressedTexture(n,i,o,s,r.UnsignedByteType);return h.minFilter=1===n.length?r.LinearFilter:r.LinearMipmapLinearFilter,h.magFilter=r.LinearFilter,h.generateMipmaps=!1,h.needsUpdate=!0,h.encoding=2===l?r.sRGBEncoding:r.LinearEncoding,h.premultiplyAlpha=!!(1&c),h}},{key:"_createTexture",value:(e=c(a().mark((function t(e){var r,n,i,o,s=this,u=arguments;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=u.length>1&&void 0!==u[1]?u[1]:{},0===(n=co(new Uint8Array(e))).vkFormat){t.next=4;break}return t.abrupt("return",wo(n));case 4:return i=r,o=this.init().then((function(){return s.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:i},[e])})).then((function(t){return s._createTextureFrom(t.data,n)})),mo.set(e,{promise:o}),t.abrupt("return",o);case 8:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"dispose",value:function(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),_o--,this}}]),i}(r.Loader);Io.BasisFormat={ETC1S:0,UASTC_4x4:1},Io.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},Io.EngineFormat={RGBAFormat:r.RGBAFormat,RGBA_ASTC_4x4_Format:r.RGBA_ASTC_4x4_Format,RGBA_BPTC_Format:r.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:r.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:r.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:r.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:r.RGB_ETC1_Format,RGB_ETC2_Format:r.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:r.RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format:r.RGB_S3TC_DXT1_Format},Io.BasisWorker=function(){var t,e,r,n=_EngineFormat,i=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",(function(s){var h,f=s.data;switch(f.type){case"init":t=f.config,h=f.transcoderBinary,e=new Promise((function(t){r={wasmBinary:h,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 h(){s.close(),s.delete()}if(!s.isValid())throw h(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");var f=s.isUASTC()?o.UASTC_4x4:o.ETC1S,p=s.getWidth(),g=s.getHeight(),A=s.getLayers()||1,d=s.getLevels(),y=s.getHasAlpha(),v=s.getDFDTransferFunc(),m=s.getDFDFlags(),_=function(e,r,s,c){for(var h,f,p=e===o.ETC1S?a:u,g=0;g<p.length;g++){var A=p[g];if(t[A.if]&&(A.basisFormat.includes(e)&&!(c&&A.transcoderFormat.length<2)&&(!A.needsPowerOfTwo||l(r)&&l(s))))return{transcoderFormat:h=A.transcoderFormat[c?1:0],engineFormat:f=A.engineFormat[c?1:0]}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),h=i.RGBA32,f=n.RGBAFormat,{transcoderFormat:h,engineFormat:f}}(f,p,g,y),I=_.transcoderFormat,E=_.engineFormat;if(!p||!g||!d)throw h(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!s.startTranscoding())throw h(),new Error("THREE.KTX2Loader: .startTranscoding failed");for(var x=[],C=0;C<d;C++){for(var w=[],b=void 0,B=void 0,S=0;S<A;S++){var M=s.getImageLevelInfo(C,S,0);b=M.origWidth,B=M.origHeight;var L=new Uint8Array(s.getImageTranscodedSizeInBytes(C,S,0,I));if(!s.transcodeImage(L,C,S,0,I,0,-1,-1))throw h(),new Error("THREE.KTX2Loader: .transcodeImage failed.");w.push(L)}x.push({data:c(w),width:b,height:B})}return h(),{width:p,height:g,hasAlpha:y,mipmaps:x,format:E,dfdTransferFn:v,dfdFlags:m}}(f.buffer),s=e.width,h=e.height,p=e.hasAlpha,g=e.mipmaps,A=e.format,d=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:h,hasAlpha:p,mipmaps:g,format:A,dfdTransferFn:d,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 c(t){var e,r=0,n=B(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=B(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 Eo=(g(ho={},109,r.RGBAFormat),g(ho,97,r.RGBAFormat),g(ho,37,r.RGBAFormat),g(ho,43,r.RGBAFormat),g(ho,103,r.RGFormat),g(ho,83,r.RGFormat),g(ho,16,r.RGFormat),g(ho,22,r.RGFormat),g(ho,100,r.RedFormat),g(ho,76,r.RedFormat),g(ho,15,r.RedFormat),g(ho,9,r.RedFormat),ho),xo=(g(fo={},109,r.FloatType),g(fo,97,r.HalfFloatType),g(fo,37,r.UnsignedByteType),g(fo,43,r.UnsignedByteType),g(fo,103,r.FloatType),g(fo,83,r.HalfFloatType),g(fo,16,r.UnsignedByteType),g(fo,22,r.UnsignedByteType),g(fo,100,r.FloatType),g(fo,76,r.HalfFloatType),g(fo,15,r.UnsignedByteType),g(fo,9,r.UnsignedByteType),fo),Co=(g(po={},43,r.sRGBEncoding),g(po,22,r.sRGBEncoding),g(po,15,r.sRGBEncoding),po);function wo(t){return bo.apply(this,arguments)}function bo(){return bo=c(a().mark((function t(e){var n,i,o,s,u,l,h,f;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.vkFormat,i=e.pixelWidth,o=e.pixelHeight,s=e.pixelDepth,void 0!==Eo[n]){t.next=3;break}throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");case 3:if(u=e.levels[0],e.supercompressionScheme!==io){t.next=8;break}l=u.levelData,t.next=16;break;case 8:if(e.supercompressionScheme!==oo){t.next=15;break}return go||(go=new Promise(function(){var t=c(a().mark((function t(e){var r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new yo,t.next=3,r.init();case 3:e(r);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())),t.next=12,go;case 12:l=t.sent.decode(u.levelData,u.uncompressedByteLength),t.next=16;break;case 15:throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");case 16:return h=xo[n]===r.FloatType?new Float32Array(l.buffer,l.byteOffset,l.byteLength/Float32Array.BYTES_PER_ELEMENT):xo[n]===r.HalfFloatType?new Uint16Array(l.buffer,l.byteOffset,l.byteLength/Uint16Array.BYTES_PER_ELEMENT):l,(f=0===s?new r.DataTexture(h,i,o):new r.Data3DTexture(h,i,o,s)).type=xo[n],f.format=Eo[n],f.encoding=Co[n]||r.LinearEncoding,f.needsUpdate=!0,t.abrupt("return",Promise.resolve(f));case 23:case"end":return t.stop()}}),t)}))),bo.apply(this,arguments)}var Bo={altitude:0},So=function(t){A(r,t);var e=m(r);function r(t,n){var i;return h(this,r),(i=e.call(this))._initOptions(Bo),i.object3d=t,i.object3d.__parent=v(i),i._raycaster=new s.Raycaster,i._mouse=new s.Vector2,i.camera=n,i.selectMesh=null,i}return p(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 c=i.intersectObject(this.object3d,!0);return c.length?(this.selectMesh=c[0],!0):(this.selectMesh=null,!1)}}]),r}(n.BaseObject),Mo=6,Lo=!1,No=!1,To=0,Ro=function(){function t(e,r,n,i){var o=this;h(this,t),this.threelayer=n,this.map=n.map,this.layerClass=i,this.statsUpdate=r.statsUpdate;var s=n.getScene(),a=n.getRenderer().context;a.outputEncoding=THREE.sRGBEncoding;var u=n.getCamera();this.scene=s,this.renderer=a,this.camera=u,this.multiles=[],this.meshs=[];var l=new Zi;l.setDecoderPath(r.decoderPath);var c=new Io;c.setTranscoderPath(r.transcoderPath),c.detectSupport(a),e.forEach((function(t){var e=new Wi(t.url,n);if(e.errorTarget=Mo,e.displayBoxBounds=Lo,e.displaySphereBounds=No,e.colorMode=parseFloat(To),e.heightOffset=t.heightOffset||0,e.xOffset=t.xOffset||0,e.yOffset=t.yOffset||0,e.setCamera(u),e.setResolutionFromRenderer(u,a),o.multiles.length>0){var r=o.multiles[0];e.lruCache=r.lruCache,e.downloadQueue=r.downloadQueue}e.fetchOptions.mode="cors";var i=new Oe(e.manager);i.setDRACOLoader(l),i.setKTX2Loader(c),e.manager.addHandler(/\.gltf$/,i);var s=new So(e.group,u);o.meshs.push(s),o.multiles.push(e)})),this.threelayer.addMesh(this.meshs),this.layerClass.updatables.push(this),this._bindMapEvents()}return p(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}(),Do={radius:100,altitude:0},Qo=function(t){A(r,t);var e=m(r);function r(t,n,i,s){var a;h(this,r),i=o.Util.extend({},Do,i,{layer:s,coordinate:t}),(a=e.call(this))._initOptions(i);var u=i.altitude;a._createGroup(),a.getObject3d().add(n);var l=s.distanceToVector3(u,u).x,c=s.coordinateToVector3(t,l);return a.getObject3d().position.copy(c),s.addMesh(v(a)),a}return p(r)}(n.BaseObject),Po=function(){function t(e,r){h(this,t),this.threeLayer=r;var n=new s.LoadingManager,i=new Oe(n),o=new Zi(n);o.setDecoderPath(e),i.setDRACOLoader(o),n.addHandler(/\.gltf$/,i),n.addHandler(/\.glb$/,i),this.loader=new Hr(n)}var e;return p(t,[{key:"addModel",value:(e=c(a().mark((function t(e,r,n){var i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loader.workingPath=this.loader.workingPathForURL(e),t.next=3,this.loader.load(e);case 3:return i=t.sent,o=new Qo(r,i.scene,n,this.threeLayer),t.abrupt("return",o);case 6:case"end":return t.stop()}}),t,this)}))),function(t,r,n){return e.apply(this,arguments)})}]),t}(),ko=function(t){A(r,t);var e=m(r);function r(t,n){var i;return h(this,r),(i=e.call(this)).name=n,i.customId=R(),t.add(v(i)),i.customType="layer",i}return p(r)}(s.Group),Oo=function(t){return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};try{URL.revokeObjectURL(Oo(""))}catch(t){Oo=function(t){return"data:application/javascript;charset=UTF-8,"+encodeURI(t)}}var Fo=Uint8Array,Go=Uint16Array,Uo=Uint32Array,qo=new Fo([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]),jo=new Fo([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]),Vo=new Fo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zo=function(t,e){for(var r=new Go(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];var i=new Uo(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]},Yo=zo(qo,2),Ho=Yo[0],Xo=Yo[1];Ho[28]=258,Xo[258]=28;for(var Jo=zo(jo,0)[0],Wo=new Go(32768),Ko=0;Ko<32768;++Ko){var Zo=(43690&Ko)>>>1|(21845&Ko)<<1;Zo=(61680&(Zo=(52428&Zo)>>>2|(13107&Zo)<<2))>>>4|(3855&Zo)<<4,Wo[Ko]=((65280&Zo)>>>8|(255&Zo)<<8)>>>1}var $o=function(t,e,r){for(var n=t.length,i=0,o=new Go(e);i<n;++i)++o[t[i]-1];var s,a=new Go(e);for(i=0;i<e;++i)a[i]=a[i-1]+o[i-1]<<1;if(r){s=new Go(1<<e);var u=15-e;for(i=0;i<n;++i)if(t[i])for(var l=i<<4|t[i],c=e-t[i],h=a[t[i]-1]++<<c,f=h|(1<<c)-1;h<=f;++h)s[Wo[h]>>>u]=l}else for(s=new Go(n),i=0;i<n;++i)t[i]&&(s[i]=Wo[a[t[i]-1]++]>>>15-t[i]);return s},ts=new Fo(288);for(Ko=0;Ko<144;++Ko)ts[Ko]=8;for(Ko=144;Ko<256;++Ko)ts[Ko]=9;for(Ko=256;Ko<280;++Ko)ts[Ko]=7;for(Ko=280;Ko<288;++Ko)ts[Ko]=8;var es=new Fo(32);for(Ko=0;Ko<32;++Ko)es[Ko]=5;var rs=$o(ts,9,1),ns=$o(es,5,1),is=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},os=function(t,e,r){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(7&e)&r},ss=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(7&e)},as=function(t){return(t/8|0)+(7&t&&1)},us=function(t,e,r){var n=t.length;if(!n||r&&!r.l&&n<5)return e||new Fo(0);var i=!e||r,o=!r||r.i;r||(r={}),e||(e=new Fo(3*n));var s=function(t){var r=e.length;if(t>r){var n=new Fo(Math.max(2*r,t));n.set(e),e=n}},a=r.f||0,u=r.p||0,l=r.b||0,c=r.l,h=r.d,f=r.m,p=r.n,g=8*n;do{if(!c){r.f=a=os(t,u,1);var A=os(t,u+1,3);if(u+=3,!A){var d=t[(B=as(u)+4)-4]|t[B-3]<<8,y=B+d;if(y>n){if(o)throw"unexpected EOF";break}i&&s(l+d),e.set(t.subarray(B,y),l),r.b=l+=d,r.p=u=8*y;continue}if(1==A)c=rs,h=ns,f=9,p=5;else{if(2!=A)throw"invalid block type";var v=os(t,u,31)+257,m=os(t,u+10,15)+4,_=v+os(t,u+5,31)+1;u+=14;for(var I=new Fo(_),E=new Fo(19),x=0;x<m;++x)E[Vo[x]]=os(t,u+3*x,7);u+=3*m;var C=is(E),w=(1<<C)-1,b=$o(E,C,1);for(x=0;x<_;){var B,S=b[os(t,u,w)];if(u+=15&S,(B=S>>>4)<16)I[x++]=B;else{var M=0,L=0;for(16==B?(L=3+os(t,u,3),u+=2,M=I[x-1]):17==B?(L=3+os(t,u,7),u+=3):18==B&&(L=11+os(t,u,127),u+=7);L--;)I[x++]=M}}var N=I.subarray(0,v),T=I.subarray(v);f=is(N),p=is(T),c=$o(N,f,1),h=$o(T,p,1)}if(u>g){if(o)throw"unexpected EOF";break}}i&&s(l+131072);for(var R=(1<<f)-1,D=(1<<p)-1,Q=u;;Q=u){var P=(M=c[ss(t,u)&R])>>>4;if((u+=15&M)>g){if(o)throw"unexpected EOF";break}if(!M)throw"invalid length/literal";if(P<256)e[l++]=P;else{if(256==P){Q=u,c=null;break}var k=P-254;if(P>264){var O=qo[x=P-257];k=os(t,u,(1<<O)-1)+Ho[x],u+=O}var F=h[ss(t,u)&D],G=F>>>4;if(!F)throw"invalid distance";u+=15&F;T=Jo[G];if(G>3){O=jo[G];T+=ss(t,u)&(1<<O)-1,u+=O}if(u>g){if(o)throw"unexpected EOF";break}i&&s(l+131072);for(var U=l+k;l<U;l+=4)e[l]=e[l-T],e[l+1]=e[l+1-T],e[l+2]=e[l+2-T],e[l+3]=e[l+3-T];l=U}}r.l=c,r.p=Q,r.b=l,c&&(a=1,r.m=f,r.d=h,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 Go?Go:t instanceof Uo?Uo:Fo)(r-e);return n.set(t.subarray(e,r)),n}(e,0,l)},ls=new Fo(0);var cs="undefined"!=typeof TextDecoder&&new TextDecoder;try{cs.decode(ls,{stream:!0}),1}catch(t){}function hs(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 fs(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 ps(t,e,n,i,o){var s=function(t,e,n,i,o){for(var s=o<t?o:t,a=[],u=hs(t,i,e),l=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=[],c=0;c<=r;++c)l[c]=o.slice(0);l[0][0]=1;for(var h=o.slice(0),f=o.slice(0),p=1;p<=r;++p){h[p]=e-i[t+1-p],f[p]=i[t+p]-e;for(var g=0,A=0;A<p;++A){var d=f[A+1],y=h[p-A];l[p][A]=d+y;var v=l[A][p-1]/l[p][A];l[A][p]=g+d*v,g=y*v}l[p][p]=g}for(var m=0;m<=r;++m)a[0][m]=l[m][r];for(var _=0;_<=r;++_){for(var I=0,E=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=_-w,S=r-w;_>=w&&(x[E][0]=x[I][0]/l[S+1][B],b=x[E][0]*l[B][S]);for(var M=_-1<=S?w-1:r-_,L=B>=-1?1:-B;L<=M;++L)x[E][L]=(x[I][L]-x[I][L-1])/l[S+1][B+L],b+=x[E][L]*l[B+L][S];_<=S&&(x[E][w]=-x[I][w-1]/l[S+1][_],b+=x[E][w]*l[_][S]),a[w][_]=b;var N=I;I=E,E=N}}for(var T=r,R=1;R<=n;++R){for(var D=0;D<=r;++D)a[R][D]*=T;T*=r-R}return a}(u,i,t,s,e),c=[],h=0;h<n.length;++h){var f=n[h].clone(),p=f.w;f.x*=p,f.y*=p,f.z*=p,c[h]=f}for(var g=0;g<=s;++g){for(var A=c[u-t].clone().multiplyScalar(l[g][0]),d=1;d<=t;++d)A.add(c[u-t+d].clone().multiplyScalar(l[g][d]));a[g]=A}for(var y=s+1;y<=o+1;++y)a[y]=new r.Vector4(0,0,0);return a}(t,e,n,i,o);return function(t){for(var e=t.length,n=[],i=[],o=0;o<e;++o){var s=t[o];n[o]=new r.Vector3(s.x,s.y,s.z),i[o]=s.w}for(var a=[],u=0;u<e;++u){for(var l=n[u].clone(),c=1;c<=u;++c)l.sub(a[u-c].clone().multiplyScalar(fs(u,c)*i[c]));a[u]=l.divideScalar(i[0])}return a}(s)}var gs,As,ds,ys=function(t){A(n,t);var e=m(n);function n(t,i,o,s,a){var u;h(this,n),(u=e.call(this)).degree=t,u.knots=i,u.controlPoints=[],u.startKnot=s||0,u.endKnot=a||u.knots.length-1;for(var l=0;l<o.length;++l){var c=o[l];u.controlPoints[l]=new r.Vector4(c.x,c.y,c.z,c.w)}return u}return p(n,[{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new r.Vector3,n=this.knots[this.startKnot]+t*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=function(t,e,n,i){for(var o=hs(t,i,e),s=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 c=s[l+1],h=o[a-l],f=i[l]/(c+h);i[l]=u+c*f,u=h*f}i[a]=u}return i}(o,i,t,e),a=new r.Vector4(0,0,0,0),u=0;u<=t;++u){var l=n[o-t+u],c=s[u],h=l.w*c;a.x+=l.x*h,a.y+=l.y*h,a.z+=l.z*h,a.w+=l.w*c}return a}(this.degree,this.knots,this.controlPoints,n);return 1!==i.w&&i.divideScalar(i.w),e.set(i.x,i.y,i.z)}},{key:"getTangent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new r.Vector3,n=this.knots[0]+t*(this.knots[this.knots.length-1]-this.knots[0]),i=ps(this.degree,this.knots,this.controlPoints,n,1);return e.copy(i[1]).normalize(),e}}]),n}(r.Curve),vs=function(t){A(n,t);var e=m(n);function n(t){return h(this,n),e.call(this,t)}return p(n,[{key:"load",value:function(t,e,n,i){var o=this,s=""===o.path?r.LoaderUtils.extractUrlBase(t):o.path,a=new r.FileLoader(this.manager);a.setPath(o.path),a.setResponseType("arraybuffer"),a.setRequestHeader(o.requestHeader),a.setWithCredentials(o.withCredentials),a.load(t,(function(r){try{e(o.parse(r,s))}catch(e){i?i(e):console.error(e),o.manager.itemError(t)}}),n,i)}},{key:"parse",value:function(t,e){if(function(t){var e="Kaydara FBX Binary \0";return t.byteLength>=e.length&&e===Qs(t,0,e.length)}(t))gs=(new xs).parse(t);else{var n=Qs(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}(n))throw new Error("THREE.FBXLoader: Unknown format.");if(bs(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+bs(n));gs=(new Es).parse(n)}var i=new r.TextureLoader(this.manager).setPath(this.resourcePath||e).setCrossOrigin(this.crossOrigin);return new ms(i,this.manager).parse(gs)}}]),n}(r.Loader),ms=function(){function t(e,r){h(this,t),this.textureLoader=e,this.manager=r}return p(t,[{key:"parse",value:function(){As=this.parseConnections();var t=this.parseImages(),e=this.parseTextures(t),r=this.parseMaterials(e),n=this.parseDeformers(),i=(new _s).parse(n);return this.parseScene(n,i,r),ds}},{key:"parseConnections",value:function(){var t=new Map;"Connections"in gs&&gs.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 gs.Objects){var r=gs.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 gs.Objects){var r=gs.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 n=this.loadTexture(t,e);n.ID=t.id,n.name=t.attrName;var i=t.WrapModeU,o=t.WrapModeV,s=void 0!==i?i.value:0,a=void 0!==o?o.value:0;if(n.wrapS=0===s?r.RepeatWrapping:r.ClampToEdgeWrapping,n.wrapT=0===a?r.RepeatWrapping:r.ClampToEdgeWrapping,"Scaling"in t){var u=t.Scaling.value;n.repeat.x=u[0],n.repeat.y=u[1]}if("Translation"in t){var l=t.Translation.value;n.offset.x=l[0],n.offset.y=l[1]}return n}},{key:"loadTexture",value:function(t,e){var n,i,o=this.textureLoader.path,s=As.get(t.id).children;void 0!==s&&s.length>0&&void 0!==e[s[0].ID]&&(0!==(n=e[s[0].ID]).indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0));var a=t.FileName.slice(-3).toLowerCase();if("tga"===a){var u=this.manager.getHandler(".tga");null===u?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),i=new r.Texture):(u.setPath(this.textureLoader.path),i=u.load(n))}else"psd"===a?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),i=new r.Texture):i=this.textureLoader.load(n);return this.textureLoader.setPath(o),i}},{key:"parseMaterials",value:function(t){var e=new Map;if("Material"in gs.Objects){var r=gs.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,e){var n=t.id,i=t.attrName,o=t.ShadingModel;if("object"===u(o)&&(o=o.value),!As.has(n))return null;var s,a=this.parseParameters(t,e,n);switch(o.toLowerCase()){case"phong":s=new r.MeshPhongMaterial;break;case"lambert":s=new r.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),s=new r.MeshPhongMaterial}return s.setValues(a),s.name=i,s}},{key:"parseParameters",value:function(t,e,n){var i={};t.BumpFactor&&(i.bumpScale=t.BumpFactor.value),t.Diffuse?i.color=(new r.Color).fromArray(t.Diffuse.value):!t.DiffuseColor||"Color"!==t.DiffuseColor.type&&"ColorRGB"!==t.DiffuseColor.type||(i.color=(new r.Color).fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(i.displacementScale=t.DisplacementFactor.value),t.Emissive?i.emissive=(new r.Color).fromArray(t.Emissive.value):!t.EmissiveColor||"Color"!==t.EmissiveColor.type&&"ColorRGB"!==t.EmissiveColor.type||(i.emissive=(new r.Color).fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(i.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(i.opacity=parseFloat(t.Opacity.value)),i.opacity<1&&(i.transparent=!0),t.ReflectionFactor&&(i.reflectivity=t.ReflectionFactor.value),t.Shininess&&(i.shininess=t.Shininess.value),t.Specular?i.specular=(new r.Color).fromArray(t.Specular.value):t.SpecularColor&&"Color"===t.SpecularColor.type&&(i.specular=(new r.Color).fromArray(t.SpecularColor.value));var o=this;return As.get(n).children.forEach((function(t){var n=t.relationship;switch(n){case"Bump":i.bumpMap=o.getTexture(e,t.ID);break;case"Maya|TEX_ao_map":i.aoMap=o.getTexture(e,t.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=o.getTexture(e,t.ID),void 0!==i.map&&(i.map.encoding=r.sRGBEncoding);break;case"DisplacementColor":i.displacementMap=o.getTexture(e,t.ID);break;case"EmissiveColor":i.emissiveMap=o.getTexture(e,t.ID),void 0!==i.emissiveMap&&(i.emissiveMap.encoding=r.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=o.getTexture(e,t.ID);break;case"ReflectionColor":i.envMap=o.getTexture(e,t.ID),void 0!==i.envMap&&(i.envMap.mapping=r.EquirectangularReflectionMapping,i.envMap.encoding=r.sRGBEncoding);break;case"SpecularColor":i.specularMap=o.getTexture(e,t.ID),void 0!==i.specularMap&&(i.specularMap.encoding=r.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=o.getTexture(e,t.ID),i.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}})),i}},{key:"getTexture",value:function(t,e){return"LayeredTexture"in gs.Objects&&e in gs.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),e=As.get(e).children[0].ID),t.get(e)}},{key:"parseDeformers",value:function(){var t={},e={};if("Deformer"in gs.Objects){var r=gs.Objects.Deformer;for(var n in r){var i=r[n],o=As.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 n=[];return t.children.forEach((function(t){var i=e[t.ID];if("Cluster"===i.attrType){var o={ID:t.ID,indices:[],weights:[],transformLink:(new r.Matrix4).fromArray(i.TransformLink.a)};"Indexes"in i&&(o.indices=i.Indexes.a,o.weights=i.Weights.a),n.push(o)}})),{rawBones:n,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=As.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,n){ds=new r.Group;var i=this.parseModels(t.skeletons,e,n),o=gs.Objects.Model,s=this;i.forEach((function(t){var e=o[t.ID];s.setLookAtProperties(t,e),As.get(t.ID).parents.forEach((function(e){var r=i.get(e.ID);void 0!==r&&r.add(t)})),null===t.parent&&ds.add(t)})),this.bindSkeleton(t.skeletons,e,i),this.createAmbientLight(),ds.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=Ts(t.userData.transformData);t.applyMatrix4(e),t.updateWorldMatrix()}}));var a=(new Is).parse();1===ds.children.length&&ds.children[0].isGroup&&(ds.children[0].animations=a,ds=ds.children[0]),ds.animations=a}},{key:"parseModels",value:function(t,e,n){var i=new Map,o=gs.Objects.Model;for(var s in o){var a=parseInt(s),u=o[s],l=As.get(a),c=this.buildSkeleton(l,t,a,u.attrName);if(!c){switch(u.attrType){case"Camera":c=this.createCamera(l);break;case"Light":c=this.createLight(l);break;case"Mesh":c=this.createMesh(l,e,n);break;case"NurbsCurve":c=this.createCurve(l,e);break;case"LimbNode":case"Root":c=new r.Bone;break;default:c=new r.Group}c.name=u.attrName?r.PropertyBinding.sanitizeNodeName(u.attrName):"",c.ID=a}this.getTransformData(c,u),i.set(a,c)}return i}},{key:"buildSkeleton",value:function(t,e,n,i){var o=null;return t.parents.forEach((function(t){var s=function(){var s=e[a];s.rawBones.forEach((function(e,a){if(e.ID===t.ID){var u=o;(o=new r.Bone).matrixWorld.copy(e.transformLink),o.name=i?r.PropertyBinding.sanitizeNodeName(i):"",o.ID=n,s.bones[a]=o,null!==u&&o.add(u)}}))};for(var a in e)s()})),o}},{key:"createCamera",value:function(t){var e,n;if(t.children.forEach((function(t){var e=gs.Objects.NodeAttribute[t.ID];void 0!==e&&(n=e)})),void 0===n)e=new r.Object3D;else{var i=0;void 0!==n.CameraProjectionType&&1===n.CameraProjectionType.value&&(i=1);var o=1;void 0!==n.NearPlane&&(o=n.NearPlane.value/1e3);var s=1e3;void 0!==n.FarPlane&&(s=n.FarPlane.value/1e3);var a=window.innerWidth,u=window.innerHeight;void 0!==n.AspectWidth&&void 0!==n.AspectHeight&&(a=n.AspectWidth.value,u=n.AspectHeight.value);var l=a/u,c=45;void 0!==n.FieldOfView&&(c=n.FieldOfView.value);var h=n.FocalLength?n.FocalLength.value:null;switch(i){case 0:e=new r.PerspectiveCamera(c,l,o,s),null!==h&&e.setFocalLength(h);break;case 1:e=new r.OrthographicCamera(-a/2,a/2,u/2,-u/2,o,s);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+i+"."),e=new r.Object3D}}return e}},{key:"createLight",value:function(t){var e,n;if(t.children.forEach((function(t){var e=gs.Objects.NodeAttribute[t.ID];void 0!==e&&(n=e)})),void 0===n)e=new r.Object3D;else{var i;i=void 0===n.LightType?0:n.LightType.value;var o=16777215;void 0!==n.Color&&(o=(new r.Color).fromArray(n.Color.value));var s=void 0===n.Intensity?1:n.Intensity.value/100;void 0!==n.CastLightOnObject&&0===n.CastLightOnObject.value&&(s=0);var a=0;void 0!==n.FarAttenuationEnd&&(a=void 0!==n.EnableFarAttenuation&&0===n.EnableFarAttenuation.value?0:n.FarAttenuationEnd.value);switch(i){case 0:e=new r.PointLight(o,s,a,1);break;case 1:e=new r.DirectionalLight(o,s);break;case 2:var u=Math.PI/3;void 0!==n.InnerAngle&&(u=r.MathUtils.degToRad(n.InnerAngle.value));var l=0;void 0!==n.OuterAngle&&(l=r.MathUtils.degToRad(n.OuterAngle.value),l=Math.max(l,1)),e=new r.SpotLight(o,s,a,u,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),e=new r.PointLight(o,s)}void 0!==n.CastShadows&&1===n.CastShadows.value&&(e.castShadow=!0)}return e}},{key:"createMesh",value:function(t,e,n){var i,o=null,s=null,a=[];return t.children.forEach((function(t){e.has(t.ID)&&(o=e.get(t.ID)),n.has(t.ID)&&a.push(n.get(t.ID))})),a.length>1?s=a:a.length>0?s=a[0]:(s=new r.MeshPhongMaterial({color:13421772}),a.push(s)),"color"in o.attributes&&a.forEach((function(t){t.vertexColors=!0})),o.FBX_Deformer?(i=new r.SkinnedMesh(o,s)).normalizeSkinWeights():i=new r.Mesh(o,s),i}},{key:"createCurve",value:function(t,e){var n=t.children.reduce((function(t,r){return e.has(r.ID)&&(t=e.get(r.ID)),t}),null),i=new r.LineBasicMaterial({color:3342591,linewidth:1});return new r.Line(n,i)}},{key:"getTransformData",value:function(t,e){var r={};"InheritType"in e&&(r.inheritType=parseInt(e.InheritType.value)),r.eulerOrder="RotationOrder"in e?Rs(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&&As.get(t.ID).children.forEach((function(e){if("LookAtProperty"===e.relationship){var n=gs.Objects.Model[e.ID];if("Lcl_Translation"in n){var i=n.Lcl_Translation.value;void 0!==t.target?(t.target.position.fromArray(i),ds.add(t.target)):t.lookAt((new r.Vector3).fromArray(i))}}}))}},{key:"bindSkeleton",value:function(t,e,n){var i=this.parsePoseNodes(),o=function(){var o=t[s];As.get(parseInt(o.ID)).parents.forEach((function(t){if(e.has(t.ID)){var s=t.ID;As.get(s).parents.forEach((function(t){n.has(t.ID)&&n.get(t.ID).bind(new r.Skeleton(o.bones),i[t.ID])}))}}))};for(var s in t)o()}},{key:"parsePoseNodes",value:function(){var t={};if("Pose"in gs.Objects){var e=gs.Objects.Pose;for(var n in e)if("BindPose"===e[n].attrType&&e[n].NbPoseNodes>0){var i=e[n].PoseNode;Array.isArray(i)?i.forEach((function(e){t[e.Node]=(new r.Matrix4).fromArray(e.Matrix.a)})):t[i.Node]=(new r.Matrix4).fromArray(i.Matrix.a)}}return t}},{key:"createAmbientLight",value:function(){if("GlobalSettings"in gs&&"AmbientColor"in gs.GlobalSettings){var t=gs.GlobalSettings.AmbientColor.value,e=t[0],n=t[1],i=t[2];if(0!==e||0!==n||0!==i){var o=new r.Color(e,n,i);ds.add(new r.AmbientLight(o,1))}}}}]),t}(),_s=function(){function t(){h(this,t),this.negativeMaterialIndices=!1}return p(t,[{key:"parse",value:function(t){var e=new Map;if("Geometry"in gs.Objects){var r=gs.Objects.Geometry;for(var n in r){var i=As.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 gs.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=Rs(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=Ts(u);return this.genGeometry(e,s,i,l)}}},{key:"genGeometry",value:function(t,e,n,i){var o=new r.BufferGeometry;t.attrName&&(o.name=t.attrName);var s=this.parseGeoNode(t,e),a=this.genBuffers(s),u=new r.Float32BufferAttribute(a.vertex,3);if(u.applyMatrix4(i),o.setAttribute("position",u),a.colors.length>0&&o.setAttribute("color",new r.Float32BufferAttribute(a.colors,3)),e&&(o.setAttribute("skinIndex",new r.Uint16BufferAttribute(a.weightsIndices,4)),o.setAttribute("skinWeight",new r.Float32BufferAttribute(a.vertexWeights,4)),o.FBX_Deformer=e),a.normal.length>0){var l=(new r.Matrix3).getNormalMatrix(i),c=new r.Float32BufferAttribute(a.normal,3);c.applyNormalMatrix(l),o.setAttribute("normal",c)}if(a.uvs.forEach((function(t,e){var n="uv"+(e+1).toString();0===e&&(n="uv"),o.setAttribute(n,new r.Float32BufferAttribute(a.uvs[e],2))})),s.material&&"AllSame"!==s.material.mappingType){var h=a.materialIndex[0],f=0;if(a.materialIndex.forEach((function(t,e){t!==h&&(o.addGroup(f,e-f,h),h=t,f=e)})),o.groups.length>0){var p=o.groups[o.groups.length-1],g=p.start+p.count;g!==a.materialIndex.length&&o.addGroup(g,a.materialIndex.length-g,h)}0===o.groups.length&&o.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(o,t,n,i),o}},{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=[],c=[],h=this;return t.vertexIndices.forEach((function(f,p){var g,A=!1;f<0&&(f^=-1,A=!0);var d=[],y=[];if(o.push(3*f,3*f+1,3*f+2),t.color){var v=Ms(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),d.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],_=[0,0,0,0];y.forEach((function(t,e){var r=t,n=d[e];_.forEach((function(t,e,i){if(r>t){i[e]=r,r=t;var o=m[e];m[e]=n,n=o}}))})),d=m,y=_}for(;y.length<4;)y.push(0),d.push(0);for(var I=0;I<4;++I)l.push(y[I]),c.push(d[I])}if(t.normal){var E=Ms(p,r,f,t.normal);s.push(E[0],E[1],E[2])}t.material&&"AllSame"!==t.material.mappingType&&(g=Ms(p,r,f,t.material)[0])<0&&(h.negativeMaterialIndices=!0,g=0),t.uv&&t.uv.forEach((function(t,e){var n=Ms(p,r,f,t);void 0===u[e]&&(u[e]=[]),u[e].push(n[0]),u[e].push(n[1])})),n++,A&&(n>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),h.genFace(e,t,o,g,s,a,u,l,c,n),r++,n=0,o=[],s=[],a=[],u=[],l=[],c=[])})),e}},{key:"genFace",value:function(t,e,r,n,i,o,s,a,u,l){for(var c=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])}))},h=2;h<l;h++)c(h)}},{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=gs.Objects.Geometry[r.geoID];void 0!==o&&i.genMorphGeometry(t,e,o,n,r.name)}))}))}}},{key:"genMorphGeometry",value:function(t,e,n,i,o){for(var s=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],a=void 0!==n.Vertices?n.Vertices.a:[],u=void 0!==n.Indexes?n.Indexes.a:[],l=3*t.attributes.position.count,c=new Float32Array(l),h=0;h<u.length;h++){var f=3*u[h];c[f]=a[3*h],c[f+1]=a[3*h+1],c[f+2]=a[3*h+2]}var p={vertexIndices:s,vertexPositions:c},g=this.genBuffers(p),A=new r.Float32BufferAttribute(g.vertex,3);A.name=o||n.attrName,A.applyMatrix4(i),t.morphAttributes.position.push(A)}},{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 r.BufferGeometry;for(var n,i,o=e-1,s=t.KnotVector.a,a=[],u=t.Points.a,l=0,c=u.length;l<c;l+=4)a.push((new r.Vector4).fromArray(u,l));if("Closed"===t.Form)a.push(a[0]);else if("Periodic"===t.Form){n=o,i=s.length-1-n;for(var h=0;h<o;++h)a.push(a[h])}var f=new ys(o,s,a,n,i).getPoints(12*a.length);return(new r.BufferGeometry).setFromPoints(f)}}]),t}(),Is=function(){function t(){h(this,t)}return p(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!==gs.Objects.AnimationCurve){var t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);var e=this.parseAnimationLayers(t);return this.parseAnimStacks(e)}}},{key:"parseAnimationCurveNodes",value:function(){var t=gs.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=gs.Objects.AnimationCurve;for(var r in e){var n={id:e[r].id,times:e[r].KeyTime.a.map(Bs),values:e[r].KeyValueFloat.a},i=As.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=gs.Objects.AnimationLayer,n=new Map,i=function(){var e=[],i=As.get(parseInt(o));void 0!==i&&(i.children.forEach((function(n,i){if(t.has(n.ID)){var o=t.get(n.ID);if(void 0!==o.curves.x||void 0!==o.curves.y||void 0!==o.curves.z){if(void 0===e[i]){var s=As.get(n.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID;if(void 0!==s){var a=gs.Objects.Model[s.toString()];if(void 0===a)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",n);var u={modelName:a.attrName?r.PropertyBinding.sanitizeNodeName(a.attrName):"",ID:a.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};ds.traverse((function(t){t.ID===a.id&&(u.transform=t.matrix,t.userData.transformData&&(u.eulerOrder=t.userData.transformData.eulerOrder))})),u.transform||(u.transform=new r.Matrix4),"PreRotation"in a&&(u.preRotation=a.PreRotation.value),"PostRotation"in a&&(u.postRotation=a.PostRotation.value),e[i]=u}}e[i]&&(e[i][o.attr]=o)}else if(void 0!==o.curves.morph){if(void 0===e[i]){var l=As.get(n.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID,c=As.get(l).parents[0].ID,h=As.get(c).parents[0].ID,f=As.get(h).parents[0].ID,p=gs.Objects.Model[f],g={modelName:p.attrName?r.PropertyBinding.sanitizeNodeName(p.attrName):"",morphName:gs.Objects.Deformer[l].attrName};e[i]=g}e[i][o.attr]=o}}})),n.set(parseInt(o),e))};for(var o in e)i();return n}},{key:"parseAnimStacks",value:function(t){var e=gs.Objects.AnimationStack,r={};for(var n in e){var i=As.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=[],n=this;return t.layer.forEach((function(t){e=e.concat(n.generateTracks(t))})),new r.AnimationClip(t.name,-1,e)}},{key:"generateTracks",value:function(t){var e=[],n=new r.Vector3,i=new r.Quaternion,o=new r.Vector3;if(t.transform&&t.transform.decompose(n,i,o),n=n.toArray(),i=(new r.Euler).setFromQuaternion(i,t.eulerOrder).toArray(),o=o.toArray(),void 0!==t.T&&Object.keys(t.T.curves).length>0){var s=this.generateVectorTrack(t.modelName,t.T.curves,n,"position");void 0!==s&&e.push(s)}if(void 0!==t.R&&Object.keys(t.R.curves).length>0){var a=this.generateRotationTrack(t.modelName,t.R.curves,i,t.preRotation,t.postRotation,t.eulerOrder);void 0!==a&&e.push(a)}if(void 0!==t.S&&Object.keys(t.S.curves).length>0){var u=this.generateVectorTrack(t.modelName,t.S.curves,o,"scale");void 0!==u&&e.push(u)}if(void 0!==t.DeformPercent){var l=this.generateMorphTrack(t);void 0!==l&&e.push(l)}return e}},{key:"generateVectorTrack",value:function(t,e,n,i){var o=this.getTimesForAllAxes(e),s=this.getKeyframeTrackValues(o,e,n);return new r.VectorKeyframeTrack(t+"."+i,o,s)}},{key:"generateRotationTrack",value:function(t,e,n,i,o,s){void 0!==e.x&&(this.interpolateRotations(e.x),e.x.values=e.x.values.map(r.MathUtils.degToRad)),void 0!==e.y&&(this.interpolateRotations(e.y),e.y.values=e.y.values.map(r.MathUtils.degToRad)),void 0!==e.z&&(this.interpolateRotations(e.z),e.z.values=e.z.values.map(r.MathUtils.degToRad));var a=this.getTimesForAllAxes(e),u=this.getKeyframeTrackValues(a,e,n);void 0!==i&&((i=i.map(r.MathUtils.degToRad)).push(s),i=(new r.Euler).fromArray(i),i=(new r.Quaternion).setFromEuler(i)),void 0!==o&&((o=o.map(r.MathUtils.degToRad)).push(s),o=(new r.Euler).fromArray(o),o=(new r.Quaternion).setFromEuler(o).invert());for(var l=new r.Quaternion,c=new r.Euler,h=[],f=0;f<u.length;f+=3)c.set(u[f],u[f+1],u[f+2],s),l.setFromEuler(c),void 0!==i&&l.premultiply(i),void 0!==o&&l.multiply(o),l.toArray(h,f/3*4);return new r.QuaternionKeyframeTrack(t+".quaternion",a,h)}},{key:"generateMorphTrack",value:function(t){var e=t.DeformPercent.curves.morph,n=e.values.map((function(t){return t/100})),i=ds.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new r.NumberKeyframeTrack(t.modelName+".morphTargetInfluences["+i+"]",e.times,n)}},{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,c=u+l,h=[],f=[];c<t.times[e];)h.push(c),c+=l,f.push(a),a+=s;t.times=Ps(t.times,e,h),t.values=Ps(t.values,e,f)}}}}]),t}(),Es=function(){function t(){h(this,t)}return p(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 ws,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=Ds(i))}else this.parseNodeSpecialProperty(t,n,i)}},{key:"parseNodePropertyContinued",value:function(t){var e=this.getCurrentNode();e.a+=t,","!==t.slice(-1)&&(e.a=Ds(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=Ds(u)}this.getPrevNode()[i]={type:o,type2:s,flag:a,value:u},this.setCurrentProp(this.getPrevNode(),i)}}]),t}(),xs=function(){function t(){h(this,t)}return p(t,[{key:"parse",value:function(t){var e=new Cs(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 ws;!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]:"",c=a.length>1?a[1]:"",h=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),""!==c&&(r.attrName=c),""!==h&&(r.attrType=h),""!==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 us((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 Cs(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}(),Cs=function(){function t(e,r){h(this,t),this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===r||r}return p(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=[],n=0;n<t;n++)e[n]=this.getUint8();var i=e.indexOf(0);return i>=0&&(e=e.slice(0,i)),r.LoaderUtils.decodeText(new Uint8Array(e))}}]),t}(),ws=function(){function t(){h(this,t)}return p(t,[{key:"add",value:function(t,e){this[t]=e}}]),t}();function bs(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 Bs(t){return t/46186158e3}var Ss=[];function Ms(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}(Ss,n.buffer,o,s)}var Ls=new r.Euler,Ns=new r.Vector3;function Ts(t){var e=new r.Matrix4,n=new r.Matrix4,i=new r.Matrix4,o=new r.Matrix4,s=new r.Matrix4,a=new r.Matrix4,u=new r.Matrix4,l=new r.Matrix4,c=new r.Matrix4,h=new r.Matrix4,f=new r.Matrix4,p=new r.Matrix4,g=t.inheritType?t.inheritType:0;if(t.translation&&e.setPosition(Ns.fromArray(t.translation)),t.preRotation){var A=t.preRotation.map(r.MathUtils.degToRad);A.push(t.eulerOrder||r.Euler.DefaultOrder),n.makeRotationFromEuler(Ls.fromArray(A))}if(t.rotation){var d=t.rotation.map(r.MathUtils.degToRad);d.push(t.eulerOrder||r.Euler.DefaultOrder),i.makeRotationFromEuler(Ls.fromArray(d))}if(t.postRotation){var y=t.postRotation.map(r.MathUtils.degToRad);y.push(t.eulerOrder||r.Euler.DefaultOrder),o.makeRotationFromEuler(Ls.fromArray(y)),o.invert()}t.scale&&s.scale(Ns.fromArray(t.scale)),t.scalingOffset&&u.setPosition(Ns.fromArray(t.scalingOffset)),t.scalingPivot&&a.setPosition(Ns.fromArray(t.scalingPivot)),t.rotationOffset&&l.setPosition(Ns.fromArray(t.rotationOffset)),t.rotationPivot&&c.setPosition(Ns.fromArray(t.rotationPivot)),t.parentMatrixWorld&&(f.copy(t.parentMatrix),h.copy(t.parentMatrixWorld));var v=n.clone().multiply(i).multiply(o),m=new r.Matrix4;m.extractRotation(h);var _=new r.Matrix4;_.copyPosition(h);var I=_.clone().invert().multiply(h),E=m.clone().invert().multiply(I),x=s,C=new r.Matrix4;if(0===g)C.copy(m).multiply(v).multiply(E).multiply(x);else if(1===g)C.copy(m).multiply(E).multiply(v).multiply(x);else{var w=(new r.Matrix4).scale((new r.Vector3).setFromMatrixScale(f)).clone().invert(),b=E.clone().multiply(w);C.copy(m).multiply(v).multiply(b).multiply(x)}var B=c.clone().invert(),S=a.clone().invert(),M=e.clone().multiply(l).multiply(c).multiply(n).multiply(i).multiply(o).multiply(B).multiply(u).multiply(a).multiply(s).multiply(S),L=(new r.Matrix4).copyPosition(M),N=h.clone().multiply(L);return p.copyPosition(N),(M=p.clone().multiply(C)).premultiply(h.invert()),M}function Rs(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 Ds(t){return t.split(",").map((function(t){return parseFloat(t)}))}function Qs(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=t.byteLength),r.LoaderUtils.decodeText(new Uint8Array(t,e,n))}function Ps(t,e,r){return t.slice(0,e).concat(r).concat(t.slice(e))}var ks=function(){function t(e,r,n,i,o){h(this,t),this.threelayer=i,this.map=i.map,this.groupId=o,this.loader=new vs,this.loader.load(e,(function(t){t.traverse((function(t){t instanceof s.Mesh&&(t.geometry.computeVertexNormals(),t.scale.set(.04,.04,.04),t.rotation.set(1*Math.PI/2,1*-Math.PI/2,0))}));var e=i.toModel(t,{coordinate:r,altitude:n.altitude||0});o?i.addMesh1(e,o):i.addMesh(e),e.object3d.rotation.z=Math.PI/2}))}return p(t,[{key:"dispose",value:function(){}}]),t}(),Os={altitude:0,speed:.015,height:10},Fs=function(t){A(r,t);var e=m(r);function r(t,n,i,s,a){var u;h(this,r),Array.isArray(t)&&(t=new o.Polygon([t])),n=o.Util.extend({},Os,n,{layer:s,polygon:t}),(u=e.call(this)).parent=a,u._initOptions(n);var l=n,c=l.altitude,f=l.height,p=u.createGeometry(t,s,f);u._createMesh(p,i);var g=s.altitudeToVector3(c,c).x,A=s.coordinateToVector3(t.getCenter(),g);return u.getObject3d().position.copy(A),u}return p(r,[{key:"createGeometry",value:function(t,e,r){r=e.altitudeToVector3(r,r).x;var n=e.coordinateToVector3(t.getCenter()),i=t.getShell(),o=[],a=[];i.forEach((function(t){var r=e.coordinateToVector3(t).sub(n);o.push(r),a.push(r.x),a.push(r.y)}));for(var u=a,l=[],c=0,h=0;c<u.length-2;c+=2,h++)0===c?l[0]=Math.sqrt((u[2]-u[0])*(u[2]-u[0])+(u[3]-u[1])*(u[3]-u[1])):l[h]=l[h-1]+Math.sqrt((u[c+2]-u[c])*(u[c+2]-u[c])+(u[c+3]-u[c+1])*(u[c+3]-u[c+1]));for(var f=[],p=[],g=l[l.length-1],A=0,d=f.length,y=p.length;A<o.length-1;A++){var v=o[A],m=o[A+1],_=l[A];f[d++]=v.x,f[d++]=v.y,f[d++]=0,p[y++]=0===A?0:l[A-1]/g,p[y++]=0,f[d++]=m.x,f[d++]=m.y,f[d++]=0,p[y++]=_/g,p[y++]=0,f[d++]=v.x,f[d++]=v.y,f[d++]=r,p[y++]=0===A?0:l[A-1]/g,p[y++]=1,f[d++]=v.x,f[d++]=v.y,f[d++]=r,p[y++]=0===A?0:l[A-1]/g,p[y++]=1,f[d++]=m.x,f[d++]=m.y,f[d++]=0,p[y++]=_/g,p[y++]=0,f[d++]=m.x,f[d++]=m.y,f[d++]=r,p[y++]=_/g,p[y++]=1}var I=new s.BufferGeometry;return I.setAttribute("position",new s.BufferAttribute(new Float32Array(f),3)),I.setAttribute("uv",new s.BufferAttribute(new Float32Array(p),2)),I}}]),r}(n.BaseObject),Gs=function(){function t(e,r,n,i,o){h(this,t),this.threelayer=n,this.map=n.map,this.groupId=i,this.layerClass=o,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 s.Color(this.color)},fadeColor:{type:"uvs",value:new s.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 s.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:s.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:s.DoubleSide});this.interactive=void 0===r.interactive||r.interactive,this.groundWall=new Fs(this.coords,{height:r.height||1e3,interactive:this.interactive},a,n,this),i?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this),this.clickFunc=r.clickFunc,this._bindMapEvents()}return p(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}(),Us=function(){function t(e,r,n,i,o){if(h(this,t),this.threelayer=n,this.map=n.map,this.layerClass=o,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 s.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 s.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:s.DoubleSide});this.groundWall=new Fs(e,{height:r.height||1e3},a,n),i?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this)}}return p(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}();r.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new r.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},r.ShaderLib.line={uniforms:r.UniformsUtils.merge([r.UniformsLib.common,r.UniformsLib.fog,r.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 qs,js,Vs=function(t){A(n,t);var e=m(n);function n(t){var i;return h(this,n),(i=e.call(this,{type:"LineMaterial",uniforms:r.UniformsUtils.clone(r.ShaderLib.line.uniforms),vertexShader:r.ShaderLib.line.vertexShader,fragmentShader:r.ShaderLib.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(v(i),{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)}}}),i.setValues(t),i}return p(n)}(r.ShaderMaterial),zs=function(){function t(e,r,n,i){h(this,t),this.map=n.map,this.threeLayer=n,this.groupId=i,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 Vs({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 Vs({color:r.lineColor||"rgb(15,159,190)",transparent:!0,linewidth:r.linewidth||1});var o=[];e.features.forEach((function(t){var e=t.geometry;o.push(e)})),this.lineItems=o}var e;return p(t,[{key:"addLine",value:(e=c(a().mark((function t(){var e,r,n=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=[],this.lineItems.forEach((function(t){"Polygon"===t.type?t.coordinates.forEach((function(t){var r=new o.LineString(t);e.push(r)})):t.coordinates.forEach((function(t){var r=new o.LineString(t[0]);e.push(r)}))})),e.length>0&&(r=this.threeLayer.toFatLines(e,{altitude:1,interactive:!1},this.lineMaterial),this.dashed&&(r.zoomChange=function(){if(n.map){var t=n.map.pixelToDistance(1,0);n.lineMaterial.dashScale=18.93/t}}),this.groupId?this.threeLayer.addMesh1(r,this.groupId):this.threeLayer.addMesh(r),this.line=r),t.abrupt("return",this);case 4:case"end":return t.stop()}}),t,this)}))),function(){return e.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()}}]),t}(),Ys={altitude:0},Hs=function(t){A(r,t);var e=m(r);function r(t,n,i,a){var u;h(this,r),n=o.Util.extend({layer:a},Ys,n),(u=e.call(this))._initOptions(n),u.height=n.height||50;for(var l=1/0,c=1/0,f=-1/0,p=-1/0,g=0;g<t.length;g++){var A=t[g].getCenter();l=Math.min(l,A.x),c=Math.min(c,A.y),f=Math.max(f,A.x),p=Math.max(p,A.y)}var d=new o.Coordinate((l+f)/2,(c+p)/2),y=a.coordinateToVector3(d),v=a.altitudeToVector3(u.height,u.height).x,m=[];u._geometriesAttributes=[],u._colorMap={};for(var _=0;_<t.length;_++){var I=O(y,t[_],a,v),E=I.attributes.position.array;u._geometriesAttributes[_]={position:{count:E.length/3}},m.push(I)}u._datas=t,u._uniforms={time:{type:"pv2",value:0},color:{type:"uvs",value:new s.Color("#0099FF")},fadeColor:{type:"uvs",value:new s.Color("#000")},opacity:{type:"pv2",value:u.opacity},num:{type:"pv2",value:5},hiz:{type:"pv2",value:.15}},new s.ShaderMaterial({uniforms:u._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:s.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:s.DoubleSide});var x=new s.MeshBasicMaterial({side:s.DoubleSide,transparent:!0,opacity:.5,depthTest:!1,color:"blue"});u._createMesh(m[0],x);var C=a.coordinateToVector3(d,0);return u.getObject3d().position.copy(C),u._setPickObject3d(),u._init(),u}return p(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=function(t){for(var e=t.length,r=0,n=0;n<e;n++)r+=t[n].position.count;return new Float32Array(3*r)}(this._geometriesAttributes),i=0,o=0;o<r;o++){var a=e.getColor(),u=a.getHex();this._colorMap[u]=o;var l=this._geometriesAttributes[o].position.count;this._datas[o].colorIndex=u;for(var c=0;c<l;c++)n[i]=a.r,n[i+1]=a.g,n[i+2]=a.b,i+=3}t.setAttribute("pickColor",new s.BufferAttribute(n,3,!0));var h=new s.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:s.DoubleSide,transparent:!0}),f=e.getColor().getHex(),p=new s.Mesh(t,h);p.position.copy(this.getObject3d().position),p._colorIndex=f,this.setPickObject3d(p)}}},{key:"getSelectMesh",value:function(){return console.log(this._datas[this.index]),this._datas[this.index]}},{key:"identify",value:function(t){return this.picked}}]),r}(n.BaseObject),Xs=function(){function t(e,r,n,i,o){h(this,t),this.map=n.map,this.threeLayer=n,this.groupId=i,this.layerClass=o;var s=[];e.features.forEach((function(t){var e=t.geometry;s.push(e)})),this.lineItems=s}var e;return p(t,[{key:"addLine",value:(e=c(a().mark((function t(){var e,r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],this.lineItems.forEach((function(t){"Polygon"===t.type?e.push(t):t.coordinates.forEach((function(t){var r=new o.Polygon(t);e.push(r)}))})),r=new Hs(e,{},null,this.threeLayer),this.groupId?this.threeLayer.addMesh1(r,this.groupId):this.threeLayer.addMesh(r);case 4:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})}]),t}(),Js=new r.Box3,Ws=new r.Vector3,Ks=function(t){A(n,t);var e=m(n);function n(){var t;h(this,n),(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 r.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 r.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),t}return p(n,[{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 n=new r.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceStart",new r.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new r.InterleavedBufferAttribute(n,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 n=new r.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceColorStart",new r.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceColorEnd",new r.InterleavedBufferAttribute(n,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 r.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 r.Box3);var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),Js.setFromBufferAttribute(e),this.boundingBox.union(Js))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new r.Sphere),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var n=this.boundingSphere.center;this.boundingBox.getCenter(n);for(var i=0,o=0,s=t.count;o<s;o++)Ws.fromBufferAttribute(t,o),i=Math.max(i,n.distanceToSquared(Ws)),Ws.fromBufferAttribute(e,o),i=Math.max(i,n.distanceToSquared(Ws));this.boundingSphere.radius=Math.sqrt(i),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)}}]),n}(r.InstancedBufferGeometry),Zs=new r.Vector3,$s=new r.Vector3,ta=new r.Vector4,ea=new r.Vector4,ra=new r.Vector4,na=new r.Vector3,ia=new r.Matrix4,oa=new r.Line3,sa=new r.Vector3,aa=new r.Box3,ua=new r.Sphere,la=new r.Vector4;function ca(t,e,r){return la.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),la.multiplyScalar(1/la.w),la.x=js/r.width,la.y=js/r.height,la.applyMatrix4(t.projectionMatrixInverse),la.multiplyScalar(1/la.w),Math.abs(Math.max(la.x,la.y))}var ha=function(t){A(n,t);var e=m(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ks,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vs({color:16777215*Math.random()});return h(this,n),(t=e.call(this,r,i)).isLineSegments2=!0,t.type="LineSegments2",t}return p(n,[{key:"computeLineDistances",value:function(){for(var t=this.geometry,e=t.attributes.instanceStart,n=t.attributes.instanceEnd,i=new Float32Array(2*e.count),o=0,s=0,a=e.count;o<a;o++,s+=2)Zs.fromBufferAttribute(e,o),$s.fromBufferAttribute(n,o),i[s]=0===s?0:i[s-1],i[s+1]=i[s]+Zs.distanceTo($s);var u=new r.InstancedInterleavedBuffer(i,2,1);return t.setAttribute("instanceDistanceStart",new r.InterleavedBufferAttribute(u,1,0)),t.setAttribute("instanceDistanceEnd",new r.InterleavedBufferAttribute(u,1,1)),this}},{key:"raycast",value:function(t,e){var n=this.material.worldUnits,i=t.camera;null!==i||n||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');var o=void 0!==t.params.Line2&&t.params.Line2.threshold||0;qs=t.ray;var s,a=this.matrixWorld,u=this.geometry,l=this.material;(js=l.linewidth+o,null===u.boundingSphere&&u.computeBoundingSphere(),ua.copy(u.boundingSphere).applyMatrix4(a),n)?s=.5*js:s=ca(i,Math.max(i.near,ua.distanceToPoint(qs.origin)),l.resolution);if(ua.radius+=s,!1!==qs.intersectsSphere(ua)){var c;if(null===u.boundingBox&&u.computeBoundingBox(),aa.copy(u.boundingBox).applyMatrix4(a),n)c=.5*js;else c=ca(i,Math.max(i.near,aa.distanceToPoint(qs.origin)),l.resolution);aa.expandByScalar(c),!1!==qs.intersectsBox(aa)&&(n?function(t,e){for(var n=t.matrixWorld,i=t.geometry,o=i.attributes.instanceStart,s=i.attributes.instanceEnd,a=0,u=Math.min(i.instanceCount,o.count);a<u;a++){oa.start.fromBufferAttribute(o,a),oa.end.fromBufferAttribute(s,a),oa.applyMatrix4(n);var l=new r.Vector3,c=new r.Vector3;qs.distanceSqToSegment(oa.start,oa.end,c,l),c.distanceTo(l)<.5*js&&e.push({point:c,pointOnLine:l,distance:qs.origin.distanceTo(c),object:t,face:null,faceIndex:a,uv:null,uv2:null})}}(this,e):function(t,e,n){var i=e.projectionMatrix,o=t.material.resolution,s=t.matrixWorld,a=t.geometry,u=a.attributes.instanceStart,l=a.attributes.instanceEnd,c=Math.min(a.instanceCount,u.count),h=-e.near;qs.at(1,ra),ra.w=1,ra.applyMatrix4(e.matrixWorldInverse),ra.applyMatrix4(i),ra.multiplyScalar(1/ra.w),ra.x*=o.x/2,ra.y*=o.y/2,ra.z=0,na.copy(ra),ia.multiplyMatrices(e.matrixWorldInverse,s);for(var f=0,p=c;f<p;f++)if(ta.fromBufferAttribute(u,f),ea.fromBufferAttribute(l,f),ta.w=1,ea.w=1,ta.applyMatrix4(ia),ea.applyMatrix4(ia),!(ta.z>h&&ea.z>h)){if(ta.z>h){var g=ta.z-ea.z,A=(ta.z-h)/g;ta.lerp(ea,A)}else if(ea.z>h){var d=ea.z-ta.z,y=(ea.z-h)/d;ea.lerp(ta,y)}ta.applyMatrix4(i),ea.applyMatrix4(i),ta.multiplyScalar(1/ta.w),ea.multiplyScalar(1/ea.w),ta.x*=o.x/2,ta.y*=o.y/2,ea.x*=o.x/2,ea.y*=o.y/2,oa.start.copy(ta),oa.start.z=0,oa.end.copy(ea),oa.end.z=0;var v=oa.closestPointToPointParameter(na,!0);oa.at(v,sa);var m=r.MathUtils.lerp(ta.z,ea.z,v),_=m>=-1&&m<=1,I=na.distanceTo(sa)<.5*js;if(_&&I){oa.start.fromBufferAttribute(u,f),oa.end.fromBufferAttribute(l,f),oa.start.applyMatrix4(s),oa.end.applyMatrix4(s);var E=new r.Vector3,x=new r.Vector3;qs.distanceSqToSegment(oa.start,oa.end,x,E),n.push({point:x,pointOnLine:E,distance:qs.origin.distanceTo(x),object:t,face:null,faceIndex:f,uv:null,uv2:null})}}}(this,i,e))}}}]),n}(r.Mesh),fa=function(t){A(r,t);var e=m(r);function r(){var t;return h(this,r),(t=e.call(this)).isLineGeometry=!0,t.type="LineGeometry",t}return p(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 I(d(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 I(d(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}(Ks),pa=function(t){A(r,t);var e=m(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new fa,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vs({color:16777215*Math.random()});return h(this,r),(t=e.call(this,n,i)).isLine2=!0,t.type="Line2",t}return p(r)}(ha),ga={altitude:0,height:10},Aa=function(t){A(r,t);var e=m(r);function r(t,n,i,s){var a;h(this,r),n=o.Util.extend({},ga,n,{layer:s,coordinate:t}),a=e.call(this);var u=n,l=u.altitude,c=u.height;a._initOptions(n),a.map=s.map;var f=s.altitudeToVector3(c,c).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 fa;g.setPositions(p),a.object3d=new pa(g,i),a.object3d.computeLineDistances(),a.object3d.scale.set(1,1,1),a.object3d.__parent=v(a);var A=s.distanceToVector3(l,l).x,d=s.coordinateToVector3(t,A);return a.getObject3d().position.copy(d),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 p(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}(n.BaseObject),da=function(){function t(e,r,n,i){var o=this;h(this,t),0!=e.length?(this.map=n.map,this.threeLayer=n,this.groupId=i,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=o.dashed?new Vs({color:t.color||"#35FFAC",transparent:!0,linewidth:r.linewidth||4,dashed:!0,defines:{USE_DASH:""},dashScale:o.dashScale,dashSize:o.dashSize,gapSize:o.gapSize}):new Vs({color:t.color||"#35FFAC",linewidth:r.lineWidth||4,dashed:!1,transparent:!0,opacity:r.opacity||1}),o._setMaterialRes(n,e);var i=new Aa([t.longitude,t.latitude],{height:t.height||o.height,interactive:!1,beginSizeZoom:r.beginSizeZoom||9,endSizeZoom:r.endSizeZoom||16,closeZoomChange:o.closeZoomChange},e,n);i.object3d.renderOrder=o.renderOrder,o.dashed&&(i.zoomChange=function(){if(o.map){var t=o.map.pixelToDistance(1,0);e.dashScale=18.93/t}}),o.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(),o.meshs.push(i)})),i?this.threeLayer.addMesh1(this.meshs,this.groupId):this.threeLayer.addMesh(this.meshs),this.dataItems=e):console.error("需要绘制的点位数量为0")}return p(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,s=-1/0,a=-1/0,u=0;u<this.dataItems.length;u++){var l=this.dataItems[u];t.includes(l.code)?(n=Math.min(n,this.dataItems[u].longitude),i=Math.min(i,this.dataItems[u].latitude),s=Math.max(s,this.dataItems[u].longitude),a=Math.max(a,this.dataItems[u].latitude),l.visibility=1):l.visibility=.1}this.updateByVisibility(),e&&this.map.fitExtent(new o.Extent(n,i,s,a),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}(),ya={altitude:0,height:0},va=function(t){A(r,t);var e=m(r);function r(t,n,i,a){var u;h(this,r),i=o.Util.extend({},ya,i,{layer:a}),u=e.call(this);var l=i,c=l.width,f=l.height,p=l.altitude;u._initOptions(i);var g=new s.PlaneGeometry(c,f);u._createMesh(g,n);var A=a.distanceToVector3(p,p).x,d=a.coordinateToVector3(t,A);return u.getObject3d().position.copy(d),u}return p(r)}(n.BaseObject),ma=function(){function t(e,r,n,i,a,u,l){var c=this;h(this,t),this.threelayer=a,this.map=a.map,this.layerClass=u,this.groupId=l,this.millsec=i.millsec||1e3,this.duration=i.duration||75;var f=e.split(","),p=r.split(","),g=parseFloat(f[0]),A=parseFloat(f[1]),d=parseFloat(p[0]),y=parseFloat(p[1]),v=new o.Extent(g,A,d,y),m=1/0,_=1/0,I=-1/0,E=-1/0;[[g,A],[g,y],[d,y],[d,A]].forEach((function(t){var e=c.threelayer.coordinateToVector3(t),r=e.x,n=e.y;m=Math.min(r,m),_=Math.min(n,_),I=Math.max(r,I),E=Math.max(n,E)}));var x=Math.abs(I-m),C=Math.abs(E-_);n.length>1&&Xt.generateGifTexture(n,i.width,i.height).then((function(t){c.texture=t.texture,c.annie=new $(t.texture,t.colNum,t.rowNum,n.length,c.duration,t.colNum==t.rowNum);var e=new s.MeshBasicMaterial({map:t.texture,transparent:!0,opacity:void 0!==i.opacity?parseFloat(i.opacity):1}),r=new va(v.getCenter(),e,{width:x,height:C,interactive:!1},a);c.groupId?c.threelayer.addMesh1(r,c.groupId):c.threelayer.addMesh(r),c.imgObj=r,c.layerClass.updatables.push(c)}))}return p(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}(),_a={radius:50,altitude:0},Ia=function(t){A(r,t);var e=m(r);function r(t,n,i,a){var u;h(this,r),n=o.Util.extend({},_a,n,{layer:a}),u=e.call(this),n.altitude,u._initOptions(n);var l=k(t),c=a.coordinateToVector3(l),f=[];t.forEach((function(t){var e=a.coordinateToVector3(t);e.sub(c),f.push(e)}));var p=new s.CatmullRomCurve3(f),g=a.distanceToVector3(n.radius,n.radius).x,A=new s.TubeGeometry(p,2,g,20,!1);return u._createMesh(A,i),u.parent=null,u.getObject3d().position.set(c.x,c.y,g/2),u}return p(r)}(n.BaseObject),Ea=function(){function t(e,r,n,i){h(this,t),this.threelayer=n,this.map=n.map,this.groupId=i;var o=new s.MeshMatcapMaterial({color:r.color||"red",side:s.DoubleSide});this.m=o;var a=new Ia(e,{radius:r.radius||2},o,n);a.parent=this,this.groupId?this.threelayer.addMesh1(a,this.groupId):this.threelayer.addMesh(a),this.mesh=a}return p(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}(),xa={radius:100,altitude:0},Ca=function(t){A(r,t);var e=m(r);function r(t,n,i,s,a){var u;h(this,r),n=o.Util.extend({},xa,n,{layer:a,coordinate:t}),(u=e.call(this))._initOptions(n);var l=n.altitude;u.object3d=new pa(i,s),u.object3d.computeLineDistances(),u.object3d.scale.set(1,1,1),u.object3d.__parent=v(u);var c=a.distanceToVector3(l,l).x,f=a.coordinateToVector3(t,c);return u.getObject3d().position.copy(f),u}return p(r)}(n.BaseObject),wa={altitude:0,height:0},ba=function(t){A(r,t);var e=m(r);function r(t,n,i,a){var u;h(this,r),i=o.Util.extend({},wa,i,{layer:a}),u=e.call(this);var l=i.altitude;u._initOptions(i);var c=i.scaleFactor||1,f=[],p=new s.ConeGeometry(1*c,2*c,10);p.translate(0,2.5*c,0),f.push(p);var g=new s.CylinderGeometry(.4*c,.6*c,3*c,10);f.push(g);var A=M(f);A.computeVertexNormals(),u._createMesh(A,n);var d=a.distanceToVector3(l,l).x,y=a.coordinateToVector3(t,d);return u.getObject3d().position.copy(y),u}return p(r)}(n.BaseObject),Ba=function(){function t(e,r,n,i,a){h(this,t),this.threelayer=n,this.map=n.map,this.layerClass=i,this.groupId=a;var u=void 0===r.lineFlag||!1!==r.lineFlag,l=r.heightDiv||4,c=r.pointsLen||20,f=r.arrowColor||"rgb(0,255,255)",p=r.arrowNum||5;this.speedFactor=r.speedFactor||2e-4,this.material=null,this.curve=null,this.meshs=[],this.arrows=[],this.up=new s.Vector3(0,1,0),this.axis=new s.Vector3,u&&(this.lineMaterial=new Vs({color:r.lineColor||"red",transparent:!0,linewidth:r.linewidth||4}),this._setMaterialRes(n,this.lineMaterial));var g=new s.MeshBasicMaterial({color:f,side:s.DoubleSide,transparent:!0});this.material=g;var A=new o.LineString(e),d=U(A)/l,y=n.distanceToVector3(d,d).x,v=e[0],m=e[1],_=[v[0]/2+m[0]/2,v[1]/2+m[1]/2],I=n.coordinateToVector3(A.getCenter()),E=n.coordinateToVector3(v).sub(I),x=n.coordinateToVector3(m).sub(I),C=n.coordinateToVector3(_,y).sub(I),w=new s.CatmullRomCurve3([E,C,x],!1,"catmullrom");this.curve=w,this.centerPt=I;var b=w.getPoints(c),B=[];b.forEach((function(t){B.push(t.x,t.y,t.z)}));var S=new fa;S.setPositions(B);var M=new Ca(A.getCenter(),{interactive:!1},S,this.lineMaterial,n);this.meshs.push(M),this.ArrowNum=p;var L=1/this.ArrowNum;this.addSpan=Math.floor(100*L)/100;for(var N=0;N<this.ArrowNum;N++){var T=new ba(e[0],g,{scaleFactor:r.scaleFactor||1},n);T.object3d.renderOrder=r.arrowOrder||1,this.arrows.push(T)}this.groupId?(this.threelayer.addMesh1(M,this.groupId),this.threelayer.addMesh1(this.arrows,this.groupId)):(this.threelayer.addMesh(M),this.threelayer.addMesh(this.arrows)),this.layerClass.updatables.push(this)}var e;return p(t,[{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:(e=c(a().mark((function t(e){var r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.promiseToDoSomething(e);case 2:return r=t.sent,this.texture=new s.CanvasTexture(r.canvas),this.material=new s.MeshBasicMaterial({map:this.texture,side:s.DoubleSide,transparent:!0}),t.abrupt("return",this.material);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return e.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}}]),t}(),Sa=function(){function t(e,r,n,i,a){var u=this;h(this,t),this.threelayer=n,this.map=n.map,this.layerClass=i,this.groupId=a;var l=r.heightDiv||4,c=r.pointsLen||20;this.speedFactor=r.speedFactor||.01,this.sum=0,this.meshs=[];var f=new o.LineString(e),p=U(f)/l,g=n.distanceToVector3(p,p).x,A=e[0],d=e[1],y=[A[0]/2+d[0]/2,A[1]/2+d[1]/2],v=n.coordinateToVector3(f.getCenter()),m=n.coordinateToVector3(A).sub(v),_=n.coordinateToVector3(d).sub(v),I=n.coordinateToVector3(y,g).sub(v);this.lineMaterialDash=new Vs({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 Vs({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 s.CatmullRomCurve3([m,I,_],!1,"catmullrom").getPoints(c),x=[];E.forEach((function(t){x.push(t.x,t.y,t.z)}));var C=new fa;C.setPositions(x);var w=new Ca(f.getCenter(),{interactive:!1},C,this.lineMaterialDash,n),b=new Ca(f.getCenter(),{interactive:!1},C,this.lineMaterial,n),B=b.object3d.geometry.attributes.instanceDistanceEnd.array;this.len=B[B.length-1],this.dur=this.len/3,this.lineMaterialDash.onBeforeCompile=function(t){t.uniforms.actionRatio={value:0},t.uniforms.lineLength={value:u.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 "),u.shaderDash=t},this.groupId?(this.threelayer.addMesh1(b,this.groupId),this.threelayer.addMesh1(w,this.groupId)):(this.threelayer.addMesh(b),this.threelayer.addMesh(w)),this.meshs.push(b),this.meshs.push(w),this.layerClass.updatables.push(this)}return p(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 s.CatmullRomCurve3([e,n,r],!1,"catmullrom").getPoints(20),a=0;a<=19;a++){var u=o[a];i.setXYZ(a,u.x,u.y,u.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}();n.ThreeLayer.prototype._recursionMesh=function(t){for(;t&&t.parent!==this.getScene()&&!t.parent.customType;)t=t.parent;return t},n.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 o.Coordinate(t)),!(t instanceof o.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,a=n.y;this._initRaycaster(),this.fire("identify",{coordinate:t,options:e});var u=this._raycaster,l=this._mouse,c=this.getCamera(),h=this.getScene(),f=this.getMap().getSize();if(!h)return[];var p=f.width,g=f.height;l.x=i/p*2-1,l.y=-a/g*2+1,u.setFromCamera(l,c),u.layers&&u.layers.enableAll&&u.layers.enableAll(),function(t,e){t.linePrecision=e}(u,this._getLinePrecision(this.getMap().getResolution()));var A=[],d=[];h.children.forEach((function(t){var e=t.__parent;if(e&&e.getOptions){var r=e;r.getOptions().interactive&&r.isVisible()&&(r.identify&&o.Util.isFunction(r.identify)?d.push(r):A.push(t))}else(t instanceof s.Mesh||t instanceof s.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&&o.Util.isFunction(r.identify)?d.push(r):A.push(t))}})):A.push(t))}));var y=[],v=u.intersectObjects(A,!0);v&&Array.isArray(v)&&v.length&&(y=v.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,o.Util.isNumber(n)&&(i.instanceId=n),i}))),this.renderPickScene(),d.length&&d.forEach((function(e){e.identify(t)&&y.push(e)}));for(var m=y.length,_=0;_<m;_++)if(y[_])for(var I=_+1;I<m;I++)y[_]===y[I]&&y.splice(I,1);var E=(e=o.Util.extend({},e)).count;return o.Util.isNumber(E)&&E>0?y.slice(0,E):y},n.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&&o.Util.isFunction(n.zoomChange)&&n.zoomChange(e);var i=n.getMinZoom(),s=n.getMaxZoom();e<i||e>s?(n.isVisible()&&(n.getObject3d().visible=!1),n._zoomVisible=!1):i<=e&&e<=s&&(n._visible&&(n.getObject3d().visible=!0),n._zoomVisible=!0)}}));else{var r=t.__parent;if(r&&r.getOptions){var n=r;n.zoomChange&&o.Util.isFunction(n.zoomChange)&&n.zoomChange(e);var i=n.getMinZoom(),s=n.getMaxZoom();e<i||e>s?(n.isVisible()&&(n.getObject3d().visible=!1),n._zoomVisible=!1):i<=e&&e<=s&&(n._visible&&(n.getObject3d().visible=!0),n._zoomVisible=!0)}}}))}},n.ThreeLayer.prototype.addMesh1=function(t,e){var r=this,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)return this;Array.isArray(t)||(t=[t]);var o=this.getScene(),s=void 0;if(e&&(s=o.getObjectByProperty("customId",e)),t.forEach((function(t){if(t instanceof n.BaseObject){var e;if(s)s.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(),i){var a=this._getRenderer();a&&a.setToRedraw()}return this},n.ThreeLayer.prototype.removeMesh1=function(t,e){var r=this,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)return this;Array.isArray(t)||(t=[t]);var a=this.getScene(),u=a.getObjectByProperty("customId",e);if(t.forEach((function(t){if(t instanceof n.BaseObject){u?u.remove(t.getObject3d()):a.remove(t.getObject3d()),t.isAdd&&(t.isAdd=!1,t._fire("remove",{target:t})),t._animation&&o.Util.isFunction(t._animation)&&delete r._animationBaseObjectMap[t.getObject3d().uuid];var e=r._delayMeshes;if(e.length)for(var i=0,l=e.length;i<l;i++)if(e[i]===t){e.splice(i,1);break}}else t instanceof s.Object3D&&a.remove(t)})),i){var l=this._getRenderer();l&&l.setToRedraw()}return this};var Ma=function(){function t(e,r){var i=this;h(this,t),this.map=r,this.animationId=null,this.updatables=[];var o=R();this.threeLayer=new n.ThreeLayer(o,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new s.Clock;var a=function t(){var e,r;(i.threeLayer._needsUpdate=!i.threeLayer._needsUpdate,i.threeLayer._needsUpdate)&&(null===(e=i.threeLayer)||void 0===e||null===(r=e.getRenderer())||void 0===r||r.clearCanvas(),i.threeLayer.renderScene());var n,o=i.clock.getDelta(),s=B(i.updatables);try{for(s.s();!(n=s.n()).done;){n.value.tick(o)}}catch(t){s.e(t)}finally{s.f()}i.animationId=requestAnimationFrame(t)};this.threeLayer.prepareToDraw=function(t,e,r){var n=new s.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),e.add(n),a()},this.threeLayer.addTo(r),this.layerId=o,this.layerName=e,this.dirty=!1,this.initFlag=!1}var e;return p(t,[{key:"createGroup",value:(e=c(a().mark((function t(e){return a().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(),e));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,D(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),t,this)}))),function(t){return e.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 ko(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=R();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,n;(t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate)&&(null===(r=t.threeLayer)||void 0===r||null===(n=r.getRenderer())||void 0===n||n.clearCanvas(),t.threeLayer.renderScene());var i,o=t.clock.getDelta(),s=B(t.updatables);try{for(s.s();!(i=s.n()).done;){i.value.tick(o)}}catch(t){s.e(t)}finally{s.f()}t.animationId=requestAnimationFrame(e)};return new Promise((function(r){t.threeLayer.prepareToDraw=function(t,n,i){var o=new s.DirectionalLight(16777215);o.position.set(0,-10,10).normalize(),n.add(o),n.add(new s.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 W(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new W(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 tt(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new tt(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 V(t,e,r,n,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new V(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 nt(t,e||{},r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new nt(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 he(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 he(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 Ro(t,e,r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new Ro(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 Po(t,e.threeLayer);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new Po(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 ks(t,e,r,i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new ks(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 Gs(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Gs(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 Us(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Us(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 zs(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new zs(t,e,n.threeLayer,r);o.addLine().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 Xs(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Xs(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 da(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new da(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 Ea(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Ea(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 ma(t,e,r,n||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new ma(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 Ba(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Ba(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 Sa(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Sa(t,e||{},n.threeLayer,n,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)}}]),t}(),La=function(){function t(e,r,n,i){h(this,t),this.map=i,this.geometry=null,this.selectGeometry=null,this.isEndSelect=!1,this.drawTool=new o.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 o.VectorLayer(o.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 p(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 Na(){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}}function Ta(t,e,r){if(null!==t)for(var n,i,o,s,a,u,l,c,h=0,f=0,p=t.type,g="FeatureCollection"===p,A="Feature"===p,d=g?t.features.length:1,y=0;y<d;y++){a=(c=!!(l=g?t.features[y].geometry:A?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var v=0;v<a;v++){var m=0,_=0;if(null!==(s=c?l.geometries[v]:l)){u=s.coordinates;var I=s.type;switch(h=!r||"Polygon"!==I&&"MultiPolygon"!==I?0:1,I){case null:break;case"Point":if(!1===e(u,f,y,m,_))return!1;f++,m++;break;case"LineString":case"MultiPoint":for(n=0;n<u.length;n++){if(!1===e(u[n],f,y,m,_))return!1;f++,"MultiPoint"===I&&m++}"LineString"===I&&m++;break;case"Polygon":case"MultiLineString":for(n=0;n<u.length;n++){for(i=0;i<u[n].length-h;i++){if(!1===e(u[n][i],f,y,m,_))return!1;f++}"MultiLineString"===I&&m++,"Polygon"===I&&_++}"Polygon"===I&&m++;break;case"MultiPolygon":for(n=0;n<u.length;n++){for(_=0,i=0;i<u[n].length;i++){for(o=0;o<u[n][i].length-h;o++){if(!1===e(u[n][i][o],f,y,m,_))return!1;f++}_++}m++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(!1===Ta(s.geometries[n],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Ra(t,e,r,n){var i=r;return Ta(t,(function(t,n,o,s,a){i=0===n&&void 0===r?t:e(i,t,n,o,s,a)}),n),i}function Da(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 Qa(t,e,r){var n=r;return Da(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n}function Pa(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 Pa(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n}function Oa(t){var e=[];return Ta(t,(function(t){e.push(t)})),e}function Fa(t,e){var r,n,i,o,s,a,u,l,c,h,f=0,p="FeatureCollection"===t.type,g="Feature"===t.type,A=p?t.features.length:1;for(r=0;r<A;r++){for(a=p?t.features[r].geometry:g?t.geometry:t,l=p?t.features[r].properties:g?t.properties:{},c=p?t.features[r].bbox:g?t.bbox:void 0,h=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,c,h))return!1;break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===e(o.geometries[n],f,l,c,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,f,l,c,h))return!1;f++}}function Ga(t,e,r){var n=r;return Fa(t,(function(t,i,o,s,a){n=0===i&&void 0===r?t:e(n,t,i,o,s,a)})),n}function Ua(t,e){Fa(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(ut(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(ut({type:s,coordinates:l},n),r,u))return!1}}))}function qa(t,e,r){var n=r;return Ua(t,(function(t,i,o){n=0===i&&0===o&&void 0===r?t:e(n,t,i,o)})),n}function ja(t,e){Ua(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!==Ta(t,(function(o,c,h,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=gt([s,o],t.properties);if(!1===e(g,r,n,p,i))return!1;i++,s=o}))&&void 0}}}))}function Va(t,e,r){var n=r,i=!1;return ja(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 za(t,e){if(!t)throw new Error("geojson is required");Ua(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(gt(o[s],t.properties),r,n,s))return!1}}}))}function Ya(t,e,r){var n=r;return za(t,(function(t,i,o,s){n=0===i&&void 0===r?t:e(n,t,i,o,s)})),n}function Ha(t,e){if(!Nt(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),gt([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),gt([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),gt([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),gt([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")}function Xa(t,e){if(!Nt(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 ct(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),ct(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),ct(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),ct(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),ct(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),ct(u[i][o][s],a,e)}throw new Error("geojson is invalid")}Na.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)]},Na.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]},Na.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]},Na.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)]},Na.prototype.WGS2BD=function(t,e){var r=this.WGS2GCJ(t,e);return r=this.GCJ2BD(r[0],r[1])},Na.prototype.BD2WGS=function(t,e){var r=this.BD2GCJ(t,e);return r=this.GCJ2WGS(r[0],r[1])},Na.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]},Na.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 Ja=Object.freeze({__proto__:null,coordAll:Oa,coordEach:Ta,coordReduce:Ra,featureEach:Pa,featureReduce:ka,findPoint:Xa,findSegment:Ha,flattenEach:Ua,flattenReduce:qa,geomEach:Fa,geomReduce:Ga,lineEach:za,lineReduce:Ya,propEach:Da,propReduce:Qa,segmentEach:ja,segmentReduce:Va});function Wa(t){var e=[1/0,1/0,-1/0,-1/0];return Ta(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}Wa.default=Wa;
|
|
2
|
+
/*
|
|
3
|
+
object-assign
|
|
4
|
+
(c) Sindre Sorhus
|
|
5
|
+
@license MIT
|
|
6
|
+
*/
|
|
7
|
+
var Ka=Object.getOwnPropertySymbols,Za=Object.prototype.hasOwnProperty,$a=Object.prototype.propertyIsEnumerable;var tu=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(e).map((function(t){return e[t]}));if("0123456789"!==n.join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach((function(t){i[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,n,i=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),o=1;o<arguments.length;o++){for(var s in r=Object(arguments[o]))Za.call(r,s)&&(i[s]=r[s]);if(Ka){n=Ka(r);for(var a=0;a<n.length;a++)$a.call(r,n[a])&&(i[n[a]]=r[n[a]])}}return i},eu={successCallback:null,verbose:!1},ru={};
|
|
8
|
+
/**
|
|
9
|
+
* @license GNU Affero General Public License.
|
|
10
|
+
* Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>
|
|
11
|
+
* v. 1.2.0
|
|
12
|
+
* https://github.com/RaumZeit/MarchingSquares.js
|
|
13
|
+
*
|
|
14
|
+
* MarchingSquaresJS is free software: you can redistribute it and/or modify
|
|
15
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
16
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
17
|
+
* (at your option) any later version.
|
|
18
|
+
*
|
|
19
|
+
* MarchingSquaresJS is distributed in the hope that it will be useful,
|
|
20
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
21
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
22
|
+
* GNU Affero General Public License for more details.
|
|
23
|
+
*
|
|
24
|
+
* As additional permission under GNU Affero General Public License version 3
|
|
25
|
+
* section 7, third-party projects (personal or commercial) may distribute,
|
|
26
|
+
* include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the
|
|
27
|
+
* requirement that said third-party project for that reason alone becomes
|
|
28
|
+
* subject to any requirement of the GNU Affero General Public License version 3.
|
|
29
|
+
* Any modifications to MarchingSquaresJS, however, must be shared with the public
|
|
30
|
+
* and made available.
|
|
31
|
+
*
|
|
32
|
+
* In summary this:
|
|
33
|
+
* - allows you to use MarchingSquaresJS at no cost
|
|
34
|
+
* - allows you to use MarchingSquaresJS for both personal and commercial purposes
|
|
35
|
+
* - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any
|
|
36
|
+
* license as long as this license notice is included
|
|
37
|
+
* - enables you to keep the source code of your program that uses MarchingSquaresJS
|
|
38
|
+
* undisclosed
|
|
39
|
+
* - forces you to share any modifications you have made to MarchingSquaresJS,
|
|
40
|
+
* e.g. bug-fixes
|
|
41
|
+
*
|
|
42
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
43
|
+
* along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.
|
|
44
|
+
*/function nu(t,e,r){r=r||{};for(var n=Object.keys(eu),i=0;i<n.length;i++){var o=n[i],s=r[o];s=null!=s?s:eu[o],ru[o]=s}ru.verbose&&console.log("MarchingSquaresJS-isoContours: computing isocontour for "+e);var a=function(t){var e=[],r=0,n=1e-7;return t.cells.forEach((function(i,o){i.forEach((function(i,s){if(void 0!==i&&(5!==(p=i).cval&&10!==p.cval)&&!ou(i)){var a=function(t,e,r){var n,i,o=t.length,s=[],a=[0,0,1,1,0,0,0,0,-1,0,1,1,-1,0,-1,0],u=[0,-1,0,0,1,1,1,1,0,-1,0,0,0,-1,0,0],l=["none","left","bottom","left","right","none","bottom","left","top","top","none","top","right","right","bottom","none"],c=["none","bottom","right","right","top","top","top","top","left","bottom","right","right","left","bottom","left","none"],h=t[e][r],f=h.cval,p=l[f],g=au(h,p);s.push([r+g[0],e+g[1]]),p=c[f],g=au(h,p),s.push([r+g[0],e+g[1]]),su(h);var A=r+a[f],d=e+u[f],y=f;for(;A>=0&&d>=0&&d<o&&(A!=r||d!=e)&&void 0!==(h=t[d][A]);){if(0===(f=h.cval)||15===f)return{path:s,info:"mergeable"};p=c[f],n=a[f],i=u[f],5!==f&&10!==f||(5===f?h.flipped?-1===u[y]?(p="left",n=-1,i=0):(p="right",n=1,i=0):-1===a[y]&&(p="bottom",n=0,i=-1):10===f&&(h.flipped?-1===a[y]?(p="top",n=0,i=1):(p="bottom",n=0,i=-1):1===u[y]&&(p="left",n=-1,i=0))),g=au(h,p),s.push([A+g[0],d+g[1]]),su(h),A+=n,d+=i,y=f}return{path:s,info:"closed"}}(t.cells,o,s),u=!1;if("mergeable"===a.info)for(var l=a.path[a.path.length-1][0],c=a.path[a.path.length-1][1],h=r-1;h>=0;h--)if(Math.abs(e[h][0][0]-l)<=n&&Math.abs(e[h][0][1]-c)<=n){for(var f=a.path.length-2;f>=0;--f)e[h].unshift(a.path[f]);u=!0;break}u||(e[r++]=a.path)}var p}))})),e}(function(t,e){for(var r=t.length-1,n=t[0].length-1,i={rows:r,cols:n,cells:[]},o=0;o<r;++o){i.cells[o]=[];for(var s=0;s<n;++s){var a=0,u=t[o+1][s],l=t[o+1][s+1],c=t[o][s+1],h=t[o][s];if(!(isNaN(u)||isNaN(l)||isNaN(c)||isNaN(h))){a|=u>=e?8:0,a|=l>=e?4:0,a|=c>=e?2:0;var f,p,g,A,d=!1;if(5===(a|=h>=e?1:0)||10===a){var y=(u+l+c+h)/4;5===a&&y<e?(a=10,d=!0):10===a&&y<e&&(a=5,d=!0)}if(0!==a&&15!==a)f=p=g=A=.5,1===a?(g=1-iu(e,u,h),p=1-iu(e,c,h)):2===a?(p=iu(e,h,c),A=1-iu(e,l,c)):3===a?(g=1-iu(e,u,h),A=1-iu(e,l,c)):4===a?(f=iu(e,u,l),A=iu(e,c,l)):5===a?(f=iu(e,u,l),A=iu(e,c,l),p=1-iu(e,c,h),g=1-iu(e,u,h)):6===a?(p=iu(e,h,c),f=iu(e,u,l)):7===a?(g=1-iu(e,u,h),f=iu(e,u,l)):8===a?(g=iu(e,h,u),f=1-iu(e,l,u)):9===a?(p=1-iu(e,c,h),f=1-iu(e,l,u)):10===a?(f=1-iu(e,l,u),A=1-iu(e,l,c),p=iu(e,h,c),g=iu(e,h,u)):11===a?(f=1-iu(e,l,u),A=1-iu(e,l,c)):12===a?(g=iu(e,h,u),A=iu(e,c,l)):13===a?(p=1-iu(e,c,h),A=iu(e,c,l)):14===a?(g=iu(e,h,u),p=iu(e,h,c)):console.log("MarchingSquaresJS-isoContours: Illegal cval detected: "+a),i.cells[o][s]={cval:a,flipped:d,top:f,right:A,bottom:p,left:g}}}}return i}(t,e));return"function"==typeof ru.successCallback&&ru.successCallback(a),a}function iu(t,e,r){return(t-e)/(r-e)}function ou(t){return 0===t.cval||15===t.cval}function su(t){ou(t)||5===t.cval||10===t.cval||(t.cval=15)}function au(t,e){return"top"===e?[t.top,1]:"bottom"===e?[t.bottom,0]:"right"===e?[1,t.right]:"left"===e?[0,t.left]:void 0}function uu(t,e){if(!Nt(e=e||{}))throw new Error("options is invalid");var r=e.zProperty||"elevation",n=e.flip,i=e.flags;Gt(t,"Point","input must contain Points");for(var o=function(t,e){var r={};Pa(t,(function(t){var e=Pt(t)[1];r[e]||(r[e]=[]),r[e].push(t)}));var n=Object.keys(r).map((function(t){return r[t].sort((function(t,e){return Pt(t)[0]-Pt(e)[0]}))})),i=n.sort((function(t,r){return e?Pt(t[0])[1]-Pt(r[0])[1]:Pt(r[0])[1]-Pt(t[0])[1]}));return i}(t,n),s=[],a=0;a<o.length;a++){for(var u=o[a],l=[],c=0;c<u.length;c++){var h=u[c];h.properties[r]?l.push(h.properties[r]):l.push(0),!0===i&&(h.properties.matrixPosition=[a,c])}s.push(l)}return s}var lu={exports:{}};function cu(t,e,r,n,i){hu(t,e,r||0,n||t.length-1,i||pu)}function hu(t,e,r,n,i){for(;n>r;){if(n-r>600){var o=n-r+1,s=e-r+1,a=Math.log(o),u=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*u*(o-u)/o)*(s-o/2<0?-1:1);hu(t,e,Math.max(r,Math.floor(e-s*u/o+l)),Math.min(n,Math.floor(e+(o-s)*u/o+l)),i)}var c=t[e],h=r,f=n;for(fu(t,r,e),i(t[n],c)>0&&fu(t,r,n);h<f;){for(fu(t,h,f),h++,f--;i(t[h],c)<0;)h++;for(;i(t[f],c)>0;)f--}0===i(t[r],c)?fu(t,r,f):fu(t,++f,n),f<=e&&(r=f+1),e<=f&&(n=f-1)}}function fu(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function pu(t,e){return t<e?-1:t>e?1:0}function gu(t,e,r){if(!r)return e.indexOf(t);for(let n=0;n<e.length;n++)if(r(t,e[n]))return n;return-1}function Au(t,e){du(t,0,t.children.length,e,t)}function du(t,e,r,n,i){i||(i=wu(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let o=e;o<r;o++){const e=t.children[o];yu(i,t.leaf?n(e):e)}return i}function yu(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function vu(t,e){return t.minX-e.minX}function mu(t,e){return t.minY-e.minY}function _u(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Iu(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Eu(t,e){const r=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-r)*Math.max(0,o-n)}function xu(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Cu(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function wu(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function bu(t,e,r,n,i){const o=[e,r];for(;o.length;){if((r=o.pop())-(e=o.pop())<=n)continue;const s=e+Math.ceil((r-e)/n/2)*n;cu(t,s,e,r,i),o.push(e,s,s,r)}}var Bu=Object.freeze({__proto__:null,default:class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const r=[];if(!Cu(t,e))return r;const n=this.toBBox,i=[];for(;e;){for(let o=0;o<e.children.length;o++){const s=e.children[o],a=e.leaf?n(s):s;Cu(t,a)&&(e.leaf?r.push(s):xu(t,a)?this._all(s,r):i.push(s))}e=i.pop()}return r}collides(t){let e=this.data;if(!Cu(t,e))return!1;const r=[];for(;e;){for(let n=0;n<e.children.length;n++){const i=e.children[n],o=e.leaf?this.toBBox(i):i;if(Cu(t,o)){if(e.leaf||xu(t,o))return!0;r.push(i)}}e=r.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=wu([]),this}remove(t,e){if(!t)return this;let r=this.data;const n=this.toBBox(t),i=[],o=[];let s,a,u;for(;r||i.length;){if(r||(r=i.pop(),a=i[i.length-1],s=o.pop(),u=!0),r.leaf){const n=gu(t,r.children,e);if(-1!==n)return r.children.splice(n,1),i.push(r),this._condense(i),this}u||r.leaf||!xu(r,n)?a?(s++,r=a.children[s],u=!1):r=null:(i.push(r),o.push(s),s=0,a=r,r=r.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const r=[];for(;t;)t.leaf?e.push(...t.children):r.push(...t.children),t=r.pop();return e}_build(t,e,r,n){const i=r-e+1;let o,s=this._maxEntries;if(i<=s)return o=wu(t.slice(e,r+1)),Au(o,this.toBBox),o;n||(n=Math.ceil(Math.log(i)/Math.log(s)),s=Math.ceil(i/Math.pow(s,n-1))),o=wu([]),o.leaf=!1,o.height=n;const a=Math.ceil(i/s),u=a*Math.ceil(Math.sqrt(s));bu(t,e,r,u,this.compareMinX);for(let i=e;i<=r;i+=u){const e=Math.min(i+u-1,r);bu(t,i,e,a,this.compareMinY);for(let r=i;r<=e;r+=a){const i=Math.min(r+a-1,e);o.children.push(this._build(t,r,i,n-1))}}return Au(o,this.toBBox),o}_chooseSubtree(t,e,r,n){for(;n.push(e),!e.leaf&&n.length-1!==r;){let r,n=1/0,s=1/0;for(let a=0;a<e.children.length;a++){const u=e.children[a],l=_u(u),c=(i=t,o=u,(Math.max(o.maxX,i.maxX)-Math.min(o.minX,i.minX))*(Math.max(o.maxY,i.maxY)-Math.min(o.minY,i.minY))-l);c<s?(s=c,n=l<n?l:n,r=u):c===s&&l<n&&(n=l,r=u)}e=r||e.children[0]}var i,o;return e}_insert(t,e,r){const n=r?t:this.toBBox(t),i=[],o=this._chooseSubtree(n,this.data,e,i);for(o.children.push(t),yu(o,n);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(n,i,e)}_split(t,e){const r=t[e],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);const o=this._chooseSplitIndex(r,i,n),s=wu(r.children.splice(o,r.children.length-o));s.height=r.height,s.leaf=r.leaf,Au(r,this.toBBox),Au(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(r,s)}_splitRoot(t,e){this.data=wu([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Au(this.data,this.toBBox)}_chooseSplitIndex(t,e,r){let n,i=1/0,o=1/0;for(let s=e;s<=r-e;s++){const e=du(t,0,s,this.toBBox),a=du(t,s,r,this.toBBox),u=Eu(e,a),l=_u(e)+_u(a);u<i?(i=u,n=s,o=l<o?l:o):u===i&&l<o&&(o=l,n=s)}return n||r-e}_chooseSplitAxis(t,e,r){const n=t.leaf?this.compareMinX:vu,i=t.leaf?this.compareMinY:mu;this._allDistMargin(t,e,r,n)<this._allDistMargin(t,e,r,i)&&t.children.sort(n)}_allDistMargin(t,e,r,n){t.children.sort(n);const i=this.toBBox,o=du(t,0,e,i),s=du(t,r-e,r,i);let a=Iu(o)+Iu(s);for(let n=e;n<r-e;n++){const e=t.children[n];yu(o,t.leaf?i(e):e),a+=Iu(o)}for(let n=r-e-1;n>=e;n--){const e=t.children[n];yu(s,t.leaf?i(e):e),a+=Iu(s)}return a}_adjustParentBBoxes(t,e,r){for(let n=r;n>=0;n--)yu(e[n],t)}_condense(t){for(let e,r=t.length-1;r>=0;r--)0===t[r].children.length?r>0?(e=t[r-1].children,e.splice(e.indexOf(t[r]),1)):this.clear():Au(t[r],this.toBBox)}}}),Su=Wt(Bu);function Mu(t,e){return t<e?-1:t>e?1:0}var Lu=Object.freeze({__proto__:null,default:class{constructor(t=[],e=Mu){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,o=e[i];if(r(n,o)>=0)break;e[t]=o,t=i}e[t]=n}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t<n;){let n=1+(t<<1),o=e[n];const s=n+1;if(s<this.length&&r(e[s],o)<0&&(n=s,o=e[s]),r(o,i)>=0)break;e[t]=o,t=n}e[t]=i}}}),Nu=Wt(Lu),Tu={exports:{}},Ru=function(t,e,r,n){var i=t[0],o=t[1],s=!1;void 0===r&&(r=0),void 0===n&&(n=e.length);for(var a=(n-r)/2,u=0,l=a-1;u<a;l=u++){var c=e[r+2*u+0],h=e[r+2*u+1],f=e[r+2*l+0],p=e[r+2*l+1];h>o!=p>o&&i<(f-c)*(o-h)/(p-h)+c&&(s=!s)}return s},Du=function(t,e,r,n){var i=t[0],o=t[1],s=!1;void 0===r&&(r=0),void 0===n&&(n=e.length);for(var a=n-r,u=0,l=a-1;u<a;l=u++){var c=e[u+r][0],h=e[u+r][1],f=e[l+r][0],p=e[l+r][1];h>o!=p>o&&i<(f-c)*(o-h)/(p-h)+c&&(s=!s)}return s};Tu.exports=function(t,e,r,n){return e.length>0&&Array.isArray(e[0])?Du(t,e,r,n):Ru(t,e,r,n)},Tu.exports.nested=Du,Tu.exports.flat=Ru;var Qu={exports:{}};!function(t,e){!function(t){const e=134217729,r=33306690738754706e-32;function n(t,e,r,n,i){let o,s,a,u,l=e[0],c=n[0],h=0,f=0;c>l==c>-l?(o=l,l=e[++h]):(o=c,c=n[++f]);let p=0;if(h<t&&f<r)for(c>l==c>-l?(a=o-((s=l+o)-l),l=e[++h]):(a=o-((s=c+o)-c),c=n[++f]),o=s,0!==a&&(i[p++]=a);h<t&&f<r;)c>l==c>-l?(a=o-((s=o+l)-(u=s-o))+(l-u),l=e[++h]):(a=o-((s=o+c)-(u=s-o))+(c-u),c=n[++f]),o=s,0!==a&&(i[p++]=a);for(;h<t;)a=o-((s=o+l)-(u=s-o))+(l-u),l=e[++h],o=s,0!==a&&(i[p++]=a);for(;f<r;)a=o-((s=o+c)-(u=s-o))+(c-u),c=n[++f],o=s,0!==a&&(i[p++]=a);return 0===o&&0!==p||(i[p++]=o),p}function i(t){return new Float64Array(t)}const o=33306690738754716e-32,s=22204460492503146e-32,a=11093356479670487e-47,u=i(4),l=i(8),c=i(12),h=i(16),f=i(4);t.orient2d=function(t,i,p,g,A,d){const y=(i-d)*(p-A),v=(t-A)*(g-d),m=y-v;if(0===y||0===v||y>0!=v>0)return m;const _=Math.abs(y+v);return Math.abs(m)>=o*_?m:-function(t,i,o,p,g,A,d){let y,v,m,_,I,E,x,C,w,b,B,S,M,L,N,T,R,D;const Q=t-g,P=o-g,k=i-A,O=p-A;I=(N=(C=Q-(x=(E=e*Q)-(E-Q)))*(b=O-(w=(E=e*O)-(E-O)))-((L=Q*O)-x*w-C*w-x*b))-(B=N-(R=(C=k-(x=(E=e*k)-(E-k)))*(b=P-(w=(E=e*P)-(E-P)))-((T=k*P)-x*w-C*w-x*b))),u[0]=N-(B+I)+(I-R),I=(M=L-((S=L+B)-(I=S-L))+(B-I))-(B=M-T),u[1]=M-(B+I)+(I-T),I=(D=S+B)-S,u[2]=S-(D-I)+(B-I),u[3]=D;let F=function(t,e){let r=e[0];for(let n=1;n<t;n++)r+=e[n];return r}(4,u),G=s*d;if(F>=G||-F>=G)return F;if(y=t-(Q+(I=t-Q))+(I-g),m=o-(P+(I=o-P))+(I-g),v=i-(k+(I=i-k))+(I-A),_=p-(O+(I=p-O))+(I-A),0===y&&0===v&&0===m&&0===_)return F;if(G=a*d+r*Math.abs(F),(F+=Q*_+O*y-(k*m+P*v))>=G||-F>=G)return F;I=(N=(C=y-(x=(E=e*y)-(E-y)))*(b=O-(w=(E=e*O)-(E-O)))-((L=y*O)-x*w-C*w-x*b))-(B=N-(R=(C=v-(x=(E=e*v)-(E-v)))*(b=P-(w=(E=e*P)-(E-P)))-((T=v*P)-x*w-C*w-x*b))),f[0]=N-(B+I)+(I-R),I=(M=L-((S=L+B)-(I=S-L))+(B-I))-(B=M-T),f[1]=M-(B+I)+(I-T),I=(D=S+B)-S,f[2]=S-(D-I)+(B-I),f[3]=D;const U=n(4,u,4,f,l);I=(N=(C=Q-(x=(E=e*Q)-(E-Q)))*(b=_-(w=(E=e*_)-(E-_)))-((L=Q*_)-x*w-C*w-x*b))-(B=N-(R=(C=k-(x=(E=e*k)-(E-k)))*(b=m-(w=(E=e*m)-(E-m)))-((T=k*m)-x*w-C*w-x*b))),f[0]=N-(B+I)+(I-R),I=(M=L-((S=L+B)-(I=S-L))+(B-I))-(B=M-T),f[1]=M-(B+I)+(I-T),I=(D=S+B)-S,f[2]=S-(D-I)+(B-I),f[3]=D;const q=n(U,l,4,f,c);I=(N=(C=y-(x=(E=e*y)-(E-y)))*(b=_-(w=(E=e*_)-(E-_)))-((L=y*_)-x*w-C*w-x*b))-(B=N-(R=(C=v-(x=(E=e*v)-(E-v)))*(b=m-(w=(E=e*m)-(E-m)))-((T=v*m)-x*w-C*w-x*b))),f[0]=N-(B+I)+(I-R),I=(M=L-((S=L+B)-(I=S-L))+(B-I))-(B=M-T),f[1]=M-(B+I)+(I-T),I=(D=S+B)-S,f[2]=S-(D-I)+(B-I),f[3]=D;const j=n(q,c,4,f,h);return h[j-1]}(t,i,p,g,A,d,_)},t.orient2dfast=function(t,e,r,n,i,o){return(e-o)*(r-i)-(t-i)*(n-o)},Object.defineProperty(t,"__esModule",{value:!0})}(e)}(0,Qu.exports);var Pu=Su,ku=Nu,Ou=Tu.exports,Fu=Qu.exports.orient2d;function Gu(t,e,r){e=Math.max(0,void 0===e?2:e),r=r||0;var n=function(t){for(var e=t[0],r=t[0],n=t[0],i=t[0],o=0;o<t.length;o++){var s=t[o];s[0]<e[0]&&(e=s),s[0]>n[0]&&(n=s),s[1]<r[1]&&(r=s),s[1]>i[1]&&(i=s)}var a=[e,r,n,i],u=a.slice();for(o=0;o<t.length;o++)Ou(t[o],a)||u.push(t[o]);return function(t){t.sort(Zu);for(var e=[],r=0;r<t.length;r++){for(;e.length>=2&&Yu(e[e.length-2],e[e.length-1],t[r])<=0;)e.pop();e.push(t[r])}for(var n=[],i=t.length-1;i>=0;i--){for(;n.length>=2&&Yu(n[n.length-2],n[n.length-1],t[i])<=0;)n.pop();n.push(t[i])}return n.pop(),e.pop(),e.concat(n)}(u)}(t),i=new Pu(16);i.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},i.compareMinX=function(t,e){return t[0]-e[0]},i.compareMinY=function(t,e){return t[1]-e[1]},i.load(t);for(var o,s=[],a=0;a<n.length;a++){var u=n[a];i.remove(u),o=Xu(u,o),s.push(o)}var l=new Pu(16);for(a=0;a<s.length;a++)l.insert(Hu(s[a]));for(var c=e*e,h=r*r;s.length;){var f=s.shift(),p=f.p,g=f.next.p,A=Ju(p,g);if(!(A<h)){var d=A/c;(u=Uu(i,f.prev.p,p,g,f.next.next.p,d,l))&&Math.min(Ju(u,p),Ju(u,g))<=d&&(s.push(f),s.push(Xu(u,f)),i.remove(u),l.remove(f),l.insert(Hu(f)),l.insert(Hu(f.next)))}}f=o;var y=[];do{y.push(f.p),f=f.next}while(f!==o);return y.push(f.p),y}function Uu(t,e,r,n,i,o,s){for(var a=new ku([],qu),u=t.data;u;){for(var l=0;l<u.children.length;l++){var c=u.children[l],h=u.leaf?Wu(c,r,n):ju(r,n,c);h>o||a.push({node:c,dist:h})}for(;a.length&&!a.peek().node.children;){var f=a.pop(),p=f.node,g=Wu(p,e,r),A=Wu(p,n,i);if(f.dist<g&&f.dist<A&&zu(r,p,s)&&zu(n,p,s))return p}(u=a.pop())&&(u=u.node)}return null}function qu(t,e){return t.dist-e.dist}function ju(t,e,r){if(Vu(t,r)||Vu(e,r))return 0;var n=Ku(t[0],t[1],e[0],e[1],r.minX,r.minY,r.maxX,r.minY);if(0===n)return 0;var i=Ku(t[0],t[1],e[0],e[1],r.minX,r.minY,r.minX,r.maxY);if(0===i)return 0;var o=Ku(t[0],t[1],e[0],e[1],r.maxX,r.minY,r.maxX,r.maxY);if(0===o)return 0;var s=Ku(t[0],t[1],e[0],e[1],r.minX,r.maxY,r.maxX,r.maxY);return 0===s?0:Math.min(n,i,o,s)}function Vu(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function zu(t,e,r){for(var n,i,o,s,a=Math.min(t[0],e[0]),u=Math.min(t[1],e[1]),l=Math.max(t[0],e[0]),c=Math.max(t[1],e[1]),h=r.search({minX:a,minY:u,maxX:l,maxY:c}),f=0;f<h.length;f++)if(n=h[f].p,i=h[f].next.p,o=t,n!==(s=e)&&i!==o&&Yu(n,i,o)>0!=Yu(n,i,s)>0&&Yu(o,s,n)>0!=Yu(o,s,i)>0)return!1;return!0}function Yu(t,e,r){return Fu(t[0],t[1],e[0],e[1],r[0],r[1])}function Hu(t){var e=t.p,r=t.next.p;return t.minX=Math.min(e[0],r[0]),t.minY=Math.min(e[1],r[1]),t.maxX=Math.max(e[0],r[0]),t.maxY=Math.max(e[1],r[1]),t}function Xu(t,e){var r={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function Ju(t,e){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function Wu(t,e,r){var n=e[0],i=e[1],o=r[0]-n,s=r[1]-i;if(0!==o||0!==s){var a=((t[0]-n)*o+(t[1]-i)*s)/(o*o+s*s);a>1?(n=r[0],i=r[1]):a>0&&(n+=o*a,i+=s*a)}return(o=t[0]-n)*o+(s=t[1]-i)*s}function Ku(t,e,r,n,i,o,s,a){var u,l,c,h,f=r-t,p=n-e,g=s-i,A=a-o,d=t-i,y=e-o,v=f*f+p*p,m=f*g+p*A,_=g*g+A*A,I=f*d+p*y,E=g*d+A*y,x=v*_-m*m,C=x,w=x;0===x?(l=0,C=1,h=E,w=_):(h=v*E-m*I,(l=m*E-_*I)<0?(l=0,h=E,w=_):l>C&&(l=C,h=E+m,w=_)),h<0?(h=0,-I<0?l=0:-I>v?l=C:(l=-I,C=v)):h>w&&(h=w,-I+m<0?l=0:-I+m>v?l=C:(l=-I+m,C=v));var b=(1-(c=0===h?0:h/w))*i+c*s-((1-(u=0===l?0:l/C))*t+u*r),B=(1-c)*o+c*a-((1-u)*e+u*n);return b*b+B*B}function Zu(t,e){return t[0]===e[0]?t[1]-e[1]:t[0]-e[0]}ku.default&&(ku=ku.default),lu.exports=Gu,lu.exports.default=Gu;var $u=lu.exports;function tl(t,e){void 0===e&&(e={}),e.concavity=e.concavity||1/0;var r=[];if(Ta(t,(function(t){r.push([t[0],t[1]])})),!r.length)return null;var n=$u(r,e.concavity);return n.length>3?ft([n]):null}function el(t,e){var r=[];return Pa(t,(function(t){var n=!1;if("Point"===t.geometry.type)Fa(e,(function(e){zt(t,e)&&(n=!0)})),n&&r.push(t);else{if("MultiPoint"!==t.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var i=[];Fa(e,(function(e){Ta(t,(function(t){zt(t,e)&&(n=!0,i.push(t))}))})),n&&r.push(vt(i))}})),dt(r)}function rl(t,e){var r=!1;return dt(function(t){if(t.length<3)return[];t.sort(il);var e,r,n,i,o,s,a=t.length-1,u=t[a].x,l=t[0].x,c=t[a].y,h=c,f=1e-12;for(;a--;)t[a].y<c&&(c=t[a].y),t[a].y>h&&(h=t[a].y);var p,g=l-u,A=h-c,d=g>A?g:A,y=.5*(l+u),v=.5*(h+c),m=[new nl({__sentinel:!0,x:y-20*d,y:v-d},{__sentinel:!0,x:y,y:v+20*d},{__sentinel:!0,x:y+20*d,y:v-d})],_=[],I=[];a=t.length;for(;a--;){for(I.length=0,p=m.length;p--;)(g=t[a].x-m[p].x)>0&&g*g>m[p].r?(_.push(m[p]),m.splice(p,1)):g*g+(A=t[a].y-m[p].y)*A>m[p].r||(I.push(m[p].a,m[p].b,m[p].b,m[p].c,m[p].c,m[p].a),m.splice(p,1));for(ol(I),p=I.length;p;)r=I[--p],e=I[--p],n=t[a],i=r.x-e.x,o=r.y-e.y,s=2*(i*(n.y-r.y)-o*(n.x-r.x)),Math.abs(s)>f&&m.push(new nl(e,r,n))}Array.prototype.push.apply(_,m),a=_.length;for(;a--;)(_[a].a.__sentinel||_[a].b.__sentinel||_[a].c.__sentinel)&&_.splice(a,1);return _}(t.features.map((function(t){var n={x:t.geometry.coordinates[0],y:t.geometry.coordinates[1]};return e?n.z=t.properties[e]:3===t.geometry.coordinates.length&&(r=!0,n.z=t.geometry.coordinates[2]),n}))).map((function(t){var e=[t.a.x,t.a.y],n=[t.b.x,t.b.y],i=[t.c.x,t.c.y],o={};return r?(e.push(t.a.z),n.push(t.b.z),i.push(t.c.z)):o={a:t.a.z,b:t.b.z,c:t.c.z},ft([[e,n,i,e]],o)})))}var nl=function(t,e,r){this.a=t,this.b=e,this.c=r;var n,i,o=e.x-t.x,s=e.y-t.y,a=r.x-t.x,u=r.y-t.y,l=o*(t.x+e.x)+s*(t.y+e.y),c=a*(t.x+r.x)+u*(t.y+r.y),h=2*(o*(r.y-e.y)-s*(r.x-e.x));this.x=(u*l-s*c)/h,this.y=(o*c-a*l)/h,n=this.x-t.x,i=this.y-t.y,this.r=n*n+i*i};function il(t,e){return e.x-t.x}function ol(t){var e,r,n,i,o,s=t.length;t:for(;s;)for(r=t[--s],e=t[--s],n=s;n;)if(o=t[--n],e===(i=t[--n])&&r===o||e===o&&r===i){t.splice(s,2),t.splice(n,2),s-=2;continue t}}function sl(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return al(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 al(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return ll(t);default:throw new Error("unknown GeoJSON type")}}function al(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=ul(t.properties),e.geometry=ll(t.geometry),e}function ul(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]=ul(n):e[r]=n})),e):e}function ll(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return ll(t)})),e):(e.coordinates=cl(t.coordinates),e)}function cl(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return cl(t)}))}function hl(t,e){if(void 0===e&&(e={}),!Nt(e=e||{}))throw new Error("options is invalid");var r=e.mutate;if("FeatureCollection"!==qt(t))throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");!1!==r&&void 0!==r||(t=sl(t));var n=[],i=Ya(t,(function(t,e){var r=function(t,e){var r,n=t.geometry.coordinates,i=e.geometry.coordinates,o=fl(n[0]),s=fl(n[n.length-1]),a=fl(i[0]),u=fl(i[i.length-1]);if(o===u)r=i.concat(n.slice(1));else if(a===s)r=n.concat(i.slice(1));else if(o===a)r=n.slice(1).reverse().concat(i);else{if(s!==u)return null;r=n.concat(i.reverse().slice(1))}return gt(r)}(t,e);return r||(n.push(t),e)}));return i&&n.push(i),n.length?1===n.length?n[0]:yt(n.map((function(t){return t.coordinates}))):null}function fl(t){return t[0].toString()+","+t[1].toString()}function pl(t){return t}function gl(t,e){var r=function(t){if(null==t)return pl;var e,r,n=t.scale[0],i=t.scale[1],o=t.translate[0],s=t.translate[1];return function(t,a){a||(e=r=0);var u=2,l=t.length,c=new Array(l);for(c[0]=(e+=t[0])*n+o,c[1]=(r+=t[1])*i+s;u<l;)c[u]=t[u],++u;return c}}(t.transform),n=t.arcs;function i(t,e){e.length&&e.pop();for(var i=n[t<0?~t:t],o=0,s=i.length;o<s;++o)e.push(r(i[o],o));t<0&&function(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r}(e,s)}function o(t){return r(t)}function s(t){for(var e=[],r=0,n=t.length;r<n;++r)i(t[r],e);return e.length<2&&e.push(e[0]),e}function a(t){for(var e=s(t);e.length<4;)e.push(e[0]);return e}function u(t){return t.map(a)}return function t(e){var r,n=e.type;switch(n){case"GeometryCollection":return{type:n,geometries:e.geometries.map(t)};case"Point":r=o(e.coordinates);break;case"MultiPoint":r=e.coordinates.map(o);break;case"LineString":r=s(e.arcs);break;case"MultiLineString":r=e.arcs.map(s);break;case"Polygon":r=u(e.arcs);break;case"MultiPolygon":r=e.arcs.map(u);break;default:return null}return{type:n,coordinates:r}}(e)}function Al(t,e){var r={},n={},i={},o=[],s=-1;function a(t,e){for(var n in t){var i=t[n];delete e[i.start],delete i.start,delete i.end,i.forEach((function(t){r[t<0?~t:t]=1})),o.push(i)}}return e.forEach((function(r,n){var i,o=t.arcs[r<0?~r:r];o.length<3&&!o[1][0]&&!o[1][1]&&(i=e[++s],e[s]=r,e[n]=i)})),e.forEach((function(e){var r,o,s=function(e){var r,n=t.arcs[e<0?~e:e],i=n[0];t.transform?(r=[0,0],n.forEach((function(t){r[0]+=t[0],r[1]+=t[1]}))):r=n[n.length-1];return e<0?[r,i]:[i,r]}(e),a=s[0],u=s[1];if(r=i[a])if(delete i[r.end],r.push(e),r.end=u,o=n[u]){delete n[o.start];var l=o===r?r:r.concat(o);n[l.start=r.start]=i[l.end=o.end]=l}else n[r.start]=i[r.end]=r;else if(r=n[u])if(delete n[r.start],r.unshift(e),r.start=a,o=i[a]){delete i[o.end];var c=o===r?r:o.concat(r);n[c.start=o.start]=i[c.end=r.end]=c}else n[r.start]=i[r.end]=r;else n[(r=[e]).start=a]=i[r.end=u]=r})),a(i,n),a(n,i),e.forEach((function(t){r[t<0?~t:t]||o.push([t])})),o}function dl(t){return gl(t,yl.apply(this,arguments))}function yl(t,e){var r={},n=[],i=[];function o(t){t.forEach((function(e){e.forEach((function(e){(r[e=e<0?~e:e]||(r[e]=[])).push(t)}))})),n.push(t)}function s(e){return function(t){for(var e,r=-1,n=t.length,i=t[n-1],o=0;++r<n;)e=i,i=t[r],o+=e[0]*i[1]-e[1]*i[0];return Math.abs(o)}(gl(t,{type:"Polygon",arcs:[e]}).coordinates[0])}return e.forEach((function t(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(t);break;case"Polygon":o(e.arcs);break;case"MultiPolygon":e.arcs.forEach(o)}})),n.forEach((function(t){if(!t._){var e=[],n=[t];for(t._=1,i.push(e);t=n.pop();)e.push(t),t.forEach((function(t){t.forEach((function(t){r[t<0?~t:t].forEach((function(t){t._||(t._=1,n.push(t))}))}))}))}})),n.forEach((function(t){delete t._})),{type:"MultiPolygon",arcs:i.map((function(e){var n,i=[];if(e.forEach((function(t){t.forEach((function(t){t.forEach((function(t){r[t<0?~t:t].length<2&&i.push(t)}))}))})),(n=(i=Al(t,i)).length)>1)for(var o,a,u=1,l=s(i[0]);u<n;++u)(o=s(i[u]))>l&&(a=i[0],i[0]=i[u],i[u]=a,l=o);return i})).filter((function(t){return t.length>0}))}}var vl=Object.prototype.hasOwnProperty;function ml(t,e,r,n,i,o){3===arguments.length&&(n=o=Array,i=null);for(var s=new n(t=1<<Math.max(4,Math.ceil(Math.log(t)/Math.LN2))),a=new o(t),u=t-1,l=0;l<t;++l)s[l]=i;return{set:function(n,o){for(var l=e(n)&u,c=s[l],h=0;c!=i;){if(r(c,n))return a[l]=o;if(++h>=t)throw new Error("full hashmap");c=s[l=l+1&u]}return s[l]=n,a[l]=o,o},maybeSet:function(n,o){for(var l=e(n)&u,c=s[l],h=0;c!=i;){if(r(c,n))return a[l];if(++h>=t)throw new Error("full hashmap");c=s[l=l+1&u]}return s[l]=n,a[l]=o,o},get:function(n,o){for(var l=e(n)&u,c=s[l],h=0;c!=i;){if(r(c,n))return a[l];if(++h>=t)break;c=s[l=l+1&u]}return o},keys:function(){for(var t=[],e=0,r=s.length;e<r;++e){var n=s[e];n!=i&&t.push(n)}return t}}}function _l(t,e){return t[0]===e[0]&&t[1]===e[1]}var Il=new ArrayBuffer(16),El=new Float64Array(Il),xl=new Uint32Array(Il);function Cl(t){El[0]=t[0],El[1]=t[1];var e=xl[0]^xl[1];return 2147483647&(e=e<<5^e>>7^xl[2]^xl[3])}function wl(t){var e,r,n,i,o=t.coordinates,s=t.lines,a=t.rings,u=function(){for(var t=ml(1.4*o.length,I,E,Int32Array,-1,Int32Array),e=new Int32Array(o.length),r=0,n=o.length;r<n;++r)e[r]=t.maybeSet(r,r);return e}(),l=new Int32Array(o.length),c=new Int32Array(o.length),h=new Int32Array(o.length),f=new Int8Array(o.length),p=0;for(e=0,r=o.length;e<r;++e)l[e]=c[e]=h[e]=-1;for(e=0,r=s.length;e<r;++e){var g=s[e],A=g[0],d=g[1];for(n=u[A],i=u[++A],++p,f[n]=1;++A<=d;)_(e,n,n=i,i=u[A]);++p,f[i]=1}for(e=0,r=o.length;e<r;++e)l[e]=-1;for(e=0,r=a.length;e<r;++e){var y=a[e],v=y[0]+1,m=y[1];for(_(e,u[m-1],n=u[v-1],i=u[v]);++v<=m;)_(e,n,n=i,i=u[v])}function _(t,e,r,n){if(l[r]!==t){l[r]=t;var i=c[r];if(i>=0){var o=h[r];i===e&&o===n||i===n&&o===e||(++p,f[r]=1)}else c[r]=e,h[r]=n}}function I(t){return Cl(o[t])}function E(t,e){return _l(o[t],o[e])}l=c=h=null;var x,C=function(t,e,r,n,i){3===arguments.length&&(n=Array,i=null);for(var o=new n(t=1<<Math.max(4,Math.ceil(Math.log(t)/Math.LN2))),s=t-1,a=0;a<t;++a)o[a]=i;return{add:function(n){for(var a=e(n)&s,u=o[a],l=0;u!=i;){if(r(u,n))return!0;if(++l>=t)throw new Error("full hashset");u=o[a=a+1&s]}return o[a]=n,!0},has:function(n){for(var a=e(n)&s,u=o[a],l=0;u!=i;){if(r(u,n))return!0;if(++l>=t)break;u=o[a=a+1&s]}return!1},values:function(){for(var t=[],e=0,r=o.length;e<r;++e){var n=o[e];n!=i&&t.push(n)}return t}}}(1.4*p,Cl,_l);for(e=0,r=o.length;e<r;++e)f[x=u[e]]&&C.add(o[x]);return C}function bl(t,e,r,n){Bl(t,e,r),Bl(t,e,e+n),Bl(t,e+n,r)}function Bl(t,e,r){for(var n,i=e+(r---e>>1);e<i;++e,--r)n=t[e],t[e]=t[r],t[r]=n}function Sl(t){var e,r,n={};for(e in t)n[e]=null==(r=t[e])?{type:null}:("FeatureCollection"===r.type?Ml:"Feature"===r.type?Ll:Nl)(r);return n}function Ml(t){var e={type:"GeometryCollection",geometries:t.features.map(Ll)};return null!=t.bbox&&(e.bbox=t.bbox),e}function Ll(t){var e,r=Nl(t.geometry);for(e in null!=t.id&&(r.id=t.id),null!=t.bbox&&(r.bbox=t.bbox),t.properties){r.properties=t.properties;break}return r}function Nl(t){if(null==t)return{type:null};var e="GeometryCollection"===t.type?{type:"GeometryCollection",geometries:t.geometries.map(Nl)}:"Point"===t.type||"MultiPoint"===t.type?{type:t.type,coordinates:t.coordinates}:{type:t.type,arcs:t.coordinates};return null!=t.bbox&&(e.bbox=t.bbox),e}function Tl(t,e){var r=function(t){var e=1/0,r=1/0,n=-1/0,i=-1/0;function o(t){null!=t&&vl.call(s,t.type)&&s[t.type](t)}var s={GeometryCollection:function(t){t.geometries.forEach(o)},Point:function(t){a(t.coordinates)},MultiPoint:function(t){t.coordinates.forEach(a)},LineString:function(t){u(t.arcs)},MultiLineString:function(t){t.arcs.forEach(u)},Polygon:function(t){t.arcs.forEach(u)},MultiPolygon:function(t){t.arcs.forEach(l)}};function a(t){var o=t[0],s=t[1];o<e&&(e=o),o>n&&(n=o),s<r&&(r=s),s>i&&(i=s)}function u(t){t.forEach(a)}function l(t){t.forEach(u)}for(var c in t)o(t[c]);return n>=e&&i>=r?[e,r,n,i]:void 0}(t=Sl(t)),n=e>0&&r&&function(t,e,r){var n=e[0],i=e[1],o=e[2],s=e[3],a=o-n?(r-1)/(o-n):1,u=s-i?(r-1)/(s-i):1;function l(t){return[Math.round((t[0]-n)*a),Math.round((t[1]-i)*u)]}function c(t,e){for(var r,o,s,l,c,h=-1,f=0,p=t.length,g=new Array(p);++h<p;)r=t[h],l=Math.round((r[0]-n)*a),c=Math.round((r[1]-i)*u),l===o&&c===s||(g[f++]=[o=l,s=c]);for(g.length=f;f<e;)f=g.push([g[0][0],g[0][1]]);return g}function h(t){return c(t,2)}function f(t){return c(t,4)}function p(t){return t.map(f)}function g(t){null!=t&&vl.call(A,t.type)&&A[t.type](t)}var A={GeometryCollection:function(t){t.geometries.forEach(g)},Point:function(t){t.coordinates=l(t.coordinates)},MultiPoint:function(t){t.coordinates=t.coordinates.map(l)},LineString:function(t){t.arcs=h(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(h)},Polygon:function(t){t.arcs=p(t.arcs)},MultiPolygon:function(t){t.arcs=t.arcs.map(p)}};for(var d in t)g(t[d]);return{scale:[1/a,1/u],translate:[n,i]}}(t,r,e),i=function(t){var e,r,n,i,o=t.coordinates,s=t.lines,a=t.rings,u=s.length+a.length;for(delete t.lines,delete t.rings,n=0,i=s.length;n<i;++n)for(e=s[n];e=e.next;)++u;for(n=0,i=a.length;n<i;++n)for(r=a[n];r=r.next;)++u;var l=ml(2*u*1.4,Cl,_l),c=t.arcs=[];for(n=0,i=s.length;n<i;++n){e=s[n];do{h(e)}while(e=e.next)}for(n=0,i=a.length;n<i;++n)if((r=a[n]).next)do{h(r)}while(r=r.next);else f(r);function h(t){var e,r,n,i,s,a,u,h;if(n=l.get(e=o[t[0]]))for(u=0,h=n.length;u<h;++u)if(p(i=n[u],t))return t[0]=i[0],void(t[1]=i[1]);if(s=l.get(r=o[t[1]]))for(u=0,h=s.length;u<h;++u)if(g(a=s[u],t))return t[1]=a[0],void(t[0]=a[1]);n?n.push(t):l.set(e,[t]),s?s.push(t):l.set(r,[t]),c.push(t)}function f(t){var e,r,n,i,s;if(r=l.get(o[t[0]]))for(i=0,s=r.length;i<s;++i){if(A(n=r[i],t))return t[0]=n[0],void(t[1]=n[1]);if(d(n,t))return t[0]=n[1],void(t[1]=n[0])}if(r=l.get(e=o[t[0]+y(t)]))for(i=0,s=r.length;i<s;++i){if(A(n=r[i],t))return t[0]=n[0],void(t[1]=n[1]);if(d(n,t))return t[0]=n[1],void(t[1]=n[0])}r?r.push(t):l.set(e,[t]),c.push(t)}function p(t,e){var r=t[0],n=e[0],i=t[1];if(r-i!=n-e[1])return!1;for(;r<=i;++r,++n)if(!_l(o[r],o[n]))return!1;return!0}function g(t,e){var r=t[0],n=e[0],i=t[1],s=e[1];if(r-i!=n-s)return!1;for(;r<=i;++r,--s)if(!_l(o[r],o[s]))return!1;return!0}function A(t,e){var r=t[0],n=e[0],i=t[1]-r;if(i!==e[1]-n)return!1;for(var s=y(t),a=y(e),u=0;u<i;++u)if(!_l(o[r+(u+s)%i],o[n+(u+a)%i]))return!1;return!0}function d(t,e){var r=t[0],n=e[0],i=t[1],s=e[1],a=i-r;if(a!==s-n)return!1;for(var u=y(t),l=a-y(e),c=0;c<a;++c)if(!_l(o[r+(c+u)%a],o[s-(c+l)%a]))return!1;return!0}function y(t){for(var e=t[0],r=t[1],n=e,i=n,s=o[n];++n<r;){var a=o[n];(a[0]<s[0]||a[0]===s[0]&&a[1]<s[1])&&(i=n,s=a)}return i-e}return t}(function(t){var e,r,n,i=wl(t),o=t.coordinates,s=t.lines,a=t.rings;for(r=0,n=s.length;r<n;++r)for(var u=s[r],l=u[0],c=u[1];++l<c;)i.has(o[l])&&(e={0:l,1:u[1]},u[1]=l,u=u.next=e);for(r=0,n=a.length;r<n;++r)for(var h=a[r],f=h[0],p=f,g=h[1],A=i.has(o[f]);++p<g;)i.has(o[p])&&(A?(e={0:p,1:h[1]},h[1]=p,h=h.next=e):(bl(o,f,g,g-p),o[g]=o[f],A=!0,p=f));return t}(function(t){var e=-1,r=[],n=[],i=[];function o(t){t&&vl.call(s,t.type)&&s[t.type](t)}var s={GeometryCollection:function(t){t.geometries.forEach(o)},LineString:function(t){t.arcs=a(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(a)},Polygon:function(t){t.arcs=t.arcs.map(u)},MultiPolygon:function(t){t.arcs=t.arcs.map(l)}};function a(t){for(var n=0,o=t.length;n<o;++n)i[++e]=t[n];var s={0:e-o+1,1:e};return r.push(s),s}function u(t){for(var r=0,o=t.length;r<o;++r)i[++e]=t[r];var s={0:e-o+1,1:e};return n.push(s),s}function l(t){return t.map(u)}for(var c in t)o(t[c]);return{type:"Topology",coordinates:i,lines:r,rings:n,objects:t}}(t))),o=i.coordinates,s=ml(1.4*i.arcs.length,Rl,Dl);function a(t){t&&vl.call(u,t.type)&&u[t.type](t)}t=i.objects,i.bbox=r,i.arcs=i.arcs.map((function(t,e){return s.set(t,e),o.slice(t[0],t[1]+1)})),delete i.coordinates,o=null;var u={GeometryCollection:function(t){t.geometries.forEach(a)},LineString:function(t){t.arcs=l(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(l)},Polygon:function(t){t.arcs=t.arcs.map(l)},MultiPolygon:function(t){t.arcs=t.arcs.map(c)}};function l(t){var e=[];do{var r=s.get(t);e.push(t[0]<t[1]?r:~r)}while(t=t.next);return e}function c(t){return t.map(l)}for(var h in t)a(t[h]);return n&&(i.transform=n,i.arcs=function(t){for(var e=-1,r=t.length;++e<r;){for(var n,i,o=t[e],s=0,a=1,u=o.length,l=o[0],c=l[0],h=l[1];++s<u;)n=(l=o[s])[0],i=l[1],n===c&&i===h||(o[a++]=[n-c,i-h],c=n,h=i);1===a&&(o[a++]=[0,0]),o.length=a}return t}(i.arcs)),i}function Rl(t){var e,r=t[0],n=t[1];return n<r&&(e=r,r=n,n=e),r+31*n}function Dl(t,e){var r,n=t[0],i=t[1],o=e[0],s=e[1];return i<n&&(r=n,n=i,i=r),s<o&&(r=o,o=s,s=r),n===o&&i===s}function Ql(t,e){if(void 0===e&&(e={}),!Nt(e=e||{}))throw new Error("options is invalid");var r=e.mutate;if("FeatureCollection"!==qt(t))throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");!1!==r&&void 0!==r||(t=sl(t));var n=function(t){var e={};Ua(t,(function(t){e[t.geometry.type]=!0}));var r=Object.keys(e);if(1===r.length)return r[0];return null}(t);if(!n)throw new Error("geojson must be homogenous");var i=t;switch(n){case"LineString":return hl(i,e);case"Polygon":return function(t,e){if(void 0===e&&(e={}),"FeatureCollection"!==qt(t))throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");!1!==e.mutate&&void 0!==e.mutate||(t=sl(t));var r=[];Ua(t,(function(t){r.push(t.geometry)}));var n=Tl({geoms:_t(r).geometry});return dl(n,n.objects.geoms.geometries)}(i,e);default:throw new Error(n+" is not supported")}}var Pl={exports:{}},kl={exports:{}};!function(t,e){t.exports=function(){function t(t,r,i,o,s){e(t,r,i||0,o||t.length-1,s||n)}function e(t,n,i,o,s){for(;o>i;){if(o-i>600){var a=o-i+1,u=n-i+1,l=Math.log(a),c=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*c*(a-c)/a)*(u-a/2<0?-1:1);e(t,n,Math.max(i,Math.floor(n-u*c/a+h)),Math.min(o,Math.floor(n+(a-u)*c/a+h)),s)}var f=t[n],p=i,g=o;for(r(t,i,n),s(t[o],f)>0&&r(t,i,o);p<g;){for(r(t,p,g),p++,g--;s(t[p],f)<0;)p++;for(;s(t[g],f)>0;)g--}0===s(t[i],f)?r(t,i,g):r(t,++g,o),g<=n&&(i=g+1),n<=g&&(o=g-1)}}function r(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function n(t,e){return t<e?-1:t>e?1:0}return t}()}(kl),Pl.exports=Fl,Pl.exports.default=Fl;var Ol=kl.exports;function Fl(t,e){if(!(this instanceof Fl))return new Fl(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function Gl(t,e,r){if(!r)return e.indexOf(t);for(var n=0;n<e.length;n++)if(r(t,e[n]))return n;return-1}function Ul(t,e){ql(t,0,t.children.length,e,t)}function ql(t,e,r,n,i){i||(i=Wl(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o,s=e;s<r;s++)o=t.children[s],jl(i,t.leaf?n(o):o);return i}function jl(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function Vl(t,e){return t.minX-e.minX}function zl(t,e){return t.minY-e.minY}function Yl(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Hl(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Xl(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Jl(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Wl(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Kl(t,e,r,n,i){for(var o,s=[e,r];s.length;)(r=s.pop())-(e=s.pop())<=n||(o=e+Math.ceil((r-e)/n/2)*n,Ol(t,o,e,r,i),s.push(e,o,o,r))}Fl.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,r=[],n=this.toBBox;if(!Jl(t,e))return r;for(var i,o,s,a,u=[];e;){for(i=0,o=e.children.length;i<o;i++)s=e.children[i],Jl(t,a=e.leaf?n(s):s)&&(e.leaf?r.push(s):Xl(t,a)?this._all(s,r):u.push(s));e=u.pop()}return r},collides:function(t){var e=this.data,r=this.toBBox;if(!Jl(t,e))return!1;for(var n,i,o,s,a=[];e;){for(n=0,i=e.children.length;n<i;n++)if(o=e.children[n],Jl(t,s=e.leaf?r(o):o)){if(e.leaf||Xl(t,s))return!0;a.push(o)}e=a.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0,r=t.length;e<r;e++)this.insert(t[e]);return this}var n=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var i=this.data;this.data=n,n=i}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=Wl([]),this},remove:function(t,e){if(!t)return this;for(var r,n,i,o,s=this.data,a=this.toBBox(t),u=[],l=[];s||u.length;){if(s||(s=u.pop(),n=u[u.length-1],r=l.pop(),o=!0),s.leaf&&-1!==(i=Gl(t,s.children,e)))return s.children.splice(i,1),u.push(s),this._condense(u),this;o||s.leaf||!Xl(s,a)?n?(r++,s=n.children[r],o=!1):s=null:(u.push(s),l.push(r),r=0,n=s,s=s.children[0])}return this},toBBox:function(t){return t},compareMinX:Vl,compareMinY:zl,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var r=[];t;)t.leaf?e.push.apply(e,t.children):r.push.apply(r,t.children),t=r.pop();return e},_build:function(t,e,r,n){var i,o=r-e+1,s=this._maxEntries;if(o<=s)return Ul(i=Wl(t.slice(e,r+1)),this.toBBox),i;n||(n=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,n-1))),(i=Wl([])).leaf=!1,i.height=n;var a,u,l,c,h=Math.ceil(o/s),f=h*Math.ceil(Math.sqrt(s));for(Kl(t,e,r,f,this.compareMinX),a=e;a<=r;a+=f)for(Kl(t,a,l=Math.min(a+f-1,r),h,this.compareMinY),u=a;u<=l;u+=h)c=Math.min(u+h-1,l),i.children.push(this._build(t,u,c,n-1));return Ul(i,this.toBBox),i},_chooseSubtree:function(t,e,r,n){for(var i,o,s,a,u,l,c,h,f,p;n.push(e),!e.leaf&&n.length-1!==r;){for(c=h=1/0,i=0,o=e.children.length;i<o;i++)u=Yl(s=e.children[i]),f=t,p=s,(l=(Math.max(p.maxX,f.maxX)-Math.min(p.minX,f.minX))*(Math.max(p.maxY,f.maxY)-Math.min(p.minY,f.minY))-u)<h?(h=l,c=u<c?u:c,a=s):l===h&&u<c&&(c=u,a=s);e=a||e.children[0]}return e},_insert:function(t,e,r){var n=this.toBBox,i=r?t:n(t),o=[],s=this._chooseSubtree(i,this.data,e,o);for(s.children.push(t),jl(s,i);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)},_split:function(t,e){var r=t[e],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);var o=this._chooseSplitIndex(r,i,n),s=Wl(r.children.splice(o,r.children.length-o));s.height=r.height,s.leaf=r.leaf,Ul(r,this.toBBox),Ul(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(r,s)},_splitRoot:function(t,e){this.data=Wl([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Ul(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,r){var n,i,o,s,a,u,l,c,h,f,p,g,A,d;for(u=l=1/0,n=e;n<=r-e;n++)i=ql(t,0,n,this.toBBox),o=ql(t,n,r,this.toBBox),h=i,f=o,p=void 0,g=void 0,A=void 0,d=void 0,p=Math.max(h.minX,f.minX),g=Math.max(h.minY,f.minY),A=Math.min(h.maxX,f.maxX),d=Math.min(h.maxY,f.maxY),s=Math.max(0,A-p)*Math.max(0,d-g),a=Yl(i)+Yl(o),s<u?(u=s,c=n,l=a<l?a:l):s===u&&a<l&&(l=a,c=n);return c},_chooseSplitAxis:function(t,e,r){var n=t.leaf?this.compareMinX:Vl,i=t.leaf?this.compareMinY:zl;this._allDistMargin(t,e,r,n)<this._allDistMargin(t,e,r,i)&&t.children.sort(n)},_allDistMargin:function(t,e,r,n){t.children.sort(n);var i,o,s=this.toBBox,a=ql(t,0,e,s),u=ql(t,r-e,r,s),l=Hl(a)+Hl(u);for(i=e;i<r-e;i++)o=t.children[i],jl(a,t.leaf?s(o):o),l+=Hl(a);for(i=r-e-1;i>=e;i--)o=t.children[i],jl(u,t.leaf?s(o):o),l+=Hl(u);return l},_adjustParentBBoxes:function(t,e,r){for(var n=r;n>=0;n--)jl(e[n],t)},_condense:function(t){for(var e,r=t.length-1;r>=0;r--)0===t[r].children.length?r>0?(e=t[r-1].children).splice(e.indexOf(t[r]),1):this.clear():Ul(t[r],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}};var Zl=Pl.exports;function $l(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=tc(t);break;case"MultiLineString":case"Polygon":Pt(t).forEach((function(t){i.push(tc(t))}));break;case"MultiPolygon":Pt(t).forEach((function(t){var e=[];t.forEach((function(t){e.push(tc(t))})),i.push(e)}));break;case"Point":return t;case"MultiPoint":var o={};Pt(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):ut({type:n,coordinates:i},t.properties,{bbox:t.bbox,id:t.id})}function tc(t){var e=Pt(t);if(2===e.length&&!ec(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&&rc(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,ec(e[0],e[e.length-1])&&i<4)throw new Error("invalid polygon");return rc(r[i-3],r[i-1],r[i-2])&&r.splice(r.length-2,1),r}function ec(t,e){return t[0]===e[0]&&t[1]===e[1]}function rc(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,c=u-s;return 0===(n-o)*c-(i-s)*l&&(Math.abs(l)>=Math.abs(c)?l>0?o<=n&&n<=a:a<=n&&n<=o:c>0?s<=i&&i<=u:u<=i&&i<=s)}function nc(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 ic(t,e,r,n,i){for(var o,s=n,a=e+1;a<r;a++){var u=nc(t[a],t[e],t[r]);u>s&&(o=a,s=u)}s>n&&(o-e>1&&ic(t,e,o,n,i),i.push(t[o]),r-o>1&&ic(t,o,r,n,i))}function oc(t,e){var r=t.length-1,n=[t[0]];return ic(t,0,r,e,n),n.push(t[r]),n}function sc(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,c=t.length;l<c;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=oc(t,n)}function ac(t,e,r){return sc(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 uc(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=sc(n,e,r).map((function(t){return[t.x,t.y]}));!lc(i);)i=sc(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 lc(t){return!(t.length<3)&&!(3===t.length&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}
|
|
45
|
+
/**
|
|
46
|
+
* BezierSpline
|
|
47
|
+
* https://github.com/leszekr/bezier-spline-js
|
|
48
|
+
*
|
|
49
|
+
* @private
|
|
50
|
+
* @copyright
|
|
51
|
+
* Copyright (c) 2013 Leszek Rybicki
|
|
52
|
+
*
|
|
53
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
54
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
55
|
+
* in the Software without restriction, including without limitation the rights
|
|
56
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
57
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
58
|
+
* furnished to do so, subject to the following conditions:
|
|
59
|
+
*
|
|
60
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
61
|
+
* copies or substantial portions of the Software.
|
|
62
|
+
*
|
|
63
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
64
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
65
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
66
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
67
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
68
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
69
|
+
* SOFTWARE.
|
|
70
|
+
*/var cc=function(){function t(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(e=0;e<this.length-1;e++){var r=this.points[e],n=this.points[e+1];this.centers.push({x:(r.x+n.x)/2,y:(r.y+n.y)/2,z:(r.z+n.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(e=0;e<this.centers.length-1;e++){var i=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,o=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,s=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+i),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+o),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+s)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+i),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+o),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+s)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return t.prototype.cacheSteps=function(t){var e=[],r=this.pos(0);e.push(0);for(var n=0;n<this.duration;n+=10){var i=this.pos(n);Math.sqrt((i.x-r.x)*(i.x-r.x)+(i.y-r.y)*(i.y-r.y)+(i.z-r.z)*(i.z-r.z))>t&&(e.push(n),r=i)}return e},t.prototype.vector=function(t){var e=this.pos(t+10),r=this.pos(t-10);return{angle:180*Math.atan2(e.y-r.y,e.x-r.x)/3.14,speed:Math.sqrt((r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y)+(r.z-e.z)*(r.z-e.z))}},t.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var r=e/this.duration;if(r>=1)return this.points[this.length-1];var n=Math.floor((this.points.length-1)*r);return function(t,e,r,n,i){var o=function(t){var e=t*t,r=e*t;return[r,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}(t);return{x:i.x*o[0]+n.x*o[1]+r.x*o[2]+e.x*o[3],y:i.y*o[0]+n.y*o[1]+r.y*o[2]+e.y*o[3],z:i.z*o[0]+n.z*o[1]+r.z*o[2]+e.z*o[3]}}((this.length-1)*r-n,this.points[n],this.controls[n][1],this.controls[n+1][0],this.points[n+1])},t}();function hc(t,e){void 0===e&&(e={});for(var r=e.resolution||1e4,n=e.sharpness||.85,i=[],o=Ut(t).coordinates.map((function(t){return{x:t[0],y:t[1]}})),s=new cc({duration:r,points:o,sharpness:n}),a=function(t){var e=s.pos(t);Math.floor(t/100)%2==0&&i.push([e.x,e.y])},u=0;u<s.duration;u+=10)a(u);return a(s.duration),gt(i,e.properties)}function fc(t,e){void 0===e&&(e={});var r=Number(t[0]),n=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(6===t.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var s=[r,n];return ft([[s,[i,n],[i,o],[r,o],s]],e.properties,{bbox:t,id:e.id})}function pc(t){return fc(Wa(t))}function gc(t){var e=t[0],r=t[1],n=t[2],i=t[3];if(Vt(t.slice(0,2),[n,r])>=Vt(t.slice(0,2),[e,i])){var o=(r+i)/2;return[e,o-(n-e)/2,n,o+(n-e)/2]}var s=(e+n)/2;return[s-(i-r)/2,r,s+(i-r)/2,i]}function Ac(t,e,r,n){void 0===n&&(n={});var i=Qt(t),o=Bt(i[0]),s=Bt(i[1]),a=Bt(r),u=xt(e,n.units),l=Math.asin(Math.sin(s)*Math.cos(u)+Math.cos(s)*Math.sin(u)*Math.cos(a));return ct([bt(o+Math.atan2(Math.sin(a)*Math.sin(u)*Math.cos(s),Math.cos(u)-Math.sin(s)*Math.sin(l))),bt(l)],n.properties)}function dc(t,e,r){void 0===r&&(r={});for(var n=r.steps||64,i=r.properties?r.properties:!Array.isArray(t)&&"Feature"===t.type&&t.properties?t.properties:{},o=[],s=0;s<n;s++)o.push(Ac(t,e,-360*s/n,r).geometry.coordinates);return o.push(o[0]),ft([o],i)}function yc(t,e,r){if(void 0===r&&(r={}),!0===r.final)return function(t,e){var r=yc(e,t);return r=(r+180)%360}(t,e);var n=Qt(t),i=Qt(e),o=Bt(n[0]),s=Bt(i[0]),a=Bt(n[1]),u=Bt(i[1]),l=Math.sin(s-o)*Math.cos(u),c=Math.cos(a)*Math.sin(u)-Math.sin(a)*Math.cos(u)*Math.cos(s-o);return bt(Math.atan2(l,c))}function vc(t,e){void 0===e&&(e={});var r=Wa(t);return ct([(r[0]+r[2])/2,(r[1]+r[3])/2],e.properties,e)}function mc(t,e){void 0===e&&(e={});var r=0,n=0,i=0;return Ta(t,(function(t){r+=t[0],n+=t[1],i++}),!0),ct([r/i,n/i],e.properties)}function _c(t){var e=[];return"FeatureCollection"===t.type?Pa(t,(function(t){Ta(t,(function(r){e.push(ct(r,t.properties))}))})):Ta(t,(function(r){e.push(ct(r,t.properties))})),dt(e)}var Ic={exports:{}};function Ec(t,e,r){r=r||2;var n,i,o,s,a,u,l,c=e&&e.length,h=c?e[0]*r:t.length,f=xc(t,0,h,r,!0),p=[];if(!f||f.next===f.prev)return p;if(c&&(f=function(t,e,r,n){var i,o,s,a=[];for(i=0,o=e.length;i<o;i++)(s=xc(t,e[i]*n,i<o-1?e[i+1]*n:t.length,n,!1))===s.next&&(s.steiner=!0),a.push(Dc(s));for(a.sort(Lc),i=0;i<a.length;i++)r=Nc(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<h;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 wc(f,p,r,n,i,l,0),p}function xc(t,e,r,n,i){var o,s;if(i===Hc(t,e,r,n)>0)for(o=e;o<r;o+=n)s=Vc(o,t[o],t[o+1],s);else for(o=r-n;o>=e;o-=n)s=Vc(o,t[o],t[o+1],s);return s&&Oc(s,s.next)&&(zc(s),s=s.next),s}function Cc(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Oc(n,n.next)&&0!==kc(n.prev,n,n.next))n=n.next;else{if(zc(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function wc(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=Rc(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?Bc(t,n,i,o):bc(t))e.push(a.i/r|0),e.push(t.i/r|0),e.push(u.i/r|0),zc(t),t=u.next,l=u.next;else if((t=u)===l){s?1===s?wc(t=Sc(Cc(t),e,r),e,r,n,i,o,2):2===s&&Mc(t,e,r,n,i,o):wc(Cc(t),e,r,n,i,o,1);break}}}function bc(t){var e=t.prev,r=t,n=t.next;if(kc(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,c=i<o?i<s?i:s:o<s?o:s,h=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>=c&&g.x<=f&&g.y>=h&&g.y<=p&&Qc(i,a,o,u,s,l,g.x,g.y)&&kc(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function Bc(t,e,r,n){var i=t.prev,o=t,s=t.next;if(kc(i,o,s)>=0)return!1;for(var a=i.x,u=o.x,l=s.x,c=i.y,h=o.y,f=s.y,p=a<u?a<l?a:l:u<l?u:l,g=c<h?c<f?c:f:h<f?h:f,A=a>u?a>l?a:l:u>l?u:l,d=c>h?c>f?c:f:h>f?h:f,y=Rc(p,g,e,r,n),v=Rc(A,d,e,r,n),m=t.prevZ,_=t.nextZ;m&&m.z>=y&&_&&_.z<=v;){if(m.x>=p&&m.x<=A&&m.y>=g&&m.y<=d&&m!==i&&m!==s&&Qc(a,c,u,h,l,f,m.x,m.y)&&kc(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,_.x>=p&&_.x<=A&&_.y>=g&&_.y<=d&&_!==i&&_!==s&&Qc(a,c,u,h,l,f,_.x,_.y)&&kc(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;m&&m.z>=y;){if(m.x>=p&&m.x<=A&&m.y>=g&&m.y<=d&&m!==i&&m!==s&&Qc(a,c,u,h,l,f,m.x,m.y)&&kc(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;_&&_.z<=v;){if(_.x>=p&&_.x<=A&&_.y>=g&&_.y<=d&&_!==i&&_!==s&&Qc(a,c,u,h,l,f,_.x,_.y)&&kc(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function Sc(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!Oc(i,o)&&Fc(i,n,n.next,o)&&qc(i,o)&&qc(o,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(o.i/r|0),zc(n),zc(n.next),n=t=o),n=n.next}while(n!==t);return Cc(n)}function Mc(t,e,r,n,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&Pc(s,a)){var u=jc(s,a);return s=Cc(s,s.next),u=Cc(u,u.next),wc(s,e,r,n,i,o,0),void wc(u,e,r,n,i,o,0)}a=a.next}s=s.next}while(s!==t)}function Lc(t,e){return t.x-e.x}function Nc(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,c=r.x,h=r.y,f=1/0;n=r;do{i>=n.x&&n.x>=c&&i!==n.x&&Qc(o<h?i:s,o,c,h,o<h?s:i,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(i-n.x),qc(n,t)&&(u<f||u===f&&(n.x>r.x||n.x===r.x&&Tc(r,n)))&&(r=n,f=u)),n=n.next}while(n!==l);return r}(t,e);if(!r)return e;var n=jc(r,t);return Cc(n,n.next),Cc(r,r.next)}function Tc(t,e){return kc(t.prev,t,e.prev)<0&&kc(e.next,t,t.next)<0}function Rc(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 Dc(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 Qc(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 Pc(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&&Fc(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(qc(t,e)&&qc(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)&&(kc(t.prev,t,e.prev)||kc(t,e.prev,e))||Oc(t,e)&&kc(t.prev,t,t.next)>0&&kc(e.prev,e,e.next)>0)}function kc(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Oc(t,e){return t.x===e.x&&t.y===e.y}function Fc(t,e,r,n){var i=Uc(kc(t,e,r)),o=Uc(kc(t,e,n)),s=Uc(kc(r,n,t)),a=Uc(kc(r,n,e));return i!==o&&s!==a||(!(0!==i||!Gc(t,r,e))||(!(0!==o||!Gc(t,n,e))||(!(0!==s||!Gc(r,t,n))||!(0!==a||!Gc(r,e,n)))))}function Gc(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 Uc(t){return t>0?1:t<0?-1:0}function qc(t,e){return kc(t.prev,t,t.next)<0?kc(t,e,t.next)>=0&&kc(t,t.prev,e)>=0:kc(t,e,t.prev)<0||kc(t,t.next,e)<0}function jc(t,e){var r=new Yc(t.i,t.x,t.y),n=new Yc(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 Vc(t,e,r,n){var i=new Yc(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 zc(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 Yc(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 Hc(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}Ic.exports=Ec,Ic.exports.default=Ec,Ec.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,s=Math.abs(Hc(t,0,o,r));if(i)for(var a=0,u=e.length;a<u;a++){var l=e[a]*r,c=a<u-1?e[a+1]*r:t.length;s-=Math.abs(Hc(t,l,c,r))}var h=0;for(a=0;a<n.length;a+=3){var f=n[a]*r,p=n[a+1]*r,g=n[a+2]*r;h+=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===h?0:Math.abs((h-s)/s)},Ec.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 Xc=Ic.exports;function Jc(t){var e=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}(t),r=Xc(e.vertices,e.holes,2),n=[],i=[];r.forEach((function(t,n){var o=r[n];i.push([e.vertices[2*o],e.vertices[2*o+1]])}));for(var o=0;o<i.length;o+=3){var s=i.slice(o,o+3);s.push(i[o]),n.push(ft([s]))}return n}function Wc(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var r,n=1/0,i=0;return Pa(e,(function(e,r){var o=Vt(t,e);o<n&&(i=r,n=o)})),(r=sl(e.features[i])).properties.featureIndex=i,r.properties.distanceToPoint=n,r}function Kc(t){if(!t)throw new Error("geojson is required");var e=[];return Ua(t,(function(t){!function(t,e){var r=[],n=t.geometry;if(null!==n){switch(n.type){case"Polygon":r=Pt(n);break;case"LineString":r=[Pt(n)]}r.forEach((function(r){var n=function(t,e){var r=[];return t.reduce((function(t,n){var i=gt([t,n],e);return i.bbox=function(t,e){var r=t[0],n=t[1],i=e[0],o=e[1],s=r<i?r:i,a=n<o?n:o,u=r>i?r:i,l=n>o?n:o;return[s,a,u,l]}(t,n),r.push(i),n})),r}(r,t.properties);n.forEach((function(t){t.id=e.length,e.push(t)}))}))}}(t,e)})),dt(e)}var Zc={exports:{}};function $c(t,e,r,n,i){th(t,e,r||0,n||t.length-1,i||rh)}function th(t,e,r,n,i){for(;n>r;){if(n-r>600){var o=n-r+1,s=e-r+1,a=Math.log(o),u=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*u*(o-u)/o)*(s-o/2<0?-1:1);th(t,e,Math.max(r,Math.floor(e-s*u/o+l)),Math.min(n,Math.floor(e+(o-s)*u/o+l)),i)}var c=t[e],h=r,f=n;for(eh(t,r,e),i(t[n],c)>0&&eh(t,r,n);h<f;){for(eh(t,h,f),h++,f--;i(t[h],c)<0;)h++;for(;i(t[f],c)>0;)f--}0===i(t[r],c)?eh(t,r,f):eh(t,++f,n),f<=e&&(r=f+1),e<=f&&(n=f-1)}}function eh(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function rh(t,e){return t<e?-1:t>e?1:0}function nh(t,e,r){if(!r)return e.indexOf(t);for(let n=0;n<e.length;n++)if(r(t,e[n]))return n;return-1}function ih(t,e){oh(t,0,t.children.length,e,t)}function oh(t,e,r,n,i){i||(i=gh(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let o=e;o<r;o++){const e=t.children[o];sh(i,t.leaf?n(e):e)}return i}function sh(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function ah(t,e){return t.minX-e.minX}function uh(t,e){return t.minY-e.minY}function lh(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function ch(t){return t.maxX-t.minX+(t.maxY-t.minY)}function hh(t,e){const r=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-r)*Math.max(0,o-n)}function fh(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function ph(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function gh(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Ah(t,e,r,n,i){const o=[e,r];for(;o.length;){if((r=o.pop())-(e=o.pop())<=n)continue;const s=e+Math.ceil((r-e)/n/2)*n;$c(t,s,e,r,i),o.push(e,s,s,r)}}var dh=Object.freeze({__proto__:null,default:class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const r=[];if(!ph(t,e))return r;const n=this.toBBox,i=[];for(;e;){for(let o=0;o<e.children.length;o++){const s=e.children[o],a=e.leaf?n(s):s;ph(t,a)&&(e.leaf?r.push(s):fh(t,a)?this._all(s,r):i.push(s))}e=i.pop()}return r}collides(t){let e=this.data;if(!ph(t,e))return!1;const r=[];for(;e;){for(let n=0;n<e.children.length;n++){const i=e.children[n],o=e.leaf?this.toBBox(i):i;if(ph(t,o)){if(e.leaf||fh(t,o))return!0;r.push(i)}}e=r.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=gh([]),this}remove(t,e){if(!t)return this;let r=this.data;const n=this.toBBox(t),i=[],o=[];let s,a,u;for(;r||i.length;){if(r||(r=i.pop(),a=i[i.length-1],s=o.pop(),u=!0),r.leaf){const n=nh(t,r.children,e);if(-1!==n)return r.children.splice(n,1),i.push(r),this._condense(i),this}u||r.leaf||!fh(r,n)?a?(s++,r=a.children[s],u=!1):r=null:(i.push(r),o.push(s),s=0,a=r,r=r.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const r=[];for(;t;)t.leaf?e.push(...t.children):r.push(...t.children),t=r.pop();return e}_build(t,e,r,n){const i=r-e+1;let o,s=this._maxEntries;if(i<=s)return o=gh(t.slice(e,r+1)),ih(o,this.toBBox),o;n||(n=Math.ceil(Math.log(i)/Math.log(s)),s=Math.ceil(i/Math.pow(s,n-1))),o=gh([]),o.leaf=!1,o.height=n;const a=Math.ceil(i/s),u=a*Math.ceil(Math.sqrt(s));Ah(t,e,r,u,this.compareMinX);for(let i=e;i<=r;i+=u){const e=Math.min(i+u-1,r);Ah(t,i,e,a,this.compareMinY);for(let r=i;r<=e;r+=a){const i=Math.min(r+a-1,e);o.children.push(this._build(t,r,i,n-1))}}return ih(o,this.toBBox),o}_chooseSubtree(t,e,r,n){for(;n.push(e),!e.leaf&&n.length-1!==r;){let r,n=1/0,s=1/0;for(let a=0;a<e.children.length;a++){const u=e.children[a],l=lh(u),c=(i=t,o=u,(Math.max(o.maxX,i.maxX)-Math.min(o.minX,i.minX))*(Math.max(o.maxY,i.maxY)-Math.min(o.minY,i.minY))-l);c<s?(s=c,n=l<n?l:n,r=u):c===s&&l<n&&(n=l,r=u)}e=r||e.children[0]}var i,o;return e}_insert(t,e,r){const n=r?t:this.toBBox(t),i=[],o=this._chooseSubtree(n,this.data,e,i);for(o.children.push(t),sh(o,n);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(n,i,e)}_split(t,e){const r=t[e],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);const o=this._chooseSplitIndex(r,i,n),s=gh(r.children.splice(o,r.children.length-o));s.height=r.height,s.leaf=r.leaf,ih(r,this.toBBox),ih(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(r,s)}_splitRoot(t,e){this.data=gh([t,e]),this.data.height=t.height+1,this.data.leaf=!1,ih(this.data,this.toBBox)}_chooseSplitIndex(t,e,r){let n,i=1/0,o=1/0;for(let s=e;s<=r-e;s++){const e=oh(t,0,s,this.toBBox),a=oh(t,s,r,this.toBBox),u=hh(e,a),l=lh(e)+lh(a);u<i?(i=u,n=s,o=l<o?l:o):u===i&&l<o&&(o=l,n=s)}return n||r-e}_chooseSplitAxis(t,e,r){const n=t.leaf?this.compareMinX:ah,i=t.leaf?this.compareMinY:uh;this._allDistMargin(t,e,r,n)<this._allDistMargin(t,e,r,i)&&t.children.sort(n)}_allDistMargin(t,e,r,n){t.children.sort(n);const i=this.toBBox,o=oh(t,0,e,i),s=oh(t,r-e,r,i);let a=ch(o)+ch(s);for(let n=e;n<r-e;n++){const e=t.children[n];sh(o,t.leaf?i(e):e),a+=ch(o)}for(let n=r-e-1;n>=e;n--){const e=t.children[n];sh(s,t.leaf?i(e):e),a+=ch(s)}return a}_adjustParentBBoxes(t,e,r){for(let n=r;n>=0;n--)sh(e[n],t)}_condense(t){for(let e,r=t.length-1;r>=0;r--)0===t[r].children.length?r>0?(e=t[r-1].children,e.splice(e.indexOf(t[r]),1)):this.clear():ih(t[r],this.toBBox)}}}),yh=Wt(dh),vh={};!function(t){function e(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 r(t,r,n){if(void 0===n&&(n={}),!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(!f(t[0])||!f(t[1]))throw new Error("coordinates must contain numbers");return e({type:"Point",coordinates:t},r,n)}function n(t,r,n){void 0===n&&(n={});for(var i=0,o=t;i<o.length;i++){var s=o[i];if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<s[s.length-1].length;a++)if(s[s.length-1][a]!==s[0][a])throw new Error("First and last Position are not equivalent.")}return e({type:"Polygon",coordinates:t},r,n)}function i(t,r,n){if(void 0===n&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return e({type:"LineString",coordinates:t},r,n)}function o(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 s(t,r,n){return void 0===n&&(n={}),e({type:"MultiLineString",coordinates:t},r,n)}function a(t,r,n){return void 0===n&&(n={}),e({type:"MultiPoint",coordinates:t},r,n)}function u(t,r,n){return void 0===n&&(n={}),e({type:"MultiPolygon",coordinates:t},r,n)}function l(e,r){void 0===r&&(r="kilometers");var n=t.factors[r];if(!n)throw new Error(r+" units is invalid");return e*n}function c(e,r){void 0===r&&(r="kilometers");var n=t.factors[r];if(!n)throw new Error(r+" units is invalid");return e/n}function h(t){return 180*(t%(2*Math.PI))/Math.PI}function f(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.earthRadius=6371008.8,t.factors={centimeters:100*t.earthRadius,centimetres:100*t.earthRadius,degrees:t.earthRadius/111325,feet:3.28084*t.earthRadius,inches:39.37*t.earthRadius,kilometers:t.earthRadius/1e3,kilometres:t.earthRadius/1e3,meters:t.earthRadius,metres:t.earthRadius,miles:t.earthRadius/1609.344,millimeters:1e3*t.earthRadius,millimetres:1e3*t.earthRadius,nauticalmiles:t.earthRadius/1852,radians:1,yards:1.0936*t.earthRadius},t.unitsFactors={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/t.earthRadius,yards:1.0936133},t.areaFactors={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},t.feature=e,t.geometry=function(t,e,o){switch(t){case"Point":return r(e).geometry;case"LineString":return i(e).geometry;case"Polygon":return n(e).geometry;case"MultiPoint":return a(e).geometry;case"MultiLineString":return s(e).geometry;case"MultiPolygon":return u(e).geometry;default:throw new Error(t+" is invalid")}},t.point=r,t.points=function(t,e,n){return void 0===n&&(n={}),o(t.map((function(t){return r(t,e)})),n)},t.polygon=n,t.polygons=function(t,e,r){return void 0===r&&(r={}),o(t.map((function(t){return n(t,e)})),r)},t.lineString=i,t.lineStrings=function(t,e,r){return void 0===r&&(r={}),o(t.map((function(t){return i(t,e)})),r)},t.featureCollection=o,t.multiLineString=s,t.multiPoint=a,t.multiPolygon=u,t.geometryCollection=function(t,r,n){return void 0===n&&(n={}),e({type:"GeometryCollection",geometries:t},r,n)},t.round=function(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},t.radiansToLength=l,t.lengthToRadians=c,t.lengthToDegrees=function(t,e){return h(c(t,e))},t.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},t.radiansToDegrees=h,t.degreesToRadians=function(t){return t%360*Math.PI/180},t.convertLength=function(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 l(c(t,e),r)},t.convertArea=function(e,r,n){if(void 0===r&&(r="meters"),void 0===n&&(n="kilometers"),!(e>=0))throw new Error("area must be a positive number");var i=t.areaFactors[r];if(!i)throw new Error("invalid original units");var o=t.areaFactors[n];if(!o)throw new Error("invalid final units");return e/i*o},t.isNumber=f,t.isObject=function(t){return!!t&&t.constructor===Object},t.validateBBox=function(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(!f(t))throw new Error("bbox must only contain numbers")}))},t.validateId=function(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")}}(vh);var mh={};Object.defineProperty(mh,"__esModule",{value:!0});var _h=vh;function Ih(t,e,r){if(null!==t)for(var n,i,o,s,a,u,l,c,h=0,f=0,p=t.type,g="FeatureCollection"===p,A="Feature"===p,d=g?t.features.length:1,y=0;y<d;y++){a=(c=!!(l=g?t.features[y].geometry:A?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var v=0;v<a;v++){var m=0,_=0;if(null!==(s=c?l.geometries[v]:l)){u=s.coordinates;var I=s.type;switch(h=!r||"Polygon"!==I&&"MultiPolygon"!==I?0:1,I){case null:break;case"Point":if(!1===e(u,f,y,m,_))return!1;f++,m++;break;case"LineString":case"MultiPoint":for(n=0;n<u.length;n++){if(!1===e(u[n],f,y,m,_))return!1;f++,"MultiPoint"===I&&m++}"LineString"===I&&m++;break;case"Polygon":case"MultiLineString":for(n=0;n<u.length;n++){for(i=0;i<u[n].length-h;i++){if(!1===e(u[n][i],f,y,m,_))return!1;f++}"MultiLineString"===I&&m++,"Polygon"===I&&_++}"Polygon"===I&&m++;break;case"MultiPolygon":for(n=0;n<u.length;n++){for(_=0,i=0;i<u[n].length;i++){for(o=0;o<u[n][i].length-h;o++){if(!1===e(u[n][i][o],f,y,m,_))return!1;f++}_++}m++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(!1===Ih(s.geometries[n],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Eh(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 xh(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 Ch(t,e){var r,n,i,o,s,a,u,l,c,h,f=0,p="FeatureCollection"===t.type,g="Feature"===t.type,A=p?t.features.length:1;for(r=0;r<A;r++){for(a=p?t.features[r].geometry:g?t.geometry:t,l=p?t.features[r].properties:g?t.properties:{},c=p?t.features[r].bbox:g?t.bbox:void 0,h=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,c,h))return!1;break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===e(o.geometries[n],f,l,c,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,f,l,c,h))return!1;f++}}function wh(t,e){Ch(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(_h.feature(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={type:s,coordinates:t.coordinates[u]};if(!1===e(_h.feature(l,n),r,u))return!1}}))}function bh(t,e){wh(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!==Ih(t,(function(o,c,h,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=_h.lineString([s,o],t.properties);if(!1===e(g,r,n,p,i))return!1;i++,s=o}))&&void 0}}}))}function Bh(t,e){if(!t)throw new Error("geojson is required");wh(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(_h.lineString(o[s],t.properties),r,n,s))return!1}}}))}mh.coordAll=function(t){var e=[];return Ih(t,(function(t){e.push(t)})),e},mh.coordEach=Ih,mh.coordReduce=function(t,e,r,n){var i=r;return Ih(t,(function(t,n,o,s,a){i=0===n&&void 0===r?t:e(i,t,n,o,s,a)}),n),i},mh.featureEach=xh,mh.featureReduce=function(t,e,r){var n=r;return xh(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n},mh.findPoint=function(t,e){if(e=e||{},!_h.isObject(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 _h.point(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),_h.point(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),_h.point(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),_h.point(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),_h.point(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),_h.point(u[i][o][s],a,e)}throw new Error("geojson is invalid")},mh.findSegment=function(t,e){if(e=e||{},!_h.isObject(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),_h.lineString([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),_h.lineString([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),_h.lineString([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),_h.lineString([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")},mh.flattenEach=wh,mh.flattenReduce=function(t,e,r){var n=r;return wh(t,(function(t,i,o){n=0===i&&0===o&&void 0===r?t:e(n,t,i,o)})),n},mh.geomEach=Ch,mh.geomReduce=function(t,e,r){var n=r;return Ch(t,(function(t,i,o,s,a){n=0===i&&void 0===r?t:e(n,t,i,o,s,a)})),n},mh.lineEach=Bh,mh.lineReduce=function(t,e,r){var n=r;return Bh(t,(function(t,i,o,s){n=0===i&&void 0===r?t:e(n,t,i,o,s)})),n},mh.propEach=Eh,mh.propReduce=function(t,e,r){var n=r;return Eh(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n},mh.segmentEach=bh,mh.segmentReduce=function(t,e,r){var n=r,i=!1;return bh(t,(function(t,o,s,a,u){n=!1===i&&void 0===r?t:e(n,t,o,s,a,u),i=!0})),n};var Sh={};Object.defineProperty(Sh,"__esModule",{value:!0});var Mh=mh;function Lh(t){var e=[1/0,1/0,-1/0,-1/0];return Mh.coordEach(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}Lh.default=Lh,Sh.default=Lh;var Nh=yh,Th=vh,Rh=mh,Dh=Sh.default,Qh=Rh.featureEach;Rh.coordEach;var Ph=Th.featureCollection;function kh(t){var e=new Nh(t);return e.insert=function(t){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Dh(t),Nh.prototype.insert.call(this,t)},e.load=function(t){var e=[];return Array.isArray(t)?t.forEach((function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox?t.bbox:Dh(t),e.push(t)})):Qh(t,(function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox?t.bbox:Dh(t),e.push(t)})),Nh.prototype.load.call(this,e)},e.remove=function(t,e){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Dh(t),Nh.prototype.remove.call(this,t,e)},e.clear=function(){return Nh.prototype.clear.call(this)},e.search=function(t){var e=Nh.prototype.search.call(this,this.toBBox(t));return Ph(e)},e.collides=function(t){return Nh.prototype.collides.call(this,this.toBBox(t))},e.all=function(){var t=Nh.prototype.all.call(this);return Ph(t)},e.toJSON=function(){return Nh.prototype.toJSON.call(this)},e.fromJSON=function(t){return Nh.prototype.fromJSON.call(this,t)},e.toBBox=function(t){var e;if(t.bbox)e=t.bbox;else if(Array.isArray(t)&&4===t.length)e=t;else if(Array.isArray(t)&&6===t.length)e=[t[0],t[1],t[3],t[4]];else if("Feature"===t.type)e=Dh(t);else{if("FeatureCollection"!==t.type)throw new Error("invalid geojson");e=Dh(t)}return{minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}},e}Zc.exports=kh,Zc.exports.default=kh;var Oh=Zc.exports;function Fh(t,e){var r={},n=[];if("LineString"===t.type&&(t=ut(t)),"LineString"===e.type&&(e=ut(e)),"Feature"===t.type&&"Feature"===e.type&&null!==t.geometry&&null!==e.geometry&&"LineString"===t.geometry.type&&"LineString"===e.geometry.type&&2===t.geometry.coordinates.length&&2===e.geometry.coordinates.length){var i=Gh(t,e);return i&&n.push(i),dt(n)}var o=Oh();return o.load(Kc(e)),Pa(Kc(t),(function(t){Pa(o.search(t),(function(e){var i=Gh(t,e);if(i){var o=Pt(i).join(",");r[o]||(r[o]=!0,n.push(i))}}))})),dt(n)}function Gh(t,e){var r=Pt(t),n=Pt(e);if(2!==r.length)throw new Error("<intersects> line1 must only contain 2 coordinates");if(2!==n.length)throw new Error("<intersects> line2 must only contain 2 coordinates");var i=r[0][0],o=r[0][1],s=r[1][0],a=r[1][1],u=n[0][0],l=n[0][1],c=n[1][0],h=n[1][1],f=(h-l)*(s-i)-(c-u)*(a-o),p=(c-u)*(o-l)-(h-l)*(i-u),g=(s-i)*(o-l)-(a-o)*(i-u);if(0===f)return null;var A=p/f,d=g/f;return A>=0&&A<=1&&d>=0&&d<=1?ct([i+A*(s-i),o+A*(a-o)]):null}function Uh(t,e,r){void 0===r&&(r={});var n=ct([1/0,1/0],{dist:1/0}),i=0;return Ua(t,(function(t){for(var o=Pt(t),s=0;s<o.length-1;s++){var a=ct(o[s]);a.properties.dist=Vt(e,a,r);var u=ct(o[s+1]);u.properties.dist=Vt(e,u,r);var l=Vt(a,u,r),c=Math.max(a.properties.dist,u.properties.dist),h=yc(a,u),f=Ac(e,c,h+90,r),p=Ac(e,c,h-90,r),g=Fh(gt([f.geometry.coordinates,p.geometry.coordinates]),gt([a.geometry.coordinates,u.geometry.coordinates])),A=null;g.features.length>0&&((A=g.features[0]).properties.dist=Vt(e,A,r),A.properties.location=i+Vt(a,A,r)),a.properties.dist<n.properties.dist&&((n=a).properties.index=s,n.properties.location=i),u.properties.dist<n.properties.dist&&((n=u).properties.index=s+1,n.properties.location=i+l),A&&A.properties.dist<n.properties.dist&&((n=A).properties.index=s),i+=l}})),n}function qh(t,e,r){void 0===r&&(r={});var n=Qt(t),i=Qt(e);i[0]+=i[0]-n[0]>180?-360:n[0]-i[0]>180?360:0;var o=function(t,e,r){r=void 0===r?it:Number(r);var n=r,i=t[1]*Math.PI/180,o=e[1]*Math.PI/180,s=o-i,a=Math.abs(e[0]-t[0])*Math.PI/180;a>Math.PI&&(a-=2*Math.PI);var u=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),l=Math.abs(u)>1e-11?s/u:Math.cos(i),c=Math.sqrt(s*s+l*l*a*a),h=c*n;return h}(n,i);return St(o,"meters",r.units)}function jh(t,e,r){if(void 0===r&&(r={}),r.method||(r.method="geodesic"),r.units||(r.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=ct(t):"Point"===t.type?t=ut(t):Ft(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=gt(e):"LineString"===e.type?e=ut(e):Ft(e,"LineString","line");var n=1/0,i=t.geometry.coordinates;return ja(e,(function(t){var e=t.geometry.coordinates[0],o=t.geometry.coordinates[1],s=function(t,e,r,n){var i=[r[0]-e[0],r[1]-e[1]],o=[t[0]-e[0],t[1]-e[1]],s=Vh(o,i);if(s<=0)return zh(t,e,{method:n.method,units:"degrees"});var a=Vh(i,i);if(a<=s)return zh(t,r,{method:n.method,units:"degrees"});var u=s/a,l=[e[0]+u*i[0],e[1]+u*i[1]];return zh(t,l,{method:n.method,units:"degrees"})}(i,e,o,r);s<n&&(n=s)})),St(n,"degrees",r.units)}function Vh(t,e){return t[0]*e[0]+t[1]*e[1]}function zh(t,e,r){return"planar"===r.method?qh(t,e,r):Vt(t,e,r)}function Yh(t,e,r,n,i,o,s,a){var u,l,c,h,f={x:null,y:null,onLine1:!1,onLine2:!1};return 0===(u=(a-o)*(r-t)-(s-i)*(n-e))?null!==f.x&&null!==f.y&&f:(h=(r-t)*(l=e-o)-(n-e)*(c=t-i),l=((s-i)*l-(a-o)*c)/u,c=h/u,f.x=t+l*(r-t),f.y=e+l*(n-e),l>=0&&l<=1&&(f.onLine1=!0),c>=0&&c<=1&&(f.onLine2=!0),!(!f.onLine1||!f.onLine2)&&[f.x,f.y])}function Hh(t){for(var e=function(t){if("FeatureCollection"!==t.type)return"Feature"!==t.type?dt([ut(t)]):dt([t]);return t}(t),r=vc(e),n=!1,i=0;!n&&i<e.features.length;){var o,s=e.features[i].geometry,a=!1;if("Point"===s.type)r.geometry.coordinates[0]===s.coordinates[0]&&r.geometry.coordinates[1]===s.coordinates[1]&&(n=!0);else if("MultiPoint"===s.type){var u=!1;for(o=0;!u&&o<s.coordinates.length;)r.geometry.coordinates[0]===s.coordinates[o][0]&&r.geometry.coordinates[1]===s.coordinates[o][1]&&(n=!0,u=!0),o++}else if("LineString"===s.type)for(o=0;!a&&o<s.coordinates.length-1;)Xh(r.geometry.coordinates[0],r.geometry.coordinates[1],s.coordinates[o][0],s.coordinates[o][1],s.coordinates[o+1][0],s.coordinates[o+1][1])&&(a=!0,n=!0),o++;else if("MultiLineString"===s.type)for(var l=0;l<s.coordinates.length;){a=!1,o=0;for(var c=s.coordinates[l];!a&&o<c.length-1;)Xh(r.geometry.coordinates[0],r.geometry.coordinates[1],c[o][0],c[o][1],c[o+1][0],c[o+1][1])&&(a=!0,n=!0),o++;l++}else"Polygon"!==s.type&&"MultiPolygon"!==s.type||zt(r,s)&&(n=!0);i++}if(n)return r;var h=dt([]);for(i=0;i<e.features.length;i++)h.features=h.features.concat(_c(e.features[i]).features);return ct(Wc(r,h).geometry.coordinates)}function Xh(t,e,r,n,i,o){return Math.sqrt((i-r)*(i-r)+(o-n)*(o-n))===Math.sqrt((t-r)*(t-r)+(e-n)*(e-n))+Math.sqrt((i-t)*(i-t)+(o-e)*(o-e))}var Jh=6378137;function Wh(t){return Ga(t,(function(t,e){return t+function(t){var e,r=0;switch(t.type){case"Polygon":return Kh(t.coordinates);case"MultiPolygon":for(e=0;e<t.coordinates.length;e++)r+=Kh(t.coordinates[e]);return r;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(e)}),0)}function Kh(t){var e=0;if(t&&t.length>0){e+=Math.abs(Zh(t[0]));for(var r=1;r<t.length;r++)e-=Math.abs(Zh(t[r]))}return e}function Zh(t){var e,r,n,i,o,s,a=0,u=t.length;if(u>2){for(s=0;s<u;s++)s===u-2?(n=u-2,i=u-1,o=0):s===u-1?(n=u-1,i=0,o=1):(n=s,i=s+1,o=s+2),e=t[n],r=t[i],a+=($h(t[o][0])-$h(e[0]))*Math.sin($h(r[1]));a=a*Jh*Jh/2}return a}function $h(t){return t*Math.PI/180}function tf(t,e){return void 0===e&&(e={}),Va(t,(function(t,r){var n=r.geometry.coordinates;return t+Vt(n[0],n[1],e)}),0)}function ef(t,e,r,n){if(!Nt(n=n||{}))throw new Error("options is invalid");var i,o=[];if("Feature"===t.type)i=t.geometry.coordinates;else{if("LineString"!==t.type)throw new Error("input must be a LineString Feature or Geometry");i=t.coordinates}for(var s,a,u,l=i.length,c=0,h=0;h<i.length&&!(e>=c&&h===i.length-1);h++){if(c>e&&0===o.length){if(!(s=e-c))return o.push(i[h]),gt(o);a=yc(i[h],i[h-1])-180,u=Ac(i[h],s,a,n),o.push(u.geometry.coordinates)}if(c>=r)return(s=r-c)?(a=yc(i[h],i[h-1])-180,u=Ac(i[h],s,a,n),o.push(u.geometry.coordinates),gt(o)):(o.push(i[h]),gt(o));if(c>=e&&o.push(i[h]),h===i.length-1)return gt(o);c+=Vt(i[h],i[h+1],n)}if(c<e&&i.length===l)throw new Error("Start position is beyond line");var f=i[i.length-1];return gt([f,f])}function rf(t,e,r){void 0===r&&(r={});for(var n=Qt(t),i=Pt(e),o=0;o<i.length-1;o++){var s=!1;if(r.ignoreEndVertices&&(0===o&&(s="start"),o===i.length-2&&(s="end"),0===o&&o+1===i.length-1&&(s="both")),nf(i[o],i[o+1],n,s,void 0===r.epsilon?null:r.epsilon))return!0}return!1}function nf(t,e,r,n,i){var o=r[0],s=r[1],a=t[0],u=t[1],l=e[0],c=e[1],h=l-a,f=c-u,p=(r[0]-a)*f-(r[1]-u)*h;if(null!==i){if(Math.abs(p)>i)return!1}else if(0!==p)return!1;return n?"start"===n?Math.abs(h)>=Math.abs(f)?h>0?a<o&&o<=l:l<=o&&o<a:f>0?u<s&&s<=c:c<=s&&s<u:"end"===n?Math.abs(h)>=Math.abs(f)?h>0?a<=o&&o<l:l<o&&o<=a:f>0?u<=s&&s<c:c<s&&s<=u:"both"===n&&(Math.abs(h)>=Math.abs(f)?h>0?a<o&&o<l:l<o&&o<a:f>0?u<s&&s<c:c<s&&s<u):Math.abs(h)>=Math.abs(f)?h>0?a<=o&&o<=l:l<=o&&o<=a:f>0?u<=s&&s<=c:c<=s&&s<=u}function of(t,e){var r=Ut(t),n=Ut(e),i=r.type,o=n.type;switch(i){case"Point":switch(o){case"MultiPoint":return function(t,e){var r,n=!1;for(r=0;r<e.coordinates.length;r++)if(af(e.coordinates[r],t.coordinates)){n=!0;break}return n}(r,n);case"LineString":return rf(r,n,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return zt(r,n,{ignoreBoundary:!0});default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"MultiPoint":return function(t,e){for(var r=0;r<t.coordinates.length;r++){for(var n=!1,i=0;i<e.coordinates.length;i++)af(t.coordinates[r],e.coordinates[i])&&(n=!0);if(!n)return!1}return!0}(r,n);case"LineString":return function(t,e){for(var r=!1,n=0;n<t.coordinates.length;n++){if(!rf(t.coordinates[n],e))return!1;r||(r=rf(t.coordinates[n],e,{ignoreEndVertices:!0}))}return r}(r,n);case"Polygon":case"MultiPolygon":return function(t,e){for(var r=!0,n=!1,i=0;i<t.coordinates.length;i++){if(!(n=zt(t.coordinates[1],e))){r=!1;break}n=zt(t.coordinates[1],e,{ignoreBoundary:!0})}return r&&n}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"LineString":return function(t,e){for(var r=0;r<t.coordinates.length;r++)if(!rf(t.coordinates[r],e))return!1;return!0}(r,n);case"Polygon":case"MultiPolygon":return function(t,e){var r=Wa(e),n=Wa(t);if(!sf(r,n))return!1;for(var i=!1,o=0;o<t.coordinates.length-1;o++){if(!zt(t.coordinates[o],e))return!1;if(i||(i=zt(t.coordinates[o],e,{ignoreBoundary:!0})),!i)i=zt(uf(t.coordinates[o],t.coordinates[o+1]),e,{ignoreBoundary:!0})}return i}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Polygon":case"MultiPolygon":return function(t,e){var r=Wa(t);if(!sf(Wa(e),r))return!1;for(var n=0;n<t.coordinates[0].length;n++)if(!zt(t.coordinates[0][n],e))return!1;return!0}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function sf(t,e){return!(t[0]>e[0])&&(!(t[2]<e[2])&&(!(t[1]>e[1])&&!(t[3]<e[3])))}function af(t,e){return t[0]===e[0]&&t[1]===e[1]}function uf(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}function lf(t,e,r){void 0===r&&(r={}),r.mask&&!r.units&&(r.units="kilometers");for(var n=[],i=t[0],o=t[1],s=t[2],a=t[3],u=e/Vt([i,o],[s,o],r)*(s-i),l=e/Vt([i,o],[i,a],r)*(a-o),c=s-i,h=a-o,f=Math.floor(c/u),p=(h-Math.floor(h/l)*l)/2,g=i+(c-f*u)/2;g<=s;){for(var A=o+p;A<=a;){var d=ct([g,A],r.properties);r.mask?of(d,r.mask)&&n.push(d):n.push(d),A+=l}g+=u}return dt(n)}function cf(t,e){void 0===e&&(e={});var r=e.precision,n=e.coordinates,i=e.mutate;if(r=null==r||isNaN(r)?6:r,n=null==n||isNaN(n)?3:n,!t)throw new Error("<geojson> is required");if("number"!=typeof r)throw new Error("<precision> must be a number");if("number"!=typeof n)throw new Error("<coordinates> must be a number");!1!==i&&void 0!==i||(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,r);return Ta(t,(function(t){!function(t,e,r){t.length>r&&t.splice(r,t.length);for(var n=0;n<t.length;n++)t[n]=Math.round(t[n]*e)/e}(t,o,n)})),t}function hf(t){if(!t)throw new Error("geojson is required");var e=[];return Ua(t,(function(t){e.push(t)})),dt(e)}function ff(t,e,r){if("Polygon"!==t.geometry.type)throw new Error("The input feature must be a Polygon");void 0===r&&(r=1);var n=t.geometry.coordinates,i=[],o={};if(r){for(var s=[],a=0;a<n.length;a++)for(var u=0;u<n[a].length-1;u++)s.push(A(a,u));var l=Zl();l.load(s)}for(var c=0;c<n.length;c++)for(var h=0;h<n[c].length-1;h++){if(r)l.search(A(c,h)).forEach((function(t){var e=t.ring,r=t.edge;g(c,h,e,r)}));else for(var f=0;f<n.length;f++)for(var p=0;p<n[f].length-1;p++)g(c,h,f,p)}return e||(i={type:"Feature",geometry:{type:"MultiPoint",coordinates:i}}),i;function g(t,r,s,a){var u,l,c=n[t][r],h=n[t][r+1],f=n[s][a],p=n[s][a+1],g=function(t,e,r,n){if(pf(t,r)||pf(t,n)||pf(e,r)||pf(n,r))return null;var i=t[0],o=t[1],s=e[0],a=e[1],u=r[0],l=r[1],c=n[0],h=n[1],f=(i-s)*(l-h)-(o-a)*(u-c);if(0===f)return null;var p=((i*a-o*s)*(u-c)-(i-s)*(u*h-l*c))/f,g=((i*a-o*s)*(l-h)-(o-a)*(u*h-l*c))/f;return[p,g]}(c,h,f,p);if(null!==g&&(u=h[0]!==c[0]?(g[0]-c[0])/(h[0]-c[0]):(g[1]-c[1])/(h[1]-c[1]),l=p[0]!==f[0]?(g[0]-f[0])/(p[0]-f[0]):(g[1]-f[1])/(p[1]-f[1]),!(u>=1||u<=0||l>=1||l<=0))){var A=g,d=!o[A];d&&(o[A]=!0),e?i.push(e(g,t,r,c,h,u,s,a,f,p,l,d)):i.push(g)}}function A(t,e){var r,i,o,s,a=n[t][e],u=n[t][e+1];return a[0]<u[0]?(r=a[0],i=u[0]):(r=u[0],i=a[0]),a[1]<u[1]?(o=a[1],s=u[1]):(o=u[1],s=a[1]),{minX:r,minY:o,maxX:i,maxY:s,ring:t,edge:e}}}function pf(t,e){if(!t||!e)return!1;if(t.length!==e.length)return!1;for(var r=0,n=t.length;r<n;r++)if(t[r]instanceof Array&&e[r]instanceof Array){if(!pf(t[r],e[r]))return!1}else if(t[r]!==e[r])return!1;return!0}function gf(t){if("Feature"!=t.type)throw new Error("The input must a geojson object of type Feature");if(void 0===t.geometry||null==t.geometry)throw new Error("The input must a geojson object with a non-empty geometry");if("Polygon"!=t.geometry.type)throw new Error("The input must be a geojson Polygon");for(var e=t.geometry.coordinates.length,r=[],n=0;n<e;n++){var i=t.geometry.coordinates[n];mf(i[0],i[i.length-1])||i.push(i[0]),r.push.apply(r,i.slice(0,i.length-1))}if(!function(t){for(var e={},r=1,n=0,i=t.length;n<i;++n){if(Object.prototype.hasOwnProperty.call(e,t[n])){r=0;break}e[t[n]]=1}return r}(r))throw new Error("The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)");var o=r.length,s=ff(t,(function(t,e,r,n,i,o,s,a,u,l,c,h){return[t,e,r,n,i,o,s,a,u,l,c,h]})),a=s.length;if(0==a){var u=[];for(n=0;n<e;n++)u.push(ft([t.geometry.coordinates[n]],{parent:-1,winding:vf(t.geometry.coordinates[n])}));var l=dt(u);return P(),k(),l}var c=[],h=[];for(n=0;n<e;n++){c.push([]);for(var f=0;f<t.geometry.coordinates[n].length-1;f++)c[n].push([new Af(t.geometry.coordinates[n][_f(f+1,t.geometry.coordinates[n].length-1)],1,[n,f],[n,_f(f+1,t.geometry.coordinates[n].length-1)],void 0)]),h.push(new df(t.geometry.coordinates[n][f],[n,_f(f-1,t.geometry.coordinates[n].length-1)],[n,f],void 0,void 0,!1,!0))}for(n=0;n<a;n++)c[s[n][1]][s[n][2]].push(new Af(s[n][0],s[n][5],[s[n][1],s[n][2]],[s[n][6],s[n][7]],void 0)),s[n][11]&&h.push(new df(s[n][0],[s[n][1],s[n][2]],[s[n][6],s[n][7]],void 0,void 0,!0,!0));var p=h.length;for(n=0;n<c.length;n++)for(f=0;f<c[n].length;f++)c[n][f].sort((function(t,e){return t.param<e.param?-1:1}));var g=[];for(n=0;n<p;n++)g.push({minX:h[n].coord[0],minY:h[n].coord[1],maxX:h[n].coord[0],maxY:h[n].coord[1],index:n});var A=Zl();A.load(g);for(n=0;n<c.length;n++)for(f=0;f<c[n].length;f++)for(var d=0;d<c[n][f].length;d++){v=d==c[n][f].length-1?c[n][_f(f+1,t.geometry.coordinates[n].length-1)][0].coord:c[n][f][d+1].coord;var y=A.search({minX:v[0],minY:v[1],maxX:v[0],maxY:v[1]})[0];c[n][f][d].nxtIsectAlongEdgeIn=y.index}for(n=0;n<c.length;n++)for(f=0;f<c[n].length;f++)for(d=0;d<c[n][f].length;d++){var v=c[n][f][d].coord,m=(y=A.search({minX:v[0],minY:v[1],maxX:v[0],maxY:v[1]})[0]).index;m<o?h[m].nxtIsectAlongRingAndEdge2=c[n][f][d].nxtIsectAlongEdgeIn:mf(h[m].ringAndEdge1,c[n][f][d].ringAndEdgeIn)?h[m].nxtIsectAlongRingAndEdge1=c[n][f][d].nxtIsectAlongEdgeIn:h[m].nxtIsectAlongRingAndEdge2=c[n][f][d].nxtIsectAlongEdgeIn}var _=[];for(n=0,f=0;f<e;f++){var I=n;for(d=0;d<t.geometry.coordinates[f].length-1;d++)h[n].coord[0]<h[I].coord[0]&&(I=n),n++;var E=h[I].nxtIsectAlongRingAndEdge2;for(d=0;d<h.length;d++)if(h[d].nxtIsectAlongRingAndEdge1==I||h[d].nxtIsectAlongRingAndEdge2==I){var x=d;break}var C=yf([h[x].coord,h[I].coord,h[E].coord],!0)?1:-1;_.push({isect:I,parent:-1,winding:C})}_.sort((function(t,e){return h[t.isect].coord>h[e.isect].coord?-1:1}));for(u=[];_.length>0;){var w=_.pop(),b=w.isect,B=w.parent,S=w.winding,M=u.length,L=[h[b].coord],N=b;if(h[b].ringAndEdge1Walkable)var T=h[b].ringAndEdge1,R=h[b].nxtIsectAlongRingAndEdge1;else T=h[b].ringAndEdge2,R=h[b].nxtIsectAlongRingAndEdge2;for(;!mf(h[b].coord,h[R].coord);){L.push(h[R].coord);var D=void 0;for(n=0;n<_.length;n++)if(_[n].isect==R){D=n;break}if(null!=D&&_.splice(D,1),mf(T,h[R].ringAndEdge1)){if(T=h[R].ringAndEdge2,h[R].ringAndEdge2Walkable=!1,h[R].ringAndEdge1Walkable){var Q={isect:R};yf([h[N].coord,h[R].coord,h[h[R].nxtIsectAlongRingAndEdge2].coord],1==S)?(Q.parent=B,Q.winding=-S):(Q.parent=M,Q.winding=S),_.push(Q)}N=R,R=h[R].nxtIsectAlongRingAndEdge2}else{if(T=h[R].ringAndEdge1,h[R].ringAndEdge1Walkable=!1,h[R].ringAndEdge2Walkable){Q={isect:R};yf([h[N].coord,h[R].coord,h[h[R].nxtIsectAlongRingAndEdge1].coord],1==S)?(Q.parent=B,Q.winding=-S):(Q.parent=M,Q.winding=S),_.push(Q)}N=R,R=h[R].nxtIsectAlongRingAndEdge1}}L.push(h[R].coord),u.push(ft([L],{index:M,parent:B,winding:S,netWinding:void 0}))}l=dt(u);function P(){for(var t=[],e=0;e<l.features.length;e++)-1==l.features[e].properties.parent&&t.push(e);if(t.length>1)for(e=0;e<t.length;e++){for(var r=-1,n=0;n<l.features.length;n++)t[e]!=n&&zt(l.features[t[e]].geometry.coordinates[0][0],l.features[n],{ignoreBoundary:!0})&&Wh(l.features[n])<Infinity&&(r=n);l.features[t[e]].properties.parent=r}}function k(){for(var t=0;t<l.features.length;t++)if(-1==l.features[t].properties.parent){var e=l.features[t].properties.winding;l.features[t].properties.netWinding=e,O(t,e)}}function O(t,e){for(var r=0;r<l.features.length;r++)if(l.features[r].properties.parent==t){var n=e+l.features[r].properties.winding;l.features[r].properties.netWinding=n,O(r,n)}}return P(),k(),l}var Af=function(t,e,r,n,i){this.coord=t,this.param=e,this.ringAndEdgeIn=r,this.ringAndEdgeOut=n,this.nxtIsectAlongEdgeIn=i},df=function(t,e,r,n,i,o,s){this.coord=t,this.ringAndEdge1=e,this.ringAndEdge2=r,this.nxtIsectAlongRingAndEdge1=n,this.nxtIsectAlongRingAndEdge2=i,this.ringAndEdge1Walkable=o,this.ringAndEdge2Walkable=s};function yf(t,e){if(void 0===e&&(e=!0),3!=t.length)throw new Error("This function requires an array of three points [x,y]");return(t[1][0]-t[0][0])*(t[2][1]-t[0][1])-(t[1][1]-t[0][1])*(t[2][0]-t[0][0])>=0==e}function vf(t){for(var e=0,r=0;r<t.length-1;r++)t[r][0]<t[e][0]&&(e=r);if(yf([t[_f(e-1,t.length-1)],t[e],t[_f(e+1,t.length-1)]],!0))var n=1;else n=-1;return n}function mf(t,e){if(!t||!e)return!1;if(t.length!=e.length)return!1;for(var r=0,n=t.length;r<n;r++)if(t[r]instanceof Array&&e[r]instanceof Array){if(!mf(t[r],e[r]))return!1}else if(t[r]!=e[r])return!1;return!0}function _f(t,e){return(t%e+e)%e}var If=Math.PI/180,Ef=180/Math.PI,xf=function(t,e){this.lon=t,this.lat=e,this.x=If*t,this.y=If*e};xf.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)},xf.prototype.antipode=function(){var t=-1*this.lat,e=this.lon<0?180+this.lon:-1*(180-this.lon);return new xf(e,t)};var Cf=function(){this.coords=[],this.length=0};Cf.prototype.move_to=function(t){this.length++,this.coords.push(t)};var wf=function(t){this.properties=t||{},this.geometries=[]};wf.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(1===this.geometries.length)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var t=[],e=0;e<this.geometries.length;e++)t.push(this.geometries[e].coords);return{geometry:{type:"MultiLineString",coordinates:t},type:"Feature",properties:this.properties}},wf.prototype.wkt=function(){for(var t="",e="LINESTRING(",r=function(t){e+=t[0]+" "+t[1]+","},n=0;n<this.geometries.length;n++){if(0===this.geometries[n].coords.length)return"LINESTRING(empty)";this.geometries[n].coords.forEach(r),t+=e.substring(0,e.length-1)+")"}return t};var bf=function(t,e,r){if(!t||void 0===t.x||void 0===t.y)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!e||void 0===e.x||void 0===e.y)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new xf(t.x,t.y),this.end=new xf(e.x,e.y),this.properties=r||{};var n=this.start.x-this.end.x,i=this.start.y-this.end.y,o=Math.pow(Math.sin(i/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(n/2),2);if(this.g=2*Math.asin(Math.sqrt(o)),this.g===Math.PI)throw new Error("it appears "+t.view()+" and "+e.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+t+" and "+e)};function Bf(t,e){var r=[],n=Oh();return Ua(e,(function(e){if(r.forEach((function(t,e){t.id=e})),r.length){var i=n.search(e);if(i.features.length){var o=Mf(e,i);r=r.filter((function(t){return t.id!==o.id})),n.remove(o),Pa(Sf(o,e),(function(t){r.push(t),n.insert(t)}))}}else(r=Sf(t,e).features).forEach((function(t){t.bbox||(t.bbox=gc(Wa(t)))})),n.load(dt(r))})),dt(r)}function Sf(t,e){var r=[],n=Pt(t)[0],i=Pt(t)[t.geometry.coordinates.length-1];if(Lf(n,Qt(e))||Lf(i,Qt(e)))return dt([t]);var o=Oh(),s=Kc(t);o.load(s);var a=o.search(e);if(!a.features.length)return dt([t]);var u=Mf(e,a),l=ka(s,(function(t,n,i){var o=Pt(n)[1],s=Qt(e);return i===u.id?(t.push(s),r.push(gt(t)),Lf(s,o)?[s]:[s,o]):(t.push(o),t)}),[n]);return l.length>1&&r.push(gt(l)),dt(r)}function Mf(t,e){if(!e.features.length)throw new Error("lines must contain features");if(1===e.features.length)return e.features[0];var r,n=1/0;return Pa(e,(function(e){var i=Uh(e,t).properties.dist;i<n&&(r=e,n=i)})),r}function Lf(t,e){return t[0]===e[0]&&t[1]===e[1]}function Nf(t,e,r,n,i){void 0===i&&(i={});var o=i.steps||64,s=Tf(r),a=Tf(n),u=Array.isArray(t)||"Feature"!==t.type?{}:t.properties;if(s===a)return gt(dc(t,e,i).geometry.coordinates[0],u);for(var l=s,c=s<a?a:a+360,h=l,f=[],p=0;h<c;)f.push(Ac(t,e,h,i).geometry.coordinates),h=l+360*++p/o;return h>c&&f.push(Ac(t,e,c,i).geometry.coordinates),gt(f,u)}function Tf(t){var e=t%360;return e<0&&(e+=360),e}function Rf(t,e){void 0===e&&(e={});var r=Ut(t);switch(e.properties||"Feature"!==t.type||(e.properties=t.properties),r.type){case"Polygon":return Df(r,e);case"MultiPolygon":return function(t,e){void 0===e&&(e={});var r=Ut(t),n=r.coordinates,i=e.properties?e.properties:"Feature"===t.type?t.properties:{},o=[];return n.forEach((function(t){o.push(Qf(t,i))})),dt(o)}(r,e);default:throw new Error("invalid poly")}}function Df(t,e){return void 0===e&&(e={}),Qf(Ut(t).coordinates,e.properties?e.properties:"Feature"===t.type?t.properties:{})}function Qf(t,e){return t.length>1?yt(t,e):gt(t[0],e)}function Pf(t,e){var r,n,i;void 0===e&&(e={});var o=e.properties,s=null===(r=e.autoComplete)||void 0===r||r,a=null===(n=e.orderCoords)||void 0===n||n;if(null!==(i=e.mutate)&&void 0!==i&&i||(t=sl(t)),"FeatureCollection"===t.type){var u=[];return t.features.forEach((function(t){u.push(Pt(kf(t,{},s,a)))})),mt(u,o)}return kf(t,o,s,a)}function kf(t,e,r,n){e=e||("Feature"===t.type?t.properties:{});var i=Ut(t),o=i.coordinates,s=i.type;if(!o.length)throw new Error("line must contain coordinates");switch(s){case"LineString":return r&&(o=Of(o)),ft([o],e);case"MultiLineString":var a=[],u=0;return o.forEach((function(t){if(r&&(t=Of(t)),n){var e=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.abs(e-n)*Math.abs(r-i)}(Wa(gt(t)));e>u?(a.unshift(t),u=e):a.push(t)}else a.push(t)})),ft(a,e);default:throw new Error("geometry type "+s+" is not supported")}}function Of(t){var e=t[0],r=e[0],n=e[1],i=t[t.length-1],o=i[0],s=i[1];return r===o&&n===s||t.push(e),t}function Ff(t,e){var r,n,i,o,s,a,u;for(n=1;n<=8;n*=2){for(r=[],o=!(Uf(i=t[t.length-1],e)&n),s=0;s<t.length;s++)(u=!(Uf(a=t[s],e)&n))!==o&&r.push(Gf(i,a,n,e)),u&&r.push(a),i=a,o=u;if(!(t=r).length)break}return r}function Gf(t,e,r,n){return 8&r?[t[0]+(e[0]-t[0])*(n[3]-t[1])/(e[1]-t[1]),n[3]]:4&r?[t[0]+(e[0]-t[0])*(n[1]-t[1])/(e[1]-t[1]),n[1]]:2&r?[n[2],t[1]+(e[1]-t[1])*(n[2]-t[0])/(e[0]-t[0])]:1&r?[n[0],t[1]+(e[1]-t[1])*(n[0]-t[0])/(e[0]-t[0])]:null}function Uf(t,e){var r=0;return t[0]<e[0]?r|=1:t[0]>e[2]&&(r|=2),t[1]<e[1]?r|=4:t[1]>e[3]&&(r|=8),r}function qf(t,e){for(var r=[],n=0,i=t;n<i.length;n++){var o=Ff(i[n],e);o.length>0&&(o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]||o.push(o[0]),o.length>=4&&r.push(o))}return r}bf.prototype.interpolate=function(t){var e=Math.sin((1-t)*this.g)/Math.sin(this.g),r=Math.sin(t*this.g)/Math.sin(this.g),n=e*Math.cos(this.start.y)*Math.cos(this.start.x)+r*Math.cos(this.end.y)*Math.cos(this.end.x),i=e*Math.cos(this.start.y)*Math.sin(this.start.x)+r*Math.cos(this.end.y)*Math.sin(this.end.x),o=e*Math.sin(this.start.y)+r*Math.sin(this.end.y),s=Ef*Math.atan2(o,Math.sqrt(Math.pow(n,2)+Math.pow(i,2)));return[Ef*Math.atan2(i,n),s]},bf.prototype.Arc=function(t,e){var r=[];if(!t||t<=2)r.push([this.start.lon,this.start.lat]),r.push([this.end.lon,this.end.lat]);else for(var n=1/(t-1),i=0;i<t;++i){var o=n*i,s=this.interpolate(o);r.push(s)}for(var a=!1,u=0,l=e&&e.offset?e.offset:10,c=180-l,h=-180+l,f=360-l,p=1;p<r.length;++p){var g=r[p-1][0],A=r[p][0],d=Math.abs(A-g);d>f&&(A>c&&g<h||g>c&&A<h)?a=!0:d>u&&(u=d)}var y=[];if(a&&u<l){var v=[];y.push(v);for(var m=0;m<r.length;++m){var _=parseFloat(r[m][0]);if(m>0&&Math.abs(_-r[m-1][0])>f){var I=parseFloat(r[m-1][0]),E=parseFloat(r[m-1][1]),x=parseFloat(r[m][0]),C=parseFloat(r[m][1]);if(I>-180&&I<h&&180===x&&m+1<r.length&&r[m-1][0]>-180&&r[m-1][0]<h){v.push([-180,r[m][1]]),m++,v.push([r[m][0],r[m][1]]);continue}if(I>c&&I<180&&-180===x&&m+1<r.length&&r[m-1][0]>c&&r[m-1][0]<180){v.push([180,r[m][1]]),m++,v.push([r[m][0],r[m][1]]);continue}if(I<h&&x>c){var w=I;I=x,x=w;var b=E;E=C,C=b}if(I>c&&x<h&&(x+=360),I<=180&&x>=180&&I<x){var B=(180-I)/(x-I),S=B*C+(1-B)*E;v.push([r[m-1][0]>c?180:-180,S]),(v=[]).push([r[m-1][0]>c?-180:180,S]),y.push(v)}else v=[],y.push(v);v.push([_,r[m][1]])}else v.push([r[m][0],r[m][1]])}}else{var M=[];y.push(M);for(var L=0;L<r.length;++L)M.push([r[L][0],r[L][1]])}for(var N=new wf(this.properties),T=0;T<y.length;++T){var R=new Cf;N.geometries.push(R);for(var D=y[T],Q=0;Q<D.length;++Q)R.move_to(D[Q])}return N};var jf,Vf=Object.prototype.toString,zf=function(t){var e=Vf.call(t),r="[object Arguments]"===e;return r||(r="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===Vf.call(t.callee)),r};if(!Object.keys){var Yf=Object.prototype.hasOwnProperty,Hf=Object.prototype.toString,Xf=zf,Jf=Object.prototype.propertyIsEnumerable,Wf=!Jf.call({toString:null},"toString"),Kf=Jf.call((function(){}),"prototype"),Zf=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],$f=function(t){var e=t.constructor;return e&&e.prototype===t},tp={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},ep=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!tp["$"+t]&&Yf.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{$f(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();jf=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===Hf.call(t),n=Xf(t),i=e&&"[object String]"===Hf.call(t),o=[];if(!e&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var s=Kf&&r;if(i&&t.length>0&&!Yf.call(t,0))for(var a=0;a<t.length;++a)o.push(String(a));if(n&&t.length>0)for(var u=0;u<t.length;++u)o.push(String(u));else for(var l in t)s&&"prototype"===l||!Yf.call(t,l)||o.push(String(l));if(Wf)for(var c=function(t){if("undefined"==typeof window||!ep)return $f(t);try{return $f(t)}catch(t){return!1}}(t),h=0;h<Zf.length;++h)c&&"constructor"===Zf[h]||!Yf.call(t,Zf[h])||o.push(Zf[h]);return o}}var rp=jf,np=Array.prototype.slice,ip=zf,op=Object.keys,sp=op?function(t){return op(t)}:rp,ap=Object.keys;sp.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return ip(t)?ap(np.call(t)):ap(t)})}else Object.keys=sp;return Object.keys||sp};var up,lp=sp,cp=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(t,e);if(42!==i.value||!0!==i.enumerable)return!1}return!0},hp=cp,fp=function(){return hp()&&!!Symbol.toStringTag},pp="undefined"!=typeof Symbol&&Symbol,gp=cp,Ap={foo:{}},dp=Object,yp=Array.prototype.slice,vp=Object.prototype.toString,mp=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==vp.call(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r,n=yp.call(arguments,1),i=Math.max(0,e.length-n.length),o=[],s=0;s<i;s++)o.push("$"+s);if(r=Function("binder","return function ("+o.join(",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof r){var i=e.apply(this,n.concat(yp.call(arguments)));return Object(i)===i?i:this}return e.apply(t,n.concat(yp.call(arguments)))})),e.prototype){var a=function(){};a.prototype=e.prototype,r.prototype=new a,a.prototype=null}return r},_p=Function.prototype.bind||mp,Ip=_p.call(Function.call,Object.prototype.hasOwnProperty),Ep=SyntaxError,xp=Function,Cp=TypeError,wp=function(t){try{return xp('"use strict"; return ('+t+").constructor;")()}catch(t){}},bp=Object.getOwnPropertyDescriptor;if(bp)try{bp({},"")}catch(t){bp=null}var Bp=function(){throw new Cp},Sp=bp?function(){try{return Bp}catch(t){try{return bp(arguments,"callee").get}catch(t){return Bp}}}():Bp,Mp="function"==typeof pp&&"function"==typeof Symbol&&"symbol"==typeof pp("foo")&&"symbol"==typeof Symbol("bar")&&gp(),Lp={__proto__:Ap}.foo===Ap.foo&&!({__proto__:null}instanceof dp),Np=Object.getPrototypeOf||(Lp?function(t){return t.__proto__}:null),Tp={},Rp="undefined"!=typeof Uint8Array&&Np?Np(Uint8Array):up,Dp={"%AggregateError%":"undefined"==typeof AggregateError?up:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?up:ArrayBuffer,"%ArrayIteratorPrototype%":Mp&&Np?Np([][Symbol.iterator]()):up,"%AsyncFromSyncIteratorPrototype%":up,"%AsyncFunction%":Tp,"%AsyncGenerator%":Tp,"%AsyncGeneratorFunction%":Tp,"%AsyncIteratorPrototype%":Tp,"%Atomics%":"undefined"==typeof Atomics?up:Atomics,"%BigInt%":"undefined"==typeof BigInt?up:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?up:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?up:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?up:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?up:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?up:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?up:FinalizationRegistry,"%Function%":xp,"%GeneratorFunction%":Tp,"%Int8Array%":"undefined"==typeof Int8Array?up:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?up:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?up:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Mp&&Np?Np(Np([][Symbol.iterator]())):up,"%JSON%":"object"==typeof JSON?JSON:up,"%Map%":"undefined"==typeof Map?up:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&Mp&&Np?Np((new Map)[Symbol.iterator]()):up,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?up:Promise,"%Proxy%":"undefined"==typeof Proxy?up:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?up:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?up:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&Mp&&Np?Np((new Set)[Symbol.iterator]()):up,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?up:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Mp&&Np?Np(""[Symbol.iterator]()):up,"%Symbol%":Mp?Symbol:up,"%SyntaxError%":Ep,"%ThrowTypeError%":Sp,"%TypedArray%":Rp,"%TypeError%":Cp,"%Uint8Array%":"undefined"==typeof Uint8Array?up:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?up:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?up:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?up:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?up:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?up:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?up:WeakSet};if(Np)try{null.error}catch(t){var Qp=Np(Np(t));Dp["%Error.prototype%"]=Qp}var Pp=function t(e){var r;if("%AsyncFunction%"===e)r=wp("async function () {}");else if("%GeneratorFunction%"===e)r=wp("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=wp("async function* () {}");else if("%AsyncGenerator%"===e){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&Np&&(r=Np(i.prototype))}return Dp[e]=r,r},kp={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Op=_p,Fp=Ip,Gp=Op.call(Function.call,Array.prototype.concat),Up=Op.call(Function.apply,Array.prototype.splice),qp=Op.call(Function.call,String.prototype.replace),jp=Op.call(Function.call,String.prototype.slice),Vp=Op.call(Function.call,RegExp.prototype.exec),zp=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Yp=/\\(\\)?/g,Hp=function(t,e){var r,n=t;if(Fp(kp,n)&&(n="%"+(r=kp[n])[0]+"%"),Fp(Dp,n)){var i=Dp[n];if(i===Tp&&(i=Pp(n)),void 0===i&&!e)throw new Cp("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new Ep("intrinsic "+t+" does not exist!")},Xp=function(t,e){if("string"!=typeof t||0===t.length)throw new Cp("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new Cp('"allowMissing" argument must be a boolean');if(null===Vp(/^%?[^%]*%?$/,t))throw new Ep("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=jp(t,0,1),r=jp(t,-1);if("%"===e&&"%"!==r)throw new Ep("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new Ep("invalid intrinsic syntax, expected opening `%`");var n=[];return qp(t,zp,(function(t,e,r,i){n[n.length]=r?qp(i,Yp,"$1"):e||t})),n}(t),n=r.length>0?r[0]:"",i=Hp("%"+n+"%",e),o=i.name,s=i.value,a=!1,u=i.alias;u&&(n=u[0],Up(r,Gp([0,1],u)));for(var l=1,c=!0;l<r.length;l+=1){var h=r[l],f=jp(h,0,1),p=jp(h,-1);if(('"'===f||"'"===f||"`"===f||'"'===p||"'"===p||"`"===p)&&f!==p)throw new Ep("property names with quotes must have matching quotes");if("constructor"!==h&&c||(a=!0),Fp(Dp,o="%"+(n+="."+h)+"%"))s=Dp[o];else if(null!=s){if(!(h in s)){if(!e)throw new Cp("base intrinsic for "+t+" exists, but the property is not available.");return}if(bp&&l+1>=r.length){var g=bp(s,h);s=(c=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:s[h]}else c=Fp(s,h),s=s[h];c&&!a&&(Dp[o]=s)}}return s},Jp={exports:{}};!function(t){var e=_p,r=Xp,n=r("%Function.prototype.apply%"),i=r("%Function.prototype.call%"),o=r("%Reflect.apply%",!0)||e.call(i,n),s=r("%Object.getOwnPropertyDescriptor%",!0),a=r("%Object.defineProperty%",!0),u=r("%Math.max%");if(a)try{a({},"a",{value:1})}catch(t){a=null}t.exports=function(t){var r=o(e,i,arguments);s&&a&&(s(r,"length").configurable&&a(r,"length",{value:1+u(0,t.length-(arguments.length-1))}));return r};var l=function(){return o(e,n,arguments)};a?a(t.exports,"apply",{value:l}):t.exports.apply=l}(Jp);var Wp=Xp,Kp=Jp.exports,Zp=Kp(Wp("String.prototype.indexOf")),$p=function(t,e){var r=Wp(t,!!e);return"function"==typeof r&&Zp(t,".prototype.")>-1?Kp(r):r},tg=fp(),eg=$p("Object.prototype.toString"),rg=function(t){return!(tg&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===eg(t)},ng=function(t){return!!rg(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==eg(t)&&"[object Function]"===eg(t.callee)},ig=function(){return rg(arguments)}();rg.isLegacyArguments=ng;var og=ig?rg:ng,sg=Xp("%Object.defineProperty%",!0),ag=function(){if(sg)try{return sg({},"a",{value:1}),!0}catch(t){return!1}return!1};ag.hasArrayLengthDefineBug=function(){if(!ag())return null;try{return 1!==sg([],"length",{value:1}).length}catch(t){return!0}};var ug=ag,lg=lp,cg="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),hg=Object.prototype.toString,fg=Array.prototype.concat,pg=Object.defineProperty,gg=ug(),Ag=pg&&gg,dg=function(t,e,r,n){if(e in t)if(!0===n){if(t[e]===r)return}else if("function"!=typeof(i=n)||"[object Function]"!==hg.call(i)||!n())return;var i;Ag?pg(t,e,{configurable:!0,enumerable:!1,value:r,writable:!0}):t[e]=r},yg=function(t,e){var r=arguments.length>2?arguments[2]:{},n=lg(e);cg&&(n=fg.call(n,Object.getOwnPropertySymbols(e)));for(var i=0;i<n.length;i+=1)dg(t,n[i],e[n[i]],r[n[i]])};yg.supportsDescriptors=!!Ag;var vg=yg,mg=function(t){return t!=t},_g=function(t,e){return 0===t&&0===e?1/t==1/e:t===e||!(!mg(t)||!mg(e))},Ig=_g,Eg=function(){return"function"==typeof Object.is?Object.is:Ig},xg=Eg,Cg=vg,wg=vg,bg=_g,Bg=Eg,Sg=function(){var t=xg();return Cg(Object,{is:t},{is:function(){return Object.is!==t}}),t},Mg=(0,Jp.exports)(Bg(),Object);wg(Mg,{getPolyfill:Bg,implementation:bg,shim:Sg});var Lg,Ng,Tg,Rg,Dg=Mg,Qg=$p,Pg=fp();if(Pg){Lg=Qg("Object.prototype.hasOwnProperty"),Ng=Qg("RegExp.prototype.exec"),Tg={};var kg=function(){throw Tg};Rg={toString:kg,valueOf:kg},"symbol"==typeof Symbol.toPrimitive&&(Rg[Symbol.toPrimitive]=kg)}var Og=Qg("Object.prototype.toString"),Fg=Object.getOwnPropertyDescriptor,Gg=Pg?function(t){if(!t||"object"!=typeof t)return!1;var e=Fg(t,"lastIndex");if(!(e&&Lg(e,"value")))return!1;try{Ng(t,Rg)}catch(t){return t===Tg}}:function(t){return!(!t||"object"!=typeof t&&"function"!=typeof t)&&"[object RegExp]"===Og(t)},Ug={exports:{}},qg=function(){return"string"==typeof function(){}.name},jg=Object.getOwnPropertyDescriptor;if(jg)try{jg([],"length")}catch(t){jg=null}qg.functionsHaveConfigurableNames=function(){if(!qg()||!jg)return!1;var t=jg((function(){}),"name");return!!t&&!!t.configurable};var Vg=Function.prototype.bind;qg.boundFunctionsHaveNames=function(){return qg()&&"function"==typeof Vg&&""!==function(){}.bind().name};var zg=qg;!function(t){var e=zg.functionsHaveConfigurableNames(),r=Object,n=TypeError;t.exports=function(){if(null!=this&&this!==r(this))throw new n("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},e&&Object.defineProperty&&Object.defineProperty(t.exports,"name",{value:"get flags"})}(Ug);var Yg=Ug.exports,Hg=vg.supportsDescriptors,Xg=Object.getOwnPropertyDescriptor,Jg=function(){if(Hg&&"gim"===/a/gim.flags){var t=Xg(RegExp.prototype,"flags");if(t&&"function"==typeof t.get&&"boolean"==typeof RegExp.prototype.dotAll&&"boolean"==typeof RegExp.prototype.hasIndices){var e="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(r,"sticky",{get:function(){e+="y"}}),"dy"===e)return t.get}}return Yg},Wg=vg.supportsDescriptors,Kg=Jg,Zg=Object.getOwnPropertyDescriptor,$g=Object.defineProperty,tA=TypeError,eA=Object.getPrototypeOf,rA=/a/,nA=vg,iA=Ug.exports,oA=Jg,sA=function(){if(!Wg||!eA)throw new tA("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=Kg(),e=eA(rA),r=Zg(e,"flags");return r&&r.get===t||$g(e,"flags",{configurable:!0,enumerable:!1,get:t}),t},aA=(0,Jp.exports)(oA());nA(aA,{getPolyfill:oA,implementation:iA,shim:sA});var uA=aA,lA=Date.prototype.getDay,cA=Object.prototype.toString,hA=fp(),fA=lp,pA=og,gA=Dg,AA=Gg,dA=uA,yA=function(t){return"object"==typeof t&&null!==t&&(hA?function(t){try{return lA.call(t),!0}catch(t){return!1}}(t):"[object Date]"===cA.call(t))},vA=Date.prototype.getTime;function mA(t,e,r){var n=r||{};return!!(n.strict?gA(t,e):t===e)||(!t||!e||"object"!=typeof t&&"object"!=typeof e?n.strict?gA(t,e):t==e:function(t,e,r){var n,i;if(typeof t!=typeof e)return!1;if(_A(t)||_A(e))return!1;if(t.prototype!==e.prototype)return!1;if(pA(t)!==pA(e))return!1;var o=AA(t),s=AA(e);if(o!==s)return!1;if(o||s)return t.source===e.source&&dA(t)===dA(e);if(yA(t)&&yA(e))return vA.call(t)===vA.call(e);var a=IA(t),u=IA(e);if(a!==u)return!1;if(a||u){if(t.length!==e.length)return!1;for(n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}if(typeof t!=typeof e)return!1;try{var l=fA(t),c=fA(e)}catch(t){return!1}if(l.length!==c.length)return!1;for(l.sort(),c.sort(),n=l.length-1;n>=0;n--)if(l[n]!=c[n])return!1;for(n=l.length-1;n>=0;n--)if(!mA(t[i=l[n]],e[i],r))return!1;return!0}(t,e,n))}function _A(t){return null==t}function IA(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length)&&("function"==typeof t.copy&&"function"==typeof t.slice&&!(t.length>0&&"number"!=typeof t[0]))}var EA=mA;function xA(t,e,r){if(void 0===r&&(r={}),!Nt(r=r||{}))throw new Error("options is invalid");var n,i=r.tolerance||0,o=[],s=Oh(),a=Kc(t);return s.load(a),ja(e,(function(t){var e=!1;t&&(Pa(s.search(t),(function(r){if(!1===e){var o=Pt(t).sort(),s=Pt(r).sort();EA(o,s)||(0===i?rf(o[0],r)&&rf(o[1],r):Uh(r,o[0]).properties.dist<=i&&Uh(r,o[1]).properties.dist<=i)?(e=!0,n=n?CA(n,t):t):(0===i?rf(s[0],t)&&rf(s[1],t):Uh(t,s[0]).properties.dist<=i&&Uh(t,s[1]).properties.dist<=i)&&(n=n?CA(n,r):r)}})),!1===e&&n&&(o.push(n),n=void 0))})),n&&o.push(n),dt(o)}function CA(t,e){var r=Pt(e),n=Pt(t),i=n[0],o=n[n.length-1],s=t.geometry.coordinates;return EA(r[0],i)?s.unshift(r[1]):EA(r[0],o)?s.push(r[1]):EA(r[1],i)?s.unshift(r[0]):EA(r[1],o)&&s.push(r[0]),t}function wA(t){var e=t%360;return e<0&&(e+=360),e}function bA(t,e,r){var n;return void 0===r&&(r={}),(n=r.final?BA(Qt(e),Qt(t)):BA(Qt(t),Qt(e)))>180?-(360-n):n}function BA(t,e){var r=Bt(t[1]),n=Bt(e[1]),i=Bt(e[0]-t[0]);i>Math.PI&&(i-=2*Math.PI),i<-Math.PI&&(i+=2*Math.PI);var o=Math.log(Math.tan(n/2+Math.PI/4)/Math.tan(r/2+Math.PI/4));return(bt(Math.atan2(i,o))+360)%360}function SA(t,e,r,n){void 0===n&&(n={});var i=e<0,o=St(Math.abs(e),n.units,"meters");i&&(o=-Math.abs(o));var s=Qt(t),a=function(t,e,r,n){n=void 0===n?it:Number(n);var i=e/n,o=t[0]*Math.PI/180,s=Bt(t[1]),a=Bt(r),u=i*Math.cos(a),l=s+u;Math.abs(l)>Math.PI/2&&(l=l>0?Math.PI-l:-Math.PI-l);var c=Math.log(Math.tan(l/2+Math.PI/4)/Math.tan(s/2+Math.PI/4)),h=Math.abs(c)>1e-11?u/c:Math.cos(s),f=i*Math.sin(a)/h;return[(180*(o+f)/Math.PI+540)%360-180,180*l/Math.PI]}(s,o,r);return a[0]+=a[0]-s[0]>180?-360:s[0]-a[0]>180?360:0,ct(a,n.properties)}function MA(t,e,r,n,i,o){for(var s=0;s<t.length;s++){var a=t[s],u=t[s+1];s===t.length-1&&(u=t[0]),n=NA(a,u,e),r<=0&&n>0?NA(e,a,i)<0||(i=a):r>0&&n<=0&&(LA(e,a,o)||(o=a)),r=n}return[i,o]}function LA(t,e,r){return NA(t,e,r)>0}function NA(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(r[0]-t[0])*(e[1]-t[1])}function TA(t){for(var e,r,n=Pt(t),i=0,o=1;o<n.length;)e=r||n[0],i+=((r=n[o])[0]-e[0])*(r[1]+e[1]),o++;return i>0}function RA(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Fa(t,(function(t){RA(t,e)})),t;case"LineString":return DA(Pt(t),e),t;case"Polygon":return QA(Pt(t),e),t;case"MultiLineString":return Pt(t).forEach((function(t){DA(t,e)})),t;case"MultiPolygon":return Pt(t).forEach((function(t){QA(t,e)})),t;case"Point":case"MultiPoint":return t}}function DA(t,e){TA(t)===e&&t.reverse()}function QA(t,e){TA(t[0])!==e&&t[0].reverse();for(var r=1;r<t.length;r++)TA(t[r])===e&&t[r].reverse()}function PA(t,e){if(!Nt(e=e||{}))throw new Error("options is invalid");var r=e.zProperty||"elevation",n=e.flip,i=e.flags;Gt(t,"Point","input must contain Points");for(var o=function(t,e){var r={};Pa(t,(function(t){var e=Pt(t)[1];r[e]||(r[e]=[]),r[e].push(t)}));var n=Object.keys(r).map((function(t){return r[t].sort((function(t,e){return Pt(t)[0]-Pt(e)[0]}))})),i=n.sort((function(t,r){return e?Pt(t[0])[1]-Pt(r[0])[1]:Pt(r[0])[1]-Pt(t[0])[1]}));return i}
|
|
71
|
+
/*!
|
|
72
|
+
* @license GNU Affero General Public License.
|
|
73
|
+
* Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>
|
|
74
|
+
* v. 1.2.0
|
|
75
|
+
* https://github.com/RaumZeit/MarchingSquares.js
|
|
76
|
+
*
|
|
77
|
+
* MarchingSquaresJS is free software: you can redistribute it and/or modify
|
|
78
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
79
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
80
|
+
* (at your option) any later version.
|
|
81
|
+
*
|
|
82
|
+
* MarchingSquaresJS is distributed in the hope that it will be useful,
|
|
83
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
84
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
85
|
+
* GNU Affero General Public License for more details.
|
|
86
|
+
*
|
|
87
|
+
* As additional permission under GNU Affero General Public License version 3
|
|
88
|
+
* section 7, third-party projects (personal or commercial) may distribute,
|
|
89
|
+
* include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the
|
|
90
|
+
* requirement that said third-party project for that reason alone becomes
|
|
91
|
+
* subject to any requirement of the GNU Affero General Public License version 3.
|
|
92
|
+
* Any modifications to MarchingSquaresJS, however, must be shared with the public
|
|
93
|
+
* and made available.
|
|
94
|
+
*
|
|
95
|
+
* In summary this:
|
|
96
|
+
* - allows you to use MarchingSquaresJS at no cost
|
|
97
|
+
* - allows you to use MarchingSquaresJS for both personal and commercial purposes
|
|
98
|
+
* - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any
|
|
99
|
+
* license as long as this license notice is included
|
|
100
|
+
* - enables you to keep the source code of your program that uses MarchingSquaresJS
|
|
101
|
+
* undisclosed
|
|
102
|
+
* - forces you to share any modifications you have made to MarchingSquaresJS,
|
|
103
|
+
* e.g. bug-fixes
|
|
104
|
+
*
|
|
105
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
106
|
+
* along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.
|
|
107
|
+
*/(t,n),s=[],a=0;a<o.length;a++){for(var u=o[a],l=[],c=0;c<u.length;c++){var h=u[c];h.properties[r]?l.push(h.properties[r]):l.push(0),!0===i&&(h.properties.matrixPosition=[a,c])}s.push(l)}return s}var kA={successCallback:null,verbose:!1,polygons:!1},OA={};function FA(t,e,r,n){n=n||{};for(var i=Object.keys(kA),o=0;o<i.length;o++){var s=i[o],a=n[s];a=null!=a?a:kA[s],OA[s]=a}OA.verbose&&console.log("MarchingSquaresJS-isoBands: computing isobands for ["+e+":"+(e+r)+"]");var u,l=function(t,e,r){for(var n=t.length-1,i=t[0].length-1,o={rows:n,cols:i,cells:[]},s=e+Math.abs(r),a=0;a<n;++a){o.cells[a]=[];for(var u=0;u<i;++u){var l=0,c=t[a+1][u],h=t[a+1][u+1],f=t[a][u+1],p=t[a][u];if(!(isNaN(c)||isNaN(h)||isNaN(f)||isNaN(p))){l|=c<e?0:c>s?128:64,l|=h<e?0:h>s?32:16,l|=f<e?0:f>s?8:4;var g=+(l|=p<e?0:p>s?2:1),A=0;if(17===l||18===l||33===l||34===l||38===l||68===l||72===l||98===l||102===l||132===l||136===l||137===l||152===l||153===l){var d=(c+h+f+p)/4;A=d>s?2:d<e?0:1,34===l?1===A?l=35:0===A&&(l=136):136===l?1===A?(l=35,A=4):0===A&&(l=34):17===l?1===A?(l=155,A=4):0===A&&(l=153):68===l?1===A?(l=103,A=4):0===A&&(l=102):153===l?1===A&&(l=155):102===l?1===A&&(l=103):152===l?A<2&&(l=156,A=1):137===l?A<2&&(l=139,A=1):98===l?A<2&&(l=99,A=1):38===l?A<2&&(l=39,A=1):18===l?A>0?(l=156,A=4):l=152:33===l?A>0?(l=139,A=4):l=137:72===l?A>0?(l=99,A=4):l=98:132===l&&(A>0?(l=39,A=4):l=38)}if(0!=l&&170!=l){var y,v,m,_,I,E,x,C;y=v=m=_=I=E=x=C=.5;var w=[];1===l?(m=1-Nd(e,f,p),C=1-Nd(e,c,p),w.push(wd[l])):169===l?(m=Nd(s,p,f),C=Nd(s,p,c),w.push(wd[l])):4===l?(E=1-Nd(e,h,f),_=Nd(e,p,f),w.push(xd[l])):166===l?(E=Nd(s,f,h),_=1-Nd(s,f,p),w.push(xd[l])):16===l?(I=Nd(e,f,h),v=Nd(e,c,h),w.push(Ed[l])):154===l?(I=1-Nd(s,h,f),v=1-Nd(s,h,c),w.push(Ed[l])):64===l?(x=Nd(e,p,c),y=1-Nd(e,h,c),w.push(Bd[l])):106===l?(x=1-Nd(s,c,p),y=Nd(s,c,h),w.push(Bd[l])):168===l?(_=Nd(s,p,f),m=Nd(e,p,f),C=Nd(e,p,c),x=Nd(s,p,c),w.push(Cd[l]),w.push(wd[l])):2===l?(_=1-Nd(e,f,p),m=1-Nd(s,f,p),C=1-Nd(s,c,p),x=1-Nd(e,c,p),w.push(Cd[l]),w.push(wd[l])):162===l?(I=Nd(s,f,h),E=Nd(e,f,h),_=1-Nd(e,f,p),m=1-Nd(s,f,p),w.push(Cd[l]),w.push(wd[l])):8===l?(I=1-Nd(e,h,f),E=1-Nd(s,h,f),_=Nd(s,p,f),m=Nd(e,p,f),w.push(Ed[l]),w.push(xd[l])):138===l?(I=1-Nd(e,h,f),E=1-Nd(s,h,f),y=1-Nd(s,h,c),v=1-Nd(e,h,c),w.push(Ed[l]),w.push(xd[l])):32===l?(I=Nd(s,f,h),E=Nd(e,f,h),y=Nd(e,c,h),v=Nd(s,c,h),w.push(Ed[l]),w.push(xd[l])):42===l?(C=1-Nd(s,c,p),x=1-Nd(e,c,p),y=Nd(e,c,h),v=Nd(s,c,h),w.push(bd[l]),w.push(Bd[l])):128===l&&(C=Nd(e,p,c),x=Nd(s,p,c),y=1-Nd(s,h,c),v=1-Nd(e,h,c),w.push(bd[l]),w.push(Bd[l])),5===l?(E=1-Nd(e,h,f),C=1-Nd(e,c,p),w.push(xd[l])):165===l?(E=Nd(s,f,h),C=Nd(s,p,c),w.push(xd[l])):20===l?(_=Nd(e,p,f),v=Nd(e,c,h),w.push(Cd[l])):150===l?(_=1-Nd(s,f,p),v=1-Nd(s,h,c),w.push(Cd[l])):80===l?(I=Nd(e,f,h),x=Nd(e,p,c),w.push(Ed[l])):90===l?(I=1-Nd(s,h,f),x=1-Nd(s,c,p),w.push(Ed[l])):65===l?(m=1-Nd(e,f,p),y=1-Nd(e,h,c),w.push(wd[l])):105===l?(m=Nd(s,p,f),y=Nd(s,c,h),w.push(wd[l])):160===l?(I=Nd(s,f,h),E=Nd(e,f,h),C=Nd(e,p,c),x=Nd(s,p,c),w.push(Ed[l]),w.push(xd[l])):10===l?(I=1-Nd(e,h,f),E=1-Nd(s,h,f),C=1-Nd(s,c,p),x=1-Nd(e,c,p),w.push(Ed[l]),w.push(xd[l])):130===l?(_=1-Nd(e,f,p),m=1-Nd(s,f,p),y=1-Nd(s,h,c),v=1-Nd(e,h,c),w.push(Cd[l]),w.push(wd[l])):40===l?(_=Nd(s,p,f),m=Nd(e,p,f),y=Nd(e,c,h),v=Nd(s,c,h),w.push(Cd[l]),w.push(wd[l])):101===l?(E=Nd(s,f,h),y=Nd(s,c,h),w.push(xd[l])):69===l?(E=1-Nd(e,h,f),y=1-Nd(e,h,c),w.push(xd[l])):149===l?(C=Nd(s,p,c),v=1-Nd(s,h,c),w.push(bd[l])):21===l?(C=1-Nd(e,c,p),v=Nd(e,c,h),w.push(bd[l])):86===l?(_=1-Nd(s,f,p),x=1-Nd(s,c,p),w.push(Cd[l])):84===l?(_=Nd(e,p,f),x=Nd(e,p,c),w.push(Cd[l])):89===l?(I=1-Nd(s,h,f),m=Nd(s,p,f),w.push(wd[l])):81===l?(I=Nd(e,f,h),m=1-Nd(e,f,p),w.push(wd[l])):96===l?(I=Nd(s,f,h),E=Nd(e,f,h),x=Nd(e,p,c),y=Nd(s,c,h),w.push(Ed[l]),w.push(xd[l])):74===l?(I=1-Nd(e,h,f),E=1-Nd(s,h,f),x=1-Nd(s,c,p),y=1-Nd(e,h,c),w.push(Ed[l]),w.push(xd[l])):24===l?(I=1-Nd(s,h,f),_=Nd(s,p,f),m=Nd(e,p,f),v=Nd(e,c,h),w.push(Ed[l]),w.push(wd[l])):146===l?(I=Nd(e,f,h),_=1-Nd(e,f,p),m=1-Nd(s,f,p),v=1-Nd(s,h,c),w.push(Ed[l]),w.push(wd[l])):6===l?(E=1-Nd(e,h,f),_=1-Nd(s,f,p),C=1-Nd(s,c,p),x=1-Nd(e,c,p),w.push(xd[l]),w.push(Cd[l])):164===l?(E=Nd(s,f,h),_=Nd(e,p,f),C=Nd(e,p,c),x=Nd(s,p,c),w.push(xd[l]),w.push(Cd[l])):129===l?(m=1-Nd(e,f,p),C=Nd(s,p,c),y=1-Nd(s,h,c),v=1-Nd(e,h,c),w.push(wd[l]),w.push(bd[l])):41===l?(m=Nd(s,p,f),C=1-Nd(e,c,p),y=Nd(e,c,h),v=Nd(s,c,h),w.push(wd[l]),w.push(bd[l])):66===l?(_=1-Nd(e,f,p),m=1-Nd(s,f,p),x=1-Nd(s,c,p),y=1-Nd(e,h,c),w.push(Cd[l]),w.push(wd[l])):104===l?(_=Nd(s,p,f),m=Nd(e,p,f),x=Nd(e,p,c),y=Nd(s,c,h),w.push(wd[l]),w.push(Sd[l])):144===l?(I=Nd(e,f,h),C=Nd(e,p,c),x=Nd(s,p,c),v=1-Nd(s,h,c),w.push(Ed[l]),w.push(Bd[l])):26===l?(I=1-Nd(s,h,f),C=1-Nd(s,c,p),x=1-Nd(e,c,p),v=Nd(e,c,h),w.push(Ed[l]),w.push(Bd[l])):36===l?(E=Nd(s,f,h),_=Nd(e,p,f),y=Nd(e,c,h),v=Nd(s,c,h),w.push(xd[l]),w.push(Cd[l])):134===l?(E=1-Nd(e,h,f),_=1-Nd(s,f,p),y=1-Nd(s,h,c),v=1-Nd(e,h,c),w.push(xd[l]),w.push(Cd[l])):9===l?(I=1-Nd(e,h,f),E=1-Nd(s,h,f),m=Nd(s,p,f),C=1-Nd(e,c,p),w.push(Ed[l]),w.push(xd[l])):161===l?(I=Nd(s,f,h),E=Nd(e,f,h),m=1-Nd(e,f,p),C=Nd(s,p,c),w.push(Ed[l]),w.push(xd[l])):37===l?(E=Nd(s,f,h),C=1-Nd(e,c,p),y=Nd(e,c,h),v=Nd(s,c,h),w.push(xd[l]),w.push(bd[l])):133===l?(E=1-Nd(e,h,f),C=Nd(s,p,c),y=1-Nd(s,h,c),v=1-Nd(e,h,c),w.push(xd[l]),w.push(bd[l])):148===l?(_=Nd(e,p,f),C=Nd(e,p,c),x=Nd(s,p,c),v=1-Nd(s,h,c),w.push(Cd[l]),w.push(Bd[l])):22===l?(_=1-Nd(s,f,p),C=1-Nd(s,c,p),x=1-Nd(e,c,p),v=Nd(e,c,h),w.push(Cd[l]),w.push(Bd[l])):82===l?(I=Nd(e,f,h),_=1-Nd(e,f,p),m=1-Nd(s,f,p),x=1-Nd(s,c,p),w.push(Ed[l]),w.push(wd[l])):88===l?(I=1-Nd(s,h,f),_=Nd(s,p,f),m=Nd(e,p,f),x=Nd(e,p,c),w.push(Ed[l]),w.push(wd[l])):73===l?(I=1-Nd(e,h,f),E=1-Nd(s,h,f),m=Nd(s,p,f),y=1-Nd(e,h,c),w.push(Ed[l]),w.push(xd[l])):97===l?(I=Nd(s,f,h),E=Nd(e,f,h),m=1-Nd(e,f,p),y=Nd(s,c,h),w.push(Ed[l]),w.push(xd[l])):145===l?(I=Nd(e,f,h),m=1-Nd(e,f,p),C=Nd(s,p,c),v=1-Nd(s,h,c),w.push(Ed[l]),w.push(bd[l])):25===l?(I=1-Nd(s,h,f),m=Nd(s,p,f),C=1-Nd(e,c,p),v=Nd(e,c,h),w.push(Ed[l]),w.push(bd[l])):70===l?(E=1-Nd(e,h,f),_=1-Nd(s,f,p),x=1-Nd(s,c,p),y=1-Nd(e,h,c),w.push(xd[l]),w.push(Cd[l])):100===l?(E=Nd(s,f,h),_=Nd(e,p,f),x=Nd(e,p,c),y=Nd(s,c,h),w.push(xd[l]),w.push(Cd[l])):34===l?(0===A?(I=1-Nd(e,h,f),E=1-Nd(s,h,f),_=Nd(s,p,f),m=Nd(e,p,f),C=Nd(e,p,c),x=Nd(s,p,c),y=1-Nd(s,h,c),v=1-Nd(e,h,c)):(I=Nd(s,f,h),E=Nd(e,f,h),_=1-Nd(e,f,p),m=1-Nd(s,f,p),C=1-Nd(s,c,p),x=1-Nd(e,c,p),y=Nd(e,c,h),v=Nd(s,c,h)),w.push(Ed[l]),w.push(xd[l]),w.push(bd[l]),w.push(Bd[l])):35===l?(4===A?(I=1-Nd(e,h,f),E=1-Nd(s,h,f),_=Nd(s,p,f),m=Nd(e,p,f),C=Nd(e,p,c),x=Nd(s,p,c),y=1-Nd(s,h,c),v=1-Nd(e,h,c)):(I=Nd(s,f,h),E=Nd(e,f,h),_=1-Nd(e,f,p),m=1-Nd(s,f,p),C=1-Nd(s,c,p),x=1-Nd(e,c,p),y=Nd(e,c,h),v=Nd(s,c,h)),w.push(Ed[l]),w.push(xd[l]),w.push(wd[l]),w.push(Bd[l])):136===l?(0===A?(I=Nd(s,f,h),E=Nd(e,f,h),_=1-Nd(e,f,p),m=1-Nd(s,f,p),C=1-Nd(s,c,p),x=1-Nd(e,c,p),y=Nd(e,c,h),v=Nd(s,c,h)):(I=1-Nd(e,h,f),E=1-Nd(s,h,f),_=Nd(s,p,f),m=Nd(e,p,f),C=Nd(e,p,c),x=Nd(s,p,c),y=1-Nd(s,h,c),v=1-Nd(e,h,c)),w.push(Ed[l]),w.push(xd[l]),w.push(bd[l]),w.push(Bd[l])):153===l?(0===A?(I=Nd(e,f,h),m=1-Nd(e,f,p),C=1-Nd(e,c,p),v=Nd(e,c,h)):(I=1-Nd(s,h,f),m=Nd(s,p,f),C=Nd(s,p,c),v=1-Nd(s,h,c)),w.push(Ed[l]),w.push(wd[l])):102===l?(0===A?(E=1-Nd(e,h,f),_=Nd(e,p,f),x=Nd(e,p,c),y=1-Nd(e,h,c)):(E=Nd(s,f,h),_=1-Nd(s,f,p),x=1-Nd(s,c,p),y=Nd(s,c,h)),w.push(xd[l]),w.push(Bd[l])):155===l?(4===A?(I=Nd(e,f,h),m=1-Nd(e,f,p),C=1-Nd(e,c,p),v=Nd(e,c,h)):(I=1-Nd(s,h,f),m=Nd(s,p,f),C=Nd(s,p,c),v=1-Nd(s,h,c)),w.push(Ed[l]),w.push(bd[l])):103===l?(4===A?(E=1-Nd(e,h,f),_=Nd(e,p,f),x=Nd(e,p,c),y=1-Nd(e,h,c)):(E=Nd(s,f,h),_=1-Nd(s,f,p),x=1-Nd(s,c,p),y=Nd(s,c,h)),w.push(xd[l]),w.push(Cd[l])):152===l?(0===A?(I=Nd(e,f,h),_=1-Nd(e,f,p),m=1-Nd(s,f,p),C=1-Nd(s,c,p),x=1-Nd(e,c,p),v=Nd(e,c,h)):(I=1-Nd(s,h,f),_=Nd(s,p,f),m=Nd(e,p,f),C=Nd(e,p,c),x=Nd(s,p,c),v=1-Nd(s,h,c)),w.push(Ed[l]),w.push(Cd[l]),w.push(wd[l])):156===l?(4===A?(I=Nd(e,f,h),_=1-Nd(e,f,p),m=1-Nd(s,f,p),C=1-Nd(s,c,p),x=1-Nd(e,c,p),v=Nd(e,c,h)):(I=1-Nd(s,h,f),_=Nd(s,p,f),m=Nd(e,p,f),C=Nd(e,p,c),x=Nd(s,p,c),v=1-Nd(s,h,c)),w.push(Ed[l]),w.push(wd[l]),w.push(Bd[l])):137===l?(0===A?(I=Nd(s,f,h),E=Nd(e,f,h),m=1-Nd(e,f,p),C=1-Nd(e,c,p),y=Nd(e,c,h),v=Nd(s,c,h)):(I=1-Nd(e,h,f),E=1-Nd(s,h,f),m=Nd(s,p,f),C=Nd(s,p,c),y=1-Nd(s,h,c),v=1-Nd(e,h,c)),w.push(Ed[l]),w.push(xd[l]),w.push(wd[l])):139===l?(4===A?(I=Nd(s,f,h),E=Nd(e,f,h),m=1-Nd(e,f,p),C=1-Nd(e,c,p),y=Nd(e,c,h),v=Nd(s,c,h)):(I=1-Nd(e,h,f),E=1-Nd(s,h,f),m=Nd(s,p,f),C=Nd(s,p,c),y=1-Nd(s,h,c),v=1-Nd(e,h,c)),w.push(Ed[l]),w.push(xd[l]),w.push(bd[l])):98===l?(0===A?(I=1-Nd(e,h,f),E=1-Nd(s,h,f),_=Nd(s,p,f),m=Nd(e,p,f),x=Nd(e,p,c),y=1-Nd(e,h,c)):(I=Nd(s,f,h),E=Nd(e,f,h),_=1-Nd(e,f,p),m=1-Nd(s,f,p),x=1-Nd(s,c,p),y=Nd(s,c,h)),w.push(Ed[l]),w.push(xd[l]),w.push(Bd[l])):99===l?(4===A?(I=1-Nd(e,h,f),E=1-Nd(s,h,f),_=Nd(s,p,f),m=Nd(e,p,f),x=Nd(e,p,c),y=1-Nd(e,h,c)):(I=Nd(s,f,h),E=Nd(e,f,h),_=1-Nd(e,f,p),m=1-Nd(s,f,p),x=1-Nd(s,c,p),y=Nd(s,c,h)),w.push(Ed[l]),w.push(xd[l]),w.push(wd[l])):38===l?(0===A?(E=1-Nd(e,h,f),_=Nd(e,p,f),C=Nd(e,p,c),x=Nd(s,p,c),y=1-Nd(s,h,c),v=1-Nd(e,h,c)):(E=Nd(s,f,h),_=1-Nd(s,f,p),C=1-Nd(s,c,p),x=1-Nd(e,c,p),y=Nd(e,c,h),v=Nd(s,c,h)),w.push(xd[l]),w.push(bd[l]),w.push(Bd[l])):39===l?(4===A?(E=1-Nd(e,h,f),_=Nd(e,p,f),C=Nd(e,p,c),x=Nd(s,p,c),y=1-Nd(s,h,c),v=1-Nd(e,h,c)):(E=Nd(s,f,h),_=1-Nd(s,f,p),C=1-Nd(s,c,p),x=1-Nd(e,c,p),y=Nd(e,c,h),v=Nd(s,c,h)),w.push(xd[l]),w.push(Cd[l]),w.push(Bd[l])):85===l&&(I=1,E=0,_=1,m=0,C=0,x=1,y=0,v=1),(y<0||y>1||v<0||v>1||I<0||I>1||_<0||_>1||C<0||C>1||x<0||x>1)&&console.log("MarchingSquaresJS-isoBands: "+l+" "+g+" "+c+","+h+","+f+","+p+" "+A+" "+y+" "+v+" "+I+" "+E+" "+_+" "+m+" "+C+" "+x),o.cells[a][u]={cval:l,cval_real:g,flipped:A,topleft:y,topright:v,righttop:I,rightbottom:E,bottomright:_,bottomleft:m,leftbottom:C,lefttop:x,edges:w}}}}}return o}(t,e,r);return OA.polygons?(OA.verbose&&console.log("MarchingSquaresJS-isoBands: returning single polygons for each grid cell"),u=function(t){var e=[],r=0;return t.cells.forEach((function(t,n){t.forEach((function(t,i){if(void 0!==t){var o=Ld[t.cval](t);"object"==typeof o&&Td(o)?"object"==typeof o[0]&&Td(o[0])?"object"==typeof o[0][0]&&Td(o[0][0])?o.forEach((function(t){t.forEach((function(t){t[0]+=i,t[1]+=n})),e[r++]=t})):(o.forEach((function(t){t[0]+=i,t[1]+=n})),e[r++]=o):console.log("MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates"):console.log("MarchingSquaresJS-isoBands: bandcell polygon with null coordinates")}}))})),e}(l)):(OA.verbose&&console.log("MarchingSquaresJS-isoBands: returning polygon paths for entire data grid"),u=function(t){for(var e=[],r=t.rows,n=t.cols,i=[],o=0;o<r;o++)for(var s=0;s<n;s++)if(void 0!==t.cells[o][s]&&t.cells[o][s].edges.length>0){var a=Dd(t.cells[o][s]),u=null,l=s,c=o;null!==a&&i.push([a.p[0]+l,a.p[1]+c]);do{if(null===(u=Qd(t.cells[c][l],a.x,a.y,a.o)))break;if(i.push([u.p[0]+l,u.p[1]+c]),l+=u.x,a=u,(c+=u.y)<0||c>=r||l<0||l>=n||void 0===t.cells[c][l]){var h=Rd(t,l-=u.x,c-=u.y,u.x,u.y,u.o);if(null===h)break;h.path.forEach((function(t){i.push(t)})),l=h.i,c=h.j,a=h}}while(void 0!==t.cells[c][l]&&t.cells[c][l].edges.length>0);e.push(i),i=[],t.cells[o][s].edges.length>0&&s--}return e}(l)),"function"==typeof OA.successCallback&&OA.successCallback(u),u}var GA=64,UA=16,qA=4,jA=1,VA=[],zA=[],YA=[],HA=[],XA=[],JA=[],WA=[],KA=[],ZA=[],$A=[],td=[],ed=[],rd=[],nd=[],id=[],od=[],sd=[],ad=[],ud=[],ld=[],cd=[],hd=[],fd=[],pd=[];WA[85]=$A[85]=-1,KA[85]=td[85]=0,ZA[85]=ed[85]=1,ud[85]=hd[85]=1,ld[85]=fd[85]=0,cd[85]=pd[85]=1,VA[85]=HA[85]=0,zA[85]=XA[85]=-1,YA[85]=id[85]=0,od[85]=rd[85]=0,sd[85]=nd[85]=1,JA[85]=ad[85]=1,hd[1]=hd[169]=0,fd[1]=fd[169]=-1,pd[1]=pd[169]=0,rd[1]=rd[169]=-1,nd[1]=nd[169]=0,id[1]=id[169]=0,$A[4]=$A[166]=0,td[4]=td[166]=-1,ed[4]=ed[166]=1,od[4]=od[166]=1,sd[4]=sd[166]=0,ad[4]=ad[166]=0,WA[16]=WA[154]=0,KA[16]=KA[154]=1,ZA[16]=ZA[154]=1,HA[16]=HA[154]=1,XA[16]=XA[154]=0,JA[16]=JA[154]=1,ud[64]=ud[106]=0,ld[64]=ld[106]=1,cd[64]=cd[106]=0,VA[64]=VA[106]=-1,zA[64]=zA[106]=0,YA[64]=YA[106]=1,ud[2]=ud[168]=0,ld[2]=ld[168]=-1,cd[2]=cd[168]=1,hd[2]=hd[168]=0,fd[2]=fd[168]=-1,pd[2]=pd[168]=0,rd[2]=rd[168]=-1,nd[2]=nd[168]=0,id[2]=id[168]=0,od[2]=od[168]=-1,sd[2]=sd[168]=0,ad[2]=ad[168]=1,WA[8]=WA[162]=0,KA[8]=KA[162]=-1,ZA[8]=ZA[162]=0,$A[8]=$A[162]=0,td[8]=td[162]=-1,ed[8]=ed[162]=1,rd[8]=rd[162]=1,nd[8]=nd[162]=0,id[8]=id[162]=1,od[8]=od[162]=1,sd[8]=sd[162]=0,ad[8]=ad[162]=0,WA[32]=WA[138]=0,KA[32]=KA[138]=1,ZA[32]=ZA[138]=1,$A[32]=$A[138]=0,td[32]=td[138]=1,ed[32]=ed[138]=0,VA[32]=VA[138]=1,zA[32]=zA[138]=0,YA[32]=YA[138]=0,HA[32]=HA[138]=1,XA[32]=XA[138]=0,JA[32]=JA[138]=1,hd[128]=hd[42]=0,fd[128]=fd[42]=1,pd[128]=pd[42]=1,ud[128]=ud[42]=0,ld[128]=ld[42]=1,cd[128]=cd[42]=0,VA[128]=VA[42]=-1,zA[128]=zA[42]=0,YA[128]=YA[42]=1,HA[128]=HA[42]=-1,XA[128]=XA[42]=0,JA[128]=JA[42]=0,$A[5]=$A[165]=-1,td[5]=td[165]=0,ed[5]=ed[165]=0,hd[5]=hd[165]=1,fd[5]=fd[165]=0,pd[5]=pd[165]=0,od[20]=od[150]=0,sd[20]=sd[150]=1,ad[20]=ad[150]=1,HA[20]=HA[150]=0,XA[20]=XA[150]=-1,JA[20]=JA[150]=1,WA[80]=WA[90]=-1,KA[80]=KA[90]=0,ZA[80]=ZA[90]=1,ud[80]=ud[90]=1,ld[80]=ld[90]=0,cd[80]=cd[90]=1,rd[65]=rd[105]=0,nd[65]=nd[105]=1,id[65]=id[105]=0,VA[65]=VA[105]=0,zA[65]=zA[105]=-1,YA[65]=YA[105]=0,WA[160]=WA[10]=-1,KA[160]=KA[10]=0,ZA[160]=ZA[10]=1,$A[160]=$A[10]=-1,td[160]=td[10]=0,ed[160]=ed[10]=0,hd[160]=hd[10]=1,fd[160]=fd[10]=0,pd[160]=pd[10]=0,ud[160]=ud[10]=1,ld[160]=ld[10]=0,cd[160]=cd[10]=1,od[130]=od[40]=0,sd[130]=sd[40]=1,ad[130]=ad[40]=1,rd[130]=rd[40]=0,nd[130]=nd[40]=1,id[130]=id[40]=0,VA[130]=VA[40]=0,zA[130]=zA[40]=-1,YA[130]=YA[40]=0,HA[130]=HA[40]=0,XA[130]=XA[40]=-1,JA[130]=JA[40]=1,$A[37]=$A[133]=0,td[37]=td[133]=1,ed[37]=ed[133]=1,hd[37]=hd[133]=0,fd[37]=fd[133]=1,pd[37]=pd[133]=0,VA[37]=VA[133]=-1,zA[37]=zA[133]=0,YA[37]=YA[133]=0,HA[37]=HA[133]=1,XA[37]=XA[133]=0,JA[37]=JA[133]=0,od[148]=od[22]=-1,sd[148]=sd[22]=0,ad[148]=ad[22]=0,hd[148]=hd[22]=0,fd[148]=fd[22]=-1,pd[148]=pd[22]=1,ud[148]=ud[22]=0,ld[148]=ld[22]=1,cd[148]=cd[22]=1,HA[148]=HA[22]=-1,XA[148]=XA[22]=0,JA[148]=JA[22]=1,WA[82]=WA[88]=0,KA[82]=KA[88]=-1,ZA[82]=ZA[88]=1,od[82]=od[88]=1,sd[82]=sd[88]=0,ad[82]=ad[88]=1,rd[82]=rd[88]=-1,nd[82]=nd[88]=0,id[82]=id[88]=1,ud[82]=ud[88]=0,ld[82]=ld[88]=-1,cd[82]=cd[88]=0,WA[73]=WA[97]=0,KA[73]=KA[97]=1,ZA[73]=ZA[97]=0,$A[73]=$A[97]=0,td[73]=td[97]=-1,ed[73]=ed[97]=0,rd[73]=rd[97]=1,nd[73]=nd[97]=0,id[73]=id[97]=0,VA[73]=VA[97]=1,zA[73]=zA[97]=0,YA[73]=YA[97]=1,WA[145]=WA[25]=0,KA[145]=KA[25]=-1,ZA[145]=ZA[25]=0,rd[145]=rd[25]=1,nd[145]=nd[25]=0,id[145]=id[25]=1,hd[145]=hd[25]=0,fd[145]=fd[25]=1,pd[145]=pd[25]=1,HA[145]=HA[25]=-1,XA[145]=XA[25]=0,JA[145]=JA[25]=0,$A[70]=$A[100]=0,td[70]=td[100]=1,ed[70]=ed[100]=0,od[70]=od[100]=-1,sd[70]=sd[100]=0,ad[70]=ad[100]=1,ud[70]=ud[100]=0,ld[70]=ld[100]=-1,cd[70]=cd[100]=1,VA[70]=VA[100]=1,zA[70]=zA[100]=0,YA[70]=YA[100]=0,$A[101]=$A[69]=0,td[101]=td[69]=1,ed[101]=ed[69]=0,VA[101]=VA[69]=1,zA[101]=zA[69]=0,YA[101]=YA[69]=0,hd[149]=hd[21]=0,fd[149]=fd[21]=1,pd[149]=pd[21]=1,HA[149]=HA[21]=-1,XA[149]=XA[21]=0,JA[149]=JA[21]=0,od[86]=od[84]=-1,sd[86]=sd[84]=0,ad[86]=ad[84]=1,ud[86]=ud[84]=0,ld[86]=ld[84]=-1,cd[86]=cd[84]=1,WA[89]=WA[81]=0,KA[89]=KA[81]=-1,ZA[89]=ZA[81]=0,rd[89]=rd[81]=1,nd[89]=nd[81]=0,id[89]=id[81]=1,WA[96]=WA[74]=0,KA[96]=KA[74]=1,ZA[96]=ZA[74]=0,$A[96]=$A[74]=-1,td[96]=td[74]=0,ed[96]=ed[74]=1,ud[96]=ud[74]=1,ld[96]=ld[74]=0,cd[96]=cd[74]=0,VA[96]=VA[74]=1,zA[96]=zA[74]=0,YA[96]=YA[74]=1,WA[24]=WA[146]=0,KA[24]=KA[146]=-1,ZA[24]=ZA[146]=1,od[24]=od[146]=1,sd[24]=sd[146]=0,ad[24]=ad[146]=1,rd[24]=rd[146]=0,nd[24]=nd[146]=1,id[24]=id[146]=1,HA[24]=HA[146]=0,XA[24]=XA[146]=-1,JA[24]=JA[146]=0,$A[6]=$A[164]=-1,td[6]=td[164]=0,ed[6]=ed[164]=1,od[6]=od[164]=-1,sd[6]=sd[164]=0,ad[6]=ad[164]=0,hd[6]=hd[164]=0,fd[6]=fd[164]=-1,pd[6]=pd[164]=1,ud[6]=ud[164]=1,ld[6]=ld[164]=0,cd[6]=cd[164]=0,rd[129]=rd[41]=0,nd[129]=nd[41]=1,id[129]=id[41]=1,hd[129]=hd[41]=0,fd[129]=fd[41]=1,pd[129]=pd[41]=0,VA[129]=VA[41]=-1,zA[129]=zA[41]=0,YA[129]=YA[41]=0,HA[129]=HA[41]=0,XA[129]=XA[41]=-1,JA[129]=JA[41]=0,od[66]=od[104]=0,sd[66]=sd[104]=1,ad[66]=ad[104]=0,rd[66]=rd[104]=-1,nd[66]=nd[104]=0,id[66]=id[104]=1,ud[66]=ud[104]=0,ld[66]=ld[104]=-1,cd[66]=cd[104]=0,VA[66]=VA[104]=0,zA[66]=zA[104]=-1,YA[66]=YA[104]=1,WA[144]=WA[26]=-1,KA[144]=KA[26]=0,ZA[144]=ZA[26]=0,hd[144]=hd[26]=1,fd[144]=fd[26]=0,pd[144]=pd[26]=1,ud[144]=ud[26]=0,ld[144]=ld[26]=1,cd[144]=cd[26]=1,HA[144]=HA[26]=-1,XA[144]=XA[26]=0,JA[144]=JA[26]=1,$A[36]=$A[134]=0,td[36]=td[134]=1,ed[36]=ed[134]=1,od[36]=od[134]=0,sd[36]=sd[134]=1,ad[36]=ad[134]=0,VA[36]=VA[134]=0,zA[36]=zA[134]=-1,YA[36]=YA[134]=1,HA[36]=HA[134]=1,XA[36]=XA[134]=0,JA[36]=JA[134]=0,WA[9]=WA[161]=-1,KA[9]=KA[161]=0,ZA[9]=ZA[161]=0,$A[9]=$A[161]=0,td[9]=td[161]=-1,ed[9]=ed[161]=0,rd[9]=rd[161]=1,nd[9]=nd[161]=0,id[9]=id[161]=0,hd[9]=hd[161]=1,fd[9]=fd[161]=0,pd[9]=pd[161]=1,WA[136]=0,KA[136]=1,ZA[136]=1,$A[136]=0,td[136]=1,ed[136]=0,od[136]=-1,sd[136]=0,ad[136]=1,rd[136]=-1,nd[136]=0,id[136]=0,hd[136]=0,fd[136]=-1,pd[136]=0,ud[136]=0,ld[136]=-1,cd[136]=1,VA[136]=1,zA[136]=0,YA[136]=0,HA[136]=1,XA[136]=0,JA[136]=1,WA[34]=0,KA[34]=-1,ZA[34]=0,$A[34]=0,td[34]=-1,ed[34]=1,od[34]=1,sd[34]=0,ad[34]=0,rd[34]=1,nd[34]=0,id[34]=1,hd[34]=0,fd[34]=1,pd[34]=1,ud[34]=0,ld[34]=1,cd[34]=0,VA[34]=-1,zA[34]=0,YA[34]=1,HA[34]=-1,XA[34]=0,JA[34]=0,WA[35]=0,KA[35]=1,ZA[35]=1,$A[35]=0,td[35]=-1,ed[35]=1,od[35]=1,sd[35]=0,ad[35]=0,rd[35]=-1,nd[35]=0,id[35]=0,hd[35]=0,fd[35]=-1,pd[35]=0,ud[35]=0,ld[35]=1,cd[35]=0,VA[35]=-1,zA[35]=0,YA[35]=1,HA[35]=1,XA[35]=0,JA[35]=1,WA[153]=0,KA[153]=1,ZA[153]=1,rd[153]=-1,nd[153]=0,id[153]=0,hd[153]=0,fd[153]=-1,pd[153]=0,HA[153]=1,XA[153]=0,JA[153]=1,$A[102]=0,td[102]=-1,ed[102]=1,od[102]=1,sd[102]=0,ad[102]=0,ud[102]=0,ld[102]=1,cd[102]=0,VA[102]=-1,zA[102]=0,YA[102]=1,WA[155]=0,KA[155]=-1,ZA[155]=0,rd[155]=1,nd[155]=0,id[155]=1,hd[155]=0,fd[155]=1,pd[155]=1,HA[155]=-1,XA[155]=0,JA[155]=0,$A[103]=0,td[103]=1,ed[103]=0,od[103]=-1,sd[103]=0,ad[103]=1,ud[103]=0,ld[103]=-1,cd[103]=1,VA[103]=1,zA[103]=0,YA[103]=0,WA[152]=0,KA[152]=1,ZA[152]=1,od[152]=-1,sd[152]=0,ad[152]=1,rd[152]=-1,nd[152]=0,id[152]=0,hd[152]=0,fd[152]=-1,pd[152]=0,ud[152]=0,ld[152]=-1,cd[152]=1,HA[152]=1,XA[152]=0,JA[152]=1,WA[156]=0,KA[156]=-1,ZA[156]=1,od[156]=1,sd[156]=0,ad[156]=1,rd[156]=-1,nd[156]=0,id[156]=0,hd[156]=0,fd[156]=-1,pd[156]=0,ud[156]=0,ld[156]=1,cd[156]=1,HA[156]=-1,XA[156]=0,JA[156]=1,WA[137]=0,KA[137]=1,ZA[137]=1,$A[137]=0,td[137]=1,ed[137]=0,rd[137]=-1,nd[137]=0,id[137]=0,hd[137]=0,fd[137]=-1,pd[137]=0,VA[137]=1,zA[137]=0,YA[137]=0,HA[137]=1,XA[137]=0,JA[137]=1,WA[139]=0,KA[139]=1,ZA[139]=1,$A[139]=0,td[139]=-1,ed[139]=0,rd[139]=1,nd[139]=0,id[139]=0,hd[139]=0,fd[139]=1,pd[139]=0,VA[139]=-1,zA[139]=0,YA[139]=0,HA[139]=1,XA[139]=0,JA[139]=1,WA[98]=0,KA[98]=-1,ZA[98]=0,$A[98]=0,td[98]=-1,ed[98]=1,od[98]=1,sd[98]=0,ad[98]=0,rd[98]=1,nd[98]=0,id[98]=1,ud[98]=0,ld[98]=1,cd[98]=0,VA[98]=-1,zA[98]=0,YA[98]=1,WA[99]=0,KA[99]=1,ZA[99]=0,$A[99]=0,td[99]=-1,ed[99]=1,od[99]=1,sd[99]=0,ad[99]=0,rd[99]=-1,nd[99]=0,id[99]=1,ud[99]=0,ld[99]=-1,cd[99]=0,VA[99]=1,zA[99]=0,YA[99]=1,$A[38]=0,td[38]=-1,ed[38]=1,od[38]=1,sd[38]=0,ad[38]=0,hd[38]=0,fd[38]=1,pd[38]=1,ud[38]=0,ld[38]=1,cd[38]=0,VA[38]=-1,zA[38]=0,YA[38]=1,HA[38]=-1,XA[38]=0,JA[38]=0,$A[39]=0,td[39]=1,ed[39]=1,od[39]=-1,sd[39]=0,ad[39]=0,hd[39]=0,fd[39]=-1,pd[39]=1,ud[39]=0,ld[39]=1,cd[39]=0,VA[39]=-1,zA[39]=0,YA[39]=1,HA[39]=1,XA[39]=0,JA[39]=0;var gd=function(t){return[[t.bottomleft,0],[0,0],[0,t.leftbottom]]},Ad=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0]]},dd=function(t){return[[t.topright,1],[1,1],[1,t.righttop]]},yd=function(t){return[[0,t.lefttop],[0,1],[t.topleft,1]]},vd=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop]]},md=function(t){return[[t.bottomright,0],[t.bottomleft,0],[1,t.righttop],[1,t.rightbottom]]},_d=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.topleft,1],[t.topright,1]]},Id=function(t){return[[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},Ed=[],xd=[],Cd=[],wd=[],bd=[],Bd=[],Sd=[],Md=[];wd[1]=bd[1]=18,wd[169]=bd[169]=18,Cd[4]=xd[4]=12,Cd[166]=xd[166]=12,Ed[16]=Md[16]=4,Ed[154]=Md[154]=4,Bd[64]=Sd[64]=22,Bd[106]=Sd[106]=22,Cd[2]=Bd[2]=17,wd[2]=bd[2]=18,Cd[168]=Bd[168]=17,wd[168]=bd[168]=18,Ed[8]=wd[8]=9,xd[8]=Cd[8]=12,Ed[162]=wd[162]=9,xd[162]=Cd[162]=12,Ed[32]=Md[32]=4,xd[32]=Sd[32]=1,Ed[138]=Md[138]=4,xd[138]=Sd[138]=1,bd[128]=Md[128]=21,Bd[128]=Sd[128]=22,bd[42]=Md[42]=21,Bd[42]=Sd[42]=22,xd[5]=bd[5]=14,xd[165]=bd[165]=14,Cd[20]=Md[20]=6,Cd[150]=Md[150]=6,Ed[80]=Bd[80]=11,Ed[90]=Bd[90]=11,wd[65]=Sd[65]=3,wd[105]=Sd[105]=3,Ed[160]=Bd[160]=11,xd[160]=bd[160]=14,Ed[10]=Bd[10]=11,xd[10]=bd[10]=14,Cd[130]=Md[130]=6,wd[130]=Sd[130]=3,Cd[40]=Md[40]=6,wd[40]=Sd[40]=3,xd[101]=Sd[101]=1,xd[69]=Sd[69]=1,bd[149]=Md[149]=21,bd[21]=Md[21]=21,Cd[86]=Bd[86]=17,Cd[84]=Bd[84]=17,Ed[89]=wd[89]=9,Ed[81]=wd[81]=9,Ed[96]=Sd[96]=0,xd[96]=Bd[96]=15,Ed[74]=Sd[74]=0,xd[74]=Bd[74]=15,Ed[24]=Cd[24]=8,wd[24]=Md[24]=7,Ed[146]=Cd[146]=8,wd[146]=Md[146]=7,xd[6]=Bd[6]=15,Cd[6]=bd[6]=16,xd[164]=Bd[164]=15,Cd[164]=bd[164]=16,wd[129]=Md[129]=7,bd[129]=Sd[129]=20,wd[41]=Md[41]=7,bd[41]=Sd[41]=20,Cd[66]=Sd[66]=2,wd[66]=Bd[66]=19,Cd[104]=Sd[104]=2,wd[104]=Bd[104]=19,Ed[144]=bd[144]=10,Bd[144]=Md[144]=23,Ed[26]=bd[26]=10,Bd[26]=Md[26]=23,xd[36]=Md[36]=5,Cd[36]=Sd[36]=2,xd[134]=Md[134]=5,Cd[134]=Sd[134]=2,Ed[9]=bd[9]=10,xd[9]=wd[9]=13,Ed[161]=bd[161]=10,xd[161]=wd[161]=13,xd[37]=Md[37]=5,bd[37]=Sd[37]=20,xd[133]=Md[133]=5,bd[133]=Sd[133]=20,Cd[148]=bd[148]=16,Bd[148]=Md[148]=23,Cd[22]=bd[22]=16,Bd[22]=Md[22]=23,Ed[82]=Cd[82]=8,wd[82]=Bd[82]=19,Ed[88]=Cd[88]=8,wd[88]=Bd[88]=19,Ed[73]=Sd[73]=0,xd[73]=wd[73]=13,Ed[97]=Sd[97]=0,xd[97]=wd[97]=13,Ed[145]=wd[145]=9,bd[145]=Md[145]=21,Ed[25]=wd[25]=9,bd[25]=Md[25]=21,xd[70]=Sd[70]=1,Cd[70]=Bd[70]=17,xd[100]=Sd[100]=1,Cd[100]=Bd[100]=17,Ed[34]=wd[34]=9,xd[34]=Cd[34]=12,bd[34]=Md[34]=21,Bd[34]=Sd[34]=22,Ed[136]=Md[136]=4,xd[136]=Sd[136]=1,Cd[136]=Bd[136]=17,wd[136]=bd[136]=18,Ed[35]=Md[35]=4,xd[35]=Cd[35]=12,wd[35]=bd[35]=18,Bd[35]=Sd[35]=22,Ed[153]=Md[153]=4,wd[153]=bd[153]=18,xd[102]=Cd[102]=12,Bd[102]=Sd[102]=22,Ed[155]=wd[155]=9,bd[155]=Md[155]=23,xd[103]=Sd[103]=1,Cd[103]=Bd[103]=17,Ed[152]=Md[152]=4,Cd[152]=Bd[152]=17,wd[152]=bd[152]=18,Ed[156]=Cd[156]=8,wd[156]=bd[156]=18,Bd[156]=Md[156]=23,Ed[137]=Md[137]=4,xd[137]=Sd[137]=1,wd[137]=bd[137]=18,Ed[139]=Md[139]=4,xd[139]=wd[139]=13,bd[139]=Sd[139]=20,Ed[98]=wd[98]=9,xd[98]=Cd[98]=12,Bd[98]=Sd[98]=22,Ed[99]=Sd[99]=0,xd[99]=Cd[99]=12,wd[99]=Bd[99]=19,xd[38]=Cd[38]=12,bd[38]=Md[38]=21,Bd[38]=Sd[38]=22,xd[39]=Md[39]=5,Cd[39]=bd[39]=16,Bd[39]=Sd[39]=22;var Ld=[];function Nd(t,e,r){return(t-e)/(r-e)}function Td(t){return t.constructor.toString().indexOf("Array")>-1}function Rd(t,e,r,n,i,o){for(var s=t.cells[r][e],a=s.cval_real,u=e+n,l=r+i,c=[],h=!1;!h;){if(void 0===t.cells[l]||void 0===t.cells[l][u])if(l-=i,u-=n,a=(s=t.cells[l][u]).cval_real,-1===i)if(0===o)if(a&jA)c.push([u,l]),n=-1,i=0,o=0;else{if(!(a&qA)){c.push([u+s.bottomright,l]),n=0,i=1,o=1,h=!0;break}c.push([u+1,l]),n=1,i=0,o=0}else{if(!(a&jA)){if(a&qA){c.push([u+s.bottomright,l]),n=0,i=1,o=1,h=!0;break}c.push([u+s.bottomleft,l]),n=0,i=1,o=0,h=!0;break}c.push([u,l]),n=-1,i=0,o=0}else if(1===i)if(0===o){if(!(a&UA)){if(a&GA){c.push([u+s.topleft,l+1]),n=0,i=-1,o=0,h=!0;break}c.push([u+s.topright,l+1]),n=0,i=-1,o=1,h=!0;break}c.push([u+1,l+1]),n=1,i=0,o=1}else c.push([u+1,l+1]),n=1,i=0,o=1;else if(-1===n)if(0===o){if(!(a&GA)){if(a&jA){c.push([u,l+s.leftbottom]),n=1,i=0,o=0,h=!0;break}c.push([u,l+s.lefttop]),n=1,i=0,o=1,h=!0;break}c.push([u,l+1]),n=0,i=1,o=0}else{if(!(a&GA)){console.log("MarchingSquaresJS-isoBands: wtf");break}c.push([u,l+1]),n=0,i=1,o=0}else{if(1!==n){console.log("MarchingSquaresJS-isoBands: we came from nowhere!");break}if(0===o){if(!(a&qA)){c.push([u+1,l+s.rightbottom]),n=-1,i=0,o=0,h=!0;break}c.push([u+1,l]),n=0,i=-1,o=1}else{if(!(a&qA)){if(a&UA){c.push([u+1,l+s.righttop]),n=-1,i=0,o=1;break}c.push([u+1,l+s.rightbottom]),n=-1,i=0,o=0,h=!0;break}c.push([u+1,l]),n=0,i=-1,o=1}}else if(a=(s=t.cells[l][u]).cval_real,-1===n)if(0===o)if(void 0!==t.cells[l-1]&&void 0!==t.cells[l-1][u])n=0,i=-1,o=1;else{if(!(a&jA)){c.push([u+s.bottomright,l]),n=0,i=1,o=1,h=!0;break}c.push([u,l])}else{if(!(a&GA)){console.log("MarchingSquaresJS-isoBands: found entry from top at "+u+","+l);break}console.log("MarchingSquaresJS-isoBands: proceeding in x-direction!")}else if(1===n){if(0===o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[l+1]&&void 0!==t.cells[l+1][u])n=0,i=1,o=0;else{if(!(a&UA)){c.push([u+s.topleft,l+1]),n=0,i=-1,o=0,h=!0;break}c.push([u+1,l+1]),n=1,i=0,o=1}}else if(-1===i){if(1!==o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[l][u+1])n=1,i=0,o=1;else{if(!(a&qA)){c.push([u+1,l+s.righttop]),n=-1,i=0,o=1,h=!0;break}c.push([u+1,l]),n=0,i=-1,o=1}}else{if(1!==i){console.log("MarchingSquaresJS-isoBands: where did we came from???");break}if(0!==o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[l][u-1])n=-1,i=0,o=0;else{if(!(a&GA)){c.push([u,l+s.leftbottom]),n=1,i=0,o=0,h=!0;break}c.push([u,l+1]),n=0,i=1,o=0}}if(l+=i,(u+=n)===e&&l===r)break}return{path:c,i:u,j:l,x:n,y:i,o:o}}function Dd(t){if(t.edges.length>0){var e=t.edges[t.edges.length-1],r=t.cval_real;switch(e){case 0:return r&UA?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 1:return r&qA?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 2:return r&qA?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 3:return r&jA?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 4:return r&UA?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 5:return r&qA?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 6:return r&qA?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 7:return r&jA?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 8:return r&qA?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.righttop],x:-1,y:0,o:1};case 9:return r&jA?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 10:return r&jA?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.righttop],x:-1,y:0,o:1};case 11:return r&GA?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 12:return r&qA?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 13:return r&jA?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 14:return r&jA?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 15:return r&GA?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 16:return r&qA?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 17:return r&GA?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 18:return r&jA?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 19:return r&GA?{p:[t.bottomleft,0],x:0,y:1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 20:return r&GA?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 21:return r&UA?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.topright,1],x:0,y:-1,o:1};case 22:return r&GA?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 23:return r&UA?{p:[0,t.lefttop],x:1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};default:console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t)}}return null}function Qd(t,e,r,n){var i,o,s,a,u,l=t.cval;switch(e){case-1:if(0===n)i=xd[l],s=$A[l],a=td[l],u=ed[l];else i=Ed[l],s=WA[l],a=KA[l],u=ZA[l];break;case 1:if(0===n)i=bd[l],s=hd[l],a=fd[l],u=pd[l];else i=Bd[l],s=ud[l],a=ld[l],u=cd[l];break;default:switch(r){case-1:if(0===n)i=Sd[l],s=VA[l],a=zA[l],u=YA[l];else i=Md[l],s=HA[l],a=XA[l],u=JA[l];break;case 1:if(0===n)i=wd[l],s=rd[l],a=nd[l],u=id[l];else i=Cd[l],s=od[l],a=sd[l],u=ad[l]}}if(o=t.edges.indexOf(i),void 0===t.edges[o])return null;switch(function(t,e){delete t.edges[e];for(var r=e+1;r<t.edges.length;r++)t.edges[r-1]=t.edges[r];t.edges.pop()}(t,o),l=t.cval_real,i){case 0:l&UA?(e=t.topleft,r=1):(e=1,r=t.righttop);break;case 1:l&qA?(e=1,r=t.rightbottom):(e=t.topleft,r=1);break;case 2:l&qA?(e=t.topleft,r=1):(e=t.bottomright,r=0);break;case 3:l&jA?(e=t.bottomleft,r=0):(e=t.topleft,r=1);break;case 4:l&UA?(e=t.topright,r=1):(e=1,r=t.righttop);break;case 5:l&qA?(e=1,r=t.rightbottom):(e=t.topright,r=1);break;case 6:l&qA?(e=t.topright,r=1):(e=t.bottomright,r=0);break;case 7:l&jA?(e=t.bottomleft,r=0):(e=t.topright,r=1);break;case 8:l&qA?(e=1,r=t.righttop):(e=t.bottomright,r=0);break;case 9:l&jA?(e=t.bottomleft,r=0):(e=1,r=t.righttop);break;case 10:l&jA?(e=1,r=t.righttop):(e=0,r=t.leftbottom);break;case 11:l&GA?(e=0,r=t.lefttop):(e=1,r=t.righttop);break;case 12:l&qA?(e=1,r=t.rightbottom):(e=t.bottomright,r=0);break;case 13:l&jA?(e=t.bottomleft,r=0):(e=1,r=t.rightbottom);break;case 14:l&jA?(e=1,r=t.rightbottom):(e=0,r=t.leftbottom);break;case 15:l&GA?(e=0,r=t.lefttop):(e=1,r=t.rightbottom);break;case 16:l&qA?(e=0,r=t.leftbottom):(e=t.bottomright,r=0);break;case 17:l&GA?(e=0,r=t.lefttop):(e=t.bottomright,r=0);break;case 18:l&jA?(e=t.bottomleft,r=0):(e=0,r=t.leftbottom);break;case 19:l&GA?(e=0,r=t.lefttop):(e=t.bottomleft,r=0);break;case 20:l&GA?(e=0,r=t.leftbottom):(e=t.topleft,r=1);break;case 21:l&UA?(e=t.topright,r=1):(e=0,r=t.leftbottom);break;case 22:l&GA?(e=0,r=t.lefttop):(e=t.topleft,r=1);break;case 23:l&UA?(e=t.topright,r=1):(e=0,r=t.lefttop);break;default:return console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t),null}return void 0!==e&&void 0!==r&&void 0!==s&&void 0!==a&&void 0!==u||(console.log("MarchingSquaresJS-isoBands: undefined value!"),console.log(t),console.log(e+" "+r+" "+s+" "+a+" "+u)),{p:[e,r],x:s,y:a,o:u}}function Pd(t){var e=[],r=[];t.forEach((function(t){var n=Wh(ft([t]));r.push(n),e.push({ring:t,area:n})})),r.sort((function(t,e){return e-t}));var n=[];return r.forEach((function(t){for(var r=0;r<e.length;r++)if(e[r].area===t){n.push(e[r].ring),e.splice(r,1);break}})),n}function kd(t){for(var e=t.map((function(t){return{lrCoordinates:t,grouped:!1}})),r=[];!Fd(e);)for(var n=0;n<e.length;n++)if(!e[n].grouped){var i=[];i.push(e[n].lrCoordinates),e[n].grouped=!0;for(var o=ft([e[n].lrCoordinates]),s=n+1;s<e.length;s++){if(!e[s].grouped)Od(ft([e[s].lrCoordinates]),o)&&(i.push(e[s].lrCoordinates),e[s].grouped=!0)}r.push(i)}return r}function Od(t,e){for(var r=_c(t),n=0;n<r.features.length;n++)if(!zt(r.features[n],e))return!1;return!0}function Fd(t){for(var e=0;e<t.length;e++)if(!1===t[e].grouped)return!1;return!0}function Gd(t,e,r){if(!Nt(r=r||{}))throw new Error("options is invalid");var n=r.pivot,i=r.mutate;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("angle is required");return 0===e||(n||(n=mc(t)),!1!==i&&void 0!==i||(t=sl(t)),Ta(t,(function(t){var r=bA(n,t)+e,i=qh(n,t),o=Pt(SA(n,i,r));t[0]=o[0],t[1]=o[1]}))),t}function Ud(t,e,r){if(!Nt(r=r||{}))throw new Error("options is invalid");var n=r.origin,i=r.mutate;if(!t)throw new Error("geojson required");if("number"!=typeof e||0===e)throw new Error("invalid factor");var o=Array.isArray(n)||"object"==typeof n;return!0!==i&&(t=sl(t)),"FeatureCollection"!==t.type||o?qd(t,e,n):(Pa(t,(function(r,i){t.features[i]=qd(r,e,n)})),t)}function qd(t,e,r){var n="Point"===qt(t);return r=function(t,e){null==e&&(e="centroid");if(Array.isArray(e)||"object"==typeof e)return Qt(e);var r=t.bbox?t.bbox:Wa(t),n=r[0],i=r[1],o=r[2],s=r[3];switch(e){case"sw":case"southwest":case"westsouth":case"bottomleft":return ct([n,i]);case"se":case"southeast":case"eastsouth":case"bottomright":return ct([o,i]);case"nw":case"northwest":case"westnorth":case"topleft":return ct([n,s]);case"ne":case"northeast":case"eastnorth":case"topright":return ct([o,s]);case"center":return vc(t);case void 0:case null:case"centroid":return mc(t);default:throw new Error("invalid origin")}}(t,r),1===e||n||Ta(t,(function(t){var n=qh(r,t),i=bA(r,t),o=Pt(SA(r,n*e,i));t[0]=o[0],t[1]=o[1],3===t.length&&(t[2]*=e)})),t}function jd(t){var e=t[0],r=t[1];return[r[0]-e[0],r[1]-e[1]]}function Vd(t,e){return t[0]*e[1]-e[0]*t[1]}function zd(t,e){return!function(t,e){return 0===Vd(jd(t),jd(e))}(t,e)&&function(t,e){var r,n,i=t[0],o=jd(t),s=e[0],a=jd(e),u=Vd(o,a),l=function(t,e){return[t[0]+e[0],t[1]+e[1]]}(i,function(t,e){return[t*e[0],t*e[1]]}(Vd((n=i,[(r=s)[0]-n[0],r[1]-n[1]]),a)/u,o));return l}(t,e)}function Yd(t,e,r){var n=[],i=Ct(e,r),o=Pt(t),s=[];return o.forEach((function(t,e){if(e!==o.length-1){var r=(l=t,c=o[e+1],h=i,f=Math.sqrt((l[0]-c[0])*(l[0]-c[0])+(l[1]-c[1])*(l[1]-c[1])),p=l[0]+h*(c[1]-l[1])/f,g=c[0]+h*(c[1]-l[1])/f,A=l[1]+h*(l[0]-c[0])/f,d=c[1]+h*(l[0]-c[0])/f,[[p,A],[g,d]]);if(n.push(r),e>0){var a=n[e-1],u=zd(r,a);!1!==u&&(a[1]=u,r[0]=u),s.push(a[0]),e===o.length-2&&(s.push(r[0]),s.push(r[1]))}2===o.length&&(s.push(r[0]),s.push(r[1]))}var l,c,h,f,p,g,A,d})),gt(s,t.properties)}function Hd(t,e,r){var n=e[0]-t[0],i=e[1]-t[1],o=r[0]-e[0];return function(t){return(t>0)-(t<0)||+t}(n*(r[1]-e[1])-o*i)}function Xd(t,e){return e.geometry.coordinates[0].every((function(e){return zt(ct(e),t)}))}Ld[1]=Ld[169]=gd,Ld[4]=Ld[166]=Ad,Ld[16]=Ld[154]=dd,Ld[64]=Ld[106]=yd,Ld[168]=Ld[2]=vd,Ld[162]=Ld[8]=md,Ld[138]=Ld[32]=_d,Ld[42]=Ld[128]=Id,Ld[5]=Ld[165]=function(t){return[[0,0],[0,t.leftbottom],[1,t.rightbottom],[1,0]]},Ld[20]=Ld[150]=function(t){return[[1,0],[t.bottomright,0],[t.topright,1],[1,1]]},Ld[80]=Ld[90]=function(t){return[[1,1],[1,t.righttop],[0,t.lefttop],[0,1]]},Ld[65]=Ld[105]=function(t){return[[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},Ld[160]=Ld[10]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.leftbottom],[0,t.lefttop]]},Ld[130]=Ld[40]=function(t){return[[t.topleft,1],[t.topright,1],[t.bottomright,0],[t.bottomleft,0]]},Ld[85]=function(){return[[0,0],[0,1],[1,1],[1,0]]},Ld[101]=Ld[69]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,1],[t.topleft,1]]},Ld[149]=Ld[21]=function(t){return[[t.topright,1],[1,1],[1,0],[0,0],[0,t.leftbottom]]},Ld[86]=Ld[84]=function(t){return[[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[1,1]]},Ld[89]=Ld[81]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,1]]},Ld[96]=Ld[74]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.lefttop],[0,1],[t.topleft,1]]},Ld[24]=Ld[146]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[t.topright,1]]},Ld[6]=Ld[164]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop]]},Ld[129]=Ld[41]=function(t){return[[t.topright,1],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1]]},Ld[66]=Ld[104]=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Ld[144]=Ld[26]=function(t){return[[1,1],[1,t.righttop],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Ld[36]=Ld[134]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[t.topleft,1],[t.topright,1]]},Ld[9]=Ld[161]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom]]},Ld[37]=Ld[133]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},Ld[148]=Ld[22]=function(t){return[[1,1],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Ld[82]=Ld[88]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1]]},Ld[73]=Ld[97]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},Ld[145]=Ld[25]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},Ld[70]=Ld[100]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Ld[34]=function(t){return[Id(t),md(t)]},Ld[35]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},Ld[136]=function(t){return[_d(t),vd(t)]},Ld[153]=function(t){return[dd(t),gd(t)]},Ld[102]=function(t){return[Ad(t),yd(t)]},Ld[155]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},Ld[103]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Ld[152]=function(t){return[dd(t),vd(t)]},Ld[156]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Ld[137]=function(t){return[_d(t),gd(t)]},Ld[139]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},Ld[98]=function(t){return[md(t),yd(t)]},Ld[99]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Ld[38]=function(t){return[Ad(t),Id(t)]},Ld[39]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]};var Jd=function(){function t(e){this.id=t.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return t.buildId=function(t){return t.join(",")},t.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter((function(e){return e.from.id!==t.from.id}))},t.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter((function(e){return e.to.id!==t.to.id}))},t.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},t.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort((function(e,r){var n=e.to,i=r.to;if(n.coordinates[0]-t.coordinates[0]>=0&&i.coordinates[0]-t.coordinates[0]<0)return 1;if(n.coordinates[0]-t.coordinates[0]<0&&i.coordinates[0]-t.coordinates[0]>=0)return-1;if(n.coordinates[0]-t.coordinates[0]==0&&i.coordinates[0]-t.coordinates[0]==0)return n.coordinates[1]-t.coordinates[1]>=0||i.coordinates[1]-t.coordinates[1]>=0?n.coordinates[1]-i.coordinates[1]:i.coordinates[1]-n.coordinates[1];var o=Hd(t.coordinates,n.coordinates,i.coordinates);return o<0?1:o>0?-1:Math.pow(n.coordinates[0]-t.coordinates[0],2)+Math.pow(n.coordinates[1]-t.coordinates[1],2)-(Math.pow(i.coordinates[0]-t.coordinates[0],2)+Math.pow(i.coordinates[1]-t.coordinates[1],2))})),this.outerEdgesSorted=!0)},t.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},t.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},t.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},t}(),Wd=function(){function t(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return t.prototype.getSymetric=function(){return this.symetric||(this.symetric=new t(this.to,this.from),this.symetric.symetric=this),this.symetric},t.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},t.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},t.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},t.prototype.toLineString=function(){return gt([this.from.coordinates,this.to.coordinates])},t.prototype.compareTo=function(t){return Hd(t.from.coordinates,t.to.coordinates,this.to.coordinates)},t}(),Kd=function(){function t(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return t.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},t.prototype.get=function(t){return this.edges[t]},Object.defineProperty(t.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),t.prototype.forEach=function(t){this.edges.forEach(t)},t.prototype.map=function(t){return this.edges.map(t)},t.prototype.some=function(t){return this.edges.some(t)},t.prototype.isValid=function(){return!0},t.prototype.isHole=function(){var t=this,e=this.edges.reduce((function(e,r,n){return r.from.coordinates[1]>t.edges[e].from.coordinates[1]&&(e=n),e}),0),r=(0===e?this.length:e)-1,n=(e+1)%this.length,i=Hd(this.edges[r].from.coordinates,this.edges[e].from.coordinates,this.edges[n].from.coordinates);return 0===i?this.edges[r].from.coordinates[0]>this.edges[n].from.coordinates[0]:i>0},t.prototype.toMultiPoint=function(){return vt(this.edges.map((function(t){return t.from.coordinates})))},t.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map((function(t){return t.from.coordinates}));return t.push(this.edges[0].from.coordinates),this.polygon=ft([t])},t.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=pc(this.toPolygon())},t.findEdgeRingContaining=function(t,e){var r,n,i=t.getEnvelope();return e.forEach((function(e){var o,s,a,u,l,c,h=e.getEnvelope();if((n&&(r=n.getEnvelope()),s=i,a=(o=h).geometry.coordinates[0].map((function(t){return t[0]})),u=o.geometry.coordinates[0].map((function(t){return t[1]})),l=s.geometry.coordinates[0].map((function(t){return t[0]})),c=s.geometry.coordinates[0].map((function(t){return t[1]})),Math.max.apply(null,a)!==Math.max.apply(null,l)||Math.max.apply(null,u)!==Math.max.apply(null,c)||Math.min.apply(null,a)!==Math.min.apply(null,l)||Math.min.apply(null,u)!==Math.min.apply(null,c))&&Xd(h,i)){for(var f=t.map((function(t){return t.from.coordinates})),p=void 0,g=function(t){e.some((function(e){return r=t,n=e.from.coordinates,r[0]===n[0]&&r[1]===n[1];var r,n}))||(p=t)},A=0,d=f;A<d.length;A++){g(d[A])}p&&e.inside(ct(p))&&(n&&!Xd(r,h)||(n=e))}})),n},t.prototype.inside=function(t){return zt(t,this.toPolygon())},t}(),Zd=Kd;var $d=function(){function t(){this.edges=[],this.nodes={}}return t.fromGeoJson=function(e){!function(t){if(!t)throw new Error("No geojson passed");if("FeatureCollection"!==t.type&&"GeometryCollection"!==t.type&&"MultiLineString"!==t.type&&"LineString"!==t.type&&"Feature"!==t.type)throw new Error("Invalid input type '"+t.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}(e);var r=new t;return Ua(e,(function(t){Ft(t,"LineString","Graph::fromGeoJson"),Ra(t,(function(t,e){if(t){var n=r.getNode(t),i=r.getNode(e);r.addEdge(n,i)}return e}))})),r},t.prototype.getNode=function(t){var e=Jd.buildId(t),r=this.nodes[e];return r||(r=this.nodes[e]=new Jd(t)),r},t.prototype.addEdge=function(t,e){var r=new Wd(t,e),n=r.getSymetric();this.edges.push(r),this.edges.push(n)},t.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map((function(e){return t.nodes[e]})).forEach((function(e){return t._removeIfDangle(e)}))},t.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var r=t.getOuterEdges().map((function(t){return t.to}));this.removeNode(t),r.forEach((function(t){return e._removeIfDangle(t)}))}},t.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach((function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))}))},t.prototype._computeNextCWEdges=function(t){var e=this;void 0===t?Object.keys(this.nodes).forEach((function(t){return e._computeNextCWEdges(e.nodes[t])})):t.getOuterEdges().forEach((function(e,r){t.getOuterEdge((0===r?t.getOuterEdges().length:r)-1).symetric.next=e}))},t.prototype._computeNextCCWEdges=function(t,e){for(var r,n,i=t.getOuterEdges(),o=i.length-1;o>=0;--o){var s=i[o],a=s.symetric,u=void 0,l=void 0;s.label===e&&(u=s),a.label===e&&(l=a),u&&l&&(l&&(n=l),u&&(n&&(n.next=u,n=void 0),r||(r=u)))}n&&(n.next=r)},t.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach((function(r){if(!(r.label>=0)){t.push(r);var n=r;do{n.label=e,n=n.next}while(!r.isEqual(n));e++}})),t},t.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach((function(t){t.label=void 0})),this._findLabeledEdgeRings().forEach((function(e){t._findIntersectionNodes(e).forEach((function(r){t._computeNextCCWEdges(r,e.label)}))}));var e=[];return this.edges.forEach((function(r){r.ring||e.push(t._findEdgeRing(r))})),e},t.prototype._findIntersectionNodes=function(t){var e=[],r=t,n=function(){var n=0;r.from.getOuterEdges().forEach((function(e){e.label===t.label&&++n})),n>1&&e.push(r.from),r=r.next};do{n()}while(!t.isEqual(r));return e},t.prototype._findEdgeRing=function(t){var e=t,r=new Zd;do{r.push(e),e.ring=r,e=e.next}while(!t.isEqual(e));return r},t.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach((function(t){return e.removeEdge(t)})),t.innerEdges.forEach((function(t){return e.removeEdge(t)})),delete this.nodes[t.id]},t.prototype.removeEdge=function(t){this.edges=this.edges.filter((function(e){return!e.isEqual(t)})),t.deleteEdge()},t}(),ty=$d;function ey(t,e){var r=!0;return Ua(t,(function(t){Ua(e,(function(e){if(!1===r)return!1;r=function(t,e){switch(t.type){case"Point":switch(e.type){case"Point":return r=t.coordinates,n=e.coordinates,!(r[0]===n[0]&&r[1]===n[1]);case"LineString":return!ry(e,t);case"Polygon":return!zt(t,e)}break;case"LineString":switch(e.type){case"Point":return!ry(t,e);case"LineString":return!function(t,e){if(Fh(t,e).features.length>0)return!0;return!1}(t,e);case"Polygon":return!ny(e,t)}break;case"Polygon":switch(e.type){case"Point":return!zt(e,t);case"LineString":return!ny(t,e);case"Polygon":return!function(t,e){for(var r=0,n=t.coordinates[0];r<n.length;r++){if(zt(n[r],e))return!0}for(var i=0,o=e.coordinates[0];i<o.length;i++){if(zt(o[i],t))return!0}var s=Fh(Rf(t),Rf(e));if(s.features.length>0)return!0;return!1}(e,t)}}var r,n;return!1}(t.geometry,e.geometry)}))})),r}function ry(t,e){for(var r=0;r<t.coordinates.length-1;r++)if(iy(t.coordinates[r],t.coordinates[r+1],e.coordinates))return!0;return!1}function ny(t,e){for(var r=0,n=e.coordinates;r<n.length;r++){if(zt(n[r],t))return!0}return Fh(e,Rf(t)).features.length>0}function iy(t,e,r){var n=r[0]-t[0],i=r[1]-t[1],o=e[0]-t[0],s=e[1]-t[1];return 0==n*s-i*o&&(Math.abs(o)>=Math.abs(s)?o>0?t[0]<=r[0]&&r[0]<=e[0]:e[0]<=r[0]&&r[0]<=t[0]:s>0?t[1]<=r[1]&&r[1]<=e[1]:e[1]<=r[1]&&r[1]<=t[1])}function oy(t,e){return!(t[0]>e[0])&&(!(t[2]<e[2])&&(!(t[1]>e[1])&&!(t[3]<e[3])))}function sy(t,e){return t[0]===e[0]&&t[1]===e[1]}function ay(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}function uy(t,e){for(var r=!1,n=!1,i=t.coordinates.length,o=0;o<i&&!r&&!n;){for(var s=0;s<e.coordinates.length-1;s++){var a=!0;0!==s&&s!==e.coordinates.length-2||(a=!1),hy(e.coordinates[s],e.coordinates[s+1],t.coordinates[o],a)?r=!0:n=!0}o++}return r&&n}function ly(t,e){return Fh(t,Df(e)).features.length>0}function cy(t,e){for(var r=!1,n=!1,i=t.coordinates.length,o=0;o<i&&(!r||!n);o++)zt(ct(t.coordinates[o]),e)?r=!0:n=!0;return n&&r}function hy(t,e,r,n){var i=r[0]-t[0],o=r[1]-t[1],s=e[0]-t[0],a=e[1]-t[1];return 0==i*a-o*s&&(n?Math.abs(s)>=Math.abs(a)?s>0?t[0]<=r[0]&&r[0]<=e[0]:e[0]<=r[0]&&r[0]<=t[0]:a>0?t[1]<=r[1]&&r[1]<=e[1]:e[1]<=r[1]&&r[1]<=t[1]:Math.abs(s)>=Math.abs(a)?s>0?t[0]<r[0]&&r[0]<e[0]:e[0]<r[0]&&r[0]<t[0]:a>0?t[1]<r[1]&&r[1]<e[1]:e[1]<r[1]&&r[1]<t[1])}var fy=EA,py=function(t){this.precision=t&&t.precision?t.precision:17,this.direction=!(!t||!t.direction)&&t.direction,this.pseudoNode=!(!t||!t.pseudoNode)&&t.pseudoNode,this.objectComparator=t&&t.objectComparator?t.objectComparator:dy};function gy(t){return t.coordinates.map((function(e){return{type:t.type.replace("Multi",""),coordinates:e}}))}function Ay(t,e){return t.hasOwnProperty("coordinates")?t.coordinates.length===e.coordinates.length:t.length===e.length}function dy(t,e){return fy(t,e,{strict:!0})}py.prototype.compare=function(t,e){if(t.type!==e.type||!Ay(t,e))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,e.coordinates);case"LineString":return this.compareLine(t.coordinates,e.coordinates,0,!1);case"Polygon":return this.comparePolygon(t,e);case"Feature":return this.compareFeature(t,e);default:if(0===t.type.indexOf("Multi")){var r=this,n=gy(t),i=gy(e);return n.every((function(t){return this.some((function(e){return r.compare(t,e)}))}),i)}}return!1},py.prototype.compareCoord=function(t,e){if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(t[r].toFixed(this.precision)!==e[r].toFixed(this.precision))return!1;return!0},py.prototype.compareLine=function(t,e,r,n){if(!Ay(t,e))return!1;var i=this.pseudoNode?t:this.removePseudo(t),o=this.pseudoNode?e:this.removePseudo(e);if(!n||this.compareCoord(i[0],o[0])||(o=this.fixStartIndex(o,i))){var s=this.compareCoord(i[r],o[r]);return this.direction||s?this.comparePath(i,o):!!this.compareCoord(i[r],o[o.length-(1+r)])&&this.comparePath(i.slice().reverse(),o)}},py.prototype.fixStartIndex=function(t,e){for(var r,n=-1,i=0;i<t.length;i++)if(this.compareCoord(t[i],e[0])){n=i;break}return n>=0&&(r=[].concat(t.slice(n,t.length),t.slice(1,n+1))),r},py.prototype.comparePath=function(t,e){var r=this;return t.every((function(t,e){return r.compareCoord(t,this[e])}),e)},py.prototype.comparePolygon=function(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){var r=t.coordinates.slice(1,t.coordinates.length),n=e.coordinates.slice(1,e.coordinates.length),i=this;return r.every((function(t){return this.some((function(e){return i.compareLine(t,e,1,!0)}))}),n)}return!1},py.prototype.compareFeature=function(t,e){return!(t.id!==e.id||!this.objectComparator(t.properties,e.properties)||!this.compareBBox(t,e))&&this.compare(t.geometry,e.geometry)},py.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},py.prototype.removePseudo=function(t){return t};var yy=py;function vy(t,e){var r=!1;return Ua(t,(function(t){Ua(e,(function(e){if(!0===r)return!0;r=!ey(t.geometry,e.geometry)}))})),r}var my={exports:{}},_y={exports:{}};
|
|
108
|
+
/**
|
|
109
|
+
* DBSCAN - Density based clustering
|
|
110
|
+
*
|
|
111
|
+
* @author Lukasz Krawczyk <contact@lukaszkrawczyk.eu>
|
|
112
|
+
* @copyright MIT
|
|
113
|
+
*/
|
|
114
|
+
!function(t){function e(t,e,r,n){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(t,e,r,n)}e.prototype.run=function(t,e,r,n){this._init(t,e,r,n);for(var i=0;i<this._datasetLength;i++)if(1!==this._visited[i]){this._visited[i]=1;var o=this._regionQuery(i);if(o.length<this.minPts)this.noise.push(i);else{var s=this.clusters.length;this.clusters.push([]),this._addToCluster(i,s),this._expandCluster(s,o)}}return this.clusters},e.prototype._init=function(t,e,r,n){if(t){if(!(t instanceof Array))throw Error("Dataset must be of type array, "+typeof t+" given");this.dataset=t,this.clusters=[],this.noise=[],this._datasetLength=t.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}e&&(this.epsilon=e),r&&(this.minPts=r),n&&(this.distance=n)},e.prototype._expandCluster=function(t,e){for(var r=0;r<e.length;r++){var n=e[r];if(1!==this._visited[n]){this._visited[n]=1;var i=this._regionQuery(n);i.length>=this.minPts&&(e=this._mergeArrays(e,i))}1!==this._assigned[n]&&this._addToCluster(n,t)}},e.prototype._addToCluster=function(t,e){this.clusters[e].push(t),this._assigned[t]=1},e.prototype._regionQuery=function(t){for(var e=[],r=0;r<this._datasetLength;r++){this.distance(this.dataset[t],this.dataset[r])<this.epsilon&&e.push(r)}return e},e.prototype._mergeArrays=function(t,e){for(var r=e.length,n=0;n<r;n++){var i=e[n];t.indexOf(i)<0&&t.push(i)}return t},e.prototype._euclideanDistance=function(t,e){for(var r=0,n=Math.min(t.length,e.length);n--;)r+=(t[n]-e[n])*(t[n]-e[n]);return Math.sqrt(r)},t.exports&&(t.exports=e)}(_y);var Iy={exports:{}};!function(t){
|
|
115
|
+
/**
|
|
116
|
+
* KMEANS clustering
|
|
117
|
+
*
|
|
118
|
+
* @author Lukasz Krawczyk <contact@lukaszkrawczyk.eu>
|
|
119
|
+
* @copyright MIT
|
|
120
|
+
*/
|
|
121
|
+
function e(t,e,r){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(t,e,r)}e.prototype.init=function(t,e,r){this.assignments=[],this.centroids=[],void 0!==t&&(this.dataset=t),void 0!==e&&(this.k=e),void 0!==r&&(this.distance=r)},e.prototype.run=function(t,e){this.init(t,e);for(var r=this.dataset.length,n=0;n<this.k;n++)this.centroids[n]=this.randomCentroid();for(var i=!0;i;){i=this.assign();for(var o=0;o<this.k;o++){for(var s=new Array(c),a=0,u=0;u<c;u++)s[u]=0;for(var l=0;l<r;l++){var c=this.dataset[l].length;if(o===this.assignments[l]){for(u=0;u<c;u++)s[u]+=this.dataset[l][u];a++}}if(a>0){for(u=0;u<c;u++)s[u]/=a;this.centroids[o]=s}else this.centroids[o]=this.randomCentroid(),i=!0}}return this.getClusters()},e.prototype.randomCentroid=function(){var t,e,r=this.dataset.length-1;do{e=Math.round(Math.random()*r),t=this.dataset[e]}while(this.centroids.indexOf(t)>=0);return t},e.prototype.assign=function(){for(var t,e=!1,r=this.dataset.length,n=0;n<r;n++)(t=this.argmin(this.dataset[n],this.centroids,this.distance))!=this.assignments[n]&&(this.assignments[n]=t,e=!0);return e},e.prototype.getClusters=function(){for(var t,e=new Array(this.k),r=0;r<this.assignments.length;r++)void 0===e[t=this.assignments[r]]&&(e[t]=[]),e[t].push(r);return e},e.prototype.argmin=function(t,e,r){for(var n,i=Number.MAX_VALUE,o=0,s=e.length,a=0;a<s;a++)(n=r(t,e[a]))<i&&(i=n,o=a);return o},e.prototype.distance=function(t,e){for(var r=0,n=Math.min(t.length,e.length);n--;){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)},t.exports&&(t.exports=e)}(Iy);var Ey={exports:{}},xy={exports:{}};
|
|
122
|
+
/**
|
|
123
|
+
* PriorityQueue
|
|
124
|
+
* Elements in this queue are sorted according to their value
|
|
125
|
+
*
|
|
126
|
+
* @author Lukasz Krawczyk <contact@lukaszkrawczyk.eu>
|
|
127
|
+
* @copyright MIT
|
|
128
|
+
*/
|
|
129
|
+
!function(t){function e(t,e,r){this._queue=[],this._priorities=[],this._sorting="desc",this._init(t,e,r)}e.prototype.insert=function(t,e){for(var r=this._queue.length,n=r;n--;){var i=this._priorities[n];"desc"===this._sorting?e>i&&(r=n):e<i&&(r=n)}this._insertAt(t,e,r)},e.prototype.remove=function(t){for(var e=this._queue.length;e--;){if(t===this._queue[e]){this._queue.splice(e,1),this._priorities.splice(e,1);break}}},e.prototype.forEach=function(t){this._queue.forEach(t)},e.prototype.getElements=function(){return this._queue},e.prototype.getElementPriority=function(t){return this._priorities[t]},e.prototype.getPriorities=function(){return this._priorities},e.prototype.getElementsWithPriorities=function(){for(var t=[],e=0,r=this._queue.length;e<r;e++)t.push([this._queue[e],this._priorities[e]]);return t},e.prototype._init=function(t,e,r){if(t&&e){if(this._queue=[],this._priorities=[],t.length!==e.length)throw new Error("Arrays must have the same length");for(var n=0;n<t.length;n++)this.insert(t[n],e[n])}r&&(this._sorting=r)},e.prototype._insertAt=function(t,e,r){this._queue.length===r?(this._queue.push(t),this._priorities.push(e)):(this._queue.splice(r,0,t),this._priorities.splice(r,0,e))},t.exports&&(t.exports=e)}(xy),function(t){if(t.exports)var e=xy.exports;
|
|
130
|
+
/**
|
|
131
|
+
* OPTICS - Ordering points to identify the clustering structure
|
|
132
|
+
*
|
|
133
|
+
* @author Lukasz Krawczyk <contact@lukaszkrawczyk.eu>
|
|
134
|
+
* @copyright MIT
|
|
135
|
+
*/function r(t,e,r,n){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(t,e,r,n)}r.prototype.run=function(t,r,n,i){this._init(t,r,n,i);for(var o=0,s=this.dataset.length;o<s;o++)if(1!==this._processed[o]){this._processed[o]=1,this.clusters.push([o]);var a=this.clusters.length-1;this._orderedList.push(o);var u=new e(null,null,"asc"),l=this._regionQuery(o);void 0!==this._distanceToCore(o)&&(this._updateQueue(o,l,u),this._expandCluster(a,u))}return this.clusters},r.prototype.getReachabilityPlot=function(){for(var t=[],e=0,r=this._orderedList.length;e<r;e++){var n=this._orderedList[e],i=this._reachability[n];t.push([n,i])}return t},r.prototype._init=function(t,e,r,n){if(t){if(!(t instanceof Array))throw Error("Dataset must be of type array, "+typeof t+" given");this.dataset=t,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}e&&(this.epsilon=e),r&&(this.minPts=r),n&&(this.distance=n)},r.prototype._updateQueue=function(t,e,r){var n=this;this._coreDistance=this._distanceToCore(t),e.forEach((function(e){if(void 0===n._processed[e]){var i=n.distance(n.dataset[t],n.dataset[e]),o=Math.max(n._coreDistance,i);void 0===n._reachability[e]?(n._reachability[e]=o,r.insert(e,o)):o<n._reachability[e]&&(n._reachability[e]=o,r.remove(e),r.insert(e,o))}}))},r.prototype._expandCluster=function(t,e){for(var r=e.getElements(),n=0,i=r.length;n<i;n++){var o=r[n];if(void 0===this._processed[o]){var s=this._regionQuery(o);this._processed[o]=1,this.clusters[t].push(o),this._orderedList.push(o),void 0!==this._distanceToCore(o)&&(this._updateQueue(o,s,e),this._expandCluster(t,e))}}},r.prototype._distanceToCore=function(t){for(var e=this.epsilon,r=0;r<e;r++){if(this._regionQuery(t,r).length>=this.minPts)return r}},r.prototype._regionQuery=function(t,e){e=e||this.epsilon;for(var r=[],n=0,i=this.dataset.length;n<i;n++)this.distance(this.dataset[t],this.dataset[n])<e&&r.push(n);return r},r.prototype._euclideanDistance=function(t,e){for(var r=0,n=Math.min(t.length,e.length);n--;)r+=(t[n]-e[n])*(t[n]-e[n]);return Math.sqrt(r)},t.exports&&(t.exports=r)}(Ey),function(t){t.exports&&(t.exports={DBSCAN:_y.exports,KMEANS:Iy.exports,OPTICS:Ey.exports,PriorityQueue:xy.exports})}(my);var Cy=my.exports;var wy={eudist:function(t,e,r){for(var n=t.length,i=0,o=0;o<n;o++){var s=(t[o]||0)-(e[o]||0);i+=s*s}return r?Math.sqrt(i):i},mandist:function(t,e,r){for(var n=t.length,i=0,o=0;o<n;o++)i+=Math.abs((t[o]||0)-(e[o]||0));return r?Math.sqrt(i):i},dist:function(t,e,r){var n=Math.abs(t-e);return r?n:n*n}},by=wy.eudist,By=wy.dist,Sy={kmrand:function(t,e){for(var r={},n=[],i=e<<2,o=t.length,s=t[0].length>0;n.length<e&&i-- >0;){var a=t[Math.floor(Math.random()*o)],u=s?a.join("_"):""+a;r[u]||(r[u]=!0,n.push(a))}if(n.length<e)throw new Error("Error initializating clusters");return n},kmpp:function(t,e){var r=t[0].length?by:By,n=[],i=t.length,o=t[0].length>0,s=t[Math.floor(Math.random()*i)];for(o&&s.join("_"),n.push(s);n.length<e;){for(var a=[],u=n.length,l=0,c=[],h=0;h<i;h++){for(var f=1/0,p=0;p<u;p++){var g=r(t[h],n[p]);g<=f&&(f=g)}a[h]=f}for(var A=0;A<i;A++)l+=a[A];for(var d=0;d<i;d++)c[d]={i:d,v:t[d],pr:a[d]/l,cs:0};c.sort((function(t,e){return t.pr-e.pr})),c[0].cs=c[0].pr;for(var y=1;y<i;y++)c[y].cs=c[y-1].cs+c[y].pr;for(var v=Math.random(),m=0;m<i-1&&c[m++].cs<v;);n.push(c[m-1].v)}return n}},My=wy.eudist,Ly=Sy.kmrand,Ny=Sy.kmpp;function Ty(t,e,r){r=r||[];for(var n=0;n<t;n++)r[n]=e;return r}var Ry=function(t,e,r,n){var i=[],o=[],s=[],a=[],u=!1,l=n||1e4,c=t.length,h=t[0].length,f=h>0,p=[];if(r)i="kmrand"==r?Ly(t,e):"kmpp"==r?Ny(t,e):r;else for(var g={};i.length<e;){var A=Math.floor(Math.random()*c);g[A]||(g[A]=!0,i.push(t[A]))}do{Ty(e,0,p);for(var d=0;d<c;d++){for(var y=1/0,v=0,m=0;m<e;m++){(a=f?My(t[d],i[m]):Math.abs(t[d]-i[m]))<=y&&(y=a,v=m)}s[d]=v,p[v]++}for(var _=[],I=(o=[],0);I<e;I++)_[I]=f?Ty(h,0,_[I]):0,o[I]=i[I];if(f){for(var E=0;E<e;E++)i[E]=[];for(var x=0;x<c;x++)for(var C=_[s[x]],w=t[x],b=0;b<h;b++)C[b]+=w[b];u=!0;for(var B=0;B<e;B++){for(var S=i[B],M=_[B],L=o[B],N=p[B],T=0;T<h;T++)S[T]=M[T]/N||0;if(u)for(var R=0;R<h;R++)if(L[R]!=S[R]){u=!1;break}}}else{for(var D=0;D<c;D++){_[s[D]]+=t[D]}for(var Q=0;Q<e;Q++)i[Q]=_[Q]/p[Q]||0;u=!0;for(var P=0;P<e;P++)if(o[P]!=i[P]){u=!1;break}}u=u||--l<=0}while(!u);return{it:1e4-l,k:e,idxs:s,centroids:i}};function Dy(t,e){return wt(bA(t[0],t[1]))===wt(bA(e[0],e[1]))}function Qy(t,e){if(t.geometry&&t.geometry.type)return t.geometry.type;if(t.type)return t.type;throw new Error("Invalid GeoJSON object for "+e)}function Py(t){for(var e=t,r=[];e.parent;)r.unshift(e),e=e.parent;return r}var ky={search:function(t,e,r,n){t.cleanDirty();var i=(n=n||{}).heuristic||ky.heuristics.manhattan,o=n.closest||!1,s=new Gy((function(t){return t.f})),a=e;for(e.h=i(e,r),s.push(e);s.size()>0;){var u=s.pop();if(u===r)return Py(u);u.closed=!0;for(var l=t.neighbors(u),c=0,h=l.length;c<h;++c){var f=l[c];if(!f.closed&&!f.isWall()){var p=u.g+f.getCost(u),g=f.visited;(!g||p<f.g)&&(f.visited=!0,f.parent=u,f.h=f.h||i(f,r),f.g=p,f.f=f.g+f.h,t.markDirty(f),o&&(f.h<a.h||f.h===a.h&&f.g<a.g)&&(a=f),g?s.rescoreElement(f):s.push(f))}}}return o?Py(a):[]},heuristics:{manhattan:function(t,e){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},diagonal:function(t,e){var r=Math.sqrt(2),n=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y);return 1*(n+i)+(r-2)*Math.min(n,i)}},cleanNode:function(t){t.f=0,t.g=0,t.h=0,t.visited=!1,t.closed=!1,t.parent=null}};function Oy(t,e){e=e||{},this.nodes=[],this.diagonal=!!e.diagonal,this.grid=[];for(var r=0;r<t.length;r++){this.grid[r]=[];for(var n=0,i=t[r];n<i.length;n++){var o=new Fy(r,n,i[n]);this.grid[r][n]=o,this.nodes.push(o)}}this.init()}function Fy(t,e,r){this.x=t,this.y=e,this.weight=r}function Gy(t){this.content=[],this.scoreFunction=t}function Uy(t,e){for(var r=0;r<e.features.length;r++)if(zt(t,e.features[r]))return!0;return!1}function qy(t){return function(){return t}}function jy(t){return t[0]}function Vy(t){return t[1]}function zy(){this._=null}function Yy(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function Hy(t,e){var r=e,n=e.R,i=r.U;i?i.L===r?i.L=n:i.R=n:t._=n,n.U=i,r.U=n,r.R=n.L,r.R&&(r.R.U=r),n.L=r}function Xy(t,e){var r=e,n=e.L,i=r.U;i?i.L===r?i.L=n:i.R=n:t._=n,n.U=i,r.U=n,r.L=n.R,r.L&&(r.L.U=r),n.R=r}function Jy(t){for(;t.L;)t=t.L;return t}function Wy(t,e,r,n){var i=[null,null],o=_v.push(i)-1;return i.left=t,i.right=e,r&&Zy(i,t,e,r),n&&Zy(i,e,t,n),vv[t.index].halfedges.push(o),vv[e.index].halfedges.push(o),i}function Ky(t,e,r){var n=[e,r];return n.left=t,n}function Zy(t,e,r,n){t[0]||t[1]?t.left===r?t[1]=n:t[0]=n:(t[0]=n,t.left=e,t.right=r)}function $y(t,e,r,n,i){var o,s=t[0],a=t[1],u=s[0],l=s[1],c=0,h=1,f=a[0]-u,p=a[1]-l;if(o=e-u,f||!(o>0)){if(o/=f,f<0){if(o<c)return;o<h&&(h=o)}else if(f>0){if(o>h)return;o>c&&(c=o)}if(o=n-u,f||!(o<0)){if(o/=f,f<0){if(o>h)return;o>c&&(c=o)}else if(f>0){if(o<c)return;o<h&&(h=o)}if(o=r-l,p||!(o>0)){if(o/=p,p<0){if(o<c)return;o<h&&(h=o)}else if(p>0){if(o>h)return;o>c&&(c=o)}if(o=i-l,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>c&&(c=o)}else if(p>0){if(o<c)return;o<h&&(h=o)}return!(c>0||h<1)||(c>0&&(t[0]=[u+c*f,l+c*p]),h<1&&(t[1]=[u+h*f,l+h*p]),!0)}}}}}function tv(t,e,r,n,i){var o=t[1];if(o)return!0;var s,a,u=t[0],l=t.left,c=t.right,h=l[0],f=l[1],p=c[0],g=c[1],A=(h+p)/2,d=(f+g)/2;if(g===f){if(A<e||A>=n)return;if(h>p){if(u){if(u[1]>=i)return}else u=[A,r];o=[A,i]}else{if(u){if(u[1]<r)return}else u=[A,i];o=[A,r]}}else if(a=d-(s=(h-p)/(g-f))*A,s<-1||s>1)if(h>p){if(u){if(u[1]>=i)return}else u=[(r-a)/s,r];o=[(i-a)/s,i]}else{if(u){if(u[1]<r)return}else u=[(i-a)/s,i];o=[(r-a)/s,r]}else if(f<g){if(u){if(u[0]>=n)return}else u=[e,s*e+a];o=[n,s*n+a]}else{if(u){if(u[0]<e)return}else u=[n,s*n+a];o=[e,s*e+a]}return t[0]=u,t[1]=o,!0}function ev(t,e){var r=t.site,n=e.left,i=e.right;return r===i&&(i=n,n=r),i?Math.atan2(i[1]-n[1],i[0]-n[0]):(r===n?(n=e[1],i=e[0]):(n=e[0],i=e[1]),Math.atan2(n[0]-i[0],i[1]-n[1]))}function rv(t,e){return e[+(e.left!==t.site)]}function nv(t,e){return e[+(e.left===t.site)]}Oy.prototype.init=function(){this.dirtyNodes=[];for(var t=0;t<this.nodes.length;t++)ky.cleanNode(this.nodes[t])},Oy.prototype.cleanDirty=function(){for(var t=0;t<this.dirtyNodes.length;t++)ky.cleanNode(this.dirtyNodes[t]);this.dirtyNodes=[]},Oy.prototype.markDirty=function(t){this.dirtyNodes.push(t)},Oy.prototype.neighbors=function(t){var e=[],r=t.x,n=t.y,i=this.grid;return i[r-1]&&i[r-1][n]&&e.push(i[r-1][n]),i[r+1]&&i[r+1][n]&&e.push(i[r+1][n]),i[r]&&i[r][n-1]&&e.push(i[r][n-1]),i[r]&&i[r][n+1]&&e.push(i[r][n+1]),this.diagonal&&(i[r-1]&&i[r-1][n-1]&&e.push(i[r-1][n-1]),i[r+1]&&i[r+1][n-1]&&e.push(i[r+1][n-1]),i[r-1]&&i[r-1][n+1]&&e.push(i[r-1][n+1]),i[r+1]&&i[r+1][n+1]&&e.push(i[r+1][n+1])),e},Oy.prototype.toString=function(){for(var t,e,r,n,i=[],o=this.grid,s=0,a=o.length;s<a;s++){for(t=[],r=0,n=(e=o[s]).length;r<n;r++)t.push(e[r].weight);i.push(t.join(" "))}return i.join("\n")},Fy.prototype.toString=function(){return"["+this.x+" "+this.y+"]"},Fy.prototype.getCost=function(t){return t&&t.x!==this.x&&t.y!==this.y?1.41421*this.weight:this.weight},Fy.prototype.isWall=function(){return 0===this.weight},Gy.prototype={push:function(t){this.content.push(t),this.sinkDown(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.bubbleUp(0)),t},remove:function(t){var e=this.content.indexOf(t),r=this.content.pop();e!==this.content.length-1&&(this.content[e]=r,this.scoreFunction(r)<this.scoreFunction(t)?this.sinkDown(e):this.bubbleUp(e))},size:function(){return this.content.length},rescoreElement:function(t){this.sinkDown(this.content.indexOf(t))},sinkDown:function(t){for(var e=this.content[t];t>0;){var r=(t+1>>1)-1,n=this.content[r];if(!(this.scoreFunction(e)<this.scoreFunction(n)))break;this.content[r]=e,this.content[t]=n,t=r}},bubbleUp:function(t){for(var e=this.content.length,r=this.content[t],n=this.scoreFunction(r);;){var i,o=t+1<<1,s=o-1,a=null;if(s<e){var u=this.content[s];(i=this.scoreFunction(u))<n&&(a=s)}if(o<e){var l=this.content[o];this.scoreFunction(l)<(null===a?n:i)&&(a=o)}if(null===a)break;this.content[t]=this.content[a],this.content[a]=r,t=a}}},zy.prototype={constructor:zy,insert:function(t,e){var r,n,i;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;r=t}else this._?(t=Jy(this._),e.P=null,e.N=t,t.P=t.L=e,r=t):(e.P=e.N=null,this._=e,r=null);for(e.L=e.R=null,e.U=r,e.C=!0,t=e;r&&r.C;)r===(n=r.U).L?(i=n.R)&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.R&&(Hy(this,r),r=(t=r).U),r.C=!1,n.C=!0,Xy(this,n)):(i=n.L)&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.L&&(Xy(this,r),r=(t=r).U),r.C=!1,n.C=!0,Hy(this,n)),r=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e,r,n,i=t.U,o=t.L,s=t.R;if(r=o?s?Jy(s):o:s,i?i.L===t?i.L=r:i.R=r:this._=r,o&&s?(n=r.C,r.C=t.C,r.L=o,o.U=r,r!==s?(i=r.U,r.U=t.U,t=r.R,i.L=t,r.R=s,s.U=r):(r.U=i,i=r,t=r.R)):(n=t.C,t=r),t&&(t.U=i),!n)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((e=i.R).C&&(e.C=!1,i.C=!0,Hy(this,i),e=i.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,Xy(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,Hy(this,i),t=this._;break}}else if((e=i.L).C&&(e.C=!1,i.C=!0,Xy(this,i),e=i.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,Hy(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,Xy(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}};var iv,ov=[];function sv(){Yy(this),this.x=this.y=this.arc=this.site=this.cy=null}function av(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,i=t.site,o=r.site;if(n!==o){var s=i[0],a=i[1],u=n[0]-s,l=n[1]-a,c=o[0]-s,h=o[1]-a,f=2*(u*h-l*c);if(!(f>=-Ev)){var p=u*u+l*l,g=c*c+h*h,A=(h*p-l*g)/f,d=(u*g-c*p)/f,y=ov.pop()||new sv;y.arc=t,y.site=i,y.x=A+s,y.y=(y.cy=d+a)+Math.sqrt(A*A+d*d),t.circle=y;for(var v=null,m=mv._;m;)if(y.y<m.y||y.y===m.y&&y.x<=m.x){if(!m.L){v=m.P;break}m=m.L}else{if(!m.R){v=m;break}m=m.R}mv.insert(v,y),v||(iv=y)}}}}function uv(t){var e=t.circle;e&&(e.P||(iv=e.N),mv.remove(e),ov.push(e),Yy(e),t.circle=null)}var lv=[];function cv(){Yy(this),this.edge=this.site=this.circle=null}function hv(t){var e=lv.pop()||new cv;return e.site=t,e}function fv(t){uv(t),yv.remove(t),lv.push(t),Yy(t)}function pv(t){var e=t.circle,r=e.x,n=e.cy,i=[r,n],o=t.P,s=t.N,a=[t];fv(t);for(var u=o;u.circle&&Math.abs(r-u.circle.x)<Iv&&Math.abs(n-u.circle.cy)<Iv;)o=u.P,a.unshift(u),fv(u),u=o;a.unshift(u),uv(u);for(var l=s;l.circle&&Math.abs(r-l.circle.x)<Iv&&Math.abs(n-l.circle.cy)<Iv;)s=l.N,a.push(l),fv(l),l=s;a.push(l),uv(l);var c,h=a.length;for(c=1;c<h;++c)l=a[c],u=a[c-1],Zy(l.edge,u.site,l.site,i);u=a[0],(l=a[h-1]).edge=Wy(u.site,l.site,null,i),av(u),av(l)}function gv(t){for(var e,r,n,i,o=t[0],s=t[1],a=yv._;a;)if((n=Av(a,s)-o)>Iv)a=a.L;else{if(!((i=o-dv(a,s))>Iv)){n>-Iv?(e=a.P,r=a):i>-Iv?(e=a,r=a.N):e=r=a;break}if(!a.R){e=a;break}a=a.R}!function(t){vv[t.index]={site:t,halfedges:[]}}(t);var u=hv(t);if(yv.insert(e,u),e||r){if(e===r)return uv(e),r=hv(e.site),yv.insert(u,r),u.edge=r.edge=Wy(e.site,u.site),av(e),void av(r);if(r){uv(e),uv(r);var l=e.site,c=l[0],h=l[1],f=t[0]-c,p=t[1]-h,g=r.site,A=g[0]-c,d=g[1]-h,y=2*(f*d-p*A),v=f*f+p*p,m=A*A+d*d,_=[(d*v-p*m)/y+c,(f*m-A*v)/y+h];Zy(r.edge,l,g,_),u.edge=Wy(l,t,null,_),r.edge=Wy(t,g,null,_),av(e),av(r)}else u.edge=Wy(e.site,u.site)}}function Av(t,e){var r=t.site,n=r[0],i=r[1],o=i-e;if(!o)return n;var s=t.P;if(!s)return-1/0;var a=(r=s.site)[0],u=r[1],l=u-e;if(!l)return a;var c=a-n,h=1/o-1/l,f=c/l;return h?(-f+Math.sqrt(f*f-2*h*(c*c/(-2*l)-u+l/2+i-o/2)))/h+n:(n+a)/2}function dv(t,e){var r=t.N;if(r)return Av(r,e);var n=t.site;return n[1]===e?n[0]:1/0}var yv,vv,mv,_v,Iv=1e-6,Ev=1e-12;function xv(t,e){return e[1]-t[1]||e[0]-t[0]}function Cv(t,e){var r,n,i,o=t.sort(xv).pop();for(_v=[],vv=new Array(t.length),yv=new zy,mv=new zy;;)if(i=iv,o&&(!i||o[1]<i.y||o[1]===i.y&&o[0]<i.x))o[0]===r&&o[1]===n||(gv(o),r=o[0],n=o[1]),o=t.pop();else{if(!i)break;pv(i.arc)}if(function(){for(var t,e,r,n,i=0,o=vv.length;i<o;++i)if((t=vv[i])&&(n=(e=t.halfedges).length)){var s=new Array(n),a=new Array(n);for(r=0;r<n;++r)s[r]=r,a[r]=ev(t,_v[e[r]]);for(s.sort((function(t,e){return a[e]-a[t]})),r=0;r<n;++r)a[r]=e[s[r]];for(r=0;r<n;++r)e[r]=a[r]}}(),e){var s=+e[0][0],a=+e[0][1],u=+e[1][0],l=+e[1][1];!function(t,e,r,n){for(var i,o=_v.length;o--;)tv(i=_v[o],t,e,r,n)&&$y(i,t,e,r,n)&&(Math.abs(i[0][0]-i[1][0])>Iv||Math.abs(i[0][1]-i[1][1])>Iv)||delete _v[o]}(s,a,u,l),function(t,e,r,n){var i,o,s,a,u,l,c,h,f,p,g,A,d=vv.length,y=!0;for(i=0;i<d;++i)if(o=vv[i]){for(s=o.site,a=(u=o.halfedges).length;a--;)_v[u[a]]||u.splice(a,1);for(a=0,l=u.length;a<l;)g=(p=nv(o,_v[u[a]]))[0],A=p[1],h=(c=rv(o,_v[u[++a%l]]))[0],f=c[1],(Math.abs(g-h)>Iv||Math.abs(A-f)>Iv)&&(u.splice(a,0,_v.push(Ky(s,p,Math.abs(g-t)<Iv&&n-A>Iv?[t,Math.abs(h-t)<Iv?f:n]:Math.abs(A-n)<Iv&&r-g>Iv?[Math.abs(f-n)<Iv?h:r,n]:Math.abs(g-r)<Iv&&A-e>Iv?[r,Math.abs(h-r)<Iv?f:e]:Math.abs(A-e)<Iv&&g-t>Iv?[Math.abs(f-e)<Iv?h:t,e]:null))-1),++l);l&&(y=!1)}if(y){var v,m,_,I=1/0;for(i=0,y=null;i<d;++i)(o=vv[i])&&(_=(v=(s=o.site)[0]-t)*v+(m=s[1]-e)*m)<I&&(I=_,y=o);if(y){var E=[t,e],x=[t,n],C=[r,n],w=[r,e];y.halfedges.push(_v.push(Ky(s=y.site,E,x))-1,_v.push(Ky(s,x,C))-1,_v.push(Ky(s,C,w))-1,_v.push(Ky(s,w,E))-1)}}for(i=0;i<d;++i)(o=vv[i])&&(o.halfedges.length||delete vv[i])}(s,a,u,l)}this.edges=_v,this.cells=vv,yv=mv=_v=vv=null}function wv(t){return(t=t.slice()).push(t[0]),ft([t])}function bv(t,e,r,n){var i=(n=n||{}).steps||64,o=n.units||"kilometers",s=n.angle||0,a=n.pivot||t,u=n.properties||t.properties||{};if(!t)throw new Error("center is required");if(!e)throw new Error("xSemiAxis is required");if(!r)throw new Error("ySemiAxis is required");if(!Nt(n))throw new Error("options must be an object");if(!Lt(i))throw new Error("steps must be a number");if(!Lt(s))throw new Error("angle must be a number");var l=Qt(t);if("degrees"===o)var c=Bt(s);else e=SA(t,e,90,{units:o}),r=SA(t,r,0,{units:o}),e=Qt(e)[0]-l[0],r=Qt(r)[1]-l[1];for(var h=[],f=0;f<i;f+=1){var p=-360*f/i,g=e*r/Math.sqrt(Math.pow(r,2)+Math.pow(e,2)*Math.pow(Bv(p),2)),A=e*r/Math.sqrt(Math.pow(e,2)+Math.pow(r,2)/Math.pow(Bv(p),2));if(p<-90&&p>=-270&&(g=-g),p<-180&&p>=-360&&(A=-A),"degrees"===o){var d=g*Math.cos(c)+A*Math.sin(c),y=A*Math.cos(c)-g*Math.sin(c);g=d,A=y}h.push([g+l[0],A+l[1]])}return h.push(h[0]),"degrees"===o?ft([h],u):Gd(ft([h],u),s,{pivot:a})}function Bv(t){var e=t*Math.PI/180;return Math.tan(e)}function Sv(t,e){void 0===e&&(e={});var r=0,n=0,i=0;return Fa(t,(function(t,o,s){var a=e.weight?null==s?void 0:s[e.weight]:void 0;if(!Lt(a=null==a?1:a))throw new Error("weight value must be a number for feature index "+o);(a=Number(a))>0&&Ta(t,(function(t){r+=t[0]*a,n+=t[1]*a,i+=a}))})),ct([r/i,n/i],e.properties,e)}function Mv(t,e,r,n,i){var o=n.tolerance||.001,s=0,a=0,u=0,l=0;if(Pa(r,(function(e){var r,n=null===(r=e.properties)||void 0===r?void 0:r.weight,i=null==n?1:n;if(!Lt(i=Number(i)))throw new Error("weight value must be a number");if(i>0){l+=1;var o=i*Vt(e,t);0===o&&(o=1);var c=i/o;s+=e.geometry.coordinates[0]*c,a+=e.geometry.coordinates[1]*c,u+=c}})),l<1)throw new Error("no features to measure");var c=s/u,h=a/u;return 1===l||0===i||Math.abs(c-e[0])<o&&Math.abs(h-e[1])<o?ct([c,h],{medianCandidates:n.medianCandidates}):(n.medianCandidates.push([c,h]),Mv([c,h],t,r,n,i-1))}function Lv(t,e){return{x:t[0]-e[0],y:t[1]-e[1]}}function Nv(t,e){var r=0,n=0;Ta(t,(function(i,o,s,a,u){u>r&&(r=u,n=o,e.push([]));var l=o-n,c=t.coordinates[u][l+1],h=i[0],f=i[1],p=c[0],g=c[1];e[u].push([.75*h+.25*p,.75*f+.25*g]),e[u].push([.25*h+.75*p,.25*f+.75*g])}),!0),e.forEach((function(t){t.push(t[0])}))}function Tv(t,e){var r=0,n=0,i=0;Ta(t,(function(o,s,a,u,l){u>i&&(i=u,n=s,e.push([[]])),l>r&&(r=l,n=s,e[u].push([]));var c=s-n,h=t.coordinates[u][l][c+1],f=o[0],p=o[1],g=h[0],A=h[1];e[u][l].push([.75*f+.25*g,.75*p+.25*A]),e[u][l].push([.25*f+.75*g,.25*p+.75*A])}),!0),e.forEach((function(t){t.forEach((function(t){t.push(t[0])}))}))}function Rv(t,e,r){void 0===r&&(r=2);var n=Qt(t),i=Qt(e),o=n[0]-i[0],s=n[1]-i[1];return 1===r?Math.abs(o)+Math.abs(s):Math.pow(Math.pow(o,r)+Math.pow(s,r),1/r)}function Dv(t,e){var r=(e=e||{}).threshold||1e4,n=e.p||2,i=e.binary||!1,o=e.alpha||-1,s=e.standardization||!1,a=[];Pa(t,(function(t){a.push(mc(t))}));for(var u=[],l=0;l<a.length;l++)u[l]=[];for(l=0;l<a.length;l++)for(var c=l;c<a.length;c++){l===c&&(u[l][c]=0);var h=Rv(a[l],a[c],n);u[l][c]=h,u[c][l]=h}for(l=0;l<a.length;l++)for(c=0;c<a.length;c++){0!==(h=u[l][c])&&(u[l][c]=i?h<=r?1:0:h<=r?Math.pow(h,o):0)}if(s)for(l=0;l<a.length;l++){var f=u[l].reduce((function(t,e){return t+e}),0);for(c=0;c<a.length;c++)u[l][c]=u[l][c]/f}return u}function Qv(t){for(var e=0,r=0,n=t;r<n.length;r++){e+=n[r]}return e/t.length}function Pv(t,e){return void 0===e&&(e={}),Ov(t,"mercator",e)}function kv(t,e){return void 0===e&&(e={}),Ov(t,"wgs84",e)}function Ov(t,e,r){void 0===r&&(r={});var n=(r=r||{}).mutate;if(!t)throw new Error("geojson is required");return Array.isArray(t)&&Lt(t[0])?t="mercator"===e?Fv(t):Gv(t):(!0!==n&&(t=sl(t)),Ta(t,(function(t){var r="mercator"===e?Fv(t):Gv(t);t[0]=r[0],t[1]=r[1]}))),t}function Fv(t){var e=Math.PI/180,r=6378137,n=20037508.342789244,i=Math.abs(t[0])<=180?t[0]:t[0]-360*function(t){return t<0?-1:t>0?1:0}(t[0]),o=[r*i*e,r*Math.log(Math.tan(.25*Math.PI+.5*t[1]*e))];return o[0]>n&&(o[0]=n),o[0]<-n&&(o[0]=-n),o[1]>n&&(o[1]=n),o[1]<-n&&(o[1]=-n),o}function Gv(t){var e=180/Math.PI,r=6378137;return[t[0]*e/r,(.5*Math.PI-2*Math.atan(Math.exp(-t[1]/r)))*e]}Cv.prototype={constructor:Cv,polygons:function(){var t=this.edges;return this.cells.map((function(e){var r=e.halfedges.map((function(r){return rv(e,t[r])}));return r.data=e.site.data,r}))},triangles:function(){var t=[],e=this.edges;return this.cells.forEach((function(r,n){if(o=(i=r.halfedges).length)for(var i,o,s,a,u,l,c=r.site,h=-1,f=e[i[o-1]],p=f.left===c?f.right:f.left;++h<o;)s=p,p=(f=e[i[h]]).left===c?f.right:f.left,s&&p&&n<s.index&&n<p.index&&(u=s,l=p,((a=c)[0]-l[0])*(u[1]-a[1])-(a[0]-u[0])*(l[1]-a[1])<0)&&t.push([c.data,s.data,p.data])})),t},links:function(){return this.edges.filter((function(t){return t.right})).map((function(t){return{source:t.left.data,target:t.right.data}}))},find:function(t,e,r){for(var n,i,o=this,s=o._found||0,a=o.cells.length;!(i=o.cells[s]);)if(++s>=a)return null;var u=t-i.site[0],l=e-i.site[1],c=u*u+l*l;do{i=o.cells[n=s],s=null,i.halfedges.forEach((function(r){var n=o.edges[r],a=n.left;if(a!==i.site&&a||(a=n.right)){var u=t-a[0],l=e-a[1],h=u*u+l*l;h<c&&(c=h,s=a.index)}}))}while(null!==s);return o._found=n,null==r||c<=r*r?i.site:null}};var Uv=Object.freeze({__proto__:null,toMercator:Pv,toWgs84:kv}),qv=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),i=0;for(e=0;e<r;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)n[i]=o[s];return n};function jv(t){return Array.isArray(t)?Xv(t):t&&t.bbox?Xv(t.bbox):[360*Hv(),180*Hv()]}function Vv(t,e){void 0===e&&(e={}),null==t&&(t=1);for(var r=[],n=0;n<t;n++)r.push(ct(jv(e.bbox)));return dt(r)}function zv(t,e){void 0===e&&(e={}),null==t&&(t=1),Lt(e.num_vertices)&&void 0!==e.num_vertices||(e.num_vertices=10),Lt(e.max_radial_length)&&void 0!==e.max_radial_length||(e.max_radial_length=10);for(var r=[],n=function(t){var n,i=[],o=qv(Array(e.num_vertices+1)).map(Math.random);o.forEach((function(t,e,r){r[e]=e>0?t+r[e-1]:t})),o.forEach((function(t){t=2*t*Math.PI/o[o.length-1];var r=Math.random();i.push([r*(e.max_radial_length||10)*Math.sin(t),r*(e.max_radial_length||10)*Math.cos(t)])})),i[i.length-1]=i[0],i=i.map((n=jv(e.bbox),function(t){return[t[0]+n[0],t[1]+n[1]]})),r.push(ft([i]))},i=0;i<t;i++)n();return dt(r)}function Yv(t,e){if(void 0===e&&(e={}),!Nt(e=e||{}))throw new Error("options is invalid");var r=e.bbox,n=e.num_vertices,i=e.max_length,o=e.max_rotation;null==t&&(t=1),(!Lt(n)||void 0===n||n<2)&&(n=10),Lt(i)&&void 0!==i||(i=1e-4),Lt(o)&&void 0!==o||(o=Math.PI/8);for(var s=[],a=0;a<t;a++){for(var u=[jv(r)],l=0;l<n-1;l++){var c=(0===l?2*Math.random()*Math.PI:Math.tan((u[l][1]-u[l-1][1])/(u[l][0]-u[l-1][0])))+(Math.random()-.5)*o*2,h=Math.random()*i;u.push([u[l][0]+h*Math.cos(c),u[l][1]+h*Math.sin(c)])}s.push(gt(u))}return dt(s)}function Hv(){return Math.random()-.5}function Xv(t){return[Math.random()*(t[2]-t[0])+t[0],Math.random()*(t[3]-t[1])+t[1]]}var Jv=Object.freeze({__proto__:null,randomPosition:jv,randomPoint:Vv,randomPolygon:zv,randomLineString:Yv});function Wv(t,e){if(!t)throw new Error("geojson is required");if("FeatureCollection"!==t.type)throw new Error("geojson must be a FeatureCollection");if(null==e)throw new Error("filter is required");var r=[];return Pa(t,(function(t){tm(t.properties,e)&&r.push(t)})),dt(r)}function Kv(t,e,r){if(!t)throw new Error("geojson is required");if("FeatureCollection"!==t.type)throw new Error("geojson must be a FeatureCollection");if(null==e)throw new Error("property is required");for(var n=$v(t,e),i=Object.keys(n),o=0;o<i.length;o++){for(var s=i[o],a=n[s],u=[],l=0;l<a.length;l++)u.push(t.features[a[l]]);r(dt(u),s,o)}}function Zv(t,e,r,n){var i=n;return Kv(t,e,(function(t,e,o){i=0===o&&void 0===n?t:r(i,t,e,o)})),i}function $v(t,e){var r={};return Pa(t,(function(t,n){var i=t.properties||{};if(Object.prototype.hasOwnProperty.call(i,String(e))){var o=i[e];Object.prototype.hasOwnProperty.call(r,o)?r[o].push(n):r[o]=[n]}})),r}function tm(t,e){if(void 0===t)return!1;var r=typeof e;if("number"===r||"string"===r)return Object.prototype.hasOwnProperty.call(t,e);if(Array.isArray(e)){for(var n=0;n<e.length;n++)if(!tm(t,e[n]))return!1;return!0}return em(t,e)}function em(t,e){for(var r=Object.keys(e),n=0;n<r.length;n++){var i=r[n];if(t[i]!==e[i])return!1}return!0}function rm(t,e){if(!e)return{};if(!e.length)return{};for(var r={},n=0;n<e.length;n++){var i=e[n];Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r}var nm=Object.freeze({__proto__:null,getCluster:Wv,clusterEach:Kv,clusterReduce:Zv,createBins:$v,applyFilter:tm,propertiesContainsFilter:em,filterProperties:rm});
|
|
136
|
+
/**
|
|
137
|
+
* splaytree v3.1.2
|
|
138
|
+
* Fast Splay tree for Node and browser
|
|
139
|
+
*
|
|
140
|
+
* @author Alexander Milevski <info@w8r.name>
|
|
141
|
+
* @license MIT
|
|
142
|
+
* @preserve
|
|
143
|
+
*/
|
|
144
|
+
/*! *****************************************************************************
|
|
145
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
146
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
147
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
148
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
149
|
+
|
|
150
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
151
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
152
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
153
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
154
|
+
|
|
155
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
156
|
+
and limitations under the License.
|
|
157
|
+
***************************************************************************** */function im(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var om=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function sm(t,e){return t>e?1:t<e?-1:0}function am(t,e,r){for(var n=new om(null,null),i=n,o=n;;){var s=r(t,e.key);if(s<0){if(null===e.left)break;if(r(t,e.left.key)<0){var a=e.left;if(e.left=a.right,a.right=e,null===(e=a).left)break}o.left=e,o=e,e=e.left}else{if(!(s>0))break;if(null===e.right)break;if(r(t,e.right.key)>0){a=e.right;if(e.right=a.left,a.left=e,null===(e=a).right)break}i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=n.right,e.right=n.left,e}function um(t,e,r,n){var i=new om(t,e);if(null===r)return i.left=i.right=null,i;var o=n(t,(r=am(t,r,n)).key);return o<0?(i.left=r.left,i.right=r,r.left=null):o>=0&&(i.right=r.right,i.left=r,r.right=null),i}function lm(t,e,r){var n=null,i=null;if(e){var o=r((e=am(t,e,r)).key,t);0===o?(n=e.left,i=e.right):o<0?(i=e.right,e.right=null,n=e):(n=e.left,e.left=null,i=e)}return{left:n,right:i}}function cm(t,e,r,n,i){if(t){n(e+(r?"└── ":"├── ")+i(t)+"\n");var o=e+(r?" ":"│ ");t.left&&cm(t.left,o,!1,n,i),t.right&&cm(t.right,o,!0,n,i)}}var hm=function(){function t(t){void 0===t&&(t=sm),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=um(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var r=new om(t,e);null===this._root&&(r.left=r.right=null,this._size++,this._root=r);var n=this._comparator,i=am(t,this._root,n),o=n(t,i.key);return 0===o?this._root=i:(o<0?(r.left=i.left,r.right=i,i.left=null):o>0&&(r.right=i.right,r.left=i,i.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,r){var n;return null===e?null:0===r(t,(e=am(t,e,r)).key)?(null===e.left?n=e.right:(n=am(t,e.left,r)).right=e.right,this._size--,n):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=am(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return e;e=n<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=am(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return!0;e=n<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var r=this._root,n=[],i=!1;!i;)null!==r?(n.push(r),r=r.left):0!==n.length?(r=n.pop(),t.call(e,r),r=r.right):i=!0;return this},t.prototype.range=function(t,e,r,n){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&r.call(n,s))return this;s=s.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var r=e.key;return t.push(r)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var r=e.data;return t.push(r)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,r=!1,n=0,i=[];!r;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),n===t)return e;n++,e=e.right}else r=!0;return null},t.prototype.next=function(t){var e=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?(r=e,e=e.left):e=e.right}return r},t.prototype.prev=function(t){var e=this._root,r=null;if(null!==t.left){for(r=t.left;r.right;)r=r.right;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?e=e.left:(r=e,e=e.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){var e=t,r=[],n=!1,i=new om(null,null),o=i;for(;!n;)e?(r.push(e),e=e.left):r.length>0?e=(e=o=o.next=r.pop()).right:n=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,r){void 0===e&&(e=[]),void 0===r&&(r=!1);var n=t.length,i=this._comparator;if(r&&gm(t,e,0,n-1,i),null===this._root)this._root=fm(t,e,0,n),this._size=n;else{var o=function(t,e,r){var n=new om(null,null),i=n,o=t,s=e;for(;null!==o&&null!==s;)r(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;null!==o?i.next=o:null!==s&&(i.next=s);return n.next}(this.toList(),function(t,e){for(var r=new om(null,null),n=r,i=0;i<t.length;i++)n=n.next=new om(t[i],e[i]);return n.next=null,r.next}(t,e),i);n=this._size+n,this._root=pm({head:o},0,n)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return cm(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,r){var n=this._comparator,i=lm(t,this._root,n),o=i.left,s=i.right;n(t,e)<0?s=um(e,r,s,n):o=um(e,r,o,n),this._root=function(t,e,r){return null===e?t:(null===t||((e=am(t.key,e,r)).left=t),e)}(o,s,n)},t.prototype.split=function(t){return lm(t,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var t,e,r;return im(this,(function(n){switch(n.label){case 0:t=this._root,e=[],r=!1,n.label=1;case 1:return r?[3,6]:null===t?[3,2]:(e.push(t),t=t.left,[3,5]);case 2:return 0===e.length?[3,4]:[4,t=e.pop()];case 3:return n.sent(),t=t.right,[3,5];case 4:r=!0,n.label=5;case 5:return[3,1];case 6:return[2]}}))},t}();function fm(t,e,r,n){var i=n-r;if(i>0){var o=r+Math.floor(i/2),s=t[o],a=e[o],u=new om(s,a);return u.left=fm(t,e,r,o),u.right=fm(t,e,o+1,n),u}return null}function pm(t,e,r){var n=r-e;if(n>0){var i=e+Math.floor(n/2),o=pm(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=pm(t,i+1,r),s}return null}function gm(t,e,r,n,i){if(!(r>=n)){for(var o=t[r+n>>1],s=r-1,a=n+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var u=t[s];t[s]=t[a],t[a]=u,u=e[s],e[s]=e[a],e[a]=u}gm(t,e,r,a,i),gm(t,e,a+1,n,i)}}function Am(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dm(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,n.key,n)}}function ym(t,e,r){return e&&dm(t.prototype,e),r&&dm(t,r),t}var vm=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},mm=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var r=t.ll.x<e.ll.x?e.ll.x:t.ll.x,n=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:r,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:n,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},_m=Number.EPSILON;void 0===_m&&(_m=Math.pow(2,-52));var Im=_m*_m,Em=function(t,e){if(-_m<t&&t<_m&&-_m<e&&e<_m)return 0;var r=t-e;return r*r<Im*t*e?0:t<e?-1:1},xm=function(){function t(){Am(this,t),this.reset()}return ym(t,[{key:"reset",value:function(){this.xRounder=new Cm,this.yRounder=new Cm}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),t}(),Cm=function(){function t(){Am(this,t),this.tree=new hm,this.round(0)}return ym(t,[{key:"round",value:function(t){var e=this.tree.add(t),r=this.tree.prev(e);if(null!==r&&0===Em(e.key,r.key))return this.tree.remove(t),r.key;var n=this.tree.next(e);return null!==n&&0===Em(e.key,n.key)?(this.tree.remove(t),n.key):t}}]),t}(),wm=new xm,bm=function(t,e){return t.x*e.y-t.y*e.x},Bm=function(t,e){return t.x*e.x+t.y*e.y},Sm=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y},o=bm(n,i);return Em(o,0)},Mm=function(t){return Math.sqrt(Bm(t,t))},Lm=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y};return Bm(i,n)/Mm(i)/Mm(n)},Nm=function(t,e,r){return 0===e.y?null:{x:t.x+e.x/e.y*(r-t.y),y:r}},Tm=function(t,e,r){return 0===e.x?null:{x:r,y:t.y+e.y/e.x*(r-t.x)}},Rm=function(){function t(e,r){Am(this,t),void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return ym(t,null,[{key:"compare",value:function(e,r){var n=t.comparePoints(e.point,r.point);return 0!==n?n:(e.point!==r.point&&e.link(r),e.isLeft!==r.isLeft?e.isLeft?1:-1:Qm.compare(e.segment,r.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),ym(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,r=0,n=e.length;r<n;r++){var i=e[r];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var r=this.point.events[e];if(void 0===r.segment.consumedBy)for(var n=e+1;n<t;n++){var i=this.point.events[n];void 0===i.consumedBy&&(r.otherSE.point.events===i.otherSE.point.events&&r.segment.consume(i.segment))}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,r=this.point.events.length;e<r;e++){var n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,r=new Map,n=function(n){var i,o,s,a,u,l=n.otherSE;r.set(n,{sine:(i=e.point,o=t.point,s=l.point,a={x:o.x-i.x,y:o.y-i.y},u={x:s.x-i.x,y:s.y-i.y},bm(u,a)/Mm(u)/Mm(a)),cosine:Lm(e.point,t.point,l.point)})};return function(t,e){r.has(t)||n(t),r.has(e)||n(e);var i=r.get(t),o=i.sine,s=i.cosine,a=r.get(e),u=a.sine,l=a.cosine;return o>=0&&u>=0?s<l?1:s>l?-1:0:o<0&&u<0?s<l?-1:s>l?1:0:u<o?-1:u>o?1:0}}}]),t}(),Dm=0,Qm=function(){function t(e,r,n,i){Am(this,t),this.id=++Dm,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=n,this.windings=i}return ym(t,null,[{key:"compare",value:function(t,e){var r=t.leftSE.point.x,n=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<r)return 1;if(i<n)return-1;var s=t.leftSE.point.y,a=e.leftSE.point.y,u=t.rightSE.point.y,l=e.rightSE.point.y;if(r<n){if(a<s&&a<u)return 1;if(a>s&&a>u)return-1;var c=t.comparePoint(e.leftSE.point);if(c<0)return 1;if(c>0)return-1;var h=e.comparePoint(t.rightSE.point);return 0!==h?h:-1}if(r>n){if(s<a&&s<l)return-1;if(s>a&&s>l)return 1;var f=e.comparePoint(t.leftSE.point);if(0!==f)return f;var p=t.comparePoint(e.rightSE.point);return p<0?1:p>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){var g=e.comparePoint(t.rightSE.point);if(0!==g)return g}if(i>o){var A=t.comparePoint(e.rightSE.point);if(A<0)return 1;if(A>0)return-1}if(i!==o){var d=u-s,y=i-r,v=l-a,m=o-n;if(d>y&&v<m)return 1;if(d<y&&v>m)return-1}return i>o?1:i<o||u<l?-1:u>l?1:t.id<e.id?-1:t.id>e.id?1:0}}]),ym(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,r=this.rightSE.point,n=this.vector();if(e.x===r.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/n.y,o=e.x+i*n.x;if(t.x===o)return 0;var s=(t.x-e.x)/n.x,a=e.y+s*n.y;return t.y===a?0:t.y<a?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),r=t.bbox(),n=mm(e,r);if(null===n)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,u=vm(e,s)&&0===this.comparePoint(s),l=vm(r,i)&&0===t.comparePoint(i),c=vm(e,a)&&0===this.comparePoint(a),h=vm(r,o)&&0===t.comparePoint(o);if(l&&u)return h&&!c?o:!h&&c?a:null;if(l)return c&&i.x===a.x&&i.y===a.y?null:i;if(u)return h&&o.x===s.x&&o.y===s.y?null:s;if(h&&c)return null;if(h)return o;if(c)return a;var f=function(t,e,r,n){if(0===e.x)return Tm(r,n,t.x);if(0===n.x)return Tm(t,e,r.x);if(0===e.y)return Nm(r,n,t.y);if(0===n.y)return Nm(t,e,r.y);var i=bm(e,n);if(0==i)return null;var o={x:r.x-t.x,y:r.y-t.y},s=bm(o,e)/i,a=bm(o,n)/i;return{x:(t.x+a*e.x+(r.x+s*n.x))/2,y:(t.y+a*e.y+(r.y+s*n.y))/2}}(i,this.vector(),s,t.vector());return null===f?null:vm(n,f)?wm.round(f.x,f.y):null}},{key:"split",value:function(e){var r=[],n=void 0!==e.events,i=new Rm(e,!0),o=new Rm(e,!1),s=this.rightSE;this.replaceRightSE(o),r.push(o),r.push(i);var a=new t(i,s,this.rings.slice(),this.windings.slice());return Rm.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),Rm.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,r=this.windings.length;e<r;e++)this.windings[e]*=-1}},{key:"consume",value:function(e){for(var r=this,n=e;r.consumedBy;)r=r.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var i=t.compare(r,n);if(0!==i){if(i>0){var o=r;r=n,n=o}if(r.prev===n){var s=r;r=n,n=s}for(var a=0,u=n.rings.length;a<u;a++){var l=n.rings[a],c=n.windings[a],h=r.rings.indexOf(l);-1===h?(r.rings.push(l),r.windings.push(c)):r.windings[h]+=c}n.rings=null,n.windings=null,n.consumedBy=r,n.leftSE.consumedBy=r.leftSE,n.rightSE.consumedBy=r.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,r=this._afterState.windings,n=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],a=this.windings[i],u=e.indexOf(s);-1===u?(e.push(s),r.push(a)):r[u]+=a}for(var l=[],c=[],h=0,f=e.length;h<f;h++)if(0!==r[h]){var p=e[h],g=p.poly;if(-1===c.indexOf(g))if(p.isExterior)l.push(g);else{-1===c.indexOf(g)&&c.push(g);var A=l.indexOf(p.poly);-1!==A&&l.splice(A,1)}}for(var d=0,y=l.length;d<y;d++){var v=l[d].multiPoly;-1===n.indexOf(v)&&n.push(v)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(Ym.type){case"union":var r=0===t.length,n=0===e.length;this._isInResult=r!==n;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===Ym.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2==1;break;case"difference":var a=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=a(t)!==a(e);break;default:throw new Error("Unrecognized operation type found ".concat(Ym.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,r,n){var i,o,s,a=Rm.comparePoints(e,r);if(a<0)i=e,o=r,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=r,o=e,s=-1}return new t(new Rm(i,!0),new Rm(o,!1),[n],[s])}}]),t}(),Pm=function(){function t(e,r,n){if(Am(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=n,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=wm.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,s=1,a=e.length;s<a;s++){if("number"!=typeof e[s][0]||"number"!=typeof e[s][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var u=wm.round(e[s][0],e[s][1]);u.x===o.x&&u.y===o.y||(this.segments.push(Qm.fromRing(o,u,this)),u.x<this.bbox.ll.x&&(this.bbox.ll.x=u.x),u.y<this.bbox.ll.y&&(this.bbox.ll.y=u.y),u.x>this.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}i.x===o.x&&i.y===o.y||this.segments.push(Qm.fromRing(o,i,this))}return ym(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.segments.length;e<r;e++){var n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}]),t}(),km=function(){function t(e,r){if(Am(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Pm(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var n=1,i=e.length;n<i;n++){var o=new Pm(e[n],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}return ym(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,r=this.interiorRings.length;e<r;e++)for(var n=this.interiorRings[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),Om=function(){function t(e,r){if(Am(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var n=0,i=e.length;n<i;n++){var o=new km(e[n],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}return ym(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++)for(var n=this.polys[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),Fm=function(){function t(e){Am(this,t),this.events=e;for(var r=0,n=e.length;r<n;r++)e[r].segment.ringOut=this;this.poly=null}return ym(t,null,[{key:"factory",value:function(e){for(var r=[],n=0,i=e.length;n<i;n++){var o=e[n];if(o.isInResult()&&!o.ringOut){for(var s=null,a=o.leftSE,u=o.rightSE,l=[a],c=a.point,h=[];s=a,a=u,l.push(a),a.point!==c;)for(;;){var f=a.getAvailableLinkedEvents();if(0===f.length){var p=l[0].point,g=l[l.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(p.x,",")+" ".concat(p.y,"]. Last matching segment found ends at")+" [".concat(g.x,", ").concat(g.y,"]."))}if(1===f.length){u=f[0].otherSE;break}for(var A=null,d=0,y=h.length;d<y;d++)if(h[d].point===a.point){A=d;break}if(null===A){h.push({index:l.length,point:a.point});var v=a.getLeftmostComparator(s);u=f.sort(v)[0].otherSE;break}var m=h.splice(A)[0],_=l.splice(m.index);_.unshift(_[0].otherSE),r.push(new t(_.reverse()))}r.push(new t(l))}}return r}}]),ym(t,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],r=1,n=this.events.length-1;r<n;r++){var i=this.events[r].point,o=this.events[r+1].point;0!==Sm(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],a=e[1];0===Sm(s,t,a)&&e.shift(),e.push(e[0]);for(var u=this.isExteriorRing()?1:-1,l=this.isExteriorRing()?0:e.length-1,c=this.isExteriorRing()?e.length:-1,h=[],f=l;f!=c;f+=u)h.push([e[f].x,e[f].y]);return h}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,r=this.events.length;e<r;e++){var n=this.events[e];Rm.compare(t,n)>0&&(t=n)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),Gm=function(){function t(e){Am(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return ym(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,r=this.interiorRings.length;e<r;e++){var n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}]),t}(),Um=function(){function t(e){Am(this,t),this.rings=e,this.polys=this._composePolys(e)}return ym(t,[{key:"getGeom",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++){var n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}},{key:"_composePolys",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];if(!i.poly)if(i.isExteriorRing())e.push(new Gm(i));else{var o=i.enclosingRing();o.poly||e.push(new Gm(o)),o.poly.addInterior(i)}}return e}}]),t}(),qm=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qm.compare;Am(this,t),this.queue=e,this.tree=new hm(r),this.segments=[]}return ym(t,[{key:"process",value:function(t){var e=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),r;var n=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!n)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=n,o=n,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){var u=null;if(s){var l=s.getIntersection(e);if(null!==l&&(e.isAnEndpoint(l)||(u=l),!s.isAnEndpoint(l)))for(var c=this._splitSafely(s,l),h=0,f=c.length;h<f;h++)r.push(c[h])}var p=null;if(a){var g=a.getIntersection(e);if(null!==g&&(e.isAnEndpoint(g)||(p=g),!a.isAnEndpoint(g)))for(var A=this._splitSafely(a,g),d=0,y=A.length;d<y;d++)r.push(A[d])}if(null!==u||null!==p){var v=null;if(null===u)v=p;else if(null===p)v=u;else{v=Rm.comparePoints(u,p)<=0?u:p}this.queue.remove(e.rightSE),r.push(e.rightSE);for(var m=e.split(v),_=0,I=m.length;_<I;_++)r.push(m[_])}r.length>0?(this.tree.remove(e),r.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){var E=s.getIntersection(a);if(null!==E){if(!s.isAnEndpoint(E))for(var x=this._splitSafely(s,E),C=0,w=x.length;C<w;C++)r.push(x[C]);if(!a.isAnEndpoint(E))for(var b=this._splitSafely(a,E),B=0,S=b.length;B<S;B++)r.push(b[B])}}this.tree.remove(e)}return r}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var r=t.rightSE;this.queue.remove(r);var n=t.split(e);return n.push(r),void 0===t.consumedBy&&this.tree.insert(t),n}}]),t}(),jm="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Vm="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,zm=function(){function t(){Am(this,t)}return ym(t,[{key:"run",value:function(t,e,r){Ym.type=t,wm.reset();for(var n=[new Om(e,!0)],i=0,o=r.length;i<o;i++)n.push(new Om(r[i],!1));if(Ym.numMultiPolys=n.length,"difference"===Ym.type)for(var s=n[0],a=1;a<n.length;)null!==mm(n[a].bbox,s.bbox)?a++:n.splice(a,1);if("intersection"===Ym.type)for(var u=0,l=n.length;u<l;u++)for(var c=n[u],h=u+1,f=n.length;h<f;h++)if(null===mm(c.bbox,n[h].bbox))return[];for(var p=new hm(Rm.compare),g=0,A=n.length;g<A;g++)for(var d=n[g].getSweepEvents(),y=0,v=d.length;y<v;y++)if(p.insert(d[y]),p.size>jm)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var m=new qm(p),_=p.size,I=p.pop();I;){var E=I.key;if(p.size===_){var x=E.segment;throw new Error("Unable to pop() ".concat(E.isLeft?"left":"right"," SweepEvent ")+"[".concat(E.point.x,", ").concat(E.point.y,"] from segment #").concat(x.id," ")+"[".concat(x.leftSE.point.x,", ").concat(x.leftSE.point.y,"] -> ")+"[".concat(x.rightSE.point.x,", ").concat(x.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(p.size>jm)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(m.segments.length>Vm)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var C=m.process(E),w=0,b=C.length;w<b;w++){var B=C[w];void 0===B.consumedBy&&p.insert(B)}_=p.size,I=p.pop()}wm.reset();var S=Fm.factory(m.segments);return new Um(S).getGeom()}}]),t}(),Ym=new zm,Hm={union:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Ym.run("union",t,r)},intersection:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Ym.run("intersection",t,r)},xor:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Ym.run("xor",t,r)},difference:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Ym.run("difference",t,r)}},Xm=Hm;"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(null==this)throw new TypeError(this+" is not an object");var e=Object(this),r=Math.max(Math.min(e.length,9007199254740991),0)||0,n=1 in arguments&&parseInt(Number(arguments[1]),10)||0;n=n<0?Math.max(r+n,0):Math.min(n,r);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:r;for(i=i<0?Math.max(r+arguments[2],0):Math.min(i,r);n<i;)e[n]=t,++n;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var Jm=function(){};Jm.prototype.interfaces_=function(){return[]},Jm.prototype.getClass=function(){return Jm},Jm.prototype.equalsWithTolerance=function(t,e,r){return Math.abs(t-e)<=r};var Wm=function(t){function e(e){t.call(this,e),this.name="IllegalArgumentException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),Km=function(){},Zm={MAX_VALUE:{configurable:!0}};Km.isNaN=function(t){return Number.isNaN(t)},Km.doubleToLongBits=function(t){return t},Km.longBitsToDouble=function(t){return t},Km.isInfinite=function(t){return!Number.isFinite(t)},Zm.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(Km,Zm);var $m=function(){},t_=function(){},e_=function(){};function r_(){}var n_=function t(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.z=e.z}else 2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},i_={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};n_.prototype.setOrdinate=function(t,e){switch(t){case n_.X:this.x=e;break;case n_.Y:this.y=e;break;case n_.Z:this.z=e;break;default:throw new Wm("Invalid ordinate index: "+t)}},n_.prototype.equals2D=function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!Jm.equalsWithTolerance(this.x,e.x,r)&&!!Jm.equalsWithTolerance(this.y,e.y,r)}},n_.prototype.getOrdinate=function(t){switch(t){case n_.X:return this.x;case n_.Y:return this.y;case n_.Z:return this.z}throw new Wm("Invalid ordinate index: "+t)},n_.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||Km.isNaN(this.z))&&Km.isNaN(t.z)},n_.prototype.equals=function(t){return t instanceof n_&&this.equals2D(t)},n_.prototype.equalInZ=function(t,e){return Jm.equalsWithTolerance(this.z,t.z,e)},n_.prototype.compareTo=function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0},n_.prototype.clone=function(){},n_.prototype.copy=function(){return new n_(this)},n_.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},n_.prototype.distance3D=function(t){var e=this.x-t.x,r=this.y-t.y,n=this.z-t.z;return Math.sqrt(e*e+r*r+n*n)},n_.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},n_.prototype.hashCode=function(){var t=17;return t=37*(t=37*t+n_.hashCode(this.x))+n_.hashCode(this.y)},n_.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},n_.prototype.interfaces_=function(){return[$m,t_,r_]},n_.prototype.getClass=function(){return n_},n_.hashCode=function(){if(1===arguments.length){var t=Km.doubleToLongBits(arguments[0]);return Math.trunc((t^t)>>>32)}},i_.DimensionalComparator.get=function(){return o_},i_.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},i_.NULL_ORDINATE.get=function(){return Km.NaN},i_.X.get=function(){return 0},i_.Y.get=function(){return 1},i_.Z.get=function(){return 2},Object.defineProperties(n_,i_);var o_=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=arguments[0];if(2!==e&&3!==e)throw new Wm("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};o_.prototype.compare=function(t,e){var r=t,n=e,i=o_.compare(r.x,n.x);if(0!==i)return i;var o=o_.compare(r.y,n.y);return 0!==o?o:this._dimensionsToTest<=2?0:o_.compare(r.z,n.z)},o_.prototype.interfaces_=function(){return[e_]},o_.prototype.getClass=function(){return o_},o_.compare=function(t,e){return t<e?-1:t>e?1:Km.isNaN(t)?Km.isNaN(e)?0:-1:Km.isNaN(e)?1:0};var s_=function(){};s_.prototype.create=function(){},s_.prototype.interfaces_=function(){return[]},s_.prototype.getClass=function(){return s_};var a_=function(){},u_={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};a_.prototype.interfaces_=function(){return[]},a_.prototype.getClass=function(){return a_},a_.toLocationSymbol=function(t){switch(t){case a_.EXTERIOR:return"e";case a_.BOUNDARY:return"b";case a_.INTERIOR:return"i";case a_.NONE:return"-"}throw new Wm("Unknown location value: "+t)},u_.INTERIOR.get=function(){return 0},u_.BOUNDARY.get=function(){return 1},u_.EXTERIOR.get=function(){return 2},u_.NONE.get=function(){return-1},Object.defineProperties(a_,u_);var l_=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},c_=function(){},h_={LOG_10:{configurable:!0}};c_.prototype.interfaces_=function(){return[]},c_.prototype.getClass=function(){return c_},c_.log10=function(t){var e=Math.log(t);return Km.isInfinite(e)||Km.isNaN(e)?e:e/c_.LOG_10},c_.min=function(t,e,r,n){var i=t;return e<i&&(i=e),r<i&&(i=r),n<i&&(i=n),i},c_.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],r=arguments[2];return t<e?e:t>r?r:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var n=arguments[0],i=arguments[1],o=arguments[2];return n<i?i:n>o?o:n}},c_.wrap=function(t,e){return t<0?e- -t%e:t%e},c_.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[0];return t>r&&(r=t),e>r&&(r=e),r}if(4===arguments.length){var n=arguments[1],i=arguments[2],o=arguments[3],s=arguments[0];return n>s&&(s=n),i>s&&(s=i),o>s&&(s=o),s}},c_.average=function(t,e){return(t+e)/2},h_.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(c_,h_);var f_=function(t){this.str=t};f_.prototype.append=function(t){this.str+=t},f_.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},f_.prototype.toString=function(t){return this.str};var p_=function(t){this.value=t};p_.prototype.intValue=function(){return this.value},p_.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},p_.isNaN=function(t){return Number.isNaN(t)};var g_=function(){};g_.isWhitespace=function(t){return t<=32&&t>=0||127===t},g_.toUpperCase=function(t){return t.toUpperCase()};var A_=function t(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}else if("string"==typeof arguments[0]){t.call(this,t.parse(arguments[0]))}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n,i)}},d_={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};A_.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},A_.prototype.extractSignificantDigits=function(t,e){var r=this.abs(),n=A_.magnitude(r._hi),i=A_.TEN.pow(n);(r=r.divide(i)).gt(A_.TEN)?(r=r.divide(A_.TEN),n+=1):r.lt(A_.ONE)&&(r=r.multiply(A_.TEN),n-=1);for(var o=n+1,s=new f_,a=A_.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===o&&s.append(".");var l=Math.trunc(r._hi);if(l<0)break;var c=!1,h=0;l>9?(c=!0,h="9"):h="0"+l,s.append(h),r=r.subtract(A_.valueOf(l)).multiply(A_.TEN),c&&r.selfAdd(A_.TEN);var f=!0,p=A_.magnitude(r._hi);if(p<0&&Math.abs(p)>=a-u&&(f=!1),!f)break}return e[0]=n,s.toString()},A_.prototype.sqr=function(){return this.multiply(this)},A_.prototype.doubleValue=function(){return this._hi+this._lo},A_.prototype.subtract=function(){if(arguments[0]instanceof A_){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},A_.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},A_.prototype.isZero=function(){return 0===this._hi&&0===this._lo},A_.prototype.selfSubtract=function(){if(arguments[0]instanceof A_){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},A_.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},A_.prototype.min=function(t){return this.le(t)?this:t},A_.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof A_){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var r,n,i,o,s=arguments[0],a=arguments[1],u=null,l=null,c=null,h=null;return i=this._hi/s,h=(u=(c=A_.SPLIT*i)-(u=c-i))*(l=(h=A_.SPLIT*s)-(l=h-s))-(o=i*s)+u*(n=s-l)+(r=i-u)*l+r*n,h=i+(c=(this._hi-o-h+this._lo-i*a)/s),this._hi=h,this._lo=i-h+c,this}},A_.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},A_.prototype.divide=function(){if(arguments[0]instanceof A_){var t,e,r,n,i=arguments[0],o=null,s=null,a=null,u=null;return t=(r=this._hi/i._hi)-(o=(a=A_.SPLIT*r)-(o=a-r)),u=o*(s=(u=A_.SPLIT*i._hi)-(s=u-i._hi))-(n=r*i._hi)+o*(e=i._hi-s)+t*s+t*e,a=(this._hi-n-u+this._lo-r*i._lo)/i._hi,new A_(u=r+a,r-u+a)}if("number"==typeof arguments[0]){var l=arguments[0];return Km.isNaN(l)?A_.createNaN():A_.copy(this).selfDivide(l,0)}},A_.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},A_.prototype.pow=function(t){if(0===t)return A_.valueOf(1);var e=new A_(this),r=A_.valueOf(1),n=Math.abs(t);if(n>1)for(;n>0;)n%2==1&&r.selfMultiply(e),(n/=2)>0&&(e=e.sqr());else r=e;return t<0?r.reciprocal():r},A_.prototype.ceil=function(){if(this.isNaN())return A_.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new A_(t,e)},A_.prototype.compareTo=function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0},A_.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},A_.prototype.setValue=function(){if(arguments[0]instanceof A_){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},A_.prototype.max=function(t){return this.ge(t)?this:t},A_.prototype.sqrt=function(){if(this.isZero())return A_.valueOf(0);if(this.isNegative())return A_.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,r=A_.valueOf(e),n=this.subtract(r.sqr())._hi*(.5*t);return r.add(n)},A_.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof A_){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,r,n,i,o,s=arguments[0],a=null;return a=(n=this._hi+s)-(i=n-this._hi),r=(o=(a=s-i+(this._hi-a))+this._lo)+(n-(e=n+o)),this._hi=e+r,this._lo=r+(e-this._hi),this}}else if(2===arguments.length){var u,l,c,h,f=arguments[0],p=arguments[1],g=null,A=null,d=null;c=this._hi+f,l=this._lo+p,A=c-(d=c-this._hi),g=l-(h=l-this._lo);var y=(u=c+(d=(A=f-d+(this._hi-A))+l))+(d=(g=p-h+(this._lo-g))+(d+(c-u))),v=d+(u-y);return this._hi=y,this._lo=v,this}},A_.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof A_){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var r,n,i=arguments[0],o=arguments[1],s=null,a=null,u=null,l=null;s=(u=A_.SPLIT*this._hi)-this._hi,l=A_.SPLIT*i,s=u-s,r=this._hi-s,a=l-i;var c=(u=this._hi*i)+(l=s*(a=l-a)-u+s*(n=i-a)+r*a+r*n+(this._hi*o+this._lo*i)),h=l+(s=u-c);return this._hi=c,this._lo=h,this}},A_.prototype.selfSqr=function(){return this.selfMultiply(this)},A_.prototype.floor=function(){if(this.isNaN())return A_.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new A_(t,e)},A_.prototype.negate=function(){return this.isNaN()?this:new A_(-this._hi,-this._lo)},A_.prototype.clone=function(){},A_.prototype.multiply=function(){if(arguments[0]instanceof A_){var t=arguments[0];return t.isNaN()?A_.createNaN():A_.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return Km.isNaN(e)?A_.createNaN():A_.copy(this).selfMultiply(e,0)}},A_.prototype.isNaN=function(){return Km.isNaN(this._hi)},A_.prototype.intValue=function(){return Math.trunc(this._hi)},A_.prototype.toString=function(){var t=A_.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},A_.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!0,e),n=e[0]+1,i=r;if("."===r.charAt(0))i="0"+r;else if(n<0)i="0."+A_.stringOfChar("0",-n)+r;else if(-1===r.indexOf(".")){var o=n-r.length;i=r+A_.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},A_.prototype.reciprocal=function(){var t,e,r,n,i=null,o=null,s=null,a=null;t=(r=1/this._hi)-(i=(s=A_.SPLIT*r)-(i=s-r)),o=(a=A_.SPLIT*this._hi)-this._hi;var u=r+(s=(1-(n=r*this._hi)-(a=i*(o=a-o)-n+i*(e=this._hi-o)+t*o+t*e)-r*this._lo)/this._hi);return new A_(u,r-u+s)},A_.prototype.toSciNotation=function(){if(this.isZero())return A_.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!1,e),n=A_.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===r.charAt(0))throw new Error("Found leading zero: "+r);var i="";r.length>1&&(i=r.substring(1));var o=r.charAt(0)+"."+i;return this.isNegative()?"-"+o+n:o+n},A_.prototype.abs=function(){return this.isNaN()?A_.NaN:this.isNegative()?this.negate():new A_(this)},A_.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},A_.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},A_.prototype.add=function(){if(arguments[0]instanceof A_){var t=arguments[0];return A_.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return A_.copy(this).selfAdd(e)}},A_.prototype.init=function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof A_){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._hi=r,this._lo=n}},A_.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},A_.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},A_.prototype.trunc=function(){return this.isNaN()?A_.NaN:this.isPositive()?this.floor():this.ceil()},A_.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},A_.prototype.interfaces_=function(){return[r_,$m,t_]},A_.prototype.getClass=function(){return A_},A_.sqr=function(t){return A_.valueOf(t).selfMultiply(t)},A_.valueOf=function(){return"string"==typeof arguments[0]?A_.parse(arguments[0]):"number"==typeof arguments[0]?new A_(arguments[0]):void 0},A_.sqrt=function(t){return A_.valueOf(t).sqrt()},A_.parse=function(t){for(var e=0,r=t.length;g_.isWhitespace(t.charAt(e));)e++;var n=!1;if(e<r){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(n=!0))}for(var o=new A_,s=0,a=0,u=0;!(e>=r);){var l=t.charAt(e);if(e++,g_.isDigit(l)){var c=l-"0";o.selfMultiply(A_.TEN),o.selfAdd(c),s++}else{if("."!==l){if("e"===l||"E"===l){var h=t.substring(e);try{u=p_.parseInt(h)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+h+" in string "+t):e}break}throw new Error("Unexpected character '"+l+"' at position "+e+" in string "+t)}a=s}}var f=o,p=s-a-u;if(0===p)f=o;else if(p>0){var g=A_.TEN.pow(p);f=o.divide(g)}else if(p<0){var A=A_.TEN.pow(-p);f=o.multiply(A)}return n?f.negate():f},A_.createNaN=function(){return new A_(Km.NaN,Km.NaN)},A_.copy=function(t){return new A_(t)},A_.magnitude=function(t){var e=Math.abs(t),r=Math.log(e)/Math.log(10),n=Math.trunc(Math.floor(r));return 10*Math.pow(10,n)<=e&&(n+=1),n},A_.stringOfChar=function(t,e){for(var r=new f_,n=0;n<e;n++)r.append(t);return r.toString()},d_.PI.get=function(){return new A_(3.141592653589793,12246467991473532e-32)},d_.TWO_PI.get=function(){return new A_(6.283185307179586,24492935982947064e-32)},d_.PI_2.get=function(){return new A_(1.5707963267948966,6123233995736766e-32)},d_.E.get=function(){return new A_(2.718281828459045,14456468917292502e-32)},d_.NaN.get=function(){return new A_(Km.NaN,Km.NaN)},d_.EPS.get=function(){return 123259516440783e-46},d_.SPLIT.get=function(){return 134217729},d_.MAX_PRINT_DIGITS.get=function(){return 32},d_.TEN.get=function(){return A_.valueOf(10)},d_.ONE.get=function(){return A_.valueOf(1)},d_.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},d_.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(A_,d_);var y_=function(){},v_={DP_SAFE_EPSILON:{configurable:!0}};y_.prototype.interfaces_=function(){return[]},y_.prototype.getClass=function(){return y_},y_.orientationIndex=function(t,e,r){var n=y_.orientationIndexFilter(t,e,r);if(n<=1)return n;var i=A_.valueOf(e.x).selfAdd(-t.x),o=A_.valueOf(e.y).selfAdd(-t.y),s=A_.valueOf(r.x).selfAdd(-e.x),a=A_.valueOf(r.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},y_.signOfDet2x2=function(t,e,r,n){return t.multiply(n).selfSubtract(e.multiply(r)).signum()},y_.intersection=function(t,e,r,n){var i=A_.valueOf(n.y).selfSubtract(r.y).selfMultiply(A_.valueOf(e.x).selfSubtract(t.x)),o=A_.valueOf(n.x).selfSubtract(r.x).selfMultiply(A_.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=A_.valueOf(n.x).selfSubtract(r.x).selfMultiply(A_.valueOf(t.y).selfSubtract(r.y)),u=A_.valueOf(n.y).selfSubtract(r.y).selfMultiply(A_.valueOf(t.x).selfSubtract(r.x)),l=a.subtract(u).selfDivide(s).doubleValue(),c=A_.valueOf(t.x).selfAdd(A_.valueOf(e.x).selfSubtract(t.x).selfMultiply(l)).doubleValue(),h=A_.valueOf(e.x).selfSubtract(t.x).selfMultiply(A_.valueOf(t.y).selfSubtract(r.y)),f=A_.valueOf(e.y).selfSubtract(t.y).selfMultiply(A_.valueOf(t.x).selfSubtract(r.x)),p=h.subtract(f).selfDivide(s).doubleValue(),g=A_.valueOf(r.y).selfAdd(A_.valueOf(n.y).selfSubtract(r.y).selfMultiply(p)).doubleValue();return new n_(c,g)},y_.orientationIndexFilter=function(t,e,r){var n=null,i=(t.x-r.x)*(e.y-r.y),o=(t.y-r.y)*(e.x-r.x),s=i-o;if(i>0){if(o<=0)return y_.signum(s);n=i+o}else{if(!(i<0))return y_.signum(s);if(o>=0)return y_.signum(s);n=-i-o}var a=y_.DP_SAFE_EPSILON*n;return s>=a||-s>=a?y_.signum(s):2},y_.signum=function(t){return t>0?1:t<0?-1:0},v_.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(y_,v_);var m_=function(){},__={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};__.X.get=function(){return 0},__.Y.get=function(){return 1},__.Z.get=function(){return 2},__.M.get=function(){return 3},m_.prototype.setOrdinate=function(t,e,r){},m_.prototype.size=function(){},m_.prototype.getOrdinate=function(t,e){},m_.prototype.getCoordinate=function(){},m_.prototype.getCoordinateCopy=function(t){},m_.prototype.getDimension=function(){},m_.prototype.getX=function(t){},m_.prototype.clone=function(){},m_.prototype.expandEnvelope=function(t){},m_.prototype.copy=function(){},m_.prototype.getY=function(t){},m_.prototype.toCoordinateArray=function(){},m_.prototype.interfaces_=function(){return[t_]},m_.prototype.getClass=function(){return m_},Object.defineProperties(m_,__);var I_=function(){},E_=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(I_),x_=function(){};x_.arraycopy=function(t,e,r,n,i){for(var o=0,s=e;s<e+i;s++)r[n+o]=t[s],o++},x_.getProperty=function(t){return{"line.separator":"\n"}[t]};var C_=function t(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this.x=r,this.y=n,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof n_&&arguments[1]instanceof n_){var s=arguments[0],a=arguments[1];this.x=s.y-a.y,this.y=a.x-s.x,this.w=s.x*a.y-a.x*s.y}}else if(3===arguments.length){var u=arguments[0],l=arguments[1],c=arguments[2];this.x=u,this.y=l,this.w=c}else if(4===arguments.length){var h=arguments[0],f=arguments[1],p=arguments[2],g=arguments[3],A=h.y-f.y,d=f.x-h.x,y=h.x*f.y-f.x*h.y,v=p.y-g.y,m=g.x-p.x,_=p.x*g.y-g.x*p.y;this.x=d*_-m*y,this.y=v*y-A*_,this.w=A*m-v*d}};C_.prototype.getY=function(){var t=this.y/this.w;if(Km.isNaN(t)||Km.isInfinite(t))throw new E_;return t},C_.prototype.getX=function(){var t=this.x/this.w;if(Km.isNaN(t)||Km.isInfinite(t))throw new E_;return t},C_.prototype.getCoordinate=function(){var t=new n_;return t.x=this.getX(),t.y=this.getY(),t},C_.prototype.interfaces_=function(){return[]},C_.prototype.getClass=function(){return C_},C_.intersection=function(t,e,r,n){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=r.y-n.y,u=n.x-r.x,l=r.x*n.y-n.x*r.y,c=i*u-a*o,h=(o*l-u*s)/c,f=(a*s-i*l)/c;if(Km.isNaN(h)||Km.isInfinite(h)||Km.isNaN(f)||Km.isInfinite(f))throw new E_;return new n_(h,f)};var w_=function t(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof n_){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];this.init(o,s,a,u)}},b_={serialVersionUID:{configurable:!0}};w_.prototype.getArea=function(){return this.getWidth()*this.getHeight()},w_.prototype.equals=function(t){if(!(t instanceof w_))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()},w_.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new w_;var e=this._minx>t._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny,n=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new w_(e,n,r,i)},w_.prototype.isNull=function(){return this._maxx<this._minx},w_.prototype.getMaxX=function(){return this._maxx},w_.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof n_){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof w_){var e=arguments[0];return!this.isNull()&&!e.isNull()&&(e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&(r>=this._minx&&r<=this._maxx&&n>=this._miny&&n<=this._maxy)}},w_.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof w_){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof n_){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&!(r>this._maxx||r<this._minx||n>this._maxy||n<this._miny)}},w_.prototype.getMinY=function(){return this._miny},w_.prototype.getMinX=function(){return this._minx},w_.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof n_){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof w_){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=n,this._maxy=n):(r<this._minx&&(this._minx=r),r>this._maxx&&(this._maxx=r),n<this._miny&&(this._miny=n),n>this._maxy&&(this._maxy=n))}},w_.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},w_.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},w_.prototype.compareTo=function(t){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0},w_.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},w_.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},w_.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},w_.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},w_.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},w_.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},w_.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof w_){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof n_){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.covers(r,n)}},w_.prototype.centre=function(){return this.isNull()?null:new n_((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},w_.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof n_){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof w_){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.init(r.x,n.x,r.y,n.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];i<o?(this._minx=i,this._maxx=o):(this._minx=o,this._maxx=i),s<a?(this._miny=s,this._maxy=a):(this._miny=a,this._maxy=s)}},w_.prototype.getMaxY=function(){return this._maxy},w_.prototype.distance=function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var r=0;return this._maxy<t._miny?r=t._miny-this._maxy:this._miny>t._maxy&&(r=this._miny-t._maxy),0===e?r:0===r?e:Math.sqrt(e*e+r*r)},w_.prototype.hashCode=function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+n_.hashCode(this._minx))+n_.hashCode(this._maxx))+n_.hashCode(this._miny))+n_.hashCode(this._maxy)},w_.prototype.interfaces_=function(){return[$m,r_]},w_.prototype.getClass=function(){return w_},w_.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2];return r.x>=(t.x<e.x?t.x:e.x)&&r.x<=(t.x>e.x?t.x:e.x)&&r.y>=(t.y<e.y?t.y:e.y)&&r.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),u=Math.max(o.x,s.x),l=Math.min(n.x,i.x),c=Math.max(n.x,i.x);return!(l>u)&&(!(c<a)&&(a=Math.min(o.y,s.y),u=Math.max(o.y,s.y),l=Math.min(n.y,i.y),c=Math.max(n.y,i.y),!(l>u)&&!(c<a)))}},b_.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(w_,b_);var B_={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},S_=function(t){this.geometryFactory=t||new pE};S_.prototype.read=function(t){var e,r,n;t=t.replace(/[\n\r]/g," ");var i=B_.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=B_.emptyTypeStr.exec(t))[2]=void 0),i&&(r=i[1].toLowerCase(),n=i[2],L_[r]&&(e=L_[r].apply(this,[n]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},S_.prototype.write=function(t){return this.extractGeometry(t)},S_.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!M_[e])return null;var r=e.toUpperCase();return t.isEmpty()?r+" EMPTY":r+"("+M_[e].apply(this,[t])+")"};var M_={coordinate:function(t){return t.x+" "+t.y},point:function(t){return M_.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+M_.point.apply(this,[t._geometries[r]])+")");return e.join(",")},linestring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(M_.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},linearring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(M_.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},multilinestring:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+M_.linestring.apply(this,[t._geometries[r]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+M_.linestring.apply(this,[t._shell])+")");for(var r=0,n=t._holes.length;r<n;++r)e.push("("+M_.linestring.apply(this,[t._holes[r]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+M_.polygon.apply(this,[t._geometries[r]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push(this.extractGeometry(t._geometries[r]));return e.join(",")}},L_={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(B_.spaces);return this.geometryFactory.createPoint(new n_(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPoint();for(var r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(B_.trimParens,"$1"),n.push(L_.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(n)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(B_.spaces),n.push(new n_(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(n)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(B_.spaces),n.push(new n_(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(n)},multilinestring:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiLineString();for(var r=t.trim().split(B_.parenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(B_.trimParens,"$1"),n.push(L_.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(n)},polygon:function(t){var e,r,n;if(void 0===t)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(B_.parenComma),s=[],a=0,u=o.length;a<u;++a)e=o[a].replace(B_.trimParens,"$1"),r=L_.linestring.apply(this,[e]),n=this.geometryFactory.createLinearRing(r._points),0===a?i=n:s.push(n);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var r=t.trim().split(B_.doubleParenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(B_.trimParens,"$1"),n.push(L_.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(n)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),r=[],n=0,i=e.length;n<i;++n)r.push(this.read(e[n]));return this.geometryFactory.createGeometryCollection(r)}},N_=function(t){this.parser=new S_(t)};N_.prototype.write=function(t){return this.parser.write(t)},N_.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var T_=function(t){function e(e){t.call(this,e),this.name="RuntimeException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),R_=function(t){function e(){if(t.call(this),0===arguments.length)t.call(this);else if(1===arguments.length){var e=arguments[0];t.call(this,e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(T_),D_=function(){};D_.prototype.interfaces_=function(){return[]},D_.prototype.getClass=function(){return D_},D_.shouldNeverReachHere=function(){if(0===arguments.length)D_.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new R_("Should never reach here"+(null!==t?": "+t:""))}},D_.isTrue=function(){var t;if(1===arguments.length)D_.isTrue(arguments[0],null);else if(2===arguments.length&&(t=arguments[1],!arguments[0]))throw null===t?new R_:new R_(t)},D_.equals=function(){var t,e,r;if(2===arguments.length)D_.equals(t=arguments[0],e=arguments[1],null);else if(3===arguments.length&&(t=arguments[0],r=arguments[2],!(e=arguments[1]).equals(t)))throw new R_("Expected "+t+" but encountered "+e+(null!==r?": "+r:""))};var Q_=function(){this._result=null,this._inputLines=Array(2).fill().map((function(){return Array(2)})),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new n_,this._intPt[1]=new n_,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},P_={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};Q_.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},Q_.prototype.getTopologySummary=function(){var t=new f_;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},Q_.prototype.computeIntersection=function(t,e,r,n){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=r,this._inputLines[1][1]=n,this._result=this.computeIntersect(t,e,r,n)},Q_.prototype.getIntersectionNum=function(){return this._result},Q_.prototype.computeIntLineIndex=function(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},Q_.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},Q_.prototype.setPrecisionModel=function(t){this._precisionModel=t},Q_.prototype.isInteriorIntersection=function(){var t=this;if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var e=arguments[0],r=0;r<this._result;r++)if(!t._intPt[r].equals2D(t._inputLines[e][0])&&!t._intPt[r].equals2D(t._inputLines[e][1]))return!0;return!1}},Q_.prototype.getIntersection=function(t){return this._intPt[t]},Q_.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},Q_.prototype.hasIntersection=function(){return this._result!==Q_.NO_INTERSECTION},Q_.prototype.getEdgeDistance=function(t,e){return Q_.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},Q_.prototype.isCollinear=function(){return this._result===Q_.COLLINEAR_INTERSECTION},Q_.prototype.toString=function(){return N_.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+N_.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},Q_.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},Q_.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},Q_.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},Q_.prototype.interfaces_=function(){return[]},Q_.prototype.getClass=function(){return Q_},Q_.computeEdgeDistance=function(t,e,r){var n=Math.abs(r.x-e.x),i=Math.abs(r.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(r))o=n>i?n:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=n>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return D_.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},Q_.nonRobustComputeEdgeDistance=function(t,e,r){var n=t.x-e.x,i=t.y-e.y,o=Math.sqrt(n*n+i*i);return D_.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},P_.DONT_INTERSECT.get=function(){return 0},P_.DO_INTERSECT.get=function(){return 1},P_.COLLINEAR.get=function(){return 2},P_.NO_INTERSECTION.get=function(){return 0},P_.POINT_INTERSECTION.get=function(){return 1},P_.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(Q_,P_);var k_=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(t){var e=new w_(this._inputLines[0][0],this._inputLines[0][1]),r=new w_(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&r.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],r=arguments[1],n=arguments[2];if(this._isProper=!1,w_.intersects(r,n,e)&&0===G_.orientationIndex(r,n,e)&&0===G_.orientationIndex(n,r,e))return this._isProper=!0,(e.equals(r)||e.equals(n))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,r,n,i){i.x=this.smallestInAbsValue(t.x,e.x,r.x,n.x),i.y=this.smallestInAbsValue(t.y,e.y,r.y,n.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,r,n,i){var o=null;try{o=C_.intersection(t,r,n,i)}catch(s){if(!(s instanceof E_))throw s;o=e.nearestEndpoint(t,r,n,i)}return o},e.prototype.intersection=function(t,r,n,i){var o=this.intersectionWithNormalization(t,r,n,i);return this.isInSegmentEnvelopes(o)||(o=new n_(e.nearestEndpoint(t,r,n,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,r,n){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(r)<o&&(i=r,o=Math.abs(r)),Math.abs(n)<o&&(i=n),i},e.prototype.checkDD=function(t,e,r,n,i){var o=y_.intersection(t,e,r,n),s=this.isInSegmentEnvelopes(o);x_.out.println("DD in env = "+s+" --------------------- "+o),i.distance(o)>1e-4&&x_.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,r,n){var i=new n_(t),o=new n_(e),s=new n_(r),a=new n_(n),u=new n_;this.normalizeToEnvCentre(i,o,s,a,u);var l=this.safeHCoordinateIntersection(i,o,s,a);return l.x+=u.x,l.y+=u.y,l},e.prototype.computeCollinearIntersection=function(e,r,n,i){var o=w_.intersects(e,r,n),s=w_.intersects(e,r,i),a=w_.intersects(n,i,e),u=w_.intersects(n,i,r);return o&&s?(this._intPt[0]=n,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&u?(this._intPt[0]=e,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||s||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&u?(this._intPt[0]=n,this._intPt[1]=r,!n.equals(r)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&u?(this._intPt[0]=i,this._intPt[1]=r,!i.equals(r)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,r,n,i){var o=t.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=r.x<n.x?r.x:n.x,c=r.y<n.y?r.y:n.y,h=r.x>n.x?r.x:n.x,f=r.y>n.y?r.y:n.y,p=((o>l?o:l)+(a<h?a:h))/2,g=((s>c?s:c)+(u<f?u:f))/2;i.x=p,i.y=g,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.computeIntersect=function(e,r,n,i){if(this._isProper=!1,!w_.intersects(e,r,n,i))return t.NO_INTERSECTION;var o=G_.orientationIndex(e,r,n),s=G_.orientationIndex(e,r,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=G_.orientationIndex(n,i,e),u=G_.orientationIndex(n,i,r);return a>0&&u>0||a<0&&u<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===u?this.computeCollinearIntersection(e,r,n,i):(0===o||0===s||0===a||0===u?(this._isProper=!1,e.equals2D(n)||e.equals2D(i)?this._intPt[0]=e:r.equals2D(n)||r.equals2D(i)?this._intPt[0]=r:0===o?this._intPt[0]=new n_(n):0===s?this._intPt[0]=new n_(i):0===a?this._intPt[0]=new n_(e):0===u&&(this._intPt[0]=new n_(r))):(this._isProper=!0,this._intPt[0]=this.intersection(e,r,n,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,r,n){var i=t,o=G_.distancePointLine(t,r,n),s=G_.distancePointLine(e,r,n);return s<o&&(o=s,i=e),(s=G_.distancePointLine(r,t,e))<o&&(o=s,i=r),(s=G_.distancePointLine(n,t,e))<o&&(o=s,i=n),i},e}(Q_),O_=function(){};O_.prototype.interfaces_=function(){return[]},O_.prototype.getClass=function(){return O_},O_.orientationIndex=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=r.x-e.x,s=r.y-e.y;return O_.signOfDet2x2(n,i,o,s)},O_.signOfDet2x2=function(t,e,r,n){var i=null,o=null,s=null;if(i=1,0===t||0===n)return 0===e||0===r?0:e>0?r>0?-i:i:r>0?i:-i;if(0===e||0===r)return n>0?t>0?i:-i:t>0?-i:i;if(e>0?n>0?e<=n||(i=-i,o=t,t=r,r=o,o=e,e=n,n=o):e<=-n?(i=-i,r=-r,n=-n):(o=t,t=-r,r=o,o=e,e=-n,n=o):n>0?-e<=n?(i=-i,t=-t,e=-e):(o=-t,t=r,r=o,o=-e,e=n,n=o):e>=n?(t=-t,e=-e,r=-r,n=-n):(i=-i,o=-t,t=-r,r=o,o=-e,e=-n,n=o),t>0){if(!(r>0))return i;if(!(t<=r))return i}else{if(r>0)return-i;if(!(t>=r))return-i;i=-i,t=-t,r=-r}for(;;){if((n-=(s=Math.floor(r/t))*e)<0)return-i;if(n>e)return i;if(t>(r-=s*t)+r){if(e<n+n)return i}else{if(e>n+n)return-i;r=t-r,n=e-n,i=-i}if(0===n)return 0===r?0:-i;if(0===r)return i;if((e-=(s=Math.floor(t/r))*n)<0)return i;if(e>n)return-i;if(r>(t-=s*r)+t){if(n<e+e)return-i}else{if(n>e+e)return i;t=r-t,e=n-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var F_=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};F_.prototype.countSegment=function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var r=t.x,n=e.x;return r>n&&(r=e.x,n=t.x),this._p.x>=r&&this._p.x<=n&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,u=O_.signOfDet2x2(i,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a<o&&(u=-u),u>0&&this._crossingCount++}},F_.prototype.isPointInPolygon=function(){return this.getLocation()!==a_.EXTERIOR},F_.prototype.getLocation=function(){return this._isPointOnSegment?a_.BOUNDARY:this._crossingCount%2==1?a_.INTERIOR:a_.EXTERIOR},F_.prototype.isOnSegment=function(){return this._isPointOnSegment},F_.prototype.interfaces_=function(){return[]},F_.prototype.getClass=function(){return F_},F_.locatePointInRing=function(){if(arguments[0]instanceof n_&&l_(arguments[1],m_)){for(var t=arguments[1],e=new F_(arguments[0]),r=new n_,n=new n_,i=1;i<t.size();i++)if(t.getCoordinate(i,r),t.getCoordinate(i-1,n),e.countSegment(r,n),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof n_&&arguments[1]instanceof Array){for(var o=arguments[1],s=new F_(arguments[0]),a=1;a<o.length;a++){var u=o[a],l=o[a-1];if(s.countSegment(u,l),s.isOnSegment())return s.getLocation()}return s.getLocation()}};var G_=function(){},U_={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};G_.prototype.interfaces_=function(){return[]},G_.prototype.getClass=function(){return G_},G_.orientationIndex=function(t,e,r){return y_.orientationIndex(t,e,r)},G_.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,r=t[0].x,n=1;n<t.length-1;n++){var i=t[n].x-r,o=t[n+1].y;e+=i*(t[n-1].y-o)}return e/2}if(l_(arguments[0],m_)){var s=arguments[0],a=s.size();if(a<3)return 0;var u=new n_,l=new n_,c=new n_;s.getCoordinate(0,l),s.getCoordinate(1,c);var h=l.x;c.x-=h;for(var f=0,p=1;p<a-1;p++)u.y=l.y,l.x=c.x,l.y=c.y,s.getCoordinate(p+1,c),c.x-=h,f+=l.x*(u.y-c.y);return f/2}},G_.distanceLineLine=function(t,e,r,n){if(t.equals(e))return G_.distancePointLine(t,r,n);if(r.equals(n))return G_.distancePointLine(n,t,e);var i=!1;if(w_.intersects(t,e,r,n)){var o=(e.x-t.x)*(n.y-r.y)-(e.y-t.y)*(n.x-r.x);if(0===o)i=!0;else{var s=(t.y-r.y)*(n.x-r.x)-(t.x-r.x)*(n.y-r.y),a=((t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y))/o,u=s/o;(u<0||u>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?c_.min(G_.distancePointLine(t,r,n),G_.distancePointLine(e,r,n),G_.distancePointLine(r,t,e),G_.distancePointLine(n,t,e)):0},G_.isPointInRing=function(t,e){return G_.locatePointInRing(t,e)!==a_.EXTERIOR},G_.computeLength=function(t){var e=t.size();if(e<=1)return 0;var r=0,n=new n_;t.getCoordinate(0,n);for(var i=n.x,o=n.y,s=1;s<e;s++){t.getCoordinate(s,n);var a=n.x,u=n.y,l=a-i,c=u-o;r+=Math.sqrt(l*l+c*c),i=a,o=u}return r},G_.isCCW=function(t){var e=t.length-1;if(e<3)throw new Wm("Ring has fewer than 4 points, so orientation cannot be determined");for(var r=t[0],n=0,i=1;i<=e;i++){var o=t[i];o.y>r.y&&(r=o,n=i)}var s=n;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(r)&&s!==n);var a=n;do{a=(a+1)%e}while(t[a].equals2D(r)&&a!==n);var u=t[s],l=t[a];if(u.equals2D(r)||l.equals2D(r)||u.equals2D(l))return!1;var c=G_.computeOrientation(u,r,l),h=!1;return h=0===c?u.x>l.x:c>0,h},G_.locatePointInRing=function(t,e){return F_.locatePointInRing(t,e)},G_.distancePointLinePerpendicular=function(t,e,r){var n=(r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y),i=((e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y))/n;return Math.abs(i)*Math.sqrt(n)},G_.computeOrientation=function(t,e,r){return G_.orientationIndex(t,e,r)},G_.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new Wm("Line array must contain at least one vertex");for(var r=t.distance(e[0]),n=0;n<e.length-1;n++){var i=G_.distancePointLine(t,e[n],e[n+1]);i<r&&(r=i)}return r}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var u=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),l=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/u;if(l<=0)return o.distance(s);if(l>=1)return o.distance(a);var c=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(c)*Math.sqrt(u)}},G_.isOnLine=function(t,e){for(var r=new k_,n=1;n<e.length;n++){var i=e[n-1],o=e[n];if(r.computeIntersection(t,i,o),r.hasIntersection())return!0}return!1},U_.CLOCKWISE.get=function(){return-1},U_.RIGHT.get=function(){return G_.CLOCKWISE},U_.COUNTERCLOCKWISE.get=function(){return 1},U_.LEFT.get=function(){return G_.COUNTERCLOCKWISE},U_.COLLINEAR.get=function(){return 0},U_.STRAIGHT.get=function(){return G_.COLLINEAR},Object.defineProperties(G_,U_);var q_=function(){};q_.prototype.filter=function(t){},q_.prototype.interfaces_=function(){return[]},q_.prototype.getClass=function(){return q_};var j_=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},V_={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};j_.prototype.isGeometryCollection=function(){return this.getSortIndex()===j_.SORTINDEX_GEOMETRYCOLLECTION},j_.prototype.getFactory=function(){return this._factory},j_.prototype.getGeometryN=function(t){return this},j_.prototype.getArea=function(){return 0},j_.prototype.isRectangle=function(){return!1},j_.prototype.equals=function(){if(arguments[0]instanceof j_){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof j_))return!1;var r=e;return this.equalsExact(r)}},j_.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},j_.prototype.geometryChanged=function(){this.apply(j_.geometryChangedFilter)},j_.prototype.geometryChangedAction=function(){this._envelope=null},j_.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},j_.prototype.getLength=function(){return 0},j_.prototype.getNumGeometries=function(){return 1},j_.prototype.compareTo=function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.getSortIndex()!==r.getSortIndex()?this.getSortIndex()-r.getSortIndex():this.isEmpty()&&r.isEmpty()?0:this.isEmpty()?-1:r.isEmpty()?1:this.compareToSameClass(r,n)}},j_.prototype.getUserData=function(){return this._userData},j_.prototype.getSRID=function(){return this._SRID},j_.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},j_.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===j_.SORTINDEX_GEOMETRYCOLLECTION)throw new Wm("This method does not support GeometryCollection arguments")},j_.prototype.equal=function(t,e,r){return 0===r?t.equals(e):t.distance(e)<=r},j_.prototype.norm=function(){var t=this.copy();return t.normalize(),t},j_.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},j_.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new w_(this._envelope)},j_.prototype.setSRID=function(t){this._SRID=t},j_.prototype.setUserData=function(t){this._userData=t},j_.prototype.compare=function(t,e){for(var r=t.iterator(),n=e.iterator();r.hasNext()&&n.hasNext();){var i=r.next(),o=n.next(),s=i.compareTo(o);if(0!==s)return s}return r.hasNext()?1:n.hasNext()?-1:0},j_.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},j_.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===j_.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===j_.SORTINDEX_MULTIPOINT||this.getSortIndex()===j_.SORTINDEX_MULTILINESTRING||this.getSortIndex()===j_.SORTINDEX_MULTIPOLYGON},j_.prototype.interfaces_=function(){return[t_,$m,r_]},j_.prototype.getClass=function(){return j_},j_.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},j_.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},V_.serialVersionUID.get=function(){return 0x799ea46522854c00},V_.SORTINDEX_POINT.get=function(){return 0},V_.SORTINDEX_MULTIPOINT.get=function(){return 1},V_.SORTINDEX_LINESTRING.get=function(){return 2},V_.SORTINDEX_LINEARRING.get=function(){return 3},V_.SORTINDEX_MULTILINESTRING.get=function(){return 4},V_.SORTINDEX_POLYGON.get=function(){return 5},V_.SORTINDEX_MULTIPOLYGON.get=function(){return 6},V_.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},V_.geometryChangedFilter.get=function(){return z_},Object.defineProperties(j_,V_);var z_=function(){};z_.interfaces_=function(){return[q_]},z_.filter=function(t){t.geometryChangedAction()};var Y_=function(){};Y_.prototype.filter=function(t){},Y_.prototype.interfaces_=function(){return[]},Y_.prototype.getClass=function(){return Y_};var H_=function(){},X_={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};H_.prototype.isInBoundary=function(t){},H_.prototype.interfaces_=function(){return[]},H_.prototype.getClass=function(){return H_},X_.Mod2BoundaryNodeRule.get=function(){return J_},X_.EndPointBoundaryNodeRule.get=function(){return W_},X_.MultiValentEndPointBoundaryNodeRule.get=function(){return K_},X_.MonoValentEndPointBoundaryNodeRule.get=function(){return Z_},X_.MOD2_BOUNDARY_RULE.get=function(){return new J_},X_.ENDPOINT_BOUNDARY_RULE.get=function(){return new W_},X_.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new K_},X_.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Z_},X_.OGC_SFS_BOUNDARY_RULE.get=function(){return H_.MOD2_BOUNDARY_RULE},Object.defineProperties(H_,X_);var J_=function(){};J_.prototype.isInBoundary=function(t){return t%2==1},J_.prototype.interfaces_=function(){return[H_]},J_.prototype.getClass=function(){return J_};var W_=function(){};W_.prototype.isInBoundary=function(t){return t>0},W_.prototype.interfaces_=function(){return[H_]},W_.prototype.getClass=function(){return W_};var K_=function(){};K_.prototype.isInBoundary=function(t){return t>1},K_.prototype.interfaces_=function(){return[H_]},K_.prototype.getClass=function(){return K_};var Z_=function(){};Z_.prototype.isInBoundary=function(t){return 1===t},Z_.prototype.interfaces_=function(){return[H_]},Z_.prototype.getClass=function(){return Z_};var $_=function(){};function tI(t){this.message=t||""}$_.prototype.add=function(){},$_.prototype.addAll=function(){},$_.prototype.isEmpty=function(){},$_.prototype.iterator=function(){},$_.prototype.size=function(){},$_.prototype.toArray=function(){},$_.prototype.remove=function(){},tI.prototype=new Error,tI.prototype.name="IndexOutOfBoundsException";var eI=function(){};eI.prototype.hasNext=function(){},eI.prototype.next=function(){},eI.prototype.remove=function(){};var rI=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}($_);function nI(t){this.message=t||""}nI.prototype=new Error,nI.prototype.name="NoSuchElementException";var iI=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof $_&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,$_]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var r=this.array_[t];return this.array_[t]=e,r},e.prototype.iterator=function(){return new oI(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new tI;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,r=0,n=this.array_.length;r<n;r++)if(this.array_[r]===t){this.array_.splice(r,1),e=!0;break}return e},e}(rI),oI=function(t){function e(e){t.call(this),this.arrayList_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new nI;return this.arrayList_.get(this.position_++)},e.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},e.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},e.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},e}(eI),sI=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.ensureCapacity(r.length),this.add(r,n)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={coordArrayType:{configurable:!0}};return r.coordArrayType.get=function(){return new Array(0).fill(null)},e.prototype.getCoordinate=function(t){return this.get(t)},e.prototype.addAll=function(){if(2===arguments.length){for(var e=arguments[1],r=!1,n=arguments[0].iterator();n.hasNext();)this.add(n.next(),e),r=!0;return r}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),r=0;r<this.size();r++)e.add(r,this.get(r).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){var e=this;if(1===arguments.length){var r=arguments[0];t.prototype.add.call(this,r)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1];return this.add(n,i,!0),!0}if(arguments[0]instanceof n_&&"boolean"==typeof arguments[1]){var o=arguments[0];if(!arguments[1])if(this.size()>=1)if(this.get(this.size()-1).equals2D(o))return null;t.prototype.add.call(this,o)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var s=arguments[0],a=arguments[1];return this.add(s,a),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var u=arguments[0],l=arguments[1];if(arguments[2])for(var c=0;c<u.length;c++)e.add(u[c],l);else for(var h=u.length-1;h>=0;h--)e.add(u[h],l);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof n_){var f=arguments[0],p=arguments[1];if(!arguments[2]){var g=this.size();if(g>0){if(f>0)if(this.get(f-1).equals2D(p))return null;if(f<g)if(this.get(f).equals2D(p))return null}}t.prototype.add.call(this,f,p)}}else if(4===arguments.length){var A=arguments[0],d=arguments[1],y=arguments[2],v=arguments[3],m=1;y>v&&(m=-1);for(var _=y;_!==v;_+=m)e.add(A[_],d);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new n_(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,r),e}(iI),aI=function(){},uI={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};uI.ForwardComparator.get=function(){return lI},uI.BidirectionalComparator.get=function(){return cI},uI.coordArrayType.get=function(){return new Array(0).fill(null)},aI.prototype.interfaces_=function(){return[]},aI.prototype.getClass=function(){return aI},aI.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},aI.ptNotInList=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(aI.indexOf(n,e)<0)return n}return null},aI.scroll=function(t,e){var r=aI.indexOf(e,t);if(r<0)return null;var n=new Array(t.length).fill(null);x_.arraycopy(t,r,n,0,t.length-r),x_.arraycopy(t,0,n,t.length-r,r),x_.arraycopy(n,0,t,0,t.length)},aI.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(!t[r].equals(e[r]))return!1;return!0}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];if(n===i)return!0;if(null===n||null===i)return!1;if(n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(0!==o.compare(n[s],i[s]))return!1;return!0}},aI.intersection=function(t,e){for(var r=new sI,n=0;n<t.length;n++)e.intersects(t[n])&&r.add(t[n],!0);return r.toCoordinateArray()},aI.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},aI.removeRepeatedPoints=function(t){return aI.hasRepeatedPoints(t)?new sI(t,!1).toCoordinateArray():t},aI.reverse=function(t){for(var e=t.length-1,r=Math.trunc(e/2),n=0;n<=r;n++){var i=t[n];t[n]=t[e-n],t[e-n]=i}},aI.removeNull=function(t){for(var e=0,r=0;r<t.length;r++)null!==t[r]&&e++;var n=new Array(e).fill(null);if(0===e)return n;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(n[i++]=t[o]);return n},aI.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),r=0;r<t.length;r++)e[r]=new n_(t[r]);return e}if(5===arguments.length)for(var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],u=0;u<a;u++)o[s+u]=new n_(n[i+u])},aI.isEqualReversed=function(t,e){for(var r=0;r<t.length;r++){var n=t[r],i=e[t.length-r-1];if(0!==n.compareTo(i))return!1}return!0},aI.envelope=function(t){for(var e=new w_,r=0;r<t.length;r++)e.expandToInclude(t[r]);return e},aI.toCoordinateArray=function(t){return t.toArray(aI.coordArrayType)},aI.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},aI.indexOf=function(t,e){for(var r=0;r<e.length;r++)if(t.equals(e[r]))return r;return-1},aI.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var r=t.length-1-e,n=t[e].compareTo(t[r]);if(0!==n)return n}return 1},aI.compare=function(t,e){for(var r=0;r<t.length&&r<e.length;){var n=t[r].compareTo(e[r]);if(0!==n)return n;r++}return r<e.length?-1:r<t.length?1:0},aI.minCoordinate=function(t){for(var e=null,r=0;r<t.length;r++)(null===e||e.compareTo(t[r])>0)&&(e=t[r]);return e},aI.extract=function(t,e,r){e=c_.clamp(e,0,t.length);var n=(r=c_.clamp(r,-1,t.length))-e+1;r<0&&(n=0),e>=t.length&&(n=0),r<e&&(n=0);var i=new Array(n).fill(null);if(0===n)return i;for(var o=0,s=e;s<=r;s++)i[o++]=t[s];return i},Object.defineProperties(aI,uI);var lI=function(){};lI.prototype.compare=function(t,e){return aI.compare(t,e)},lI.prototype.interfaces_=function(){return[e_]},lI.prototype.getClass=function(){return lI};var cI=function(){};cI.prototype.compare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;var i=aI.compare(r,n);return aI.isEqualReversed(r,n)?0:i},cI.prototype.OLDcompare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;for(var i=aI.increasingDirection(r),o=aI.increasingDirection(n),s=i>0?0:r.length-1,a=o>0?0:r.length-1,u=0;u<r.length;u++){var l=r[s].compareTo(n[a]);if(0!==l)return l;s+=i,a+=o}return 0},cI.prototype.interfaces_=function(){return[e_]},cI.prototype.getClass=function(){return cI};var hI=function(){};hI.prototype.get=function(){},hI.prototype.put=function(){},hI.prototype.size=function(){},hI.prototype.values=function(){},hI.prototype.entrySet=function(){};var fI=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(hI);function pI(t){this.message=t||""}function gI(){}pI.prototype=new Error,pI.prototype.name="OperationNotSupported",gI.prototype=new $_,gI.prototype.contains=function(){};var AI=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof $_&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++){if(this.array_[e]===t)return!0}return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new dI(this)},e}(gI),dI=function(t){function e(e){t.call(this),this.hashSet_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new nI;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new pI},e}(eI);function yI(t){return null===t?0:t.color}function vI(t){return null===t?null:t.parent}function mI(t,e){null!==t&&(t.color=e)}function _I(t){return null===t?null:t.left}function II(t){return null===t?null:t.right}function EI(){this.root_=null,this.size_=0}EI.prototype=new fI,EI.prototype.get=function(t){for(var e=this.root_;null!==e;){var r=t.compareTo(e.key);if(r<0)e=e.left;else{if(!(r>0))return e.value;e=e.right}}return null},EI.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var r,n,i=this.root_;do{if(r=i,(n=t.compareTo(i.key))<0)i=i.left;else{if(!(n>0)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var s={key:t,left:null,right:null,value:e,parent:r,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return n<0?r.left=s:r.right=s,this.fixAfterInsertion(s),this.size_++,null},EI.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(vI(t)===_I(vI(vI(t)))){var r=II(vI(vI(t)));1===yI(r)?(mI(vI(t),0),mI(r,0),mI(vI(vI(t)),1),t=vI(vI(t))):(t===II(vI(t))&&(t=vI(t),e.rotateLeft(t)),mI(vI(t),0),mI(vI(vI(t)),1),e.rotateRight(vI(vI(t))))}else{var n=_I(vI(vI(t)));1===yI(n)?(mI(vI(t),0),mI(n,0),mI(vI(vI(t)),1),t=vI(vI(t))):(t===_I(vI(t))&&(t=vI(t),e.rotateRight(t)),mI(vI(t),0),mI(vI(vI(t)),1),e.rotateLeft(vI(vI(t))))}this.root_.color=0},EI.prototype.values=function(){var t=new iI,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=EI.successor(e));)t.add(e.value);return t},EI.prototype.entrySet=function(){var t=new AI,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=EI.successor(e));)t.add(e);return t},EI.prototype.rotateLeft=function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},EI.prototype.rotateRight=function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},EI.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},EI.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}for(var r=t.parent,n=t;null!==r&&n===r.right;)n=r,r=r.parent;return r},EI.prototype.size=function(){return this.size_};var xI=function(){};function CI(){}function wI(){this.array_=[],arguments[0]instanceof $_&&this.addAll(arguments[0])}xI.prototype.interfaces_=function(){return[]},xI.prototype.getClass=function(){return xI},CI.prototype=new gI,wI.prototype=new CI,wI.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++){if(0===this.array_[e].compareTo(t))return!0}return!1},wI.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,r=this.array_.length;e<r;e++){if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0}return this.array_.push(t),!0},wI.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},wI.prototype.remove=function(t){throw new pI},wI.prototype.size=function(){return this.array_.length},wI.prototype.isEmpty=function(){return 0===this.array_.length},wI.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},wI.prototype.iterator=function(){return new bI(this)};var bI=function(t){this.treeSet_=t,this.position_=0};bI.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new nI;return this.treeSet_.array_[this.position_++]},bI.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},bI.prototype.remove=function(){throw new pI};var BI=function(){};BI.sort=function(){var t,e,r,n,i=arguments[0];if(1===arguments.length)n=function(t,e){return t.compareTo(e)},i.sort(n);else if(2===arguments.length)r=arguments[1],n=function(t,e){return r.compare(t,e)},i.sort(n);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),r=arguments[3],n=function(t,e){return r.compare(t,e)},e.sort(n),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},BI.asList=function(t){for(var e=new iI,r=0,n=t.length;r<n;r++)e.add(t[r]);return e};var SI=function(){},MI={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};MI.P.get=function(){return 0},MI.L.get=function(){return 1},MI.A.get=function(){return 2},MI.FALSE.get=function(){return-1},MI.TRUE.get=function(){return-2},MI.DONTCARE.get=function(){return-3},MI.SYM_FALSE.get=function(){return"F"},MI.SYM_TRUE.get=function(){return"T"},MI.SYM_DONTCARE.get=function(){return"*"},MI.SYM_P.get=function(){return"0"},MI.SYM_L.get=function(){return"1"},MI.SYM_A.get=function(){return"2"},SI.prototype.interfaces_=function(){return[]},SI.prototype.getClass=function(){return SI},SI.toDimensionSymbol=function(t){switch(t){case SI.FALSE:return SI.SYM_FALSE;case SI.TRUE:return SI.SYM_TRUE;case SI.DONTCARE:return SI.SYM_DONTCARE;case SI.P:return SI.SYM_P;case SI.L:return SI.SYM_L;case SI.A:return SI.SYM_A}throw new Wm("Unknown dimension value: "+t)},SI.toDimensionValue=function(t){switch(g_.toUpperCase(t)){case SI.SYM_FALSE:return SI.FALSE;case SI.SYM_TRUE:return SI.TRUE;case SI.SYM_DONTCARE:return SI.DONTCARE;case SI.SYM_P:return SI.P;case SI.SYM_L:return SI.L;case SI.SYM_A:return SI.A}throw new Wm("Unknown dimension symbol: "+t)},Object.defineProperties(SI,MI);var LI=function(){};LI.prototype.filter=function(t){},LI.prototype.interfaces_=function(){return[]},LI.prototype.getClass=function(){return LI};var NI=function(){};NI.prototype.filter=function(t,e){},NI.prototype.isDone=function(){},NI.prototype.isGeometryChanged=function(){},NI.prototype.interfaces_=function(){return[]},NI.prototype.getClass=function(){return NI};var TI=function(t){function e(e,r){if(t.call(this,r),this._geometries=e||[],t.hasNullElements(this._geometries))throw new Wm("geometries must not contain null elements")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new w_,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries[t]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=0;r<this._geometries.length;r++)for(var n=this._geometries[r].getCoordinates(),i=0;i<n.length;i++)t[++e]=n[i];return t},e.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._geometries.length!==n._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(n._geometries[i],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();BI.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=SI.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},e.prototype.getDimension=function(){for(var t=SI.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new wI(BI.asList(this._geometries)),r=new wI(BI.asList(t._geometries));return this.compare(e,r)}if(2===arguments.length){for(var n=arguments[1],i=arguments[0],o=this.getNumGeometries(),s=i.getNumGeometries(),a=0;a<o&&a<s;){var u=this.getGeometryN(a),l=i.getGeometryN(a),c=u.compareToSameClass(l,n);if(0!==c)return c;a++}return a<o?1:a<s?-1:0}},e.prototype.apply=function(){var t=this;if(l_(arguments[0],Y_))for(var e=arguments[0],r=0;r<this._geometries.length;r++)t._geometries[r].apply(e);else if(l_(arguments[0],NI)){var n=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(t._geometries[i].apply(n),!n.isDone());i++);n.isGeometryChanged()&&this.geometryChanged()}else if(l_(arguments[0],LI)){var o=arguments[0];o.filter(this);for(var s=0;s<this._geometries.length;s++)t._geometries[s].apply(o)}else if(l_(arguments[0],q_)){var a=arguments[0];a.filter(this);for(var u=0;u<this._geometries.length;u++)t._geometries[u].apply(a)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),D_.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var r=0;r<this._geometries.length;r++)e._geometries[r]=this._geometries[r].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,r),e}(j_),RI=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return j_.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?SI.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[t-1-r]=this._geometries[r].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new DI(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[xI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,r),e}(TI),DI=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=H_.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._geom=r,this._geomFact=r.getFactory(),this._bnRule=n}};DI.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},DI.prototype.getBoundary=function(){return this._geom instanceof zI?this.boundaryLineString(this._geom):this._geom instanceof RI?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},DI.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},DI.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},DI.prototype.computeBoundaryCoordinates=function(t){var e=this,r=new iI;this._endpointMap=new EI;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);0!==i.getNumPoints()&&(e.addEndpoint(i.getCoordinateN(0)),e.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var o=this._endpointMap.entrySet().iterator();o.hasNext();){var s=o.next(),a=s.getValue().count;e._bnRule.isInBoundary(a)&&r.add(s.getKey())}return aI.toCoordinateArray(r)},DI.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new QI,this._endpointMap.put(t,e)),e.count++},DI.prototype.interfaces_=function(){return[]},DI.prototype.getClass=function(){return DI},DI.getBoundary=function(){return 1===arguments.length?new DI(arguments[0]).getBoundary():2===arguments.length?new DI(arguments[0],arguments[1]).getBoundary():void 0};var QI=function(){this.count=null};function PI(){}function kI(){}QI.prototype.interfaces_=function(){return[]},QI.prototype.getClass=function(){return QI};var OI=function(){};function FI(){}function GI(){}function UI(){}var qI=function(){},jI={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};qI.prototype.interfaces_=function(){return[]},qI.prototype.getClass=function(){return qI},qI.chars=function(t,e){for(var r=new Array(e).fill(null),n=0;n<e;n++)r[n]=t;return String(r)},qI.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new FI,r=new PI;return t.printStackTrace(r),e.toString()}if(2===arguments.length){var n=arguments[1],i="";new kI(qI.getStackTrace(arguments[0]));for(var o=new UI,s=0;s<n;s++)try{i+=o.readLine()+qI.NEWLINE}catch(t){if(!(t instanceof GI))throw t;D_.shouldNeverReachHere()}return i}},qI.split=function(t,e){for(var r=e.length,n=new iI,i=""+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);n.add(s),o=(i=i.substring(o+r)).indexOf(e)}i.length>0&&n.add(i);for(var a=new Array(n.size()).fill(null),u=0;u<a.length;u++)a[u]=n.get(u);return a},qI.toString=function(){if(1===arguments.length){var t=arguments[0];return qI.SIMPLE_ORDINATE_FORMAT.format(t)}},qI.spaces=function(t){return qI.chars(" ",t)},jI.NEWLINE.get=function(){return x_.getProperty("line.separator")},jI.SIMPLE_ORDINATE_FORMAT.get=function(){return new OI},Object.defineProperties(qI,jI);var VI=function(){};VI.prototype.interfaces_=function(){return[]},VI.prototype.getClass=function(){return VI},VI.copyCoord=function(t,e,r,n){for(var i=Math.min(t.getDimension(),r.getDimension()),o=0;o<i;o++)r.setOrdinate(n,o,t.getOrdinate(e,o))},VI.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&(t.getOrdinate(0,m_.X)===t.getOrdinate(e-1,m_.X)&&t.getOrdinate(0,m_.Y)===t.getOrdinate(e-1,m_.Y))},VI.isEqual=function(t,e){var r=t.size();if(r!==e.size())return!1;for(var n=Math.min(t.getDimension(),e.getDimension()),i=0;i<r;i++)for(var o=0;o<n;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(t.getOrdinate(i,o)!==e.getOrdinate(i,o)&&(!Km.isNaN(s)||!Km.isNaN(a)))return!1}return!0},VI.extend=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();if(VI.copy(e,0,n,0,i),i>0)for(var o=i;o<r;o++)VI.copy(e,i-1,n,o,1);return n},VI.reverse=function(t){for(var e=t.size()-1,r=Math.trunc(e/2),n=0;n<=r;n++)VI.swap(t,n,e-n)},VI.swap=function(t,e,r){if(e===r)return null;for(var n=0;n<t.getDimension();n++){var i=t.getOrdinate(e,n);t.setOrdinate(e,n,t.getOrdinate(r,n)),t.setOrdinate(r,n,i)}},VI.copy=function(t,e,r,n,i){for(var o=0;o<i;o++)VI.copyCoord(t,e+o,r,n+o)},VI.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var r=t.getDimension(),n=new f_;n.append("(");for(var i=0;i<e;i++){i>0&&n.append(" ");for(var o=0;o<r;o++)o>0&&n.append(","),n.append(qI.toString(t.getOrdinate(i,o)))}return n.append(")"),n.toString()}},VI.ensureValidRing=function(t,e){var r=e.size();return 0===r?e:r<=3?VI.createClosedRing(t,e,4):e.getOrdinate(0,m_.X)===e.getOrdinate(r-1,m_.X)&&e.getOrdinate(0,m_.Y)===e.getOrdinate(r-1,m_.Y)?e:VI.createClosedRing(t,e,r+1)},VI.createClosedRing=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();VI.copy(e,0,n,0,i);for(var o=i;o<r;o++)VI.copy(e,0,n,o,1);return n};var zI=function(t){function e(e,r){t.call(this,r),this._points=null,this.init(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new w_:this._points.expandEnvelope(new w_)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._points.size()!==n._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),n._points.getCoordinate(i),r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=this,e=0;e<Math.trunc(this._points.size()/2);e++){var r=t._points.size()-1-e;if(!t._points.getCoordinate(e).equals(t._points.getCoordinate(r)))return t._points.getCoordinate(e).compareTo(t._points.getCoordinate(r))>0&&VI.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?SI.FALSE:0},e.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return G_.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return VI.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,r=0;e<this._points.size()&&r<t._points.size();){var n=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(r));if(0!==n)return n;e++,r++}return e<this._points.size()?1:r<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(l_(arguments[0],Y_))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(l_(arguments[0],NI)){var r=arguments[0];if(0===this._points.size())return null;for(var n=0;n<this._points.size()&&(r.filter(this._points,n),!r.isDone());n++);r.isGeometryChanged()&&this.geometryChanged()}else if(l_(arguments[0],LI)){arguments[0].filter(this)}else if(l_(arguments[0],q_)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return new DI(this).getBoundary()},e.prototype.isEquivalentClass=function(t){return t instanceof e},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._points=this._points.clone(),e},e.prototype.getCoordinateN=function(t){return this._points.getCoordinate(t)},e.prototype.getGeometryType=function(){return"LineString"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._points},e.prototype.isEmpty=function(){return 0===this._points.size()},e.prototype.init=function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new Wm("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1},e.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},e.prototype.getPointN=function(t){return this.getFactory().createPoint(this._points.getCoordinate(t))},e.prototype.interfaces_=function(){return[xI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,r),e}(j_),YI=function(){};YI.prototype.interfaces_=function(){return[]},YI.prototype.getClass=function(){return YI};var HI=function(t){function e(e,r){t.call(this,r),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new w_;var t=new w_;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),r))}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){},e.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},e.prototype.getBoundaryDimension=function(){return SI.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getNumPoints=function(){return this.isEmpty()?0:1},e.prototype.reverse=function(){return this.copy()},e.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){var e=arguments[0];return arguments[1].compare(this._coordinates,e._coordinates)}},e.prototype.apply=function(){if(l_(arguments[0],Y_)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(l_(arguments[0],NI)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else if(l_(arguments[0],LI)){arguments[0].filter(this)}else if(l_(arguments[0],q_)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._coordinates=this._coordinates.clone(),e},e.prototype.getGeometryType=function(){return"Point"},e.prototype.copy=function(){return new e(this._coordinates.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._coordinates},e.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},e.prototype.isEmpty=function(){return 0===this._coordinates.size()},e.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),D_.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[YI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,r),e}(j_),XI=function(){};XI.prototype.interfaces_=function(){return[]},XI.prototype.getClass=function(){return XI};var JI=function(t){function e(e,r,n){if(t.call(this,n),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===r&&(r=[]),t.hasNullElements(r))throw new Wm("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(r))throw new Wm("shell is empty but holes are not");this._shell=e,this._holes=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},e.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},e.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=this._shell.getCoordinates(),n=0;n<r.length;n++)t[++e]=r[n];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(G_.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(G_.signedArea(this._holes[e].getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),r=0;r<5;r++){var n=t.getX(r);if(n!==e.getMinX()&&n!==e.getMaxX())return!1;var i=t.getY(r);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var u=t.getX(a),l=t.getY(a);if(u!==o===(l!==s))return!1;o=u,s=l}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e,i=this._shell,o=n._shell;if(!i.equalsExact(o,r))return!1;if(this._holes.length!==n._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(n._holes[s],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);BI.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(e.isEmpty())return null;var n=new Array(e.getCoordinates().length-1).fill(null);x_.arraycopy(e.getCoordinates(),0,n,0,n.length);var i=aI.minCoordinate(e.getCoordinates());aI.scroll(n,i),x_.arraycopy(n,0,e.getCoordinates(),0,n.length),e.getCoordinates()[n.length]=n[0],G_.isCCW(e.getCoordinates())===r&&aI.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,r=t._shell;return e.compareToSameClass(r)}if(2===arguments.length){var n=arguments[1],i=arguments[0],o=this._shell,s=i._shell,a=o.compareToSameClass(s,n);if(0!==a)return a;for(var u=this.getNumInteriorRing(),l=i.getNumInteriorRing(),c=0;c<u&&c<l;){var h=this.getInteriorRingN(c),f=i.getInteriorRingN(c),p=h.compareToSameClass(f,n);if(0!==p)return p;c++}return c<u?1:c<l?-1:0}},e.prototype.apply=function(t){var e=this;if(l_(t,Y_)){this._shell.apply(t);for(var r=0;r<this._holes.length;r++)e._holes[r].apply(t)}else if(l_(t,NI)){if(this._shell.apply(t),!t.isDone())for(var n=0;n<this._holes.length&&(e._holes[n].apply(t),!t.isDone());n++);t.isGeometryChanged()&&this.geometryChanged()}else if(l_(t,LI))t.filter(this);else if(l_(t,q_)){t.filter(this),this._shell.apply(t);for(var i=0;i<this._holes.length;i++)e._holes[i].apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var r=0;r<this._holes.length;r++)e._holes[r]=this._holes[r].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),r=new Array(this._holes.length).fill(null),n=0;n<r.length;n++)r[n]=this._holes[n].copy();return new e(t,r,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes[t]},e.prototype.interfaces_=function(){return[XI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,r),e}(j_),WI=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return j_.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(1===arguments.length){var e=arguments[0];return this._geometries[e].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return SI.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.getGeometryType=function(){return"MultiPoint"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[YI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,r),e}(TI),KI=function(t){function e(e,r){e instanceof n_&&r instanceof pE&&(e=r.getCoordinateSequenceFactory().create(e)),t.call(this,e,r),this.validateConstruction()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return j_.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return SI.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return VI.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new Wm("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new Wm("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.MINIMUM_VALID_SIZE.get=function(){return 4},r.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,r),e}(zI),ZI=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return j_.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new iI,e=0;e<this._geometries.length;e++)for(var r=this._geometries[e].getBoundary(),n=0;n<r.getNumGeometries();n++)t.add(r.getGeometryN(n));var i=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(i))},e.prototype.getGeometryType=function(){return"MultiPolygon"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[XI]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,r),e}(TI),$I=function(t){this._factory=t||null,this._isUserDataCopied=!1},tE={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};$I.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},$I.prototype.edit=function(t,e){if(null===t)return null;var r=this.editInternal(t,e);return this._isUserDataCopied&&r.setUserData(t.getUserData()),r},$I.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof TI?this.editGeometryCollection(t,e):t instanceof JI?this.editPolygon(t,e):t instanceof HI||t instanceof zI?e.edit(t,this._factory):(D_.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},$I.prototype.editGeometryCollection=function(t,e){for(var r=e.edit(t,this._factory),n=new iI,i=0;i<r.getNumGeometries();i++){var o=this.edit(r.getGeometryN(i),e);null===o||o.isEmpty()||n.add(o)}return r.getClass()===WI?this._factory.createMultiPoint(n.toArray([])):r.getClass()===RI?this._factory.createMultiLineString(n.toArray([])):r.getClass()===ZI?this._factory.createMultiPolygon(n.toArray([])):this._factory.createGeometryCollection(n.toArray([]))},$I.prototype.editPolygon=function(t,e){var r=e.edit(t,this._factory);if(null===r&&(r=this._factory.createPolygon(null)),r.isEmpty())return r;var n=this.edit(r.getExteriorRing(),e);if(null===n||n.isEmpty())return this._factory.createPolygon();for(var i=new iI,o=0;o<r.getNumInteriorRing();o++){var s=this.edit(r.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(n,i.toArray([]))},$I.prototype.interfaces_=function(){return[]},$I.prototype.getClass=function(){return $I},$I.GeometryEditorOperation=function(){},tE.NoOpGeometryOperation.get=function(){return eE},tE.CoordinateOperation.get=function(){return rE},tE.CoordinateSequenceOperation.get=function(){return nE},Object.defineProperties($I,tE);var eE=function(){};eE.prototype.edit=function(t,e){return t},eE.prototype.interfaces_=function(){return[$I.GeometryEditorOperation]},eE.prototype.getClass=function(){return eE};var rE=function(){};rE.prototype.edit=function(t,e){var r=this.editCoordinates(t.getCoordinates(),t);return null===r?t:t instanceof KI?e.createLinearRing(r):t instanceof zI?e.createLineString(r):t instanceof HI?r.length>0?e.createPoint(r[0]):e.createPoint():t},rE.prototype.interfaces_=function(){return[$I.GeometryEditorOperation]},rE.prototype.getClass=function(){return rE};var nE=function(){};nE.prototype.edit=function(t,e){return t instanceof KI?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof zI?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof HI?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},nE.prototype.interfaces_=function(){return[$I.GeometryEditorOperation]},nE.prototype.getClass=function(){return nE};var iE=function(){var t=this;if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var r=0;r<e;r++)t._coordinates[r]=new n_}else if(l_(arguments[0],m_)){var n=arguments[0];if(null===n)return this._coordinates=new Array(0).fill(null),null;this._dimension=n.getDimension(),this._coordinates=new Array(n.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)t._coordinates[i]=n.getCoordinateCopy(i)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],s=arguments[1];this._coordinates=o,this._dimension=s,null===o&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var a=arguments[0],u=arguments[1];this._coordinates=new Array(a).fill(null),this._dimension=u;for(var l=0;l<a;l++)t._coordinates[l]=new n_}},oE={serialVersionUID:{configurable:!0}};iE.prototype.setOrdinate=function(t,e,r){switch(e){case m_.X:this._coordinates[t].x=r;break;case m_.Y:this._coordinates[t].y=r;break;case m_.Z:this._coordinates[t].z=r;break;default:throw new Wm("invalid ordinateIndex")}},iE.prototype.size=function(){return this._coordinates.length},iE.prototype.getOrdinate=function(t,e){switch(e){case m_.X:return this._coordinates[t].x;case m_.Y:return this._coordinates[t].y;case m_.Z:return this._coordinates[t].z}return Km.NaN},iE.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],r=arguments[1];r.x=this._coordinates[e].x,r.y=this._coordinates[e].y,r.z=this._coordinates[e].z}},iE.prototype.getCoordinateCopy=function(t){return new n_(this._coordinates[t])},iE.prototype.getDimension=function(){return this._dimension},iE.prototype.getX=function(t){return this._coordinates[t].x},iE.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].clone();return new iE(t,this._dimension)},iE.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},iE.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new iE(t,this._dimension)},iE.prototype.toString=function(){if(this._coordinates.length>0){var t=new f_(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},iE.prototype.getY=function(t){return this._coordinates[t].y},iE.prototype.toCoordinateArray=function(){return this._coordinates},iE.prototype.interfaces_=function(){return[m_,r_]},iE.prototype.getClass=function(){return iE},oE.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(iE,oE);var sE=function(){},aE={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};sE.prototype.readResolve=function(){return sE.instance()},sE.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array)return new iE(arguments[0]);if(l_(arguments[0],m_))return new iE(arguments[0])}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new iE(t):new iE(t,e)}},sE.prototype.interfaces_=function(){return[s_,r_]},sE.prototype.getClass=function(){return sE},sE.instance=function(){return sE.instanceObject},aE.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},aE.instanceObject.get=function(){return new sE},Object.defineProperties(sE,aE);var uE=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return this.map_.get(t)||null},e.prototype.put=function(t,e){return this.map_.set(t,e),e},e.prototype.values=function(){for(var t=new iI,e=this.map_.values(),r=e.next();!r.done;)t.add(r.value),r=e.next();return t},e.prototype.entrySet=function(){var t=new AI;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(hI),lE=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof hE){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var r=arguments[0];this._modelType=t.FIXED,this.setScale(r)}else if(arguments[0]instanceof t){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}},cE={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};lE.prototype.equals=function(t){if(!(t instanceof lE))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},lE.prototype.compareTo=function(t){var e=t,r=this.getMaximumSignificantDigits(),n=e.getMaximumSignificantDigits();return new p_(r).compareTo(new p_(n))},lE.prototype.getScale=function(){return this._scale},lE.prototype.isFloating=function(){return this._modelType===lE.FLOATING||this._modelType===lE.FLOATING_SINGLE},lE.prototype.getType=function(){return this._modelType},lE.prototype.toString=function(){var t="UNKNOWN";return this._modelType===lE.FLOATING?t="Floating":this._modelType===lE.FLOATING_SINGLE?t="Floating-Single":this._modelType===lE.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},lE.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return Km.isNaN(t)||this._modelType===lE.FLOATING_SINGLE?t:this._modelType===lE.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof n_){var e=arguments[0];if(this._modelType===lE.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},lE.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===lE.FLOATING?t=16:this._modelType===lE.FLOATING_SINGLE?t=6:this._modelType===lE.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},lE.prototype.setScale=function(t){this._scale=Math.abs(t)},lE.prototype.interfaces_=function(){return[r_,$m]},lE.prototype.getClass=function(){return lE},lE.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},cE.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},cE.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(lE,cE);var hE=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},fE={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};hE.prototype.readResolve=function(){return hE.nameToTypeMap.get(this._name)},hE.prototype.toString=function(){return this._name},hE.prototype.interfaces_=function(){return[r_]},hE.prototype.getClass=function(){return hE},fE.serialVersionUID.get=function(){return-552860263173159e4},fE.nameToTypeMap.get=function(){return new uE},Object.defineProperties(hE,fE),lE.Type=hE,lE.FIXED=new hE("FIXED"),lE.FLOATING=new hE("FLOATING"),lE.FLOATING_SINGLE=new hE("FLOATING SINGLE");var pE=function t(){this._precisionModel=new lE,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?l_(arguments[0],s_)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof lE&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},gE={serialVersionUID:{configurable:!0}};pE.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new n_(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new n_(t.getMinX(),t.getMinY()),new n_(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new n_(t.getMinX(),t.getMinY()),new n_(t.getMinX(),t.getMaxY()),new n_(t.getMaxX(),t.getMaxY()),new n_(t.getMaxX(),t.getMinY()),new n_(t.getMinX(),t.getMinY())]),null)},pE.prototype.createLineString=function(t){return t?t instanceof Array?new zI(this.getCoordinateSequenceFactory().create(t),this):l_(t,m_)?new zI(t,this):void 0:new zI(this.getCoordinateSequenceFactory().create([]),this)},pE.prototype.createMultiLineString=function(){return 0===arguments.length?new RI(null,this):1===arguments.length?new RI(arguments[0],this):void 0},pE.prototype.buildGeometry=function(t){for(var e=null,r=!1,n=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(r=!0),o.isGeometryCollectionOrDerived()&&(n=!0)}if(null===e)return this.createGeometryCollection();if(r||n)return this.createGeometryCollection(pE.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof JI)return this.createMultiPolygon(pE.toPolygonArray(t));if(a instanceof zI)return this.createMultiLineString(pE.toLineStringArray(t));if(a instanceof HI)return this.createMultiPoint(pE.toPointArray(t));D_.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},pE.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},pE.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof n_){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(l_(arguments[0],m_))return new HI(arguments[0],this)}},pE.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},pE.prototype.createPolygon=function(){if(0===arguments.length)return new JI(null,null,this);if(1===arguments.length){if(l_(arguments[0],m_)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof KI){var r=arguments[0];return this.createPolygon(r,null)}}else if(2===arguments.length){return new JI(arguments[0],arguments[1],this)}},pE.prototype.getSRID=function(){return this._SRID},pE.prototype.createGeometryCollection=function(){return 0===arguments.length?new TI(null,this):1===arguments.length?new TI(arguments[0],this):void 0},pE.prototype.createGeometry=function(t){return new $I(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},pE.prototype.getPrecisionModel=function(){return this._precisionModel},pE.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(l_(arguments[0],m_))return new KI(arguments[0],this)}},pE.prototype.createMultiPolygon=function(){return 0===arguments.length?new ZI(null,this):1===arguments.length?new ZI(arguments[0],this):void 0},pE.prototype.createMultiPoint=function(){if(0===arguments.length)return new WI(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new WI(arguments[0],this);if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(l_(arguments[0],m_)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(e.size()).fill(null),n=0;n<e.size();n++){var i=this.getCoordinateSequenceFactory().create(1,e.getDimension());VI.copy(e,n,i,0,1),r[n]=this.createPoint(i)}return this.createMultiPoint(r)}}},pE.prototype.interfaces_=function(){return[r_]},pE.prototype.getClass=function(){return pE},pE.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},pE.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},pE.getDefaultCoordinateSequenceFactory=function(){return sE.instance()},pE.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},pE.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},pE.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},pE.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},pE.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},pE.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},pE.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},gE.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(pE,gE);var AE=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],dE=function(t){this.geometryFactory=t||new pE};dE.prototype.read=function(t){var e,r=(e="string"==typeof t?JSON.parse(t):t).type;if(!yE[r])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==AE.indexOf(r)?yE[r].apply(this,[e.coordinates]):"GeometryCollection"===r?yE[r].apply(this,[e.geometries]):yE[r].apply(this,[e])},dE.prototype.write=function(t){var e=t.getGeometryType();if(!vE[e])throw new Error("Geometry is not supported");return vE[e].apply(this,[t])};var yE={Feature:function(t){var e={};for(var r in t)e[r]=t[r];if(t.geometry){var n=t.geometry.type;if(!yE[n])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=yE.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var r=0;r<t.features.length;++r)e.features.push(this.read(t.features[r]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(new n_(n[0],n[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new n_(t[0],t[1]),new n_(t[2],t[1]),new n_(t[2],t[3]),new n_(t[0],t[3]),new n_(t[0],t[1])])},Point:function(t){var e=new n_(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],r=0;r<t.length;++r)e.push(yE.Point.apply(this,[t[r]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=yE.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],r=0;r<t.length;++r)e.push(yE.LineString.apply(this,[t[r]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=yE.coordinates.apply(this,[t[0]]),r=this.geometryFactory.createLinearRing(e),n=[],i=1;i<t.length;++i){var o=t[i],s=yE.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);n.push(a)}return this.geometryFactory.createPolygon(r,n)},MultiPolygon:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(yE.Polygon.apply(this,[n]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(this.read(n))}return this.geometryFactory.createGeometryCollection(e)}},vE={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:vE.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=vE.Point.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],r=t.getCoordinates(),n=0;n<r.length;++n){var i=r[n];e.push(vE.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=vE.LineString.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],r=vE.LineString.apply(this,[t._shell]);e.push(r.coordinates);for(var n=0;n<t._holes.length;++n){var i=t._holes[n],o=vE.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=vE.Polygon.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=n.getGeometryType();e.push(vE[i].apply(this,[n]))}return{type:"GeometryCollection",geometries:e}}},mE=function(t){this.geometryFactory=t||new pE,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new dE(this.geometryFactory)};mE.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===lE.FIXED&&this.reducePrecision(e),e},mE.prototype.reducePrecision=function(t){var e,r;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,r=t.points.length;e<r;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,r=t.geometries.length;e<r;e++)this.reducePrecision(t.geometries[e])};var _E=function(){this.parser=new dE(this.geometryFactory)};_E.prototype.write=function(t){return this.parser.write(t)};var IE=function(){},EE={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function xE(t){this.message=t||""}function CE(){this.array_=[]}IE.prototype.interfaces_=function(){return[]},IE.prototype.getClass=function(){return IE},IE.opposite=function(t){return t===IE.LEFT?IE.RIGHT:t===IE.RIGHT?IE.LEFT:t},EE.ON.get=function(){return 0},EE.LEFT.get=function(){return 1},EE.RIGHT.get=function(){return 2},Object.defineProperties(IE,EE),xE.prototype=new Error,xE.prototype.name="EmptyStackException",CE.prototype=new rI,CE.prototype.add=function(t){return this.array_.push(t),!0},CE.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},CE.prototype.push=function(t){return this.array_.push(t),t},CE.prototype.pop=function(t){if(0===this.array_.length)throw new xE;return this.array_.pop()},CE.prototype.peek=function(){if(0===this.array_.length)throw new xE;return this.array_[this.array_.length-1]},CE.prototype.empty=function(){return 0===this.array_.length},CE.prototype.isEmpty=function(){return this.empty()},CE.prototype.search=function(t){return this.array_.indexOf(t)},CE.prototype.size=function(){return this.array_.length},CE.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t};var wE=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};wE.prototype.getCoordinate=function(){return this._minCoord},wE.prototype.getRightmostSide=function(t,e){var r=this.getRightmostSideOfSegment(t,e);return r<0&&(r=this.getRightmostSideOfSegment(t,e-1)),r<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),r},wE.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();D_.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],r=t[this._minIndex+1],n=G_.computeOrientation(this._minCoord,r,e),i=!1;(e.y<this._minCoord.y&&r.y<this._minCoord.y&&n===G_.COUNTERCLOCKWISE||e.y>this._minCoord.y&&r.y>this._minCoord.y&&n===G_.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},wE.prototype.getRightmostSideOfSegment=function(t,e){var r=t.getEdge().getCoordinates();if(e<0||e+1>=r.length)return-1;if(r[e].y===r[e+1].y)return-1;var n=IE.LEFT;return r[e].y<r[e+1].y&&(n=IE.RIGHT),n},wE.prototype.getEdge=function(){return this._orientedDe},wE.prototype.checkForRightmostCoordinate=function(t){for(var e=this,r=t.getEdge().getCoordinates(),n=0;n<r.length-1;n++)(null===e._minCoord||r[n].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=n,e._minCoord=r[n])},wE.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},wE.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();r.isForward()&&this.checkForRightmostCoordinate(r)}D_.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===IE.LEFT&&(this._orientedDe=this._minDe.getSym())},wE.prototype.interfaces_=function(){return[]},wE.prototype.getClass=function(){return wE};var bE=function(t){function e(r,n){t.call(this,e.msgWithCoord(r,n)),this.pt=n?new n_(n):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},e}(T_),BE=function(){this.array_=[]};BE.prototype.addLast=function(t){this.array_.push(t)},BE.prototype.removeFirst=function(){return this.array_.shift()},BE.prototype.isEmpty=function(){return 0===this.array_.length};var SE=function(){this._finder=null,this._dirEdgeList=new iI,this._nodes=new iI,this._rightMostCoord=null,this._env=null,this._finder=new wE};SE.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){t.next().setVisited(!1)}},SE.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},SE.prototype.computeNodeDepth=function(t){for(var e=null,r=t.getEdges().iterator();r.hasNext();){var n=r.next();if(n.isVisited()||n.getSym().isVisited()){e=n;break}}if(null===e)throw new bE("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var i=t.getEdges().iterator();i.hasNext();){var o=i.next();o.setVisited(!0),this.copySymDepths(o)}},SE.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(IE.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},SE.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},SE.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(IE.RIGHT)>=1&&e.getDepth(IE.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},SE.prototype.computeDepths=function(t){var e=new AI,r=new BE,n=t.getNode();for(r.addLast(n),e.add(n),t.setVisited(!0);!r.isEmpty();){var i=r.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(r.addLast(a),e.add(a))}}}},SE.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},SE.prototype.getEnvelope=function(){if(null===this._env){for(var t=new w_,e=this._dirEdgeList.iterator();e.hasNext();)for(var r=e.next().getEdge().getCoordinates(),n=0;n<r.length-1;n++)t.expandToInclude(r[n]);this._env=t}return this._env},SE.prototype.addReachable=function(t){var e=new CE;for(e.add(t);!e.empty();){var r=e.pop();this.add(r,e)}},SE.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(IE.LEFT,t.getDepth(IE.RIGHT)),e.setDepth(IE.RIGHT,t.getDepth(IE.LEFT))},SE.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var r=t.getEdges().iterator();r.hasNext();){var n=r.next();this._dirEdgeList.add(n);var i=n.getSym().getNode();i.isVisited()||e.push(i)}},SE.prototype.getNodes=function(){return this._nodes},SE.prototype.getDirectedEdges=function(){return this._dirEdgeList},SE.prototype.interfaces_=function(){return[$m]},SE.prototype.getClass=function(){return SE};var ME=function t(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var r=arguments[0];this.init(1),this.location[IE.ON]=r}else if(arguments[0]instanceof t){var n=arguments[0];if(this.init(n.location.length),null!==n)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.init(3),this.location[IE.ON]=o,this.location[IE.LEFT]=s,this.location[IE.RIGHT]=a}};ME.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},ME.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==a_.NONE)return!1;return!0},ME.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===a_.NONE&&(this.location[e]=t)},ME.prototype.isLine=function(){return 1===this.location.length},ME.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[IE.ON]=this.location[IE.ON],e[IE.LEFT]=a_.NONE,e[IE.RIGHT]=a_.NONE,this.location=e}for(var r=0;r<this.location.length;r++)this.location[r]===a_.NONE&&r<t.location.length&&(this.location[r]=t.location[r])},ME.prototype.getLocations=function(){return this.location},ME.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[IE.LEFT];this.location[IE.LEFT]=this.location[IE.RIGHT],this.location[IE.RIGHT]=t},ME.prototype.toString=function(){var t=new f_;return this.location.length>1&&t.append(a_.toLocationSymbol(this.location[IE.LEFT])),t.append(a_.toLocationSymbol(this.location[IE.ON])),this.location.length>1&&t.append(a_.toLocationSymbol(this.location[IE.RIGHT])),t.toString()},ME.prototype.setLocations=function(t,e,r){this.location[IE.ON]=t,this.location[IE.LEFT]=e,this.location[IE.RIGHT]=r},ME.prototype.get=function(t){return t<this.location.length?this.location[t]:a_.NONE},ME.prototype.isArea=function(){return this.location.length>1},ME.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===a_.NONE)return!0;return!1},ME.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(IE.ON,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.location[e]=r}},ME.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(a_.NONE)},ME.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},ME.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},ME.prototype.interfaces_=function(){return[]},ME.prototype.getClass=function(){return ME};var LE=function t(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new ME(e),this.elt[1]=new ME(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.elt[0]=new ME(r.elt[0]),this.elt[1]=new ME(r.elt[1])}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.elt[0]=new ME(a_.NONE),this.elt[1]=new ME(a_.NONE),this.elt[n].setLocation(i)}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new ME(o,s,a),this.elt[1]=new ME(o,s,a)}else if(4===arguments.length){var u=arguments[0],l=arguments[1],c=arguments[2],h=arguments[3];this.elt[0]=new ME(a_.NONE,a_.NONE,a_.NONE),this.elt[1]=new ME(a_.NONE,a_.NONE,a_.NONE),this.elt[u].setLocations(l,c,h)}};LE.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},LE.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},LE.prototype.isNull=function(t){return this.elt[t].isNull()},LE.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.elt[e].setAllLocationsIfNull(r)}},LE.prototype.isLine=function(t){return this.elt[t].isLine()},LE.prototype.merge=function(t){for(var e=this,r=0;r<2;r++)null===e.elt[r]&&null!==t.elt[r]?e.elt[r]=new ME(t.elt[r]):e.elt[r].merge(t.elt[r])},LE.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},LE.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(IE.ON)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return this.elt[e].get(r)}},LE.prototype.toString=function(){var t=new f_;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},LE.prototype.isArea=function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},LE.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},LE.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(IE.ON,e)}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this.elt[r].setLocation(n,i)}},LE.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},LE.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},LE.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new ME(this.elt[t].location[0]))},LE.prototype.interfaces_=function(){return[]},LE.prototype.getClass=function(){return LE},LE.toLineLabel=function(t){for(var e=new LE(a_.NONE),r=0;r<2;r++)e.setLocation(r,t.getLocation(r));return e};var NE=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new iI,this._pts=new iI,this._label=new LE(a_.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new iI,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};NE.prototype.computeRing=function(){if(null!==this._ring)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=G_.isCCW(this._ring.getCoordinates())},NE.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},NE.prototype.computePoints=function(t){var e=this;this._startDe=t;var r=t,n=!0;do{if(null===r)throw new bE("Found null DirectedEdge");if(r.getEdgeRing()===e)throw new bE("Directed Edge visited twice during ring-building at "+r.getCoordinate());e._edges.add(r);var i=r.getLabel();D_.isTrue(i.isArea()),e.mergeLabel(i),e.addPoints(r.getEdge(),r.isForward(),n),n=!1,e.setEdgeRing(r,e),r=e.getNext(r)}while(r!==this._startDe)},NE.prototype.getLinearRing=function(){return this._ring},NE.prototype.getCoordinate=function(t){return this._pts.get(t)},NE.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var r=e.getNode().getEdges().getOutgoingDegree(t);r>t._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},NE.prototype.addPoints=function(t,e,r){var n=t.getCoordinates();if(e){var i=1;r&&(i=0);for(var o=i;o<n.length;o++)this._pts.add(n[o])}else{var s=n.length-2;r&&(s=n.length-1);for(var a=s;a>=0;a--)this._pts.add(n[a])}},NE.prototype.isHole=function(){return this._isHole},NE.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},NE.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!G_.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){if(r.next().containsPoint(t))return!1}return!0},NE.prototype.addHole=function(t){this._holes.add(t)},NE.prototype.isShell=function(){return null===this._shell},NE.prototype.getLabel=function(){return this._label},NE.prototype.getEdges=function(){return this._edges},NE.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},NE.prototype.getShell=function(){return this._shell},NE.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[1],r=arguments[0].getLocation(e,IE.RIGHT);if(r===a_.NONE)return null;if(this._label.getLocation(e)===a_.NONE)return this._label.setLocation(e,r),null}},NE.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},NE.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),r=0;r<this._holes.size();r++)e[r]=this._holes.get(r).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},NE.prototype.interfaces_=function(){return[]},NE.prototype.getClass=function(){return NE};var TE=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},e.prototype.getNext=function(t){return t.getNextMin()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(NE),RE=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new iI,e=this._startDe;do{if(null===e.getMinEdgeRing()){var r=new TE(e,this._geometryFactory);t.add(r)}e=e.getNext()}while(e!==this._startDe);return t},e.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},e.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)},e.prototype.getNext=function(t){return t.getNext()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(NE),DE=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._label=t}};DE.prototype.setVisited=function(t){this._isVisited=t},DE.prototype.setInResult=function(t){this._isInResult=t},DE.prototype.isCovered=function(){return this._isCovered},DE.prototype.isCoveredSet=function(){return this._isCoveredSet},DE.prototype.setLabel=function(t){this._label=t},DE.prototype.getLabel=function(){return this._label},DE.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},DE.prototype.updateIM=function(t){D_.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},DE.prototype.isInResult=function(){return this._isInResult},DE.prototype.isVisited=function(){return this._isVisited},DE.prototype.interfaces_=function(){return[]},DE.prototype.getClass=function(){return DE};var QE=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],r=arguments[1];this._coord=e,this._edges=r,this._label=new LE(0,a_.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();){if(t.next().getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var r=a_.NONE;if(r=this._label.getLocation(e),!t.isNull(e)){var n=t.getLocation(e);r!==a_.BOUNDARY&&(r=n)}return r},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],r=arguments[1];null===this._label?this._label=new LE(e,r):this._label.setLocation(e,r)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof LE)for(var n=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(n,i);t._label.getLocation(i)===a_.NONE&&t._label.setLocation(i,o)}},e.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},e.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=a_.NONE;null!==this._label&&(e=this._label.getLocation(t));var r=null;if(e===a_.BOUNDARY)r=a_.INTERIOR;else r=a_.BOUNDARY;this._label.setLocation(t,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(DE),PE=function(){this.nodeMap=new EI,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};PE.prototype.find=function(t){return this.nodeMap.get(t)},PE.prototype.addNode=function(){if(arguments[0]instanceof n_){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof QE){var r=arguments[0],n=this.nodeMap.get(r.getCoordinate());return null===n?(this.nodeMap.put(r.getCoordinate(),r),r):(n.mergeLabel(r),n)}},PE.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){e.next().print(t)}},PE.prototype.iterator=function(){return this.nodeMap.values().iterator()},PE.prototype.values=function(){return this.nodeMap.values()},PE.prototype.getBoundaryNodes=function(t){for(var e=new iI,r=this.iterator();r.hasNext();){var n=r.next();n.getLabel().getLocation(t)===a_.BOUNDARY&&e.add(n)}return e},PE.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},PE.prototype.interfaces_=function(){return[]},PE.prototype.getClass=function(){return PE};var kE=function(){},OE={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};kE.prototype.interfaces_=function(){return[]},kE.prototype.getClass=function(){return kE},kE.isNorthern=function(t){return t===kE.NE||t===kE.NW},kE.isOpposite=function(t,e){return t!==e&&2===(t-e+4)%4},kE.commonHalfPlane=function(t,e){if(t===e)return t;if(2===(t-e+4)%4)return-1;var r=t<e?t:e;return 0===r&&3===(t>e?t:e)?3:r},kE.isInHalfPlane=function(t,e){return e===kE.SE?t===kE.SE||t===kE.SW:t===e||t===e+1},kE.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new Wm("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?kE.NE:kE.SE:e>=0?kE.NW:kE.SW}if(arguments[0]instanceof n_&&arguments[1]instanceof n_){var r=arguments[0],n=arguments[1];if(n.x===r.x&&n.y===r.y)throw new Wm("Cannot compute the quadrant for two identical points "+r);return n.x>=r.x?n.y>=r.y?kE.NE:kE.SE:n.y>=r.y?kE.NW:kE.SW}},OE.NE.get=function(){return 0},OE.NW.get=function(){return 1},OE.SW.get=function(){return 2},OE.SE.get=function(){return 3},Object.defineProperties(kE,OE);var FE=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._edge=e,this.init(r,n),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=i,this.init(o,s),this._label=a}};FE.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:G_.computeOrientation(t._p0,t._p1,this._p1)},FE.prototype.getDy=function(){return this._dy},FE.prototype.getCoordinate=function(){return this._p0},FE.prototype.setNode=function(t){this._node=t},FE.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),r=this.getClass().getName(),n=r.lastIndexOf("."),i=r.substring(n+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},FE.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},FE.prototype.getDirectedCoordinate=function(){return this._p1},FE.prototype.getDx=function(){return this._dx},FE.prototype.getLabel=function(){return this._label},FE.prototype.getEdge=function(){return this._edge},FE.prototype.getQuadrant=function(){return this._quadrant},FE.prototype.getNode=function(){return this._node},FE.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),r=e.lastIndexOf(".");return" "+e.substring(r+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},FE.prototype.computeLabel=function(t){},FE.prototype.init=function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=kE.quadrant(this._dx,this._dy),D_.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},FE.prototype.interfaces_=function(){return[$m]},FE.prototype.getClass=function(){return FE};var GE=function(t){function e(){var e=arguments[0],r=arguments[1];if(t.call(this,e),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=r,r)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var n=e.getNumPoints()-1;this.init(e.getCoordinate(n),e.getCoordinate(n-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth[t]},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new LE(this._edge.getLabel()),this._isForward||this._label.flip()},e.prototype.getNext=function(){return this._next},e.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new bE("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=this,e=!0,r=0;r<2;r++)t._label.isArea(r)&&t._label.getLocation(r,IE.LEFT)===a_.INTERIOR&&t._label.getLocation(r,IE.RIGHT)===a_.INTERIOR||(e=!1);return e},e.prototype.setNextMin=function(t){this._nextMin=t},e.prototype.print=function(e){t.prototype.print.call(this,e),e.print(" "+this._depth[IE.LEFT]+"/"+this._depth[IE.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")},e.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},e.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,a_.EXTERIOR),r=!this._label.isArea(1)||this._label.allPositionsEqual(1,a_.EXTERIOR);return t&&e&&r},e.prototype.setEdgeRing=function(t){this._edgeRing=t},e.prototype.getMinEdgeRing=function(){return this._minEdgeRing},e.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},e.prototype.setInResult=function(t){this._isInResult=t},e.prototype.getSym=function(){return this._sym},e.prototype.isForward=function(){return this._isForward},e.prototype.getEdge=function(){return this._edge},e.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},e.prototype.setSym=function(t){this._sym=t},e.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},e.prototype.setEdgeDepths=function(t,e){var r=this.getEdge().getDepthDelta();this._isForward||(r=-r);var n=1;t===IE.LEFT&&(n=-1);var i=IE.opposite(t),o=e+r*n;this.setDepth(t,e),this.setDepth(i,o)},e.prototype.getEdgeRing=function(){return this._edgeRing},e.prototype.isInResult=function(){return this._isInResult},e.prototype.setNext=function(t){this._next=t},e.prototype.isVisited=function(){return this._isVisited},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.depthFactor=function(t,e){return t===a_.EXTERIOR&&e===a_.INTERIOR?1:t===a_.INTERIOR&&e===a_.EXTERIOR?-1:0},e}(FE),UE=function(){};UE.prototype.createNode=function(t){return new QE(t,null)},UE.prototype.interfaces_=function(){return[]},UE.prototype.getClass=function(){return UE};var qE=function(){if(this._edges=new iI,this._nodes=null,this._edgeEndList=new iI,0===arguments.length)this._nodes=new PE(new UE);else if(1===arguments.length){var t=arguments[0];this._nodes=new PE(t)}};qE.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var r=this._edges.get(e);r.print(t),r.eiList.print(t)}},qE.prototype.find=function(t){return this._nodes.find(t)},qE.prototype.addNode=function(){if(arguments[0]instanceof QE){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof n_){var e=arguments[0];return this._nodes.addNode(e)}},qE.prototype.getNodeIterator=function(){return this._nodes.iterator()},qE.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkResultDirectedEdges()}},qE.prototype.debugPrintln=function(t){x_.out.println(t)},qE.prototype.isBoundaryNode=function(t,e){var r=this._nodes.find(e);if(null===r)return!1;var n=r.getLabel();return null!==n&&n.getLocation(t)===a_.BOUNDARY},qE.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkAllDirectedEdges()}},qE.prototype.matchInSameDirection=function(t,e,r,n){return!!t.equals(r)&&(G_.computeOrientation(t,e,n)===G_.COLLINEAR&&kE.quadrant(t,e)===kE.quadrant(r,n))},qE.prototype.getEdgeEnds=function(){return this._edgeEndList},qE.prototype.debugPrint=function(t){x_.out.print(t)},qE.prototype.getEdgeIterator=function(){return this._edges.iterator()},qE.prototype.findEdgeInSameDirection=function(t,e){for(var r=this,n=0;n<this._edges.size();n++){var i=r._edges.get(n),o=i.getCoordinates();if(r.matchInSameDirection(t,e,o[0],o[1]))return i;if(r.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return i}return null},qE.prototype.insertEdge=function(t){this._edges.add(t)},qE.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var r=e.next();if(r.getEdge()===t)return r}return null},qE.prototype.addEdges=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next();e._edges.add(n);var i=new GE(n,!0),o=new GE(n,!1);i.setSym(o),o.setSym(i),e.add(i),e.add(o)}},qE.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},qE.prototype.getNodes=function(){return this._nodes.values()},qE.prototype.findEdge=function(t,e){for(var r=0;r<this._edges.size();r++){var n=this._edges.get(r),i=n.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return n}return null},qE.prototype.interfaces_=function(){return[]},qE.prototype.getClass=function(){return qE},qE.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();){e.next().getEdges().linkResultDirectedEdges()}};var jE=function(){this._geometryFactory=null,this._shellList=new iI;var t=arguments[0];this._geometryFactory=t};jE.prototype.sortShellsAndHoles=function(t,e,r){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()?r.add(i):e.add(i)}},jE.prototype.computePolygons=function(t){for(var e=new iI,r=t.iterator();r.hasNext();){var n=r.next().toPolygon(this._geometryFactory);e.add(n)}return e},jE.prototype.placeFreeHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(null===n.getShell()){var i=this.findEdgeRingContaining(n,t);if(null===i)throw new bE("unable to assign hole to a shell",n.getCoordinate(0));n.setShell(i)}}},jE.prototype.buildMinimalEdgeRings=function(t,e,r){for(var n=new iI,i=t.iterator();i.hasNext();){var o=i.next();if(o.getMaxNodeDegree()>2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):r.addAll(s)}else n.add(o)}return n},jE.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){if(e.next().containsPoint(t))return!0}return!1},jE.prototype.buildMaximalEdgeRings=function(t){for(var e=new iI,r=t.iterator();r.hasNext();){var n=r.next();if(n.isInResult()&&n.getLabel().isArea()&&null===n.getEdgeRing()){var i=new RE(n,this._geometryFactory);e.add(i),i.setInResult()}}return e},jE.prototype.placePolygonHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();n.isHole()&&n.setShell(t)}},jE.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},jE.prototype.findEdgeRingContaining=function(t,e){for(var r=t.getLinearRing(),n=r.getEnvelopeInternal(),i=r.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getLinearRing(),c=l.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var h=!1;c.contains(n)&&G_.isPointInRing(i,l.getCoordinates())&&(h=!0),h&&(null===o||s.contains(c))&&(o=u)}return o},jE.prototype.findShell=function(t){for(var e=0,r=null,n=t.iterator();n.hasNext();){var i=n.next();i.isHole()||(r=i,e++)}return D_.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),r},jE.prototype.add=function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0];qE.linkResultDirectedEdges(arguments[1]);var r=this.buildMaximalEdgeRings(e),n=new iI,i=this.buildMinimalEdgeRings(r,this._shellList,n);this.sortShellsAndHoles(i,this._shellList,n),this.placeFreeHoles(this._shellList,n)}},jE.prototype.interfaces_=function(){return[]},jE.prototype.getClass=function(){return jE};var VE=function(){};VE.prototype.getBounds=function(){},VE.prototype.interfaces_=function(){return[]},VE.prototype.getClass=function(){return VE};var zE=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};zE.prototype.getItem=function(){return this._item},zE.prototype.getBounds=function(){return this._bounds},zE.prototype.interfaces_=function(){return[VE,r_]},zE.prototype.getClass=function(){return zE};var YE=function(){this._size=null,this._items=null,this._size=0,this._items=new iI,this._items.add(null)};YE.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t},YE.prototype.size=function(){return this._size},YE.prototype.reorder=function(t){for(var e=this,r=null,n=this._items.get(t);2*t<=this._size&&((r=2*t)!==e._size&&e._items.get(r+1).compareTo(e._items.get(r))<0&&r++,e._items.get(r).compareTo(n)<0);t=r)e._items.set(t,e._items.get(r));this._items.set(t,n)},YE.prototype.clear=function(){this._size=0,this._items.clear()},YE.prototype.isEmpty=function(){return 0===this._size},YE.prototype.add=function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)},YE.prototype.interfaces_=function(){return[]},YE.prototype.getClass=function(){return YE};var HE=function(){};HE.prototype.visitItem=function(t){},HE.prototype.interfaces_=function(){return[]},HE.prototype.getClass=function(){return HE};var XE=function(){};XE.prototype.insert=function(t,e){},XE.prototype.remove=function(t,e){},XE.prototype.query=function(){},XE.prototype.interfaces_=function(){return[]},XE.prototype.getClass=function(){return XE};var JE=function(){if(this._childBoundables=new iI,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},WE={serialVersionUID:{configurable:!0}};JE.prototype.getLevel=function(){return this._level},JE.prototype.size=function(){return this._childBoundables.size()},JE.prototype.getChildBoundables=function(){return this._childBoundables},JE.prototype.addChildBoundable=function(t){D_.isTrue(null===this._bounds),this._childBoundables.add(t)},JE.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},JE.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},JE.prototype.interfaces_=function(){return[VE,r_]},JE.prototype.getClass=function(){return JE},WE.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(JE,WE);var KE=function(){};KE.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},KE.min=function(t){return KE.sort(t),t.get(0)},KE.sort=function(t,e){var r=t.toArray();e?BI.sort(r,e):BI.sort(r);for(var n=t.iterator(),i=0,o=r.length;i<o;i++)n.next(),n.set(r[i])},KE.singletonList=function(t){var e=new iI;return e.add(t),e};var ZE=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],r=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=r,this._distance=this.distance()};ZE.prototype.expandToQueue=function(t,e){var r=ZE.isComposite(this._boundable1),n=ZE.isComposite(this._boundable2);if(r&&n)return ZE.area(this._boundable1)>ZE.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(r)return this.expand(this._boundable1,this._boundable2,t,e),null;if(n)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new Wm("neither boundable is composite")},ZE.prototype.isLeaves=function(){return!(ZE.isComposite(this._boundable1)||ZE.isComposite(this._boundable2))},ZE.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},ZE.prototype.expand=function(t,e,r,n){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new ZE(o,e,this._itemDistance);s.getDistance()<n&&r.add(s)}},ZE.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},ZE.prototype.getDistance=function(){return this._distance},ZE.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},ZE.prototype.interfaces_=function(){return[$m]},ZE.prototype.getClass=function(){return ZE},ZE.area=function(t){return t.getBounds().getArea()},ZE.isComposite=function(t){return t instanceof JE};var $E=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new iI,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var r=arguments[0];D_.isTrue(r>1,"Node capacity must be greater than 1"),this._nodeCapacity=r}},tx={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};$E.prototype.getNodeCapacity=function(){return this._nodeCapacity},$E.prototype.lastNode=function(t){return t.get(t.size()-1)},$E.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();r instanceof JE?t+=this.size(r):r instanceof zE&&(t+=1)}return t}},$E.prototype.removeItem=function(t,e){for(var r=null,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof zE&&i.getItem()===e&&(r=i)}return null!==r&&(t.getChildBoundables().remove(r),!0)},$E.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new iI:t}if(1===arguments.length){for(var e=arguments[0],r=new iI,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof JE){var o=this.itemsTree(i);null!==o&&r.add(o)}else i instanceof zE?r.add(i.getItem()):D_.shouldNeverReachHere()}return r.size()<=0?null:r}},$E.prototype.insert=function(t,e){D_.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new zE(t,e))},$E.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new iI;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];if(D_.isTrue(r>-2),n.getLevel()===r)return i.add(n),null;for(var o=n.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof JE?this.boundablesAtLevel(r,s,i):(D_.isTrue(s instanceof zE),-1===r&&i.add(s))}return null}},$E.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var r=new iI;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,r),r}if(2===arguments.length){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i)}else if(3===arguments.length)if(l_(arguments[2],HE)&&arguments[0]instanceof Object&&arguments[1]instanceof JE)for(var o=arguments[0],s=arguments[2],a=arguments[1].getChildBoundables(),u=0;u<a.size();u++){var l=a.get(u);t.getIntersectsOp().intersects(l.getBounds(),o)&&(l instanceof JE?t.query(o,l,s):l instanceof zE?s.visitItem(l.getItem()):D_.shouldNeverReachHere())}else if(l_(arguments[2],rI)&&arguments[0]instanceof Object&&arguments[1]instanceof JE)for(var c=arguments[0],h=arguments[2],f=arguments[1].getChildBoundables(),p=0;p<f.size();p++){var g=f.get(p);t.getIntersectsOp().intersects(g.getBounds(),c)&&(g instanceof JE?t.query(c,g,h):g instanceof zE?h.add(g.getItem()):D_.shouldNeverReachHere())}},$E.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},$E.prototype.getRoot=function(){return this.build(),this._root},$E.prototype.remove=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=this.removeItem(n,i);if(o)return!0;for(var s=null,a=n.getChildBoundables().iterator();a.hasNext();){var u=a.next();if(this.getIntersectsOp().intersects(u.getBounds(),r)&&(u instanceof JE&&(o=this.remove(r,u,i)))){s=u;break}}return null!==s&&s.getChildBoundables().isEmpty()&&n.getChildBoundables().remove(s),o}},$E.prototype.createHigherLevels=function(t,e){D_.isTrue(!t.isEmpty());var r=this.createParentBoundables(t,e+1);return 1===r.size()?r.get(0):this.createHigherLevels(r,e+1)},$E.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();if(r instanceof JE){var n=this.depth(r);n>t&&(t=n)}}return t+1}},$E.prototype.createParentBoundables=function(t,e){var r=this;D_.isTrue(!t.isEmpty());var n=new iI;n.add(this.createNode(e));var i=new iI(t);KE.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var s=o.next();r.lastNode(n).getChildBoundables().size()===r.getNodeCapacity()&&n.add(r.createNode(e)),r.lastNode(n).addChildBoundable(s)}return n},$E.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},$E.prototype.interfaces_=function(){return[r_]},$E.prototype.getClass=function(){return $E},$E.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},tx.IntersectsOp.get=function(){return ex},tx.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},tx.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties($E,tx);var ex=function(){},rx=function(){};rx.prototype.distance=function(t,e){},rx.prototype.interfaces_=function(){return[]},rx.prototype.getClass=function(){return rx};var nx=function(t){function e(r){r=r||e.DEFAULT_NODE_CAPACITY,t.call(this,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return e.prototype.createParentBoundablesFromVerticalSlices=function(t,e){D_.isTrue(t.length>0);for(var r=new iI,n=0;n<t.length;n++)r.addAll(this.createParentBoundablesFromVerticalSlice(t[n],e));return r},e.prototype.createNode=function(t){return new ix(t)},e.prototype.size=function(){return 0===arguments.length?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},e.prototype.insert=function(){if(2!==arguments.length)return t.prototype.insert.apply(this,arguments);var e=arguments[0],r=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,r)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.prototype.verticalSlices=function(t,e){for(var r=Math.trunc(Math.ceil(t.size()/e)),n=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){n[o]=new iI;for(var s=0;i.hasNext()&&s<r;){var a=i.next();n[o].add(a),s++}}return n},e.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var r=arguments[0],n=arguments[1];t.prototype.query.call(this,r,n)}else if(3===arguments.length)if(l_(arguments[2],HE)&&arguments[0]instanceof Object&&arguments[1]instanceof JE){var i=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,i,o,s)}else if(l_(arguments[2],rI)&&arguments[0]instanceof Object&&arguments[1]instanceof JE){var a=arguments[0],u=arguments[1],l=arguments[2];t.prototype.query.call(this,a,u,l)}},e.prototype.getComparator=function(){return e.yComparator},e.prototype.createParentBoundablesFromVerticalSlice=function(e,r){return t.prototype.createParentBoundables.call(this,e,r)},e.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return t.prototype.remove.call(this,e,r)}return t.prototype.remove.apply(this,arguments)},e.prototype.depth=function(){return 0===arguments.length?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},e.prototype.createParentBoundables=function(t,r){D_.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new iI(t);KE.sort(i,e.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(n))));return this.createParentBoundablesFromVerticalSlices(o,r)},e.prototype.nearestNeighbour=function(){if(1===arguments.length){if(l_(arguments[0],rx)){var t=arguments[0],r=new ZE(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(r)}if(arguments[0]instanceof ZE){var n=arguments[0];return this.nearestNeighbour(n,Km.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof e&&l_(arguments[1],rx)){var i=arguments[0],o=arguments[1],s=new ZE(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof ZE&&"number"==typeof arguments[1]){var a=arguments[0],u=arguments[1],l=null,c=new YE;for(c.add(a);!c.isEmpty()&&u>0;){var h=c.poll(),f=h.getDistance();if(f>=u)break;h.isLeaves()?(u=f,l=h):h.expandToQueue(c,u)}return[l.getBoundable(0).getItem(),l.getBoundable(1).getItem()]}}else if(3===arguments.length){var p=arguments[2],g=new zE(arguments[0],arguments[1]),A=new ZE(this.getRoot(),g,p);return this.nearestNeighbour(A)[0]}},e.prototype.interfaces_=function(){return[XE,r_]},e.prototype.getClass=function(){return e},e.centreX=function(t){return e.avg(t.getMinX(),t.getMaxX())},e.avg=function(t,e){return(t+e)/2},e.centreY=function(t){return e.avg(t.getMinY(),t.getMaxY())},r.STRtreeNode.get=function(){return ix},r.serialVersionUID.get=function(){return 0x39920f7d5f261e0},r.xComparator.get=function(){return{interfaces_:function(){return[e_]},compare:function(r,n){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(n.getBounds()))}}},r.yComparator.get=function(){return{interfaces_:function(){return[e_]},compare:function(r,n){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(n.getBounds()))}}},r.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},r.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,r),e}($E),ix=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var r=e.next();null===t?t=new w_(r.getBounds()):t.expandToInclude(r.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(JE),ox=function(){};ox.prototype.interfaces_=function(){return[]},ox.prototype.getClass=function(){return ox},ox.relativeSign=function(t,e){return t<e?-1:t>e?1:0},ox.compare=function(t,e,r){if(e.equals2D(r))return 0;var n=ox.relativeSign(e.x,r.x),i=ox.relativeSign(e.y,r.y);switch(t){case 0:return ox.compareValue(n,i);case 1:return ox.compareValue(i,n);case 2:return ox.compareValue(i,-n);case 3:return ox.compareValue(-n,i);case 4:return ox.compareValue(-n,-i);case 5:return ox.compareValue(-i,-n);case 6:return ox.compareValue(-i,n);case 7:return ox.compareValue(n,-i)}return D_.shouldNeverReachHere("invalid octant value"),0},ox.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var sx=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._segString=t,this.coord=new n_(e),this.segmentIndex=r,this._segmentOctant=n,this._isInterior=!e.equals2D(t.getCoordinate(r))};sx.prototype.getCoordinate=function(){return this.coord},sx.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},sx.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:ox.compare(this._segmentOctant,this.coord,e.coord)},sx.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},sx.prototype.isInterior=function(){return this._isInterior},sx.prototype.interfaces_=function(){return[$m]},sx.prototype.getClass=function(){return sx};var ax=function(){this._nodeMap=new EI,this._edge=null;var t=arguments[0];this._edge=t};ax.prototype.getSplitCoordinates=function(){var t=new sI;this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next();this.addEdgeCoordinates(r,n,t),r=n}return t.toCoordinateArray()},ax.prototype.addCollapsedNodes=function(){var t=new iI;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var r=e.next().intValue();this.add(this._edge.getCoordinate(r),r)}},ax.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},ax.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var r=this._edge.getCoordinate(e),n=this._edge.getCoordinate(e+2);r.equals2D(n)&&t.add(new p_(e+1))}},ax.prototype.addEdgeCoordinates=function(t,e,r){var n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);r.add(new n_(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)r.add(this._edge.getCoordinate(o));i&&r.add(new n_(e.coord))},ax.prototype.iterator=function(){return this._nodeMap.values().iterator()},ax.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},ax.prototype.findCollapseIndex=function(t,e,r){if(!t.coord.equals2D(e.coord))return!1;var n=e.segmentIndex-t.segmentIndex;return e.isInterior()||n--,1===n&&(r[0]=t.segmentIndex+1,!0)},ax.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),r=this.iterator(),n=r.next();r.hasNext();){var i=r.next();this.findCollapseIndex(n,i,e)&&t.add(new p_(e[0])),n=i}},ax.prototype.getEdge=function(){return this._edge},ax.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},ax.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new n_(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new n_(e.coord)),new hx(o,this._edge.getData())},ax.prototype.add=function(t,e){var r=new sx(this._edge,t,e,this._edge.getSegmentOctant(e)),n=this._nodeMap.get(r);return null!==n?(D_.isTrue(n.coord.equals2D(t),"Found equal nodes with different coordinates"),n):(this._nodeMap.put(r,r),r)},ax.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),r=t.get(0).getCoordinate(0);if(!r.equals2D(e[0]))throw new T_("bad split edge start point at "+r);var n=t.get(t.size()-1).getCoordinates(),i=n[n.length-1];if(!i.equals2D(e[e.length-1]))throw new T_("bad split edge end point at "+i)},ax.prototype.interfaces_=function(){return[]},ax.prototype.getClass=function(){return ax};var ux=function(){};ux.prototype.interfaces_=function(){return[]},ux.prototype.getClass=function(){return ux},ux.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new Wm("Cannot compute the octant for point ( "+t+", "+e+" )");var r=Math.abs(t),n=Math.abs(e);return t>=0?e>=0?r>=n?0:1:r>=n?7:6:e>=0?r>=n?3:2:r>=n?4:5}if(arguments[0]instanceof n_&&arguments[1]instanceof n_){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new Wm("Cannot compute the octant for two identical points "+i);return ux.octant(s,a)}};var lx=function(){};lx.prototype.getCoordinates=function(){},lx.prototype.size=function(){},lx.prototype.getCoordinate=function(t){},lx.prototype.isClosed=function(){},lx.prototype.setData=function(t){},lx.prototype.getData=function(){},lx.prototype.interfaces_=function(){return[]},lx.prototype.getClass=function(){return lx};var cx=function(){};cx.prototype.addIntersection=function(t,e){},cx.prototype.interfaces_=function(){return[lx]},cx.prototype.getClass=function(){return cx};var hx=function(){this._nodeList=new ax(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};hx.prototype.getCoordinates=function(){return this._pts},hx.prototype.size=function(){return this._pts.length},hx.prototype.getCoordinate=function(t){return this._pts[t]},hx.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},hx.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},hx.prototype.setData=function(t){this._data=t},hx.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:ux.octant(t,e)},hx.prototype.getData=function(){return this._data},hx.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var r=arguments[1],n=arguments[3],i=new n_(arguments[0].getIntersection(n));this.addIntersection(i,r)}},hx.prototype.toString=function(){return N_.toLineString(new iE(this._pts))},hx.prototype.getNodeList=function(){return this._nodeList},hx.prototype.addIntersectionNode=function(t,e){var r=e,n=r+1;if(n<this._pts.length){var i=this._pts[n];t.equals2D(i)&&(r=n)}return this._nodeList.add(t,r)},hx.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},hx.prototype.interfaces_=function(){return[cx]},hx.prototype.getClass=function(){return hx},hx.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new iI;return hx.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){n.next().getNodeList().addSplitEdges(r)}};var fx=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new n_,this.p1=new n_;else if(1===arguments.length){var t=arguments[0];this.p0=new n_(t.p0),this.p1=new n_(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=arguments[3];this.p0=new n_(e,r),this.p1=new n_(n,i)}},px={serialVersionUID:{configurable:!0}};fx.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},fx.prototype.orientationIndex=function(){if(arguments[0]instanceof fx){var t=arguments[0],e=G_.orientationIndex(this.p0,this.p1,t.p0),r=G_.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&r>=0||e<=0&&r<=0?Math.max(e,r):0}if(arguments[0]instanceof n_){var n=arguments[0];return G_.orientationIndex(this.p0,this.p1,n)}},fx.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},fx.prototype.isVertical=function(){return this.p0.x===this.p1.x},fx.prototype.equals=function(t){if(!(t instanceof fx))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},fx.prototype.intersection=function(t){var e=new k_;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},fx.prototype.project=function(){if(arguments[0]instanceof n_){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new n_(t);var e=this.projectionFactor(t),r=new n_;return r.x=this.p0.x+e*(this.p1.x-this.p0.x),r.y=this.p0.y+e*(this.p1.y-this.p0.y),r}if(arguments[0]instanceof fx){var n=arguments[0],i=this.projectionFactor(n.p0),o=this.projectionFactor(n.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(n.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(n.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new fx(s,a)}},fx.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},fx.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},fx.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},fx.prototype.distancePerpendicular=function(t){return G_.distancePointLinePerpendicular(t,this.p0,this.p1)},fx.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},fx.prototype.midPoint=function(){return fx.midPoint(this.p0,this.p1)},fx.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,r=this.p1.y-this.p0.y,n=e*e+r*r;return n<=0?Km.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*r)/n},fx.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var r=new Array(2).fill(null),n=Km.MAX_VALUE,i=null,o=this.closestPoint(t.p0);n=o.distance(t.p0),r[0]=o,r[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<n&&(n=i,r[0]=s,r[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<n&&(n=i,r[0]=this.p0,r[1]=a);var u=t.closestPoint(this.p1);return(i=u.distance(this.p1))<n&&(n=i,r[0]=this.p1,r[1]=u),r},fx.prototype.closestPoint=function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},fx.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},fx.prototype.getLength=function(){return this.p0.distance(this.p1)},fx.prototype.compareTo=function(t){var e=t,r=this.p0.compareTo(e.p0);return 0!==r?r:this.p1.compareTo(e.p1)},fx.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},fx.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&(this.p1.equals(t.p1)||this.p0.equals(t.p1))&&this.p1.equals(t.p0)},fx.prototype.lineIntersection=function(t){try{return C_.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof E_))throw t}return null},fx.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},fx.prototype.pointAlongOffset=function(t,e){var r=this.p0.x+t*(this.p1.x-this.p0.x),n=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,s=Math.sqrt(i*i+o*o),a=0,u=0;if(0!==e){if(s<=0)throw new Error("Cannot compute offset from zero-length line segment");a=e*i/s,u=e*o/s}return new n_(r-u,n+a)},fx.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=r.x,this.p1.y=r.y}},fx.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||Km.isNaN(e))&&(e=1),e},fx.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},fx.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},fx.prototype.distance=function(){if(arguments[0]instanceof fx){var t=arguments[0];return G_.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof n_){var e=arguments[0];return G_.distancePointLine(e,this.p0,this.p1)}},fx.prototype.pointAlong=function(t){var e=new n_;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e},fx.prototype.hashCode=function(){var t=Km.doubleToLongBits(this.p0.x);t^=31*Km.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),r=Km.doubleToLongBits(this.p1.x);return r^=31*Km.doubleToLongBits(this.p1.y),e^(Math.trunc(r)^Math.trunc(r>>32))},fx.prototype.interfaces_=function(){return[$m,r_]},fx.prototype.getClass=function(){return fx},fx.midPoint=function(t,e){return new n_((t.x+e.x)/2,(t.y+e.y)/2)},px.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(fx,px);var gx=function(){this.tempEnv1=new w_,this.tempEnv2=new w_,this._overlapSeg1=new fx,this._overlapSeg2=new fx};gx.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},gx.prototype.interfaces_=function(){return[]},gx.prototype.getClass=function(){return gx};var Ax=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._pts=t,this._start=e,this._end=r,this._context=n};Ax.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},Ax.prototype.computeSelect=function(t,e,r,n){var i=this._pts[e],o=this._pts[r];if(n.tempEnv1.init(i,o),r-e==1)return n.select(this,e),null;if(!t.intersects(n.tempEnv1))return null;var s=Math.trunc((e+r)/2);e<s&&this.computeSelect(t,e,s,n),s<r&&this.computeSelect(t,s,r,n)},Ax.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,r=this._start;r<=this._end;r++)t[e++]=this._pts[r];return t},Ax.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},Ax.prototype.setId=function(t){this._id=t},Ax.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},Ax.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new w_(t,e)}return this._env},Ax.prototype.getEndIndex=function(){return this._end},Ax.prototype.getStartIndex=function(){return this._start},Ax.prototype.getContext=function(){return this._context},Ax.prototype.getId=function(){return this._id},Ax.prototype.computeOverlapsInternal=function(t,e,r,n,i,o){var s=this._pts[t],a=this._pts[e],u=r._pts[n],l=r._pts[i];if(e-t==1&&i-n==1)return o.overlap(this,t,r,n),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(u,l),!o.tempEnv1.intersects(o.tempEnv2))return null;var c=Math.trunc((t+e)/2),h=Math.trunc((n+i)/2);t<c&&(n<h&&this.computeOverlapsInternal(t,c,r,n,h,o),h<i&&this.computeOverlapsInternal(t,c,r,h,i,o)),c<e&&(n<h&&this.computeOverlapsInternal(c,e,r,n,h,o),h<i&&this.computeOverlapsInternal(c,e,r,h,i,o))},Ax.prototype.interfaces_=function(){return[]},Ax.prototype.getClass=function(){return Ax};var dx=function(){};dx.prototype.interfaces_=function(){return[]},dx.prototype.getClass=function(){return dx},dx.getChainStartIndices=function(t){var e=0,r=new iI;r.add(new p_(e));do{var n=dx.findChainEnd(t,e);r.add(new p_(n)),e=n}while(e<t.length-1);return dx.toIntArray(r)},dx.findChainEnd=function(t,e){for(var r=e;r<t.length-1&&t[r].equals2D(t[r+1]);)r++;if(r>=t.length-1)return t.length-1;for(var n=kE.quadrant(t[r],t[r+1]),i=e+1;i<t.length;){if(!t[i-1].equals2D(t[i]))if(kE.quadrant(t[i-1],t[i])!==n)break;i++}return i-1},dx.getChains=function(){if(1===arguments.length)return dx.getChains(arguments[0],null);if(2===arguments.length){for(var t=arguments[0],e=arguments[1],r=new iI,n=dx.getChainStartIndices(t),i=0;i<n.length-1;i++){var o=new Ax(t,n[i],n[i+1],e);r.add(o)}return r}},dx.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var yx=function(){};yx.prototype.computeNodes=function(t){},yx.prototype.getNodedSubstrings=function(){},yx.prototype.interfaces_=function(){return[]},yx.prototype.getClass=function(){return yx};var vx=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};vx.prototype.setSegmentIntersector=function(t){this._segInt=t},vx.prototype.interfaces_=function(){return[yx]},vx.prototype.getClass=function(){return vx};var mx=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new iI,this._index=new nx,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return hx.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=this,r=dx.getChains(t.getCoordinates(),t).iterator();r.hasNext();){var n=r.next();n.setId(e._idCounter++),e._index.insert(n.getEnvelope(),n),e._monoChains.add(n)}},e.prototype.computeNodes=function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},e.prototype.intersectChains=function(){for(var t=this,e=new _x(this._segInt),r=this._monoChains.iterator();r.hasNext();)for(var n=r.next(),i=t._index.query(n.getEnvelope()).iterator();i.hasNext();){var o=i.next();if(o.getId()>n.getId()&&(n.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.SegmentOverlapAction.get=function(){return _x},Object.defineProperties(e,r),e}(vx),_x=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[1],r=arguments[2],n=arguments[3],i=arguments[0].getContext(),o=r.getContext();this._si.processIntersections(i,e,o,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(gx),Ix=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(n)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},Ex={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Ix.prototype.getEndCapStyle=function(){return this._endCapStyle},Ix.prototype.isSingleSided=function(){return this._isSingleSided},Ix.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=Ix.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Ix.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Ix.JOIN_ROUND&&(this._quadrantSegments=Ix.DEFAULT_QUADRANT_SEGMENTS)},Ix.prototype.getJoinStyle=function(){return this._joinStyle},Ix.prototype.setJoinStyle=function(t){this._joinStyle=t},Ix.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},Ix.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Ix.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Ix.prototype.setEndCapStyle=function(t){this._endCapStyle=t},Ix.prototype.getMitreLimit=function(){return this._mitreLimit},Ix.prototype.setMitreLimit=function(t){this._mitreLimit=t},Ix.prototype.setSingleSided=function(t){this._isSingleSided=t},Ix.prototype.interfaces_=function(){return[]},Ix.prototype.getClass=function(){return Ix},Ix.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},Ex.CAP_ROUND.get=function(){return 1},Ex.CAP_FLAT.get=function(){return 2},Ex.CAP_SQUARE.get=function(){return 3},Ex.JOIN_ROUND.get=function(){return 1},Ex.JOIN_MITRE.get=function(){return 2},Ex.JOIN_BEVEL.get=function(){return 3},Ex.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Ex.DEFAULT_MITRE_LIMIT.get=function(){return 5},Ex.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(Ix,Ex);var xx=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=G_.COUNTERCLOCKWISE,this._inputLine=t||null},Cx={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};xx.prototype.isDeletable=function(t,e,r,n){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[r];return!!this.isConcave(i,o,s)&&(!!this.isShallow(i,o,s,n)&&this.isShallowSampled(i,o,t,r,n))},xx.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,r=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(r),i=!1;n<this._inputLine.length;){var o=!1;t.isDeletable(e,r,n,t._distanceTol)&&(t._isDeleted[r]=xx.DELETE,o=!0,i=!0),e=o?n:r,r=t.findNextNonDeletedIndex(e),n=t.findNextNonDeletedIndex(r)}return i},xx.prototype.isShallowConcavity=function(t,e,r,n){return G_.computeOrientation(t,e,r)===this._angleOrientation&&G_.distancePointLine(e,t,r)<n},xx.prototype.isShallowSampled=function(t,e,r,n,i){var o=Math.trunc((n-r)/xx.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=r;s<n;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},xx.prototype.isConcave=function(t,e,r){var n=G_.computeOrientation(t,e,r)===this._angleOrientation;return n},xx.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=G_.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},xx.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===xx.DELETE;)e++;return e},xx.prototype.isShallow=function(t,e,r,n){return G_.distancePointLine(e,t,r)<n},xx.prototype.collapseLine=function(){for(var t=new sI,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==xx.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},xx.prototype.interfaces_=function(){return[]},xx.prototype.getClass=function(){return xx},xx.simplify=function(t,e){return new xx(t).simplify(e)},Cx.INIT.get=function(){return 0},Cx.DELETE.get=function(){return 1},Cx.KEEP.get=function(){return 1},Cx.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(xx,Cx);var wx=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new iI},bx={COORDINATE_ARRAY_TYPE:{configurable:!0}};wx.prototype.getCoordinates=function(){return this._ptList.toArray(wx.COORDINATE_ARRAY_TYPE)},wx.prototype.setPrecisionModel=function(t){this._precisionModel=t},wx.prototype.addPt=function(t){var e=new n_(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},wx.prototype.revere=function(){},wx.prototype.addPts=function(t,e){if(e)for(var r=0;r<t.length;r++)this.addPt(t[r]);else for(var n=t.length-1;n>=0;n--)this.addPt(t[n])},wx.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance},wx.prototype.toString=function(){return(new pE).createLineString(this.getCoordinates()).toString()},wx.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new n_(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},wx.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},wx.prototype.interfaces_=function(){return[]},wx.prototype.getClass=function(){return wx},bx.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(wx,bx);var Bx=function(){},Sx={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};Bx.prototype.interfaces_=function(){return[]},Bx.prototype.getClass=function(){return Bx},Bx.toDegrees=function(t){return 180*t/Math.PI},Bx.normalize=function(t){for(;t>Math.PI;)t-=Bx.PI_TIMES_2;for(;t<=-Math.PI;)t+=Bx.PI_TIMES_2;return t},Bx.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],r=arguments[1],n=r.x-e.x,i=r.y-e.y;return Math.atan2(i,n)}},Bx.isAcute=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)>0},Bx.isObtuse=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)<0},Bx.interiorAngle=function(t,e,r){var n=Bx.angle(e,t),i=Bx.angle(e,r);return Math.abs(i-n)},Bx.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Bx.PI_TIMES_2;t>=Bx.PI_TIMES_2&&(t=0)}else{for(;t>=Bx.PI_TIMES_2;)t-=Bx.PI_TIMES_2;t<0&&(t=0)}return t},Bx.angleBetween=function(t,e,r){var n=Bx.angle(e,t),i=Bx.angle(e,r);return Bx.diff(n,i)},Bx.diff=function(t,e){var r=null;return(r=t<e?e-t:t-e)>Math.PI&&(r=2*Math.PI-r),r},Bx.toRadians=function(t){return t*Math.PI/180},Bx.getTurn=function(t,e){var r=Math.sin(e-t);return r>0?Bx.COUNTERCLOCKWISE:r<0?Bx.CLOCKWISE:Bx.NONE},Bx.angleBetweenOriented=function(t,e,r){var n=Bx.angle(e,t),i=Bx.angle(e,r)-n;return i<=-Math.PI?i+Bx.PI_TIMES_2:i>Math.PI?i-Bx.PI_TIMES_2:i},Sx.PI_TIMES_2.get=function(){return 2*Math.PI},Sx.PI_OVER_2.get=function(){return Math.PI/2},Sx.PI_OVER_4.get=function(){return Math.PI/4},Sx.COUNTERCLOCKWISE.get=function(){return G_.COUNTERCLOCKWISE},Sx.CLOCKWISE.get=function(){return G_.CLOCKWISE},Sx.NONE.get=function(){return G_.COLLINEAR},Object.defineProperties(Bx,Sx);var Mx=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new fx,this._seg1=new fx,this._offset0=new fx,this._offset1=new fx,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._precisionModel=e,this._bufParams=r,this._li=new k_,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===Ix.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},Lx={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Mx.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var r=G_.computeOrientation(this._s0,this._s1,this._s2),n=r===G_.CLOCKWISE&&this._side===IE.LEFT||r===G_.COUNTERCLOCKWISE&&this._side===IE.RIGHT;0===r?this.addCollinear(e):n?this.addOutsideTurn(r,e):this.addInsideTurn(r,e)},Mx.prototype.addLineEndCap=function(t,e){var r=new fx(t,e),n=new fx;this.computeOffsetSegment(r,IE.LEFT,this._distance,n);var i=new fx;this.computeOffsetSegment(r,IE.RIGHT,this._distance,i);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case Ix.CAP_ROUND:this._segList.addPt(n.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,G_.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Ix.CAP_FLAT:this._segList.addPt(n.p1),this._segList.addPt(i.p1);break;case Ix.CAP_SQUARE:var u=new n_;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new n_(n.p1.x+u.x,n.p1.y+u.y),c=new n_(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(c)}},Mx.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Mx.prototype.addMitreJoin=function(t,e,r,n){var i=!0,o=null;try{o=C_.intersection(e.p0,e.p1,r.p0,r.p1),(n<=0?1:o.distance(t)/Math.abs(n))>this._bufParams.getMitreLimit()&&(i=!1)}catch(t){if(!(t instanceof E_))throw t;o=new n_(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,r,n,this._bufParams.getMitreLimit())},Mx.prototype.addFilletCorner=function(t,e,r,n,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),u=r.x-t.x,l=r.y-t.y,c=Math.atan2(l,u);n===G_.CLOCKWISE?a<=c&&(a+=2*Math.PI):a>=c&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,c,n,i),this._segList.addPt(r)},Mx.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*Mx.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Ix.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Ix.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))},Mx.prototype.createSquare=function(t){this._segList.addPt(new n_(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new n_(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new n_(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new n_(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},Mx.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},Mx.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},Mx.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},Mx.prototype.initSideSegments=function(t,e,r){this._s1=t,this._s2=e,this._side=r,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,r,this._distance,this._offset1)},Mx.prototype.addLimitedMitreJoin=function(t,e,r,n){var i=this._seg0.p1,o=Bx.angle(i,this._seg0.p0),s=Bx.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=Bx.normalize(o+s),u=Bx.normalize(a+Math.PI),l=n*r,c=r-l*Math.abs(Math.sin(s)),h=i.x+l*Math.cos(u),f=i.y+l*Math.sin(u),p=new n_(h,f),g=new fx(i,p),A=g.pointAlongOffset(1,c),d=g.pointAlongOffset(1,-c);this._side===IE.LEFT?(this._segList.addPt(A),this._segList.addPt(d)):(this._segList.addPt(d),this._segList.addPt(A))},Mx.prototype.computeOffsetSegment=function(t,e,r,n){var i=e===IE.LEFT?1:-1,o=t.p1.x-t.p0.x,s=t.p1.y-t.p0.y,a=Math.sqrt(o*o+s*s),u=i*r*o/a,l=i*r*s/a;n.p0.x=t.p0.x-l,n.p0.y=t.p0.y+u,n.p1.x=t.p1.x-l,n.p1.y=t.p1.y+u},Mx.prototype.addFilletArc=function(t,e,r,n,i){var o=n===G_.CLOCKWISE?-1:1,s=Math.abs(e-r),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var u=s/a,l=0,c=new n_;l<s;){var h=e+o*l;c.x=t.x+i*Math.cos(h),c.y=t.y+i*Math.sin(h),this._segList.addPt(c),l+=u}},Mx.prototype.addInsideTurn=function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*Mx.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var r=new n_((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r);var n=new n_((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},Mx.prototype.createCircle=function(t){var e=new n_(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Mx.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},Mx.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new wx,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Mx.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Mx.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Ix.JOIN_BEVEL||this._bufParams.getJoinStyle()===Ix.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,G_.CLOCKWISE,this._distance))},Mx.prototype.closeRing=function(){this._segList.closeRing()},Mx.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Mx.prototype.interfaces_=function(){return[]},Mx.prototype.getClass=function(){return Mx},Lx.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},Lx.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},Lx.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Lx.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Mx,Lx);var Nx=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};Nx.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var r=e<0,n=Math.abs(e),i=this.getSegGen(n);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,r,i);var o=i.getCoordinates();return r&&aI.reverse(o),o},Nx.prototype.computeSingleSidedBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){r.addSegments(t,!0);var i=xx.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],IE.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{r.addSegments(t,!1);var a=xx.simplify(t,n),u=a.length-1;r.initSideSegments(a[0],a[1],IE.LEFT),r.addFirstSegment();for(var l=2;l<=u;l++)r.addNextSegment(a[l],!0)}r.addLastSegment(),r.closeRing()},Nx.prototype.computeRingBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);e===IE.RIGHT&&(n=-n);var i=xx.simplify(t,n),o=i.length-1;r.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;r.addNextSegment(i[s],a)}r.closeRing()},Nx.prototype.computeLineBufferCurve=function(t,e){var r=this.simplifyTolerance(this._distance),n=xx.simplify(t,r),i=n.length-1;e.initSideSegments(n[0],n[1],IE.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(n[o],!0);e.addLastSegment(),e.addLineEndCap(n[i-1],n[i]);var s=xx.simplify(t,-r),a=s.length-1;e.initSideSegments(s[a],s[a-1],IE.LEFT);for(var u=a-2;u>=0;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},Nx.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Ix.CAP_ROUND:e.createCircle(t);break;case Ix.CAP_SQUARE:e.createSquare(t)}},Nx.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var r=Math.abs(e),n=this.getSegGen(r);if(t.length<=1)this.computePointCurve(t[0],n);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,n)}else this.computeLineBufferCurve(t,n);return n.getCoordinates()},Nx.prototype.getBufferParameters=function(){return this._bufParams},Nx.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},Nx.prototype.getRingCurve=function(t,e,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(0===r)return Nx.copyCoordinates(t);var n=this.getSegGen(r);return this.computeRingBufferCurve(t,e,n),n.getCoordinates()},Nx.prototype.computeOffsetCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){var i=xx.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],IE.LEFT),r.addFirstSegment();for(var s=o-2;s>=0;s--)r.addNextSegment(i[s],!0)}else{var a=xx.simplify(t,n),u=a.length-1;r.initSideSegments(a[0],a[1],IE.LEFT),r.addFirstSegment();for(var l=2;l<=u;l++)r.addNextSegment(a[l],!0)}r.addLastSegment()},Nx.prototype.getSegGen=function(t){return new Mx(this._precisionModel,this._bufParams,t)},Nx.prototype.interfaces_=function(){return[]},Nx.prototype.getClass=function(){return Nx},Nx.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),r=0;r<e.length;r++)e[r]=new n_(t[r]);return e};var Tx=function(){this._subgraphs=null,this._seg=new fx,this._cga=new G_;var t=arguments[0];this._subgraphs=t},Rx={DepthSegment:{configurable:!0}};Tx.prototype.findStabbedSegments=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=new iI,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),o=i.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),r)}return r}if(3===arguments.length)if(l_(arguments[2],rI)&&arguments[0]instanceof n_&&arguments[1]instanceof GE)for(var s=arguments[0],a=arguments[1],u=arguments[2],l=a.getEdge().getCoordinates(),c=0;c<l.length-1;c++){if(t._seg.p0=l[c],t._seg.p1=l[c+1],t._seg.p0.y>t._seg.p1.y&&t._seg.reverse(),!(Math.max(t._seg.p0.x,t._seg.p1.x)<s.x||t._seg.isHorizontal()||s.y<t._seg.p0.y||s.y>t._seg.p1.y||G_.computeOrientation(t._seg.p0,t._seg.p1,s)===G_.RIGHT)){var h=a.getDepth(IE.LEFT);t._seg.p0.equals(l[c])||(h=a.getDepth(IE.RIGHT));var f=new Dx(t._seg,h);u.add(f)}}else if(l_(arguments[2],rI)&&arguments[0]instanceof n_&&l_(arguments[1],rI))for(var p=arguments[0],g=arguments[2],A=arguments[1].iterator();A.hasNext();){var d=A.next();d.isForward()&&t.findStabbedSegments(p,d,g)}},Tx.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:KE.min(e)._leftDepth},Tx.prototype.interfaces_=function(){return[]},Tx.prototype.getClass=function(){return Tx},Rx.DepthSegment.get=function(){return Dx},Object.defineProperties(Tx,Rx);var Dx=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new fx(t),this._leftDepth=e};Dx.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var r=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==r||0!==(r=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?r:this._upwardSeg.compareTo(e._upwardSeg)},Dx.prototype.compareX=function(t,e){var r=t.p0.compareTo(e.p0);return 0!==r?r:t.p1.compareTo(e.p1)},Dx.prototype.toString=function(){return this._upwardSeg.toString()},Dx.prototype.interfaces_=function(){return[$m]},Dx.prototype.getClass=function(){return Dx};var Qx=function(t,e,r){this.p0=t||null,this.p1=e||null,this.p2=r||null};Qx.prototype.area=function(){return Qx.area(this.p0,this.p1,this.p2)},Qx.prototype.signedArea=function(){return Qx.signedArea(this.p0,this.p1,this.p2)},Qx.prototype.interpolateZ=function(t){if(null===t)throw new Wm("Supplied point is null.");return Qx.interpolateZ(t,this.p0,this.p1,this.p2)},Qx.prototype.longestSideLength=function(){return Qx.longestSideLength(this.p0,this.p1,this.p2)},Qx.prototype.isAcute=function(){return Qx.isAcute(this.p0,this.p1,this.p2)},Qx.prototype.circumcentre=function(){return Qx.circumcentre(this.p0,this.p1,this.p2)},Qx.prototype.area3D=function(){return Qx.area3D(this.p0,this.p1,this.p2)},Qx.prototype.centroid=function(){return Qx.centroid(this.p0,this.p1,this.p2)},Qx.prototype.inCentre=function(){return Qx.inCentre(this.p0,this.p1,this.p2)},Qx.prototype.interfaces_=function(){return[]},Qx.prototype.getClass=function(){return Qx},Qx.area=function(t,e,r){return Math.abs(((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2)},Qx.signedArea=function(t,e,r){return((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2},Qx.det=function(t,e,r,n){return t*n-e*r},Qx.interpolateZ=function(t,e,r,n){var i=e.x,o=e.y,s=r.x-i,a=n.x-i,u=r.y-o,l=n.y-o,c=s*l-a*u,h=t.x-i,f=t.y-o,p=(l*h-a*f)/c,g=(-u*h+s*f)/c;return e.z+p*(r.z-e.z)+g*(n.z-e.z)},Qx.longestSideLength=function(t,e,r){var n=t.distance(e),i=e.distance(r),o=r.distance(t),s=n;return i>s&&(s=i),o>s&&(s=o),s},Qx.isAcute=function(t,e,r){return!!Bx.isAcute(t,e,r)&&(!!Bx.isAcute(e,r,t)&&!!Bx.isAcute(r,t,e))},Qx.circumcentre=function(t,e,r){var n=r.x,i=r.y,o=t.x-n,s=t.y-i,a=e.x-n,u=e.y-i,l=2*Qx.det(o,s,a,u),c=Qx.det(s,o*o+s*s,u,a*a+u*u),h=Qx.det(o,o*o+s*s,a,a*a+u*u);return new n_(n-c/l,i+h/l)},Qx.perpendicularBisector=function(t,e){var r=e.x-t.x,n=e.y-t.y,i=new C_(t.x+r/2,t.y+n/2,1),o=new C_(t.x-n+r/2,t.y+r+n/2,1);return new C_(i,o)},Qx.angleBisector=function(t,e,r){var n=e.distance(t),i=n/(n+e.distance(r)),o=r.x-t.x,s=r.y-t.y;return new n_(t.x+i*o,t.y+i*s)},Qx.area3D=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=r.x-t.x,a=r.y-t.y,u=r.z-t.z,l=i*u-o*a,c=o*s-n*u,h=n*a-i*s,f=l*l+c*c+h*h,p=Math.sqrt(f)/2;return p},Qx.centroid=function(t,e,r){var n=(t.x+e.x+r.x)/3,i=(t.y+e.y+r.y)/3;return new n_(n,i)},Qx.inCentre=function(t,e,r){var n=e.distance(r),i=t.distance(r),o=t.distance(e),s=n+i+o,a=(n*t.x+i*e.x+o*r.x)/s,u=(n*t.y+i*e.y+o*r.y)/s;return new n_(a,u)};var Px=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new iI;var t=arguments[0],e=arguments[1],r=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=r};Px.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,a_.EXTERIOR,a_.INTERIOR)},Px.prototype.addPolygon=function(t){var e=this,r=this._distance,n=IE.LEFT;this._distance<0&&(r=-this._distance,n=IE.RIGHT);var i=t.getExteriorRing(),o=aI.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,r,n,a_.EXTERIOR,a_.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var a=t.getInteriorRingN(s),u=aI.removeRepeatedPoints(a.getCoordinates());e._distance>0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(u,r,IE.opposite(n),a_.INTERIOR,a_.EXTERIOR)}},Px.prototype.isTriangleErodedCompletely=function(t,e){var r=new Qx(t[0],t[1],t[2]),n=r.inCentre();return G_.distancePointLine(n,r.p0,r.p1)<Math.abs(e)},Px.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=aI.removeRepeatedPoints(t.getCoordinates()),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,a_.EXTERIOR,a_.INTERIOR)},Px.prototype.addCurve=function(t,e,r){if(null===t||t.length<2)return null;var n=new hx(t,new LE(0,a_.BOUNDARY,e,r));this._curveList.add(n)},Px.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Px.prototype.addPolygonRing=function(t,e,r,n,i){if(0===e&&t.length<KI.MINIMUM_VALID_SIZE)return null;var o=n,s=i;t.length>=KI.MINIMUM_VALID_SIZE&&G_.isCCW(t)&&(o=i,s=n,r=IE.opposite(r));var a=this._curveBuilder.getRingCurve(t,r,e);this.addCurve(a,o,s)},Px.prototype.add=function(t){if(t.isEmpty())return null;t instanceof JI?this.addPolygon(t):t instanceof zI?this.addLineString(t):t instanceof HI?this.addPoint(t):(t instanceof WI||t instanceof RI||t instanceof ZI||t instanceof TI)&&this.addCollection(t)},Px.prototype.isErodedCompletely=function(t,e){var r=t.getCoordinates();if(r.length<4)return e<0;if(4===r.length)return this.isTriangleErodedCompletely(r,e);var n=t.getEnvelopeInternal(),i=Math.min(n.getHeight(),n.getWidth());return e<0&&2*Math.abs(e)>i},Px.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},Px.prototype.interfaces_=function(){return[]},Px.prototype.getClass=function(){return Px};var kx=function(){};kx.prototype.locate=function(t){},kx.prototype.interfaces_=function(){return[]},kx.prototype.getClass=function(){return kx};var Ox=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};Ox.prototype.next=function(){if(this._atStart)return this._atStart=!1,Ox.isAtomic(this._parent)&&this._index++,this._parent;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new nI;var t=this._parent.getGeometryN(this._index++);return t instanceof TI?(this._subcollectionIterator=new Ox(t),this._subcollectionIterator.next()):t},Ox.prototype.remove=function(){throw new Error(this.getClass().getName())},Ox.prototype.hasNext=function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Ox.prototype.interfaces_=function(){return[eI]},Ox.prototype.getClass=function(){return Ox},Ox.isAtomic=function(t){return!(t instanceof TI)};var Fx=function(){this._geom=null;var t=arguments[0];this._geom=t};Fx.prototype.locate=function(t){return Fx.locate(t,this._geom)},Fx.prototype.interfaces_=function(){return[kx]},Fx.prototype.getClass=function(){return Fx},Fx.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&G_.isPointInRing(t,e.getCoordinates())},Fx.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var r=e.getExteriorRing();if(!Fx.isPointInRing(t,r))return!1;for(var n=0;n<e.getNumInteriorRing();n++){var i=e.getInteriorRingN(n);if(Fx.isPointInRing(t,i))return!1}return!0},Fx.containsPoint=function(t,e){if(e instanceof JI)return Fx.containsPointInPolygon(t,e);if(e instanceof TI)for(var r=new Ox(e);r.hasNext();){var n=r.next();if(n!==e&&Fx.containsPoint(t,n))return!0}return!1},Fx.locate=function(t,e){return e.isEmpty()?a_.EXTERIOR:Fx.containsPoint(t,e)?a_.INTERIOR:a_.EXTERIOR};var Gx=function(){this._edgeMap=new EI,this._edgeList=null,this._ptInAreaLocation=[a_.NONE,a_.NONE]};Gx.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),r=e-1;return 0===e&&(r=this._edgeList.size()-1),this._edgeList.get(r)},Gx.prototype.propagateSideLabels=function(t){for(var e=a_.NONE,r=this.iterator();r.hasNext();){var n=r.next().getLabel();n.isArea(t)&&n.getLocation(t,IE.LEFT)!==a_.NONE&&(e=n.getLocation(t,IE.LEFT))}if(e===a_.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,IE.ON)===a_.NONE&&a.setLocation(t,IE.ON,i),a.isArea(t)){var u=a.getLocation(t,IE.LEFT),l=a.getLocation(t,IE.RIGHT);if(l!==a_.NONE){if(l!==i)throw new bE("side location conflict",s.getCoordinate());u===a_.NONE&&D_.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=u}else D_.isTrue(a.getLocation(t,IE.LEFT)===a_.NONE,"found single null side"),a.setLocation(t,IE.RIGHT,i),a.setLocation(t,IE.LEFT,i)}}},Gx.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},Gx.prototype.print=function(t){x_.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Gx.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},Gx.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var r=e.size()-1,n=e.get(r).getLabel().getLocation(t,IE.LEFT);D_.isTrue(n!==a_.NONE,"Found unlabelled area edge");for(var i=n,o=this.iterator();o.hasNext();){var s=o.next().getLabel();D_.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,IE.LEFT),u=s.getLocation(t,IE.RIGHT);if(a===u)return!1;if(u!==i)return!1;i=a}return!0},Gx.prototype.findIndex=function(t){this.iterator();for(var e=0;e<this._edgeList.size();e++){if(this._edgeList.get(e)===t)return e}return-1},Gx.prototype.iterator=function(){return this.getEdges().iterator()},Gx.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new iI(this._edgeMap.values())),this._edgeList},Gx.prototype.getLocation=function(t,e,r){return this._ptInAreaLocation[t]===a_.NONE&&(this._ptInAreaLocation[t]=Fx.locate(e,r[t].getGeometry())),this._ptInAreaLocation[t]},Gx.prototype.toString=function(){var t=new f_;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var r=e.next();t.append(r),t.append("\n")}return t.toString()},Gx.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){e.next().computeLabel(t)}},Gx.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],r=this.iterator();r.hasNext();)for(var n=r.next().getLabel(),i=0;i<2;i++)n.isLine(i)&&n.getLocation(i)===a_.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),u=0;u<2;u++)if(a.isAnyNull(u)){var l=a_.NONE;if(e[u])l=a_.EXTERIOR;else{var c=s.getCoordinate();l=this.getLocation(u,c,t)}a.setAllLocationsIfNull(u,l)}},Gx.prototype.getDegree=function(){return this._edgeMap.size()},Gx.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},Gx.prototype.interfaces_=function(){return[]},Gx.prototype.getClass=function(){return Gx};var Ux=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){var t=this;this.getResultAreaEdges();for(var e=null,r=null,n=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var o=t._resultAreaEdgeList.get(i),s=o.getSym();if(o.getLabel().isArea())switch(null===e&&o.isInResult()&&(e=o),n){case t._SCANNING_FOR_INCOMING:if(!s.isInResult())continue;r=s,n=t._LINKING_TO_OUTGOING;break;case t._LINKING_TO_OUTGOING:if(!o.isInResult())continue;r.setNext(o),n=t._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===e)throw new bE("no outgoing dirEdge found",this.getCoordinate());D_.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),r.setNext(e)}},e.prototype.insert=function(t){var e=t;this.insertEdgeEnd(e,e)},e.prototype.getRightmostEdge=function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var r=t.get(0);if(1===e)return r;var n=t.get(e-1),i=r.getQuadrant(),o=n.getQuadrant();return kE.isNorthern(i)&&kE.isNorthern(o)?r:kE.isNorthern(i)||kE.isNorthern(o)?0!==r.getDy()?r:0!==n.getDy()?n:(D_.shouldNeverReachHere("found two horizontal edges incident on node"),null):n},e.prototype.print=function(t){x_.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var r=e.next();t.print("out "),r.print(t),t.println(),t.print("in "),r.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new iI;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},e.prototype.updateLabelling=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next().getLabel();r.setAllLocationsIfNull(0,t.getLocation(0)),r.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,r=this._edgeList.size()-1;r>=0;r--){var n=this._edgeList.get(r),i=n.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=n}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),r=t.getDepth(IE.LEFT),n=t.getDepth(IE.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),r);if(this.computeDepths(0,e,i)!==n)throw new bE("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[1],s=arguments[2],a=arguments[0];a<o;a++){var u=this._edgeList.get(a);u.setEdgeDepths(IE.RIGHT,s),s=u.getDepth(IE.LEFT)}return s}},e.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},e.prototype.linkMinimalDirectedEdges=function(t){for(var e=this,r=null,n=null,i=this._SCANNING_FOR_INCOMING,o=this._resultAreaEdgeList.size()-1;o>=0;o--){var s=e._resultAreaEdgeList.get(o),a=s.getSym();switch(null===r&&s.getEdgeRing()===t&&(r=s),i){case e._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;n=a,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;n.setNextMin(s),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(D_.isTrue(null!==r,"found null for first outgoing dirEdge"),D_.isTrue(r.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(r))},e.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();){e.next().isInResult()&&t++}return t}if(1===arguments.length){for(var r=arguments[0],n=0,i=this.iterator();i.hasNext();){i.next().getEdgeRing()===r&&n++}return n}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=a_.NONE,e=this.iterator();e.hasNext();){var r=e.next(),n=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){t=a_.INTERIOR;break}if(n.isInResult()){t=a_.EXTERIOR;break}}}if(t===a_.NONE)return null;for(var i=t,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getSym();s.isLineEdge()?s.getEdge().setCovered(i===a_.INTERIOR):(s.isInResult()&&(i=a_.EXTERIOR),a.isInResult()&&(i=a_.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new LE(a_.NONE);for(var r=this.iterator();r.hasNext();)for(var n=r.next().getEdge().getLabel(),i=0;i<2;i++){var o=n.getLocation(i);o!==a_.INTERIOR&&o!==a_.BOUNDARY||this._label.setLocation(i,a_.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Gx),qx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(t){return new QE(t,new Ux)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(UE),jx=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};jx.prototype.compareTo=function(t){var e=t;return jx.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},jx.prototype.interfaces_=function(){return[$m]},jx.prototype.getClass=function(){return jx},jx.orientation=function(t){return 1===aI.increasingDirection(t)},jx.compareOriented=function(t,e,r,n){for(var i=e?1:-1,o=n?1:-1,s=e?t.length:-1,a=n?r.length:-1,u=e?0:t.length-1,l=n?0:r.length-1;;){var c=t[u].compareTo(r[l]);if(0!==c)return c;var h=(u+=i)===s,f=(l+=o)===a;if(h&&!f)return-1;if(!h&&f)return 1;if(h&&f)return 0}};var Vx=function(){this._edges=new iI,this._ocaMap=new EI};Vx.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var r=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var n=r.getCoordinates(),i=0;i<n.length;i++)i>0&&t.print(","),t.print(n[i].x+" "+n[i].y);t.println(")")}t.print(") ")},Vx.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Vx.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},Vx.prototype.iterator=function(){return this._edges.iterator()},Vx.prototype.getEdges=function(){return this._edges},Vx.prototype.get=function(t){return this._edges.get(t)},Vx.prototype.findEqualEdge=function(t){var e=new jx(t.getCoordinates());return this._ocaMap.get(e)},Vx.prototype.add=function(t){this._edges.add(t);var e=new jx(t.getCoordinates());this._ocaMap.put(e,t)},Vx.prototype.interfaces_=function(){return[]},Vx.prototype.getClass=function(){return Vx};var zx=function(){};zx.prototype.processIntersections=function(t,e,r,n){},zx.prototype.isDone=function(){},zx.prototype.interfaces_=function(){return[]},zx.prototype.getClass=function(){return zx};var Yx=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t};Yx.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(Yx.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},Yx.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Yx.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Yx.prototype.getLineIntersector=function(){return this._li},Yx.prototype.hasProperIntersection=function(){return this._hasProper},Yx.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Yx.prototype.hasIntersection=function(){return this._hasIntersection},Yx.prototype.isDone=function(){return!1},Yx.prototype.hasInteriorIntersection=function(){return this._hasInterior},Yx.prototype.interfaces_=function(){return[zx]},Yx.prototype.getClass=function(){return Yx},Yx.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Hx=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],r=arguments[2];this.coord=new n_(t),this.segmentIndex=e,this.dist=r};Hx.prototype.getSegmentIndex=function(){return this.segmentIndex},Hx.prototype.getCoordinate=function(){return this.coord},Hx.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},Hx.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},Hx.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},Hx.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Hx.prototype.getDistance=function(){return this.dist},Hx.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},Hx.prototype.interfaces_=function(){return[$m]},Hx.prototype.getClass=function(){return Hx};var Xx=function(){this._nodeMap=new EI,this.edge=null;var t=arguments[0];this.edge=t};Xx.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Xx.prototype.iterator=function(){return this._nodeMap.values().iterator()},Xx.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},Xx.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Xx.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),s=0;o[s++]=new n_(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return i&&(o[s]=e.coord),new $x(o,new LE(this.edge._label))},Xx.prototype.add=function(t,e,r){var n=new Hx(t,e,r),i=this._nodeMap.get(n);return null!==i?i:(this._nodeMap.put(n,n),n)},Xx.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){if(e.next().coord.equals(t))return!0}return!1},Xx.prototype.interfaces_=function(){return[]},Xx.prototype.getClass=function(){return Xx};var Jx=function(){};Jx.prototype.getChainStartIndices=function(t){var e=0,r=new iI;r.add(new p_(e));do{var n=this.findChainEnd(t,e);r.add(new p_(n)),e=n}while(e<t.length-1);return Jx.toIntArray(r)},Jx.prototype.findChainEnd=function(t,e){for(var r=kE.quadrant(t[e],t[e+1]),n=e+1;n<t.length;){if(kE.quadrant(t[n-1],t[n])!==r)break;n++}return n-1},Jx.prototype.interfaces_=function(){return[]},Jx.prototype.getClass=function(){return Jx},Jx.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var Wx=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new w_,this.env2=new w_;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Jx;this.startIndex=e.getChainStartIndices(this.pts)};Wx.prototype.getCoordinates=function(){return this.pts},Wx.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e>r?e:r},Wx.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e<r?e:r},Wx.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[r],e.startIndex[r+1],n)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=arguments[4],l=arguments[5],c=this.pts[i],h=this.pts[o],f=s.pts[a],p=s.pts[u];if(o-i==1&&u-a==1)return l.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(c,h),this.env2.init(f,p),!this.env1.intersects(this.env2))return null;var g=Math.trunc((i+o)/2),A=Math.trunc((a+u)/2);i<g&&(a<A&&this.computeIntersectsForChain(i,g,s,a,A,l),A<u&&this.computeIntersectsForChain(i,g,s,A,u,l)),g<o&&(a<A&&this.computeIntersectsForChain(g,o,s,a,A,l),A<u&&this.computeIntersectsForChain(g,o,s,A,u,l))}},Wx.prototype.getStartIndexes=function(){return this.startIndex},Wx.prototype.computeIntersects=function(t,e){for(var r=0;r<this.startIndex.length-1;r++)for(var n=0;n<t.startIndex.length-1;n++)this.computeIntersectsForChain(r,t,n,e)},Wx.prototype.interfaces_=function(){return[]},Wx.prototype.getClass=function(){return Wx};var Kx=function t(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var e=0;e<2;e++)for(var r=0;r<3;r++)this._depth[e][r]=t.NULL_VALUE},Zx={NULL_VALUE:{configurable:!0}};Kx.prototype.getDepth=function(t,e){return this._depth[t][e]},Kx.prototype.setDepth=function(t,e,r){this._depth[t][e]=r},Kx.prototype.isNull=function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==Kx.NULL_VALUE)return!1;return!0}if(1===arguments.length){var r=arguments[0];return this._depth[r][1]===Kx.NULL_VALUE}if(2===arguments.length){var n=arguments[0],i=arguments[1];return this._depth[n][i]===Kx.NULL_VALUE}},Kx.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var r=t._depth[e][1];t._depth[e][2]<r&&(r=t._depth[e][2]),r<0&&(r=0);for(var n=1;n<3;n++){var i=0;t._depth[e][n]>r&&(i=1),t._depth[e][n]=i}}},Kx.prototype.getDelta=function(t){return this._depth[t][IE.RIGHT]-this._depth[t][IE.LEFT]},Kx.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?a_.EXTERIOR:a_.INTERIOR},Kx.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Kx.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],r=0;r<2;r++)for(var n=1;n<3;n++){var i=e.getLocation(r,n);i!==a_.EXTERIOR&&i!==a_.INTERIOR||(t.isNull(r,n)?t._depth[r][n]=Kx.depthAtLocation(i):t._depth[r][n]+=Kx.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],s=arguments[1];arguments[2]===a_.INTERIOR&&this._depth[o][s]++}},Kx.prototype.interfaces_=function(){return[]},Kx.prototype.getClass=function(){return Kx},Kx.depthAtLocation=function(t){return t===a_.EXTERIOR?0:t===a_.INTERIOR?1:Kx.NULL_VALUE},Zx.NULL_VALUE.get=function(){return-1},Object.defineProperties(Kx,Zx);var $x=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Xx(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Kx,this._depthDelta=0,1===arguments.length){var r=arguments[0];e.call(this,r,null)}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.pts=n,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new e(t,LE.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var r=t;if(this.pts.length!==r.pts.length)return!1;for(var n=!0,i=!0,o=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(r.pts[s])||(n=!1),this.pts[s].equals2D(r.pts[--o])||(i=!1),!n&&!i)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&(3===this.pts.length&&!!this.pts[0].equals(this.pts[2]))},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new Wx(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new w_;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,r,n){var i=new n_(t.getIntersection(n)),o=e,s=t.getEdgeDistance(r,n),a=o+1;if(a<this.pts.length){var u=this.pts[a];i.equals2D(u)&&(o=a,s=0)}this.eiList.add(i,o,s)},e.prototype.toString=function(){var t=new f_;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments[0],r=arguments[1];r.setAtLeastIfValid(e.getLocation(0,IE.ON),e.getLocation(1,IE.ON),1),e.isArea()&&(r.setAtLeastIfValid(e.getLocation(0,IE.LEFT),e.getLocation(1,IE.LEFT),2),r.setAtLeastIfValid(e.getLocation(0,IE.RIGHT),e.getLocation(1,IE.RIGHT),2))},e}(DE),tC=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Vx,this._bufParams=t||null};tC.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},tC.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new LE(t.getLabel())).flip(),r.merge(n);var i=tC.depthDelta(n),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(tC.depthDelta(t.getLabel()))},tC.prototype.buildSubgraphs=function(t,e){for(var r=new iI,n=t.iterator();n.hasNext();){var i=n.next(),o=i.getRightmostCoordinate(),s=new Tx(r).getDepth(o);i.computeDepth(s),i.findResultEdges(),r.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},tC.prototype.createSubgraphs=function(t){for(var e=new iI,r=t.getNodes().iterator();r.hasNext();){var n=r.next();if(!n.isVisited()){var i=new SE;i.create(n),e.add(i)}}return KE.sort(e,KE.reverseOrder()),e},tC.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},tC.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new mx,r=new k_;return r.setPrecisionModel(t),e.setSegmentIntersector(new Yx(r)),e},tC.prototype.buffer=function(t,e){var r=this._workingPrecisionModel;null===r&&(r=t.getPrecisionModel()),this._geomFact=t.getFactory();var n=new Nx(r,this._bufParams),i=new Px(t,e,n).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,r),this._graph=new qE(new qx),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new jE(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},tC.prototype.computeNodedEdges=function(t,e){var r=this.getNoder(e);r.computeNodes(t);for(var n=r.getNodedSubstrings().iterator();n.hasNext();){var i=n.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=i.getData(),a=new $x(i.getCoordinates(),new LE(s));this.insertUniqueEdge(a)}}},tC.prototype.setNoder=function(t){this._workingNoder=t},tC.prototype.interfaces_=function(){return[]},tC.prototype.getClass=function(){return tC},tC.depthDelta=function(t){var e=t.getLocation(0,IE.LEFT),r=t.getLocation(0,IE.RIGHT);return e===a_.INTERIOR&&r===a_.EXTERIOR?1:e===a_.EXTERIOR&&r===a_.INTERIOR?-1:0},tC.convertSegStrings=function(t){for(var e=new pE,r=new iI;t.hasNext();){var n=t.next(),i=e.createLineString(n.getCoordinates());r.add(i)}return e.buildGeometry(r)};var eC=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=arguments[3];this._noder=r,this._scaleFactor=n,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};eC.prototype.rescale=function(){var t=this;if(l_(arguments[0],$_))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.rescale(r.getCoordinates())}else if(arguments[0]instanceof Array){for(var n=arguments[0],i=0;i<n.length;i++)n[i].x=n[i].x/t._scaleFactor+t._offsetX,n[i].y=n[i].y/t._scaleFactor+t._offsetY;2===n.length&&n[0].equals2D(n[1])&&x_.out.println(n)}},eC.prototype.scale=function(){var t=this;if(l_(arguments[0],$_)){for(var e=arguments[0],r=new iI,n=e.iterator();n.hasNext();){var i=n.next();r.add(new hx(t.scale(i.getCoordinates()),i.getData()))}return r}if(arguments[0]instanceof Array){for(var o=arguments[0],s=new Array(o.length).fill(null),a=0;a<o.length;a++)s[a]=new n_(Math.round((o[a].x-t._offsetX)*t._scaleFactor),Math.round((o[a].y-t._offsetY)*t._scaleFactor),o[a].z);return aI.removeRepeatedPoints(s)}},eC.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},eC.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},eC.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},eC.prototype.interfaces_=function(){return[yx]},eC.prototype.getClass=function(){return eC};var rC=function(){this._li=new k_,this._segStrings=null;var t=arguments[0];this._segStrings=t},nC={fact:{configurable:!0}};rC.prototype.checkEndPtVertexIntersections=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();){var r=e.next().getCoordinates();t.checkEndPtVertexIntersections(r[0],t._segStrings),t.checkEndPtVertexIntersections(r[r.length-1],t._segStrings)}else if(2===arguments.length)for(var n=arguments[0],i=arguments[1].iterator();i.hasNext();)for(var o=i.next().getCoordinates(),s=1;s<o.length-1;s++)if(o[s].equals(n))throw new T_("found endpt/interior pt intersection at index "+s+" :pt "+n)},rC.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),r=this._segStrings.iterator();r.hasNext();){var n=r.next();this.checkInteriorIntersections(e,n)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=i.getCoordinates(),a=o.getCoordinates(),u=0;u<s.length-1;u++)for(var l=0;l<a.length-1;l++)this.checkInteriorIntersections(i,u,o,l);else if(4===arguments.length){var c=arguments[0],h=arguments[1],f=arguments[2],p=arguments[3];if(c===f&&h===p)return null;var g=c.getCoordinates()[h],A=c.getCoordinates()[h+1],d=f.getCoordinates()[p],y=f.getCoordinates()[p+1];if(this._li.computeIntersection(g,A,d,y),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,g,A)||this.hasInteriorIntersection(this._li,d,y)))throw new T_("found non-noded intersection at "+g+"-"+A+" and "+d+"-"+y)}},rC.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},rC.prototype.checkCollapses=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1===arguments.length)for(var r=arguments[0].getCoordinates(),n=0;n<r.length-2;n++)this.checkCollapse(r[n],r[n+1],r[n+2])},rC.prototype.hasInteriorIntersection=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++){var i=t.getIntersection(n);if(!i.equals(e)&&!i.equals(r))return!0}return!1},rC.prototype.checkCollapse=function(t,e,r){if(t.equals(r))throw new T_("found non-noded collapse at "+rC.fact.createLineString([t,e,r]))},rC.prototype.interfaces_=function(){return[]},rC.prototype.getClass=function(){return rC},nC.fact.get=function(){return new pE},Object.defineProperties(rC,nC);var iC=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],r=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=r,e<=0)throw new Wm("Scale factor must be non-zero");1!==e&&(this._pt=new n_(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new n_,this._p1Scaled=new n_),this.initCorners(this._pt)},oC={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};iC.prototype.intersectsScaled=function(t,e){var r=Math.min(t.x,e.x),n=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<r||this._minx>n||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return D_.isTrue(!(s&&a),"Found bad envelope test"),a},iC.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new n_(this._maxx,this._maxy),this._corner[1]=new n_(this._minx,this._maxy),this._corner[2]=new n_(this._minx,this._miny),this._corner[3]=new n_(this._maxx,this._miny)},iC.prototype.intersects=function(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},iC.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},iC.prototype.getCoordinate=function(){return this._originalPt},iC.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},iC.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=iC.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new w_(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},iC.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},iC.prototype.intersectsToleranceSquare=function(t,e){var r=!1,n=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||(!(!r||!n)||(!!t.equals(this._pt)||!!e.equals(this._pt))))))},iC.prototype.addSnappedNode=function(t,e){var r=t.getCoordinate(e),n=t.getCoordinate(e+1);return!!this.intersects(r,n)&&(t.addIntersection(this.getCoordinate(),e),!0)},iC.prototype.interfaces_=function(){return[]},iC.prototype.getClass=function(){return iC},oC.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(iC,oC);var sC=function(){this.tempEnv1=new w_,this.selectedSegment=new fx};sC.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[1];arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}},sC.prototype.interfaces_=function(){return[]},sC.prototype.getClass=function(){return sC};var aC=function(){this._index=null;var t=arguments[0];this._index=t},uC={HotPixelSnapAction:{configurable:!0}};aC.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=e.getSafeEnvelope(),o=new lC(e,r,n);return this._index.query(i,{interfaces_:function(){return[HE]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},aC.prototype.interfaces_=function(){return[]},aC.prototype.getClass=function(){return aC},uC.HotPixelSnapAction.get=function(){return lC},Object.defineProperties(aC,uC);var lC=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._hotPixel=e,this._parentEdge=r,this._hotPixelVertexIndex=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments[1],r=arguments[0].getContext();if(null!==this._parentEdge&&r===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(sC),cC=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new iI};cC.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];if(this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u<this._li.getIntersectionNum();u++)this._interiorIntersections.add(this._li.getIntersection(u));t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1)}},cC.prototype.isDone=function(){return!1},cC.prototype.getInteriorIntersections=function(){return this._interiorIntersections},cC.prototype.interfaces_=function(){return[zx]},cC.prototype.getClass=function(){return cC};var hC=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new k_,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};hC.prototype.checkCorrectness=function(t){var e=hx.getNodedSubstrings(t),r=new rC(e);try{r.checkValid()}catch(t){if(!(t instanceof I_))throw t;t.printStackTrace()}},hC.prototype.getNodedSubstrings=function(){return hx.getNodedSubstrings(this._nodedSegStrings)},hC.prototype.snapRound=function(t,e){var r=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(r),this.computeVertexSnaps(t)},hC.prototype.findInteriorIntersections=function(t,e){var r=new cC(e);return this._noder.setSegmentIntersector(r),this._noder.computeNodes(t),r.getInteriorIntersections()},hC.prototype.computeVertexSnaps=function(){var t=this;if(l_(arguments[0],$_))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.computeVertexSnaps(r)}else if(arguments[0]instanceof hx)for(var n=arguments[0],i=n.getCoordinates(),o=0;o<i.length;o++){var s=new iC(i[o],t._scaleFactor,t._li);t._pointSnapper.snap(s,n,o)&&n.addIntersection(i[o],o)}},hC.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new mx,this._pointSnapper=new aC(this._noder.getIndex()),this.snapRound(t,this._li)},hC.prototype.computeIntersectionSnaps=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next(),i=new iC(n,e._scaleFactor,e._li);e._pointSnapper.snap(i)}},hC.prototype.interfaces_=function(){return[yx]},hC.prototype.getClass=function(){return hC};var fC=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Ix,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._argGeom=e,this._bufParams=r}},pC={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};fC.prototype.bufferFixedPrecision=function(t){var e=new eC(new hC(new lE(1)),t.getScale()),r=new tC(this._bufParams);r.setWorkingPrecisionModel(t),r.setNoder(e),this._resultGeometry=r.buffer(this._argGeom,this._distance)},fC.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=fC.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof bE))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var r=arguments[0],n=fC.precisionScaleFactor(this._argGeom,this._distance,r),i=new lE(n);this.bufferFixedPrecision(i)}},fC.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===lE.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},fC.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},fC.prototype.bufferOriginalPrecision=function(){try{var t=new tC(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof T_))throw t;this._saveException=t}},fC.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},fC.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},fC.prototype.interfaces_=function(){return[]},fC.prototype.getClass=function(){return fC},fC.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new fC(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof j_&&"number"==typeof arguments[1]){var e=arguments[1],r=arguments[2],n=new fC(arguments[0]);return n.setQuadrantSegments(r),n.getResultGeometry(e)}if(arguments[2]instanceof Ix&&arguments[0]instanceof j_&&"number"==typeof arguments[1]){var i=arguments[1];return new fC(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],s=arguments[2],a=arguments[3],u=new fC(arguments[0]);return u.setQuadrantSegments(s),u.setEndCapStyle(a),u.getResultGeometry(o)}},fC.precisionScaleFactor=function(t,e,r){var n=t.getEnvelopeInternal(),i=c_.max(Math.abs(n.getMaxX()),Math.abs(n.getMaxY()),Math.abs(n.getMinX()),Math.abs(n.getMinY()))+2*(e>0?e:0),o=r-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},pC.CAP_ROUND.get=function(){return Ix.CAP_ROUND},pC.CAP_BUTT.get=function(){return Ix.CAP_FLAT},pC.CAP_FLAT.get=function(){return Ix.CAP_FLAT},pC.CAP_SQUARE.get=function(){return Ix.CAP_SQUARE},pC.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(fC,pC);var gC=function(){this._pt=[new n_,new n_],this._distance=Km.NaN,this._isNull=!0};gC.prototype.getCoordinates=function(){return this._pt},gC.prototype.getCoordinate=function(t){return this._pt[t]},gC.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},gC.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},gC.prototype.getDistance=function(){return this._distance},gC.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},gC.prototype.interfaces_=function(){return[]},gC.prototype.getClass=function(){return gC};var AC=function(){};AC.prototype.interfaces_=function(){return[]},AC.prototype.getClass=function(){return AC},AC.computeDistance=function(){if(arguments[2]instanceof gC&&arguments[0]instanceof zI&&arguments[1]instanceof n_)for(var t=arguments[1],e=arguments[2],r=arguments[0].getCoordinates(),n=new fx,i=0;i<r.length-1;i++){n.setCoordinates(r[i],r[i+1]);var o=n.closestPoint(t);e.setMinimum(o,t)}else if(arguments[2]instanceof gC&&arguments[0]instanceof JI&&arguments[1]instanceof n_){var s=arguments[0],a=arguments[1],u=arguments[2];AC.computeDistance(s.getExteriorRing(),a,u);for(var l=0;l<s.getNumInteriorRing();l++)AC.computeDistance(s.getInteriorRingN(l),a,u)}else if(arguments[2]instanceof gC&&arguments[0]instanceof j_&&arguments[1]instanceof n_){var c=arguments[0],h=arguments[1],f=arguments[2];if(c instanceof zI)AC.computeDistance(c,h,f);else if(c instanceof JI)AC.computeDistance(c,h,f);else if(c instanceof TI)for(var p=c,g=0;g<p.getNumGeometries();g++){var A=p.getGeometryN(g);AC.computeDistance(A,h,f)}else f.setMinimum(c.getCoordinate(),h)}else if(arguments[2]instanceof gC&&arguments[0]instanceof fx&&arguments[1]instanceof n_){var d=arguments[1],y=arguments[2],v=arguments[0].closestPoint(d);y.setMinimum(v,d)}};var dC=function(t){this._maxPtDist=new gC,this._inputGeom=t||null},yC={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};dC.prototype.computeMaxMidpointDistance=function(t){var e=new mC(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},dC.prototype.computeMaxVertexDistance=function(t){var e=new vC(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},dC.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},dC.prototype.getDistancePoints=function(){return this._maxPtDist},dC.prototype.interfaces_=function(){return[]},dC.prototype.getClass=function(){return dC},yC.MaxPointDistanceFilter.get=function(){return vC},yC.MaxMidpointDistanceFilter.get=function(){return mC},Object.defineProperties(dC,yC);var vC=function(t){this._maxPtDist=new gC,this._minPtDist=new gC,this._geom=t||null};vC.prototype.filter=function(t){this._minPtDist.initialize(),AC.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},vC.prototype.getMaxPointDistance=function(){return this._maxPtDist},vC.prototype.interfaces_=function(){return[Y_]},vC.prototype.getClass=function(){return vC};var mC=function(t){this._maxPtDist=new gC,this._minPtDist=new gC,this._geom=t||null};mC.prototype.filter=function(t,e){if(0===e)return null;var r=t.getCoordinate(e-1),n=t.getCoordinate(e),i=new n_((r.x+n.x)/2,(r.y+n.y)/2);this._minPtDist.initialize(),AC.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},mC.prototype.isDone=function(){return!1},mC.prototype.isGeometryChanged=function(){return!1},mC.prototype.getMaxPointDistance=function(){return this._maxPtDist},mC.prototype.interfaces_=function(){return[NI]},mC.prototype.getClass=function(){return mC};var _C=function(t){this._comps=t||null};_C.prototype.filter=function(t){t instanceof JI&&this._comps.add(t)},_C.prototype.interfaces_=function(){return[LI]},_C.prototype.getClass=function(){return _C},_C.getPolygons=function(){if(1===arguments.length)return _C.getPolygons(arguments[0],new iI);if(2===arguments.length){var t=arguments[0],e=arguments[1];return t instanceof JI?e.add(t):t instanceof TI&&t.apply(new _C(e)),e}};var IC=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._lines=e,this._isForcedToLineString=r}};IC.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof KI){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof zI&&this._lines.add(t)},IC.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},IC.prototype.interfaces_=function(){return[q_]},IC.prototype.getClass=function(){return IC},IC.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(IC.getLines(t))}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().buildGeometry(IC.getLines(e,r))}},IC.getLines=function(){if(1===arguments.length)return IC.getLines(arguments[0],!1);if(2===arguments.length){if(l_(arguments[0],$_)&&l_(arguments[1],$_)){for(var t=arguments[1],e=arguments[0].iterator();e.hasNext();){var r=e.next();IC.getLines(r,t)}return t}if(arguments[0]instanceof j_&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1],o=new iI;return n.apply(new IC(o,i)),o}if(arguments[0]instanceof j_&&l_(arguments[1],$_)){var s=arguments[0],a=arguments[1];return s instanceof zI?a.add(s):s.apply(new IC(a)),a}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&l_(arguments[0],$_)&&l_(arguments[1],$_)){for(var u=arguments[1],l=arguments[2],c=arguments[0].iterator();c.hasNext();){var h=c.next();IC.getLines(h,u,l)}return u}if("boolean"==typeof arguments[2]&&arguments[0]instanceof j_&&l_(arguments[1],$_)){var f=arguments[1],p=arguments[2];return arguments[0].apply(new IC(f,p)),f}}};var EC=function(){if(this._boundaryRule=H_.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new Wm("Rule must be non-null");this._boundaryRule=t}};EC.prototype.locateInternal=function(){if(arguments[0]instanceof n_&&arguments[1]instanceof JI){var t=arguments[0],e=arguments[1];if(e.isEmpty())return a_.EXTERIOR;var r=e.getExteriorRing(),n=this.locateInPolygonRing(t,r);if(n===a_.EXTERIOR)return a_.EXTERIOR;if(n===a_.BOUNDARY)return a_.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===a_.INTERIOR)return a_.EXTERIOR;if(s===a_.BOUNDARY)return a_.BOUNDARY}return a_.INTERIOR}if(arguments[0]instanceof n_&&arguments[1]instanceof zI){var a=arguments[0],u=arguments[1];if(!u.getEnvelopeInternal().intersects(a))return a_.EXTERIOR;var l=u.getCoordinates();return u.isClosed()||!a.equals(l[0])&&!a.equals(l[l.length-1])?G_.isOnLine(a,l)?a_.INTERIOR:a_.EXTERIOR:a_.BOUNDARY}if(arguments[0]instanceof n_&&arguments[1]instanceof HI){var c=arguments[0];return arguments[1].getCoordinate().equals2D(c)?a_.INTERIOR:a_.EXTERIOR}},EC.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?G_.locatePointInRing(t,e.getCoordinates()):a_.EXTERIOR},EC.prototype.intersects=function(t,e){return this.locate(t,e)!==a_.EXTERIOR},EC.prototype.updateLocationInfo=function(t){t===a_.INTERIOR&&(this._isIn=!0),t===a_.BOUNDARY&&this._numBoundaries++},EC.prototype.computeLocation=function(t,e){var r=this;if(e instanceof HI&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof zI)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof JI)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof RI)for(var n=e,i=0;i<n.getNumGeometries();i++){var o=n.getGeometryN(i);r.updateLocationInfo(r.locateInternal(t,o))}else if(e instanceof ZI)for(var s=e,a=0;a<s.getNumGeometries();a++){var u=s.getGeometryN(a);r.updateLocationInfo(r.locateInternal(t,u))}else if(e instanceof TI)for(var l=new Ox(e);l.hasNext();){var c=l.next();c!==e&&r.computeLocation(t,c)}},EC.prototype.locate=function(t,e){return e.isEmpty()?a_.EXTERIOR:e instanceof zI||e instanceof JI?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?a_.BOUNDARY:this._numBoundaries>0||this._isIn?a_.INTERIOR:a_.EXTERIOR)},EC.prototype.interfaces_=function(){return[]},EC.prototype.getClass=function(){return EC};var xC=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length)t.call(this,arguments[0],t.INSIDE_AREA,arguments[1]);else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._component=e,this._segIndex=r,this._pt=n}},CC={INSIDE_AREA:{configurable:!0}};xC.prototype.isInsideArea=function(){return this._segIndex===xC.INSIDE_AREA},xC.prototype.getCoordinate=function(){return this._pt},xC.prototype.getGeometryComponent=function(){return this._component},xC.prototype.getSegmentIndex=function(){return this._segIndex},xC.prototype.interfaces_=function(){return[]},xC.prototype.getClass=function(){return xC},CC.INSIDE_AREA.get=function(){return-1},Object.defineProperties(xC,CC);var wC=function(t){this._pts=t||null};wC.prototype.filter=function(t){t instanceof HI&&this._pts.add(t)},wC.prototype.interfaces_=function(){return[LI]},wC.prototype.getClass=function(){return wC},wC.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof HI?KE.singletonList(t):wC.getPoints(t,new iI)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e instanceof HI?r.add(e):e instanceof TI&&e.apply(new wC(r)),r}};var bC=function(){this._locations=null;var t=arguments[0];this._locations=t};bC.prototype.filter=function(t){(t instanceof HI||t instanceof zI||t instanceof JI)&&this._locations.add(new xC(t,0,t.getCoordinate()))},bC.prototype.interfaces_=function(){return[LI]},bC.prototype.getClass=function(){return bC},bC.getLocations=function(t){var e=new iI;return t.apply(new bC(e)),e};var BC=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new EC,this._minDistanceLocation=null,this._minDistance=Km.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=n,this._terminateDistance=i}};BC.prototype.computeContainmentDistance=function(){var t=this;if(0===arguments.length){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1],i=1-r,o=_C.getPolygons(this._geom[r]);if(o.size()>0){var s=bC.getLocations(this._geom[i]);if(this.computeContainmentDistance(s,o,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=n[0],this._minDistanceLocation[r]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&l_(arguments[0],rI)&&l_(arguments[1],rI)){for(var a=arguments[0],u=arguments[1],l=arguments[2],c=0;c<a.size();c++)for(var h=a.get(c),f=0;f<u.size();f++)if(t.computeContainmentDistance(h,u.get(f),l),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof xC&&arguments[1]instanceof JI){var p=arguments[0],g=arguments[1],A=arguments[2],d=p.getCoordinate();if(a_.EXTERIOR!==this._ptLocator.locate(d,g))return this._minDistance=0,A[0]=p,A[1]=new xC(g,d),null}},BC.prototype.computeMinDistanceLinesPoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},BC.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=IC.getLines(this._geom[0]),r=IC.getLines(this._geom[1]),n=wC.getPoints(this._geom[0]),i=wC.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,r,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(r,n,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(n,i,t),void this.updateMinDistance(t,!1))))},BC.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},BC.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},BC.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},BC.prototype.computeMinDistance=function(){var t=this;if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof zI&&arguments[1]instanceof HI){var e=arguments[0],r=arguments[1],n=arguments[2];if(e.getEnvelopeInternal().distance(r.getEnvelopeInternal())>this._minDistance)return null;for(var i=e.getCoordinates(),o=r.getCoordinate(),s=0;s<i.length-1;s++){var a=G_.distancePointLine(o,i[s],i[s+1]);if(a<t._minDistance){t._minDistance=a;var u=new fx(i[s],i[s+1]).closestPoint(o);n[0]=new xC(e,s,u),n[1]=new xC(r,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof zI&&arguments[1]instanceof zI){var l=arguments[0],c=arguments[1],h=arguments[2];if(l.getEnvelopeInternal().distance(c.getEnvelopeInternal())>this._minDistance)return null;for(var f=l.getCoordinates(),p=c.getCoordinates(),g=0;g<f.length-1;g++)for(var A=0;A<p.length-1;A++){var d=G_.distanceLineLine(f[g],f[g+1],p[A],p[A+1]);if(d<t._minDistance){t._minDistance=d;var y=new fx(f[g],f[g+1]),v=new fx(p[A],p[A+1]),m=y.closestPoints(v);h[0]=new xC(l,g,m[0]),h[1]=new xC(c,A,m[1])}if(t._minDistance<=t._terminateDistance)return null}}},BC.prototype.computeMinDistancePoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s),u=o.getCoordinate().distance(a.getCoordinate());if(u<n._minDistance&&(n._minDistance=u,r[0]=new xC(o,0,o.getCoordinate()),r[1]=new xC(a,0,a.getCoordinate())),n._minDistance<=n._terminateDistance)return null}},BC.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new Wm("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},BC.prototype.computeMinDistanceLines=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(n.computeMinDistance(o,a,r),n._minDistance<=n._terminateDistance)return null}},BC.prototype.interfaces_=function(){return[]},BC.prototype.getClass=function(){return BC},BC.distance=function(t,e){return new BC(t,e).distance()},BC.isWithinDistance=function(t,e,r){return new BC(t,e,r).distance()<=r},BC.nearestPoints=function(t,e){return new BC(t,e).nearestPoints()};var SC=function(){this._pt=[new n_,new n_],this._distance=Km.NaN,this._isNull=!0};SC.prototype.getCoordinates=function(){return this._pt},SC.prototype.getCoordinate=function(t){return this._pt[t]},SC.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},SC.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},SC.prototype.toString=function(){return N_.toLineString(this._pt[0],this._pt[1])},SC.prototype.getDistance=function(){return this._distance},SC.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},SC.prototype.interfaces_=function(){return[]},SC.prototype.getClass=function(){return SC};var MC=function(){};MC.prototype.interfaces_=function(){return[]},MC.prototype.getClass=function(){return MC},MC.computeDistance=function(){if(arguments[2]instanceof SC&&arguments[0]instanceof zI&&arguments[1]instanceof n_)for(var t=arguments[0],e=arguments[1],r=arguments[2],n=new fx,i=t.getCoordinates(),o=0;o<i.length-1;o++){n.setCoordinates(i[o],i[o+1]);var s=n.closestPoint(e);r.setMinimum(s,e)}else if(arguments[2]instanceof SC&&arguments[0]instanceof JI&&arguments[1]instanceof n_){var a=arguments[0],u=arguments[1],l=arguments[2];MC.computeDistance(a.getExteriorRing(),u,l);for(var c=0;c<a.getNumInteriorRing();c++)MC.computeDistance(a.getInteriorRingN(c),u,l)}else if(arguments[2]instanceof SC&&arguments[0]instanceof j_&&arguments[1]instanceof n_){var h=arguments[0],f=arguments[1],p=arguments[2];if(h instanceof zI)MC.computeDistance(h,f,p);else if(h instanceof JI)MC.computeDistance(h,f,p);else if(h instanceof TI)for(var g=h,A=0;A<g.getNumGeometries();A++){var d=g.getGeometryN(A);MC.computeDistance(d,f,p)}else p.setMinimum(h.getCoordinate(),f)}else if(arguments[2]instanceof SC&&arguments[0]instanceof fx&&arguments[1]instanceof n_){var y=arguments[1],v=arguments[2],m=arguments[0].closestPoint(y);v.setMinimum(m,y)}};var LC=function(){this._g0=null,this._g1=null,this._ptDist=new SC,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},NC={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};LC.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},LC.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new Wm("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},LC.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},LC.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},LC.prototype.computeOrientedDistance=function(t,e,r){var n=new TC(e);if(t.apply(n),r.setMaximum(n.getMaxPointDistance()),this._densifyFrac>0){var i=new RC(e,this._densifyFrac);t.apply(i),r.setMaximum(i.getMaxPointDistance())}},LC.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},LC.prototype.interfaces_=function(){return[]},LC.prototype.getClass=function(){return LC},LC.distance=function(){if(2===arguments.length)return new LC(arguments[0],arguments[1]).distance();if(3===arguments.length){var t=arguments[2],e=new LC(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},NC.MaxPointDistanceFilter.get=function(){return TC},NC.MaxDensifiedByFractionDistanceFilter.get=function(){return RC},Object.defineProperties(LC,NC);var TC=function(){this._maxPtDist=new SC,this._minPtDist=new SC,this._euclideanDist=new MC,this._geom=null;var t=arguments[0];this._geom=t};TC.prototype.filter=function(t){this._minPtDist.initialize(),MC.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},TC.prototype.getMaxPointDistance=function(){return this._maxPtDist},TC.prototype.interfaces_=function(){return[Y_]},TC.prototype.getClass=function(){return TC};var RC=function(){this._maxPtDist=new SC,this._minPtDist=new SC,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};RC.prototype.filter=function(t,e){var r=this;if(0===e)return null;for(var n=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-n.x)/this._numSubSegs,s=(i.y-n.y)/this._numSubSegs,a=0;a<this._numSubSegs;a++){var u=n.x+a*o,l=n.y+a*s,c=new n_(u,l);r._minPtDist.initialize(),MC.computeDistance(r._geom,c,r._minPtDist),r._maxPtDist.setMaximum(r._minPtDist)}},RC.prototype.isDone=function(){return!1},RC.prototype.isGeometryChanged=function(){return!1},RC.prototype.getMaxPointDistance=function(){return this._maxPtDist},RC.prototype.interfaces_=function(){return[NI]},RC.prototype.getClass=function(){return RC};var DC=function(t,e,r){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=r||null},QC={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};DC.prototype.checkMaximumDistance=function(t,e,r){var n=new LC(e,t);if(n.setDensifyFraction(.25),this._maxDistanceFound=n.orientedDistance(),this._maxDistanceFound>r){this._isValid=!1;var i=n.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+N_.toLineString(i[0],i[1])+")"}},DC.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=DC.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),DC.VERBOSE&&x_.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},DC.prototype.checkNegativeValid=function(){if(!(this._input instanceof JI||this._input instanceof ZI||this._input instanceof TI))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},DC.prototype.getErrorIndicator=function(){return this._errorIndicator},DC.prototype.checkMinimumDistance=function(t,e,r){var n=new BC(t,e,r);if(this._minDistanceFound=n.distance(),this._minDistanceFound<r){this._isValid=!1;var i=n.nearestPoints();this._errorLocation=n.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+N_.toLineString(i[0],i[1])+" )"}},DC.prototype.checkPositiveValid=function(){var t=this._result.getBoundary();if(this.checkMinimumDistance(this._input,t,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,t,this._maxValidDistance)},DC.prototype.getErrorLocation=function(){return this._errorLocation},DC.prototype.getPolygonLines=function(t){for(var e=new iI,r=new IC(e),n=_C.getPolygons(t).iterator();n.hasNext();){n.next().apply(r)}return t.getFactory().buildGeometry(e)},DC.prototype.getErrorMessage=function(){return this._errMsg},DC.prototype.interfaces_=function(){return[]},DC.prototype.getClass=function(){return DC},QC.VERBOSE.get=function(){return!1},QC.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(DC,QC);var PC=function(t,e,r){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=r||null},kC={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};PC.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},PC.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*PC.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new w_(this._input.getEnvelopeInternal());e.expandBy(this._distance);var r=new w_(this._result.getEnvelopeInternal());r.expandBy(t),r.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(r)),this.report("Envelope")},PC.prototype.checkDistance=function(){var t=new DC(this._input,this._distance,this._result);t.isValid()||(this._isValid=!1,this._errorMsg=t.getErrorMessage(),this._errorLocation=t.getErrorLocation(),this._errorIndicator=t.getErrorIndicator()),this.report("Distance")},PC.prototype.checkArea=function(){var t=this._input.getArea(),e=this._result.getArea();this._distance>0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t<e&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},PC.prototype.checkPolygonal=function(){this._result instanceof JI||this._result instanceof ZI||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},PC.prototype.getErrorIndicator=function(){return this._errorIndicator},PC.prototype.getErrorLocation=function(){return this._errorLocation},PC.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},PC.prototype.report=function(t){if(!PC.VERBOSE)return null;x_.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},PC.prototype.getErrorMessage=function(){return this._errorMsg},PC.prototype.interfaces_=function(){return[]},PC.prototype.getClass=function(){return PC},PC.isValidMsg=function(t,e,r){var n=new PC(t,e,r);return n.isValid()?null:n.getErrorMessage()},PC.isValid=function(t,e,r){return!!new PC(t,e,r).isValid()},kC.VERBOSE.get=function(){return!1},kC.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(PC,kC);var OC=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};OC.prototype.getCoordinates=function(){return this._pts},OC.prototype.size=function(){return this._pts.length},OC.prototype.getCoordinate=function(t){return this._pts[t]},OC.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},OC.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:ux.octant(this.getCoordinate(t),this.getCoordinate(t+1))},OC.prototype.setData=function(t){this._data=t},OC.prototype.getData=function(){return this._data},OC.prototype.toString=function(){return N_.toLineString(new iE(this._pts))},OC.prototype.interfaces_=function(){return[lx]},OC.prototype.getClass=function(){return OC};var FC=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new iI,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};FC.prototype.getInteriorIntersection=function(){return this._interiorIntersection},FC.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},FC.prototype.getIntersectionSegments=function(){return this._intSegments},FC.prototype.count=function(){return this._intersectionCount},FC.prototype.getIntersections=function(){return this._intersections},FC.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},FC.prototype.setKeepIntersections=function(t){this._keepIntersections=t},FC.prototype.processIntersections=function(t,e,r,n){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===r&&e===n)return null;if(this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,e)||this.isEndSegment(r,n)))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},FC.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},FC.prototype.hasIntersection=function(){return null!==this._interiorIntersection},FC.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},FC.prototype.interfaces_=function(){return[zx]},FC.prototype.getClass=function(){return FC},FC.createAllIntersectionsFinder=function(t){var e=new FC(t);return e.setFindAllIntersections(!0),e},FC.createAnyIntersectionFinder=function(t){return new FC(t)},FC.createIntersectionCounter=function(t){var e=new FC(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var GC=function(){this._li=new k_,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};GC.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},GC.prototype.getIntersections=function(){return this._segInt.getIntersections()},GC.prototype.isValid=function(){return this.execute(),this._isValid},GC.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},GC.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new FC(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new mx;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},GC.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new bE(this.getErrorMessage(),this._segInt.getInteriorIntersection())},GC.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+N_.toLineString(t[0],t[1])+" and "+N_.toLineString(t[2],t[3])},GC.prototype.interfaces_=function(){return[]},GC.prototype.getClass=function(){return GC},GC.computeIntersections=function(t){var e=new GC(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var UC=function t(){this._nv=null;var e=arguments[0];this._nv=new GC(t.toSegmentStrings(e))};UC.prototype.checkValid=function(){this._nv.checkValid()},UC.prototype.interfaces_=function(){return[]},UC.prototype.getClass=function(){return UC},UC.toSegmentStrings=function(t){for(var e=new iI,r=t.iterator();r.hasNext();){var n=r.next();e.add(new OC(n.getCoordinates(),n))}return e},UC.checkValid=function(t){new UC(t).checkValid()};var qC=function(t){this._mapOp=t};qC.prototype.map=function(t){for(var e=new iI,r=0;r<t.getNumGeometries();r++){var n=this._mapOp.map(t.getGeometryN(r));n.isEmpty()||e.add(n)}return t.getFactory().createGeometryCollection(pE.toGeometryArray(e))},qC.prototype.interfaces_=function(){return[]},qC.prototype.getClass=function(){return qC},qC.map=function(t,e){return new qC(e).map(t)};var jC=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new iI,this._resultLineList=new iI;var t=arguments[0],e=arguments[1],r=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=r};jC.prototype.collectLines=function(t){for(var e=this,r=this._op.getGraph().getEdgeEnds().iterator();r.hasNext();){var n=r.next();e.collectLineEdge(n,t,e._lineEdgesList),e.collectBoundaryTouchEdge(n,t,e._lineEdgesList)}},jC.prototype.labelIsolatedLine=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,r)},jC.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},jC.prototype.collectLineEdge=function(t,e,r){var n=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!xw.isResultOfOp(n,e)||i.isCovered()||(r.add(i),t.setVisitedEdge(!0)))},jC.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();){t.next().getEdges().findCoveredLineEdges()}for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var r=e.next(),n=r.getEdge();if(r.isLineEdge()&&!n.isCoveredSet()){var i=this._op.isCoveredByA(r.getCoordinate());n.setCovered(i)}}},jC.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next(),n=r.getLabel();r.isIsolated()&&(n.isNull(0)?this.labelIsolatedLine(r,0):this.labelIsolatedLine(r,1))}},jC.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var r=e.next(),n=this._geometryFactory.createLineString(r.getCoordinates());this._resultLineList.add(n),r.setInResult(!0)}},jC.prototype.collectBoundaryTouchEdge=function(t,e,r){var n=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(D_.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(xw.isResultOfOp(n,e)&&e===xw.INTERSECTION&&(r.add(t.getEdge()),t.setVisitedEdge(!0))))},jC.prototype.interfaces_=function(){return[]},jC.prototype.getClass=function(){return jC};var VC=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new iI;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};VC.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var r=this._geometryFactory.createPoint(e);this._resultPointList.add(r)}},VC.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var r=e.next();if(!r.isInResult()&&(!r.isIncidentEdgeInResult()&&(0===r.getEdges().getDegree()||t===xw.INTERSECTION))){var n=r.getLabel();xw.isResultOfOp(n,t)&&this.filterCoveredNodeToPoint(r)}}},VC.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},VC.prototype.interfaces_=function(){return[]},VC.prototype.getClass=function(){return VC};var zC=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};zC.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},zC.prototype.transformPolygon=function(t,e){var r=!0,n=this.transformLinearRing(t.getExteriorRing(),t);null!==n&&n instanceof KI&&!n.isEmpty()||(r=!1);for(var i=new iI,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof KI||(r=!1),i.add(s))}if(r)return this._factory.createPolygon(n,i.toArray([]));var a=new iI;return null!==n&&a.add(n),a.addAll(i),this._factory.buildGeometry(a)},zC.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},zC.prototype.getInputGeometry=function(){return this._inputGeom},zC.prototype.transformMultiLineString=function(t,e){for(var r=new iI,n=0;n<t.getNumGeometries();n++){var i=this.transformLineString(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},zC.prototype.transformCoordinates=function(t,e){return this.copy(t)},zC.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},zC.prototype.transformMultiPoint=function(t,e){for(var r=new iI,n=0;n<t.getNumGeometries();n++){var i=this.transformPoint(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},zC.prototype.transformMultiPolygon=function(t,e){for(var r=new iI,n=0;n<t.getNumGeometries();n++){var i=this.transformPolygon(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},zC.prototype.copy=function(t){return t.copy()},zC.prototype.transformGeometryCollection=function(t,e){for(var r=new iI,n=0;n<t.getNumGeometries();n++){var i=this.transform(t.getGeometryN(n));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||r.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(pE.toGeometryArray(r)):this._factory.buildGeometry(r)},zC.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof HI)return this.transformPoint(t,null);if(t instanceof WI)return this.transformMultiPoint(t,null);if(t instanceof KI)return this.transformLinearRing(t,null);if(t instanceof zI)return this.transformLineString(t,null);if(t instanceof RI)return this.transformMultiLineString(t,null);if(t instanceof JI)return this.transformPolygon(t,null);if(t instanceof ZI)return this.transformMultiPolygon(t,null);if(t instanceof TI)return this.transformGeometryCollection(t,null);throw new Wm("Unknown Geometry subtype: "+t.getClass().getName())},zC.prototype.transformLinearRing=function(t,e){var r=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===r)return this._factory.createLinearRing(null);var n=r.size();return n>0&&n<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)},zC.prototype.interfaces_=function(){return[]},zC.prototype.getClass=function(){return zC};var YC=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new fx,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof zI&&"number"==typeof arguments[1]){var e=arguments[1];t.call(this,arguments[0].getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=n}};YC.prototype.snapVertices=function(t,e){for(var r=this._isClosed?t.size()-1:t.size(),n=0;n<r;n++){var i=t.get(n),o=this.findSnapForVertex(i,e);null!==o&&(t.set(n,new n_(o)),0===n&&this._isClosed&&t.set(t.size()-1,new n_(o)))}},YC.prototype.findSnapForVertex=function(t,e){for(var r=0;r<e.length;r++){if(t.equals2D(e[r]))return null;if(t.distance(e[r])<this._snapTolerance)return e[r]}return null},YC.prototype.snapTo=function(t){var e=new sI(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},YC.prototype.snapSegments=function(t,e){if(0===e.length)return null;var r=e.length;e[0].equals2D(e[e.length-1])&&(r=e.length-1);for(var n=0;n<r;n++){var i=e[n],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new n_(i),!1)}},YC.prototype.findSegmentIndexToSnap=function(t,e){for(var r=this,n=Km.MAX_VALUE,i=-1,o=0;o<e.size()-1;o++){if(r._seg.p0=e.get(o),r._seg.p1=e.get(o+1),r._seg.p0.equals2D(t)||r._seg.p1.equals2D(t)){if(r._allowSnappingToSourceVertices)continue;return-1}var s=r._seg.distance(t);s<r._snapTolerance&&s<n&&(n=s,i=o)}return i},YC.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},YC.prototype.interfaces_=function(){return[]},YC.prototype.getClass=function(){return YC},YC.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var HC=function(t){this._srcGeom=t||null},XC={SNAP_PRECISION_FACTOR:{configurable:!0}};HC.prototype.snapTo=function(t,e){var r=this.extractTargetCoordinates(t);return new JC(e,r).transform(this._srcGeom)},HC.prototype.snapToSelf=function(t,e){var r=this.extractTargetCoordinates(this._srcGeom),n=new JC(t,r,!0).transform(this._srcGeom),i=n;return e&&l_(i,XI)&&(i=n.buffer(0)),i},HC.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},HC.prototype.extractTargetCoordinates=function(t){for(var e=new wI,r=t.getCoordinates(),n=0;n<r.length;n++)e.add(r[n]);return e.toArray(new Array(0).fill(null))},HC.prototype.computeMinimumSegmentLength=function(t){for(var e=Km.MAX_VALUE,r=0;r<t.length-1;r++){var n=t[r].distance(t[r+1]);n<e&&(e=n)}return e},HC.prototype.interfaces_=function(){return[]},HC.prototype.getClass=function(){return HC},HC.snap=function(t,e,r){var n=new Array(2).fill(null),i=new HC(t);n[0]=i.snapTo(e,r);var o=new HC(e);return n[1]=o.snapTo(n[0],r),n},HC.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=HC.computeSizeBasedSnapTolerance(t),r=t.getPrecisionModel();if(r.getType()===lE.FIXED){var n=1/r.getScale()*2/1.415;n>e&&(e=n)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(HC.computeOverlaySnapTolerance(i),HC.computeOverlaySnapTolerance(o))}},HC.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*HC.SNAP_PRECISION_FACTOR},HC.snapToSelf=function(t,e,r){return new HC(t).snapToSelf(e,r)},XC.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(HC,XC);var JC=function(t){function e(e,r,n){t.call(this),this._snapTolerance=e||null,this._snapPts=r||null,this._isSelfSnap=void 0!==n&&n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var r=new YC(t,this._snapTolerance);return r.setAllowSnappingToSourceVertices(this._isSelfSnap),r.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var r=t.toCoordinateArray(),n=this.snapLine(r,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(zC),WC=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};WC.prototype.getCommon=function(){return Km.longBitsToDouble(this._commonBits)},WC.prototype.add=function(t){var e=Km.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=WC.signExpBits(this._commonBits),this._isFirst=!1,null):WC.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=WC.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=WC.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},WC.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=Km.longBitsToDouble(t),r="0000000000000000000000000000000000000000000000000000000000000000"+Km.toBinaryString(t),n=r.substring(r.length-64);return n.substring(0,1)+" "+n.substring(1,12)+"(exp) "+n.substring(12)+" [ "+e+" ]"}},WC.prototype.interfaces_=function(){return[]},WC.prototype.getClass=function(){return WC},WC.getBit=function(t,e){return 0!=(t&1<<e)?1:0},WC.signExpBits=function(t){return t>>52},WC.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},WC.numCommonMostSigMantissaBits=function(t,e){for(var r=0,n=52;n>=0;n--){if(WC.getBit(t,n)!==WC.getBit(e,n))return r;r++}return 52};var KC=function(){this._commonCoord=null,this._ccFilter=new $C},ZC={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};KC.prototype.addCommonBits=function(t){var e=new tw(this._commonCoord);t.apply(e),t.geometryChanged()},KC.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new n_(this._commonCoord);e.x=-e.x,e.y=-e.y;var r=new tw(e);return t.apply(r),t.geometryChanged(),t},KC.prototype.getCommonCoordinate=function(){return this._commonCoord},KC.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},KC.prototype.interfaces_=function(){return[]},KC.prototype.getClass=function(){return KC},ZC.CommonCoordinateFilter.get=function(){return $C},ZC.Translater.get=function(){return tw},Object.defineProperties(KC,ZC);var $C=function(){this._commonBitsX=new WC,this._commonBitsY=new WC};$C.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},$C.prototype.getCommonCoordinate=function(){return new n_(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},$C.prototype.interfaces_=function(){return[Y_]},$C.prototype.getClass=function(){return $C};var tw=function(){this.trans=null;var t=arguments[0];this.trans=t};tw.prototype.filter=function(t,e){var r=t.getOrdinate(e,0)+this.trans.x,n=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,r),t.setOrdinate(e,1,n)},tw.prototype.isDone=function(){return!1},tw.prototype.isGeometryChanged=function(){return!0},tw.prototype.interfaces_=function(){return[NI]},tw.prototype.getClass=function(){return tw};var ew=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};ew.prototype.selfSnap=function(t){return new HC(t).snapTo(t,this._snapTolerance)},ew.prototype.removeCommonBits=function(t){this._cbr=new KC,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},ew.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},ew.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),r=xw.overlayOp(e[0],e[1],t);return this.prepareResult(r)},ew.prototype.checkValid=function(t){t.isValid()||x_.out.println("Snapped geometry is invalid")},ew.prototype.computeSnapTolerance=function(){this._snapTolerance=HC.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},ew.prototype.snap=function(t){var e=this.removeCommonBits(t);return HC.snap(e[0],e[1],this._snapTolerance)},ew.prototype.interfaces_=function(){return[]},ew.prototype.getClass=function(){return ew},ew.overlayOp=function(t,e,r){return new ew(t,e).getResultGeometry(r)},ew.union=function(t,e){return ew.overlayOp(t,e,xw.UNION)},ew.intersection=function(t,e){return ew.overlayOp(t,e,xw.INTERSECTION)},ew.symDifference=function(t,e){return ew.overlayOp(t,e,xw.SYMDIFFERENCE)},ew.difference=function(t,e){return ew.overlayOp(t,e,xw.DIFFERENCE)};var rw=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};rw.prototype.getResultGeometry=function(t){var e=null,r=!1,n=null;try{e=xw.overlayOp(this._geom[0],this._geom[1],t);r=!0}catch(t){if(!(t instanceof T_))throw t;n=t}if(!r)try{e=ew.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof T_?n:t}return e},rw.prototype.interfaces_=function(){return[]},rw.prototype.getClass=function(){return rw},rw.overlayOp=function(t,e,r){return new rw(t,e).getResultGeometry(r)},rw.union=function(t,e){return rw.overlayOp(t,e,xw.UNION)},rw.intersection=function(t,e){return rw.overlayOp(t,e,xw.INTERSECTION)},rw.symDifference=function(t,e){return rw.overlayOp(t,e,xw.SYMDIFFERENCE)},rw.difference=function(t,e){return rw.overlayOp(t,e,xw.DIFFERENCE)};var nw=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};nw.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},nw.prototype.interfaces_=function(){return[]},nw.prototype.getClass=function(){return nw};var iw=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],r=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=r}else if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=n,this._xValue=i,this._obj=o}},ow={INSERT:{configurable:!0},DELETE:{configurable:!0}};iw.prototype.isDelete=function(){return this._eventType===iw.DELETE},iw.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},iw.prototype.getObject=function(){return this._obj},iw.prototype.compareTo=function(t){var e=t;return this._xValue<e._xValue?-1:this._xValue>e._xValue?1:this._eventType<e._eventType?-1:this._eventType>e._eventType?1:0},iw.prototype.getInsertEvent=function(){return this._insertEvent},iw.prototype.isInsert=function(){return this._eventType===iw.INSERT},iw.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},iw.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},iw.prototype.interfaces_=function(){return[$m]},iw.prototype.getClass=function(){return iw},ow.INSERT.get=function(){return 1},ow.DELETE.get=function(){return 2},Object.defineProperties(iw,ow);var sw=function(){};sw.prototype.interfaces_=function(){return[]},sw.prototype.getClass=function(){return sw};var aw=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],r=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=r};aw.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(aw.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},aw.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},aw.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},aw.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},aw.prototype.isBoundaryPointInternal=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next().getCoordinate();if(t.isIntersection(n))return!0}return!1},aw.prototype.hasProperIntersection=function(){return this._hasProper},aw.prototype.hasIntersection=function(){return this._hasIntersection},aw.prototype.isDone=function(){return this._isDone},aw.prototype.isBoundaryPoint=function(t,e){return null!==e&&(!!this.isBoundaryPointInternal(t,e[0])||!!this.isBoundaryPointInternal(t,e[1]))},aw.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},aw.prototype.addIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=r.getCoordinates()[n],a=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},aw.prototype.interfaces_=function(){return[]},aw.prototype.getClass=function(){return aw},aw.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var uw=function(t){function e(){t.call(this),this.events=new iI,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){KE.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var r=this.events.get(e);if(r.isInsert()&&this.processOverlaps(e,r.getDeleteEventIndex(),r,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof aw&&l_(arguments[0],rI)&&l_(arguments[1],rI)){var n=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(n,n),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&l_(arguments[0],rI)&&arguments[1]instanceof aw){var s=arguments[0],a=arguments[1];arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)}},e.prototype.addEdge=function(t,e){for(var r=t.getMonotoneChainEdge(),n=r.getStartIndexes(),i=0;i<n.length-1;i++){var o=new nw(r,i),s=new iw(e,r.getMinX(i),o);this.events.add(s),this.events.add(new iw(r.getMaxX(i),s))}},e.prototype.processOverlaps=function(t,e,r,n){for(var i=r.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();r.isSameLabel(s)||(i.computeIntersections(a,n),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){var i=n.next();this.addEdge(i,r)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(sw),lw=function(){this._min=Km.POSITIVE_INFINITY,this._max=Km.NEGATIVE_INFINITY},cw={NodeComparator:{configurable:!0}};lw.prototype.getMin=function(){return this._min},lw.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},lw.prototype.getMax=function(){return this._max},lw.prototype.toString=function(){return N_.toLineString(new n_(this._min,0),new n_(this._max,0))},lw.prototype.interfaces_=function(){return[]},lw.prototype.getClass=function(){return lw},cw.NodeComparator.get=function(){return hw},Object.defineProperties(lw,cw);var hw=function(){};hw.prototype.compare=function(t,e){var r=t,n=e,i=(r._min+r._max)/2,o=(n._min+n._max)/2;return i<o?-1:i>o?1:0},hw.prototype.interfaces_=function(){return[e_]},hw.prototype.getClass=function(){return hw};var fw=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],r=arguments[1],n=arguments[2];this._min=e,this._max=r,this._item=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;r.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(lw),pw=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],r=arguments[1];this._node1=e,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,r),null!==this._node2&&this._node2.query(t,e,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(lw),gw=function(){this._leaves=new iI,this._root=null,this._level=0};gw.prototype.buildTree=function(){KE.sort(this._leaves,new lw.NodeComparator);for(var t=this._leaves,e=null,r=new iI;;){if(this.buildLevel(t,r),1===r.size())return r.get(0);e=t,t=r,r=e}},gw.prototype.insert=function(t,e,r){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new fw(t,e,r))},gw.prototype.query=function(t,e,r){this.init(),this._root.query(t,e,r)},gw.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},gw.prototype.printNode=function(t){x_.out.println(N_.toLineString(new n_(t._min,this._level),new n_(t._max,this._level)))},gw.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},gw.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var r=0;r<t.size();r+=2){var n=t.get(r);if(null===(r+1<t.size()?t.get(r):null))e.add(n);else{var i=new pw(t.get(r),t.get(r+1));e.add(i)}}},gw.prototype.interfaces_=function(){return[]},gw.prototype.getClass=function(){return gw};var Aw=function(){this._items=new iI};Aw.prototype.visitItem=function(t){this._items.add(t)},Aw.prototype.getItems=function(){return this._items},Aw.prototype.interfaces_=function(){return[HE]},Aw.prototype.getClass=function(){return Aw};var dw=function(){this._index=null;var t=arguments[0];if(!l_(t,XI))throw new Wm("Argument must be Polygonal");this._index=new mw(t)},yw={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};dw.prototype.locate=function(t){var e=new F_(t),r=new vw(e);return this._index.query(t.y,t.y,r),e.getLocation()},dw.prototype.interfaces_=function(){return[kx]},dw.prototype.getClass=function(){return dw},yw.SegmentVisitor.get=function(){return vw},yw.IntervalIndexedGeometry.get=function(){return mw},Object.defineProperties(dw,yw);var vw=function(){this._counter=null;var t=arguments[0];this._counter=t};vw.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},vw.prototype.interfaces_=function(){return[HE]},vw.prototype.getClass=function(){return vw};var mw=function(){this._index=new gw;var t=arguments[0];this.init(t)};mw.prototype.init=function(t){for(var e=IC.getLines(t).iterator();e.hasNext();){var r=e.next().getCoordinates();this.addLine(r)}},mw.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var r=new fx(t[e-1],t[e]),n=Math.min(r.p0.y,r.p1.y),i=Math.max(r.p0.y,r.p1.y);this._index.insert(n,i,r)}},mw.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new Aw;return this._index.query(t,e,r),r.getItems()}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._index.query(n,i,o)}},mw.prototype.interfaces_=function(){return[]},mw.prototype.getClass=function(){return mw};var _w=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new uE,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new EC,2===arguments.length){var e=arguments[0],r=arguments[1],n=H_.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=r,this._boundaryNodeRule=n,null!==r&&this.add(r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];this._argIndex=i,this._parentGeom=o,this._boundaryNodeRule=s,null!==o&&this.add(o)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertBoundaryPoint=function(t,r){var n=this._nodes.addNode(r).getLabel(),i=1;n.getLocation(t,IE.ON)===a_.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);n.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var r=arguments[1],n=arguments[2],i=new aw(arguments[0],!0,!1);i.setIsDoneIfProperInt(n);var o=this.createEdgeSetIntersector(),s=this._parentGeom instanceof KI||this._parentGeom instanceof JI||this._parentGeom instanceof ZI,a=r||!s;return o.computeIntersections(this._edges,i,a),this.addSelfIntersectionNodes(this._argIndex),i}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();){e.next().eiList.addSplitEdges(t)}},e.prototype.computeEdgeIntersections=function(t,e,r){var n=new aw(e,r,!0);return n.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,n),n},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof HI){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,a_.INTERIOR)}else if(arguments[0]instanceof n_){var e=arguments[0];this.insertPoint(this._argIndex,e,a_.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),a_.EXTERIOR,a_.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var r=t.getInteriorRingN(e);this.addPolygonRing(r,a_.INTERIOR,a_.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],a_.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],a_.BOUNDARY)},e.prototype.addLineString=function(t){var e=aI.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var r=new $x(e,new LE(this._argIndex,a_.INTERIOR));this._lineEdgeMap.put(t,r),this.insertEdge(r),D_.isTrue(e.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),r=0,n=t.iterator();n.hasNext();){var i=n.next();e[r++]=i.getCoordinate().copy()}return e},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,r){if(this.isBoundaryNode(t,e))return null;r===a_.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,r)},e.prototype.addPolygonRing=function(t,e,r){if(t.isEmpty())return null;var n=aI.removeRepeatedPoints(t.getCoordinates());if(n.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=n[0],null;var i=e,o=r;G_.isCCW(n)&&(i=r,o=e);var s=new $x(n,new LE(this._argIndex,a_.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,n[0],a_.BOUNDARY)},e.prototype.insertPoint=function(t,e,r){var n=this._nodes.addNode(e),i=n.getLabel();null===i?n._label=new LE(t,r):i.setLocation(t,r)},e.prototype.createEdgeSetIntersector=function(){return new uw},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var r=e.next(),n=r.getLabel().getLocation(t),i=r.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,n)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof ZI&&(this._useBoundaryDeterminationRule=!1),e instanceof JI)this.addPolygon(e);else if(e instanceof zI)this.addLineString(e);else if(e instanceof HI)this.addPoint(e);else if(e instanceof WI)this.addCollection(e);else if(e instanceof RI)this.addCollection(e);else if(e instanceof ZI)this.addCollection(e);else{if(!(e instanceof TI))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},e.prototype.locate=function(t){return l_(this._parentGeom,XI)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new dw(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments[0];return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?a_.BOUNDARY:a_.INTERIOR},e}(qE),Iw=function(){if(this._li=new k_,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new _w(0,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1],n=H_.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new _w(0,e,n),this._arg[1]=new _w(1,r,n)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new _w(0,i,s),this._arg[1]=new _w(1,o,s)}};Iw.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},Iw.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},Iw.prototype.interfaces_=function(){return[]},Iw.prototype.getClass=function(){return Iw};var Ew=function(){};Ew.prototype.interfaces_=function(){return[]},Ew.prototype.getClass=function(){return Ew},Ew.map=function(){if(arguments[0]instanceof j_&&l_(arguments[1],Ew.MapOp)){for(var t=arguments[0],e=arguments[1],r=new iI,n=0;n<t.getNumGeometries();n++){var i=e.map(t.getGeometryN(n));null!==i&&r.add(i)}return t.getFactory().buildGeometry(r)}if(l_(arguments[0],$_)&&l_(arguments[1],Ew.MapOp)){for(var o=arguments[0],s=arguments[1],a=new iI,u=o.iterator();u.hasNext();){var l=u.next(),c=s.map(l);null!==c&&a.add(c)}return a}},Ew.MapOp=function(){};var xw=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r),this._ptLocator=new EC,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Vx,this._resultPolyList=new iI,this._resultLineList=new iI,this._resultPointList=new iI,this._graph=new qE(new qx),this._geomFact=e.getFactory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new LE(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(r),i.add(n),r.merge(n)}else this._edgeList.add(t)},e.prototype.getGraph=function(){return this._graph},e.prototype.cancelDuplicateResultEdges=function(){for(var t=this._graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),r=e.getSym();e.isInResult()&&r.isInResult()&&(e.setInResult(!1),r.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,r,n,i){var o=new iI;return o.addAll(t),o.addAll(r),o.addAll(n),o.isEmpty()?e.createEmptyResult(i,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().mergeSymLabels()}},e.prototype.isCovered=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(this._ptLocator.locate(t,n)!==a_.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new iI,e=this._edgeList.iterator();e.hasNext();){var r=e.next();r.isCollapsed()&&(e.remove(),t.add(r.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getEdges().getLabel();e.getLabel().merge(r)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();this.insertUniqueEdge(r)}},e.prototype.computeOverlay=function(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var e=new iI;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),UC.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var r=new jE(this._geomFact);r.add(this._graph),this._resultPolyList=r.getPolygons();var n=new jC(this,this._geomFact,this._ptLocator);this._resultLineList=n.build(t);var i=new VC(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},e.prototype.labelIncompleteNode=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,r)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var r=e.next();this._graph.addNode(r.getCoordinate()).setLabel(t,r.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var r=this._graph.getEdgeEnds().iterator();r.hasNext();){var n=r.next(),i=n.getLabel();i.isArea()&&!n.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,IE.RIGHT),i.getLocation(1,IE.RIGHT),t)&&n.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),r=e.getLabel(),n=e.getDepth();if(!n.isNull()){n.normalize();for(var i=0;i<2;i++)r.isNull(i)||!r.isArea()||n.isNull(i)||(0===n.getDelta(i)?r.toLine(i):(D_.isTrue(!n.isNull(i,IE.LEFT),"depth of LEFT side has not been initialized"),r.setLocation(i,IE.LEFT,n.getLocation(i,IE.LEFT)),D_.isTrue(!n.isNull(i,IE.RIGHT),"depth of RIGHT side has not been initialized"),r.setLocation(i,IE.RIGHT,n.getLocation(i,IE.RIGHT))))}}},e.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().computeLabelling(this._arg)}this.mergeSymLabels(),this.updateNodeLabelling()},e.prototype.labelIncompleteNodes=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getLabel();e.isIsolated()&&(r.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(r)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Iw);xw.overlayOp=function(t,e,r){return new xw(t,e).getResultGeometry(r)},xw.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return xw.createEmptyResult(xw.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var r=e;return qC.map(t,{interfaces_:function(){return[Ew.MapOp]},map:function(t){return t.intersection(r)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),rw.overlayOp(t,e,xw.INTERSECTION)},xw.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return xw.createEmptyResult(xw.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),rw.overlayOp(t,e,xw.SYMDIFFERENCE)},xw.resultDimension=function(t,e,r){var n=e.getDimension(),i=r.getDimension(),o=-1;switch(t){case xw.INTERSECTION:o=Math.min(n,i);break;case xw.UNION:o=Math.max(n,i);break;case xw.DIFFERENCE:o=n;break;case xw.SYMDIFFERENCE:o=Math.max(n,i)}return o},xw.createEmptyResult=function(t,e,r,n){var i=null;switch(xw.resultDimension(t,e,r)){case-1:i=n.createGeometryCollection(new Array(0).fill(null));break;case 0:i=n.createPoint();break;case 1:i=n.createLineString();break;case 2:i=n.createPolygon()}return i},xw.difference=function(t,e){return t.isEmpty()?xw.createEmptyResult(xw.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),rw.overlayOp(t,e,xw.DIFFERENCE))},xw.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=t.getLocation(0),n=t.getLocation(1);return xw.isResultOfOp(r,n,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1];switch(i===a_.BOUNDARY&&(i=a_.INTERIOR),o===a_.BOUNDARY&&(o=a_.INTERIOR),arguments[2]){case xw.INTERSECTION:return i===a_.INTERIOR&&o===a_.INTERIOR;case xw.UNION:return i===a_.INTERIOR||o===a_.INTERIOR;case xw.DIFFERENCE:return i===a_.INTERIOR&&o!==a_.INTERIOR;case xw.SYMDIFFERENCE:return i===a_.INTERIOR&&o!==a_.INTERIOR||i!==a_.INTERIOR&&o===a_.INTERIOR}return!1}},xw.INTERSECTION=1,xw.UNION=2,xw.DIFFERENCE=3,xw.SYMDIFFERENCE=4;var Cw=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new EC,this._seg=new fx;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};Cw.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,r=0;r<this._linework.getNumGeometries();r++)for(var n=e._linework.getGeometryN(r).getCoordinateSequence(),i=0;i<n.size()-1;i++){if(n.getCoordinate(i,e._seg.p0),n.getCoordinate(i+1,e._seg.p1),e._seg.distance(t)<=e._boundaryDistanceTolerance)return!0}return!1},Cw.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?a_.BOUNDARY:this._ptLocator.locate(t,this._g)},Cw.prototype.extractLinework=function(t){var e=new ww;t.apply(e);var r=e.getLinework(),n=pE.toLineStringArray(r);return t.getFactory().createMultiLineString(n)},Cw.prototype.interfaces_=function(){return[]},Cw.prototype.getClass=function(){return Cw};var ww=function(){this._linework=null,this._linework=new iI};ww.prototype.getLinework=function(){return this._linework},ww.prototype.filter=function(t){if(t instanceof JI){var e=t;this._linework.add(e.getExteriorRing());for(var r=0;r<e.getNumInteriorRing();r++)this._linework.add(e.getInteriorRingN(r))}},ww.prototype.interfaces_=function(){return[LI]},ww.prototype.getClass=function(){return ww};var bw=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};bw.prototype.extractPoints=function(t,e,r){for(var n=t.getCoordinates(),i=0;i<n.length-1;i++)this.computeOffsetPoints(n[i],n[i+1],e,r)},bw.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},bw.prototype.getPoints=function(t){for(var e=new iI,r=IC.getLines(this._g).iterator();r.hasNext();){var n=r.next();this.extractPoints(n,t,e)}return e},bw.prototype.computeOffsetPoints=function(t,e,r,n){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),a=r*i/s,u=r*o/s,l=(e.x+t.x)/2,c=(e.y+t.y)/2;if(this._doLeft){var h=new n_(l-u,c+a);n.add(h)}if(this._doRight){var f=new n_(l+u,c-a);n.add(f)}},bw.prototype.interfaces_=function(){return[]},bw.prototype.getClass=function(){return bw};var Bw=function t(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=t.TOLERANCE,this._testCoords=new iI;var e=arguments[0],r=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,r),this._geom=[e,r,n],this._locFinder=[new Cw(this._geom[0],this._boundaryDistanceTolerance),new Cw(this._geom[1],this._boundaryDistanceTolerance),new Cw(this._geom[2],this._boundaryDistanceTolerance)]},Sw={TOLERANCE:{configurable:!0}};Bw.prototype.reportResult=function(t,e,r){x_.out.println("Overlay result invalid - A:"+a_.toLocationSymbol(e[0])+" B:"+a_.toLocationSymbol(e[1])+" expected:"+(r?"i":"e")+" actual:"+a_.toLocationSymbol(e[2]))},Bw.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var e=this.checkValid(t);return e},Bw.prototype.checkValid=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=0;r<this._testCoords.size();r++){var n=t._testCoords.get(r);if(!t.checkValid(e,n))return t._invalidLocation=n,!1}return!0}if(2===arguments.length){var i=arguments[0],o=arguments[1];return this._location[0]=this._locFinder[0].getLocation(o),this._location[1]=this._locFinder[1].getLocation(o),this._location[2]=this._locFinder[2].getLocation(o),!!Bw.hasLocation(this._location,a_.BOUNDARY)||this.isValidResult(i,this._location)}},Bw.prototype.addTestPts=function(t){var e=new bw(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},Bw.prototype.isValidResult=function(t,e){var r=xw.isResultOfOp(e[0],e[1],t),n=!(r^e[2]===a_.INTERIOR);return n||this.reportResult(t,e,r),n},Bw.prototype.getInvalidLocation=function(){return this._invalidLocation},Bw.prototype.interfaces_=function(){return[]},Bw.prototype.getClass=function(){return Bw},Bw.hasLocation=function(t,e){for(var r=0;r<3;r++)if(t[r]===e)return!0;return!1},Bw.computeBoundaryDistanceTolerance=function(t,e){return Math.min(HC.computeSizeBasedSnapTolerance(t),HC.computeSizeBasedSnapTolerance(e))},Bw.isValid=function(t,e,r,n){return new Bw(t,e,n).isValid(r)},Sw.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(Bw,Sw);var Mw=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};Mw.prototype.extractElements=function(t,e){if(null===t)return null;for(var r=0;r<t.getNumGeometries();r++){var n=t.getGeometryN(r);this._skipEmpty&&n.isEmpty()||e.add(n)}},Mw.prototype.combine=function(){for(var t=new iI,e=this._inputGeoms.iterator();e.hasNext();){var r=e.next();this.extractElements(r,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},Mw.prototype.interfaces_=function(){return[]},Mw.prototype.getClass=function(){return Mw},Mw.combine=function(){return 1===arguments.length?new Mw(arguments[0]).combine():2===arguments.length?new Mw(Mw.createList(arguments[0],arguments[1])).combine():3===arguments.length?new Mw(Mw.createList(arguments[0],arguments[1],arguments[2])).combine():void 0},Mw.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},Mw.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new iI;return r.add(t),r.add(e),r}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],s=new iI;return s.add(n),s.add(i),s.add(o),s}};var Lw=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new iI)},Nw={STRTREE_NODE_CAPACITY:{configurable:!0}};Lw.prototype.reduceToGeometries=function(t){for(var e=new iI,r=t.iterator();r.hasNext();){var n=r.next(),i=null;l_(n,rI)?i=this.unionTree(n):n instanceof j_&&(i=n),e.add(i)}return e},Lw.prototype.extractByEnvelope=function(t,e,r){for(var n=new iI,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?n.add(o):r.add(o)}return this._geomFactory.buildGeometry(n)},Lw.prototype.unionOptimized=function(t,e){var r=t.getEnvelopeInternal(),n=e.getEnvelopeInternal();if(!r.intersects(n))return Mw.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=r.intersection(n);return this.unionUsingEnvelopeIntersection(t,e,i)},Lw.prototype.union=function(){if(null===this._inputPolys)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var t=new nx(Lw.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var r=e.next();t.insert(r.getEnvelopeInternal(),r)}this._inputPolys=null;var n=t.itemsTree();return this.unionTree(n)},Lw.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];if(n-r<=1){var i=Lw.getGeometry(e,r);return this.unionSafe(i,null)}if(n-r==2)return this.unionSafe(Lw.getGeometry(e,r),Lw.getGeometry(e,r+1));var o=Math.trunc((n+r)/2),s=this.binaryUnion(e,r,o),a=this.binaryUnion(e,o,n);return this.unionSafe(s,a)}},Lw.prototype.repeatedUnion=function(t){for(var e=null,r=t.iterator();r.hasNext();){var n=r.next();e=null===e?n.copy():e.union(n)}return e},Lw.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},Lw.prototype.unionActual=function(t,e){return Lw.restrictToPolygons(t.union(e))},Lw.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},Lw.prototype.unionUsingEnvelopeIntersection=function(t,e,r){var n=new iI,i=this.extractByEnvelope(r,t,n),o=this.extractByEnvelope(r,e,n),s=this.unionActual(i,o);return n.add(s),Mw.combine(n)},Lw.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().createGeometryCollection([e,r]).buffer(0)}},Lw.prototype.interfaces_=function(){return[]},Lw.prototype.getClass=function(){return Lw},Lw.restrictToPolygons=function(t){if(l_(t,XI))return t;var e=_C.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(pE.toPolygonArray(e))},Lw.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},Lw.union=function(t){return new Lw(t).union()},Nw.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Lw,Nw);var Tw=function(){};function Rw(){return new Dw}function Dw(){this.reset()}Tw.prototype.interfaces_=function(){return[]},Tw.prototype.getClass=function(){return Tw},Tw.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return xw.createEmptyResult(xw.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),rw.overlayOp(t,e,xw.UNION)},Dw.prototype={constructor:Dw,reset:function(){this.s=this.t=0},add:function(t){Pw(Qw,t,this.t),Pw(this,Qw.s,this.s),this.s?this.t+=Qw.t:this.s=Qw.t},valueOf:function(){return this.s}};var Qw=new Dw;function Pw(t,e,r){var n=t.s=e+r,i=n-e,o=n-i;t.t=e-o+(r-i)}var kw=1e-6,Ow=Math.PI,Fw=Ow/2,Gw=Ow/4,Uw=2*Ow,qw=180/Ow,jw=Ow/180,Vw=Math.abs,zw=Math.atan,Yw=Math.atan2,Hw=Math.cos,Xw=Math.sin,Jw=Math.sqrt;function Ww(t){return t>1?0:t<-1?Ow:Math.acos(t)}function Kw(t){return t>1?Fw:t<-1?-Fw:Math.asin(t)}function Zw(){}function $w(t,e){t&&nb.hasOwnProperty(t.type)&&nb[t.type](t,e)}var tb,eb,rb={Feature:function(t,e){$w(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)$w(r[n].geometry,e)}},nb={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){ib(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)ib(r[n],e,0)},Polygon:function(t,e){ob(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)ob(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)$w(r[n],e)}};function ib(t,e,r){var n,i=-1,o=t.length-r;for(e.lineStart();++i<o;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function ob(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)ib(t[r],e,1);e.polygonEnd()}function sb(t){return[Yw(t[1],t[0]),Kw(t[2])]}function ab(t){var e=t[0],r=t[1],n=Hw(r);return[n*Hw(e),n*Xw(e),Xw(r)]}function ub(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function lb(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function cb(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function hb(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function fb(t){var e=Jw(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function pb(t,e){function r(r,n){return r=t(r,n),e(r[0],r[1])}return t.invert&&e.invert&&(r.invert=function(r,n){return(r=e.invert(r,n))&&t.invert(r[0],r[1])}),r}function gb(t,e){return[t>Ow?t-Uw:t<-Ow?t+Uw:t,e]}function Ab(t){return function(e,r){return[(e+=t)>Ow?e-Uw:e<-Ow?e+Uw:e,r]}}function db(t){var e=Ab(t);return e.invert=Ab(-t),e}function yb(t,e){var r=Hw(t),n=Xw(t),i=Hw(e),o=Xw(e);function s(t,e){var s=Hw(e),a=Hw(t)*s,u=Xw(t)*s,l=Xw(e),c=l*r+a*n;return[Yw(u*i-c*o,a*r-l*n),Kw(c*i+u*o)]}return s.invert=function(t,e){var s=Hw(e),a=Hw(t)*s,u=Xw(t)*s,l=Xw(e),c=l*i-u*o;return[Yw(u*i+l*o,a*r+c*n),Kw(c*r-a*n)]},s}function vb(t,e){(e=ab(e))[0]-=t,fb(e);var r=Ww(-e[1]);return((-e[2]<0?-r:r)+Uw-kw)%Uw}function mb(){var t,e=[];return{point:function(e,r){t.push([e,r])},lineStart:function(){e.push(t=[])},lineEnd:Zw,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function _b(t,e){return Vw(t[0]-e[0])<kw&&Vw(t[1]-e[1])<kw}function Ib(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function Eb(t,e,r,n,i){var o,s,a=[],u=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,r,n=t[0],s=t[e];if(_b(n,s)){for(i.lineStart(),o=0;o<e;++o)i.point((n=t[o])[0],n[1]);i.lineEnd()}else a.push(r=new Ib(n,t,null,!0)),u.push(r.o=new Ib(n,null,r,!1)),a.push(r=new Ib(s,t,null,!1)),u.push(r.o=new Ib(s,null,r,!0))}})),a.length){for(u.sort(e),xb(a),xb(u),o=0,s=u.length;o<s;++o)u[o].e=r=!r;for(var l,c,h=a[0];;){for(var f=h,p=!0;f.v;)if((f=f.n)===h)return;l=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(p)for(o=0,s=l.length;o<s;++o)i.point((c=l[o])[0],c[1]);else n(f.x,f.n.x,1,i);f=f.n}else{if(p)for(l=f.p.z,o=l.length-1;o>=0;--o)i.point((c=l[o])[0],c[1]);else n(f.x,f.p.x,-1,i);f=f.p}l=(f=f.o).z,p=!p}while(!f.v);i.lineEnd()}}}function xb(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}function Cb(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function wb(t){for(var e,r,n,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(r=new Array(s);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--s]=n[e];return r}Rw(),Rw(),Rw(),gb.invert=gb,1===(tb=Cb).length&&(eb=tb,tb=function(t,e){return Cb(eb(t),e)});var bb=1e9,Bb=-bb;function Sb(t,e,r,n){function i(i,o){return t<=i&&i<=r&&e<=o&&o<=n}function o(i,o,a,l){var c=0,h=0;if(null==i||(c=s(i,a))!==(h=s(o,a))||u(i,o)<0^a>0)do{l.point(0===c||3===c?t:r,c>1?n:e)}while((c=(c+a+4)%4)!==h);else l.point(o[0],o[1])}function s(n,i){return Vw(n[0]-t)<kw?i>0?0:3:Vw(n[0]-r)<kw?i>0?2:1:Vw(n[1]-e)<kw?i>0?1:0:i>0?3:2}function a(t,e){return u(t.x,e.x)}function u(t,e){var r=s(t,1),n=s(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){var u,l,c,h,f,p,g,A,d,y,v,m=s,_=mb(),I={point:E,lineStart:function(){I.point=x,l&&l.push(c=[]);y=!0,d=!1,g=A=NaN},lineEnd:function(){u&&(x(h,f),p&&d&&_.rejoin(),u.push(_.result()));I.point=E,d&&m.lineEnd()},polygonStart:function(){m=_,u=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=l.length;r<i;++r)for(var o,s,a=l[r],u=1,c=a.length,h=a[0],f=h[0],p=h[1];u<c;++u)o=f,s=p,f=(h=a[u])[0],p=h[1],s<=n?p>n&&(f-o)*(n-s)>(p-s)*(t-o)&&++e:p<=n&&(f-o)*(n-s)<(p-s)*(t-o)&&--e;return e}(),r=v&&e,i=(u=wb(u)).length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&Eb(u,a,e,o,s),s.polygonEnd());m=s,u=l=c=null}};function E(t,e){i(t,e)&&m.point(t,e)}function x(o,s){var a=i(o,s);if(l&&c.push([o,s]),y)h=o,f=s,p=a,y=!1,a&&(m.lineStart(),m.point(o,s));else if(a&&d)m.point(o,s);else{var u=[g=Math.max(Bb,Math.min(bb,g)),A=Math.max(Bb,Math.min(bb,A))],_=[o=Math.max(Bb,Math.min(bb,o)),s=Math.max(Bb,Math.min(bb,s))];!function(t,e,r,n,i,o){var s,a=t[0],u=t[1],l=0,c=1,h=e[0]-a,f=e[1]-u;if(s=r-a,h||!(s>0)){if(s/=h,h<0){if(s<l)return;s<c&&(c=s)}else if(h>0){if(s>c)return;s>l&&(l=s)}if(s=i-a,h||!(s<0)){if(s/=h,h<0){if(s>c)return;s>l&&(l=s)}else if(h>0){if(s<l)return;s<c&&(c=s)}if(s=n-u,f||!(s>0)){if(s/=f,f<0){if(s<l)return;s<c&&(c=s)}else if(f>0){if(s>c)return;s>l&&(l=s)}if(s=o-u,f||!(s<0)){if(s/=f,f<0){if(s>c)return;s>l&&(l=s)}else if(f>0){if(s<l)return;s<c&&(c=s)}return l>0&&(t[0]=a+l*h,t[1]=u+l*f),c<1&&(e[0]=a+c*h,e[1]=u+c*f),!0}}}}}(u,_,t,e,r,n)?a&&(m.lineStart(),m.point(o,s),v=!1):(d||(m.lineStart(),m.point(u[0],u[1])),m.point(_[0],_[1]),a||m.lineEnd(),v=!1)}g=o,A=s,d=a}return I}}var Mb=Rw();function Lb(t){return t}Rw(),Rw(),Rw();var Nb=1/0,Tb=Nb,Rb=-Nb,Db=Rb,Qb={point:function(t,e){t<Nb&&(Nb=t);t>Rb&&(Rb=t);e<Tb&&(Tb=e);e>Db&&(Db=e)},lineStart:Zw,lineEnd:Zw,polygonStart:Zw,polygonEnd:Zw,result:function(){var t=[[Nb,Tb],[Rb,Db]];return Rb=Db=-(Tb=Nb=1/0),t}};function Pb(t,e,r,n){return function(i,o){var s,a,u,l=e(o),c=i.invert(n[0],n[1]),h=mb(),f=e(h),p=!1,g={point:A,lineStart:y,lineEnd:v,polygonStart:function(){g.point=m,g.lineStart=_,g.lineEnd=I,a=[],s=[]},polygonEnd:function(){g.point=A,g.lineStart=y,g.lineEnd=v,a=wb(a);var t=function(t,e){var r=e[0],n=e[1],i=[Xw(r),-Hw(r),0],o=0,s=0;Mb.reset();for(var a=0,u=t.length;a<u;++a)if(c=(l=t[a]).length)for(var l,c,h=l[c-1],f=h[0],p=h[1]/2+Gw,g=Xw(p),A=Hw(p),d=0;d<c;++d,f=v,g=_,A=I,h=y){var y=l[d],v=y[0],m=y[1]/2+Gw,_=Xw(m),I=Hw(m),E=v-f,x=E>=0?1:-1,C=x*E,w=C>Ow,b=g*_;if(Mb.add(Yw(b*x*Xw(C),A*I+b*Hw(C))),o+=w?E+x*Uw:E,w^f>=r^v>=r){var B=lb(ab(h),ab(y));fb(B);var S=lb(i,B);fb(S);var M=(w^E>=0?-1:1)*Kw(S[2]);(n>M||n===M&&(B[0]||B[1]))&&(s+=w^E>=0?1:-1)}}return(o<-kw||o<kw&&Mb<-kw)^1&s}(s,c);a.length?(p||(o.polygonStart(),p=!0),Eb(a,Ob,t,r,o)):t&&(p||(o.polygonStart(),p=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),p&&(o.polygonEnd(),p=!1),a=s=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function A(e,r){var n=i(e,r);t(e=n[0],r=n[1])&&o.point(e,r)}function d(t,e){var r=i(t,e);l.point(r[0],r[1])}function y(){g.point=d,l.lineStart()}function v(){g.point=A,l.lineEnd()}function m(t,e){u.push([t,e]);var r=i(t,e);f.point(r[0],r[1])}function _(){f.lineStart(),u=[]}function I(){m(u[0][0],u[0][1]),f.lineEnd();var t,e,r,n,i=f.clean(),l=h.result(),c=l.length;if(u.pop(),s.push(u),u=null,c)if(1&i){if((e=(r=l[0]).length-1)>0){for(p||(o.polygonStart(),p=!0),o.lineStart(),t=0;t<e;++t)o.point((n=r[t])[0],n[1]);o.lineEnd()}}else c>1&&2&i&&l.push(l.pop().concat(l.shift())),a.push(l.filter(kb))}return g}}function kb(t){return t.length>1}function Ob(t,e){return((t=t.x)[0]<0?t[1]-Fw-kw:Fw-t[1])-((e=e.x)[0]<0?e[1]-Fw-kw:Fw-e[1])}Rw();var Fb=Pb((function(){return!0}),(function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?Ow:-Ow,u=Vw(o-r);Vw(u-Ow)<kw?(t.point(r,n=(n+s)/2>0?Fw:-Fw),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),t.point(o,n),e=0):i!==a&&u>=Ow&&(Vw(r-i)<kw&&(r-=i*kw),Vw(o-a)<kw&&(o-=a*kw),n=function(t,e,r,n){var i,o,s=Xw(t-r);return Vw(s)>kw?zw((Xw(e)*(o=Hw(n))*Xw(r)-Xw(n)*(i=Hw(e))*Xw(t))/(i*o*s)):(e+n)/2}(r,n,o,s),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(a,n),e=0),t.point(r=o,n=s),i=a},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var i;if(null==t)i=r*Fw,n.point(-Ow,i),n.point(0,i),n.point(Ow,i),n.point(Ow,0),n.point(Ow,-i),n.point(0,-i),n.point(-Ow,-i),n.point(-Ow,0),n.point(-Ow,i);else if(Vw(t[0]-e[0])>kw){var o=t[0]<e[0]?Ow:-Ow;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(e[0],e[1])}),[-Ow,-Fw]);function Gb(t,e){var r=Hw(t),n=r>0,i=Vw(r)>kw;function o(t,e){return Hw(t)*Hw(e)>r}function s(t,e,n){var i=[1,0,0],o=lb(ab(t),ab(e)),s=ub(o,o),a=o[0],u=s-a*a;if(!u)return!n&&t;var l=r*s/u,c=-r*a/u,h=lb(i,o),f=hb(i,l);cb(f,hb(o,c));var p=h,g=ub(f,p),A=ub(p,p),d=g*g-A*(ub(f,f)-1);if(!(d<0)){var y=Jw(d),v=hb(p,(-g-y)/A);if(cb(v,f),v=sb(v),!n)return v;var m,_=t[0],I=e[0],E=t[1],x=e[1];I<_&&(m=_,_=I,I=m);var C=I-_,w=Vw(C-Ow)<kw;if(!w&&x<E&&(m=E,E=x,x=m),w||C<kw?w?E+x>0^v[1]<(Vw(v[0]-_)<kw?E:x):E<=v[1]&&v[1]<=x:C>Ow^(_<=v[0]&&v[0]<=I)){var b=hb(p,(-g+y)/A);return cb(b,f),[v,sb(b)]}}}function a(e,r){var i=n?t:Ow-t,o=0;return e<-i?o|=1:e>i&&(o|=2),r<-i?o|=4:r>i&&(o|=8),o}return Pb(o,(function(t){var e,r,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(h,f){var p,g=[h,f],A=o(h,f),d=n?A?0:a(h,f):A?a(h+(h<0?Ow:-Ow),f):0;if(!e&&(l=u=A)&&t.lineStart(),A!==u&&(!(p=s(e,g))||_b(e,p)||_b(g,p))&&(g[0]+=kw,g[1]+=kw,A=o(g[0],g[1])),A!==u)c=0,A?(t.lineStart(),p=s(g,e),t.point(p[0],p[1])):(p=s(e,g),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(i&&e&&n^A){var y;d&r||!(y=s(g,e,!0))||(c=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!A||e&&_b(e,g)||t.point(g[0],g[1]),e=g,u=A,r=d},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return c|(l&&u)<<1}}}),(function(r,n,i,o){!function(t,e,r,n,i,o){if(r){var s=Hw(e),a=Xw(e),u=n*r;null==i?(i=e+n*Uw,o=e-u/2):(i=vb(s,i),o=vb(s,o),(n>0?i<o:i>o)&&(i+=n*Uw));for(var l,c=i;n>0?c>o:c<o;c-=u)l=sb([s,-a*Hw(c),-a*Xw(c)]),t.point(l[0],l[1])}}(o,t,e,i,r,n)}),n?[0,-t]:[-Ow,t-Ow])}function Ub(t){return function(e){var r=new qb;for(var n in t)r[n]=t[n];return r.stream=e,r}}function qb(){}function jb(t,e,r){var n=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),function(t,e){t&&rb.hasOwnProperty(t.type)?rb[t.type](t,e):$w(t,e)}(r,t.stream(Qb));var s=Qb.result(),a=Math.min(n/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),u=+e[0][0]+(n-a*(s[1][0]+s[0][0]))/2,l=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([u,l])}qb.prototype={constructor:qb,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Vb=16,zb=Hw(30*jw);function Yb(t,e){return+e?function(t,e){function r(n,i,o,s,a,u,l,c,h,f,p,g,A,d){var y=l-n,v=c-i,m=y*y+v*v;if(m>4*e&&A--){var _=s+f,I=a+p,E=u+g,x=Jw(_*_+I*I+E*E),C=Kw(E/=x),w=Vw(Vw(E)-1)<kw||Vw(o-h)<kw?(o+h)/2:Yw(I,_),b=t(w,C),B=b[0],S=b[1],M=B-n,L=S-i,N=v*M-y*L;(N*N/m>e||Vw((y*M+v*L)/m-.5)>.3||s*f+a*p+u*g<zb)&&(r(n,i,o,s,a,u,B,S,w,_/=x,I/=x,E,A,d),d.point(B,S),r(B,S,w,_,I,E,l,c,h,f,p,g,A,d))}}return function(e){var n,i,o,s,a,u,l,c,h,f,p,g,A={point:d,lineStart:y,lineEnd:m,polygonStart:function(){e.polygonStart(),A.lineStart=_},polygonEnd:function(){e.polygonEnd(),A.lineStart=y}};function d(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){c=NaN,A.point=v,e.lineStart()}function v(n,i){var o=ab([n,i]),s=t(n,i);r(c,h,l,f,p,g,c=s[0],h=s[1],l=n,f=o[0],p=o[1],g=o[2],Vb,e),e.point(c,h)}function m(){A.point=d,e.lineEnd()}function _(){y(),A.point=I,A.lineEnd=E}function I(t,e){v(n=t,e),i=c,o=h,s=f,a=p,u=g,A.point=v}function E(){r(c,h,l,f,p,g,i,o,n,s,a,u,Vb,e),A.lineEnd=m,m()}return A}}(t,e):function(t){return Ub({point:function(e,r){e=t(e,r),this.stream.point(e[0],e[1])}})}(t)}var Hb=Ub({point:function(t,e){this.stream.point(t*jw,e*jw)}});function Xb(t){return function(t){var e,r,n,i,o,s,a,u,l,c,h=150,f=480,p=250,g=0,A=0,d=0,y=0,v=0,m=null,_=Fb,I=null,E=Lb,x=.5,C=Yb(B,x);function w(t){return[(t=o(t[0]*jw,t[1]*jw))[0]*h+r,n-t[1]*h]}function b(t){return(t=o.invert((t[0]-r)/h,(n-t[1])/h))&&[t[0]*qw,t[1]*qw]}function B(t,i){return[(t=e(t,i))[0]*h+r,n-t[1]*h]}function S(){o=pb(i=function(t,e,r){return(t%=Uw)?e||r?pb(db(t),yb(e,r)):db(t):e||r?yb(e,r):gb}(d,y,v),e);var t=e(g,A);return r=f-t[0]*h,n=p+t[1]*h,M()}function M(){return l=c=null,w}return w.stream=function(t){return l&&c===t?l:l=Hb(_(i,C(E(c=t))))},w.clipAngle=function(t){return arguments.length?(_=+t?Gb(m=t*jw,6*jw):(m=null,Fb),M()):m*qw},w.clipExtent=function(t){return arguments.length?(E=null==t?(I=s=a=u=null,Lb):Sb(I=+t[0][0],s=+t[0][1],a=+t[1][0],u=+t[1][1]),M()):null==I?null:[[I,s],[a,u]]},w.scale=function(t){return arguments.length?(h=+t,S()):h},w.translate=function(t){return arguments.length?(f=+t[0],p=+t[1],S()):[f,p]},w.center=function(t){return arguments.length?(g=t[0]%360*jw,A=t[1]%360*jw,S()):[g*qw,A*qw]},w.rotate=function(t){return arguments.length?(d=t[0]%360*jw,y=t[1]%360*jw,v=t.length>2?t[2]%360*jw:0,S()):[d*qw,y*qw,v*qw]},w.precision=function(t){return arguments.length?(C=Yb(B,x=t*t),M()):Jw(x)},w.fitExtent=function(t,e){return jb(w,t,e)},w.fitSize=function(t,e){return function(t,e,r){return jb(t,[[0,0],e],r)}(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&b,S()}}((function(){return t}))()}function Jb(t){return function(e,r){var n=Hw(e),i=Hw(r),o=t(n*i);return[o*i*Xw(e),o*Xw(r)]}}function Wb(t){return function(e,r){var n=Jw(e*e+r*r),i=t(n),o=Xw(i),s=Hw(i);return[Yw(e*o,n*s),Kw(n&&r*o/n)]}}Jb((function(t){return Jw(2/(1+t))})).invert=Wb((function(t){return 2*Kw(t/2)}));var Kb=Jb((function(t){return(t=Ww(t))&&t/Xw(t)}));function Zb(){return Xb(Kb).scale(79.4188).clipAngle(179.999)}function $b(t,e){return[t,e]}function tB(t,e,r,n){var i=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var s=[];return Fa(t,(function(t){var i=tB(t,e,r,n);i&&s.push(i)})),dt(s)}var a=function(t){var e=vc(t).geometry.coordinates,r=[-e[0],-e[1]];return Zb().rotate(r).scale(it)}(o),u={type:o.type,coordinates:rB(o.coordinates,a)},l=(new mE).read(u),c=Et(xt(e,r),"meters"),h=fC.bufferOp(l,c,n);if(!eB((h=(new _E).write(h)).coordinates))return ut({type:h.type,coordinates:nB(h.coordinates,a)},i)}function eB(t){return Array.isArray(t[0])?eB(t[0]):isNaN(t[0])}function rB(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return rB(t,e)}))}function nB(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return nB(t,e)}))}function iB(t,e,r){void 0===r&&(r={});var n=Ut(t),i=Ut(e),o=Xm.intersection(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?ft(o[0],r.properties):mt(o,r.properties)}function oB(t,e,r){void 0===r&&(r={});var n=JSON.stringify(r.properties||{}),i=t[0],o=t[1],s=t[2],a=t[3],u=(o+a)/2,l=(i+s)/2,c=2*e/Vt([i,u],[s,u],r)*(s-i),h=2*e/Vt([l,o],[l,a],r)*(a-o),f=c/2,p=2*f,g=Math.sqrt(3)/2*h,A=s-i,d=a-o,y=3/4*p,v=g,m=(A-p)/(p-f/2),_=Math.floor(m),I=(_*y-f/2-A)/2-f/2+y/2,E=Math.floor((d-g)/g),x=(d-E*g)/2,C=E*g-d>g/2;C&&(x-=g/4);for(var w=[],b=[],B=0;B<6;B++){var S=2*Math.PI/6*B;w.push(Math.cos(S)),b.push(Math.sin(S))}for(var M=[],L=0;L<=_;L++)for(var N=0;N<=E;N++){var T=L%2==1;if((0!==N||!T)&&(0!==N||!C)){var R=L*y+i-I,D=N*v+o+x;if(T&&(D-=g/2),!0===r.triangles)aB([R,D],c/2,h/2,JSON.parse(n),w,b).forEach((function(t){r.mask?iB(r.mask,t)&&M.push(t):M.push(t)}));else{var Q=sB([R,D],c/2,h/2,JSON.parse(n),w,b);r.mask?iB(r.mask,Q)&&M.push(Q):M.push(Q)}}}return dt(M)}function sB(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var u=t[0]+e*i[a],l=t[1]+r*o[a];s.push([u,l])}return s.push(s[0].slice()),ft([s],n)}function aB(t,e,r,n,i,o){for(var s=[],a=0;a<6;a++){var u=[];u.push(t),u.push([t[0]+e*i[a],t[1]+r*o[a]]),u.push([t[0]+e*i[(a+1)%6],t[1]+r*o[(a+1)%6]]),u.push(t),s.push(ft([u],n))}return s}function uB(t){return mt(t)}function lB(t){return ft(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}function cB(t,e,r){return void 0===r&&(r={}),function(t,e,r,n){void 0===n&&(n={});for(var i=[],o=t[0],s=t[1],a=t[2],u=t[3],l=e/Vt([o,s],[a,s],n)*(a-o),c=r/Vt([o,s],[o,u],n)*(u-s),h=a-o,f=u-s,p=Math.floor(h/l),g=Math.floor(f/c),A=(f-g*c)/2,d=o+(h-p*l)/2,y=0;y<p;y++){for(var v=s+A,m=0;m<g;m++){var _=ft([[[d,v],[d,v+c],[d+l,v+c],[d+l,v],[d,v]]],n.properties);n.mask?vy(n.mask,_)&&i.push(_):i.push(_),v+=c}d+=l}return dt(i)}(t,e,e,r)}function hB(t,e,r){void 0===r&&(r={});for(var n=[],i=e/Vt([t[0],t[1]],[t[2],t[1]],r)*(t[2]-t[0]),o=e/Vt([t[0],t[1]],[t[0],t[3]],r)*(t[3]-t[1]),s=0,a=t[0];a<=t[2];){for(var u=0,l=t[1];l<=t[3];){var c=null,h=null;s%2==0&&u%2==0?(c=ft([[[a,l],[a,l+o],[a+i,l],[a,l]]],r.properties),h=ft([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],r.properties)):s%2==0&&u%2==1?(c=ft([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],r.properties),h=ft([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],r.properties)):u%2==0&&s%2==1?(c=ft([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],r.properties),h=ft([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],r.properties)):u%2==1&&s%2==1&&(c=ft([[[a,l],[a,l+o],[a+i,l],[a,l]]],r.properties),h=ft([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],r.properties)),r.mask?(iB(r.mask,c)&&n.push(c),iB(r.mask,h)&&n.push(h)):(n.push(c),n.push(h)),l+=o,u++}s++,a+=i}return dt(n)}Kb.invert=Wb((function(t){return t})),$b.invert=$b;var fB=Object.freeze({__proto__:null,projection:Uv,random:Jv,clusters:nm,helpers:Dt,invariant:jt,meta:Ja,isolines:function(t,e,r){if(!Nt(r=r||{}))throw new Error("options is invalid");var n=r.zProperty||"elevation",i=r.commonProperties||{},o=r.breaksProperties||[];if(Gt(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks must be an Array");if(!Nt(i))throw new Error("commonProperties must be an Object");if(!Array.isArray(o))throw new Error("breaksProperties must be an Array");var s=uu(t,{zProperty:n,flip:!0}),a=function(t,e,r,n,i){for(var o=[],s=1;s<e.length;s++){var a=+e[s],u=tu({},n,i[s]);u[r]=a;var l=yt(nu(t,a),u);o.push(l)}return o}(s,e,n,i,o),u=function(t,e,r){var n=Wa(r),i=n[2]-n[0],o=n[3]-n[1],s=n[0],a=n[1],u=e[0].length-1,l=e.length-1,c=i/u,h=o/l,f=function(t){t[0]=t[0]*c+s,t[1]=t[1]*h+a};return t.forEach((function(t){Ta(t,f)})),t}(a,s,t);return dt(u)},convex:tl,pointsWithinPolygon:el,within:el,concave:function(t,e){void 0===e&&(e={});var r=e.maxEdge||1/0,n=function(t){var e=[],r={};return Pa(t,(function(t){if(t.geometry){var n=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(r,n)||(e.push(t),r[n]=!0)}})),dt(e)}(t),i=rl(n);if(i.features=i.features.filter((function(t){var n=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],s=Vt(n,i,e),a=Vt(i,o,e),u=Vt(n,o,e);return s<=r&&a<=r&&u<=r})),i.features.length<1)return null;var o=Ql(i);return 1===o.coordinates.length&&(o.coordinates=o.coordinates[0],o.type="Polygon"),ut(o)},collect:function(t,e,r,n){var i=Zl(6),o=e.features.map((function(t){var e;return{minX:t.geometry.coordinates[0],minY:t.geometry.coordinates[1],maxX:t.geometry.coordinates[0],maxY:t.geometry.coordinates[1],property:null===(e=t.properties)||void 0===e?void 0:e[r]}}));return i.load(o),t.features.forEach((function(t){t.properties||(t.properties={});var e=Wa(t),r=i.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}),o=[];r.forEach((function(e){zt([e.minX,e.minY],t)&&o.push(e.property)})),t.properties[n]=o})),t},flip:function(t,e){if(!Nt(e=e||{}))throw new Error("options is invalid");var r=e.mutate;if(!t)throw new Error("geojson is required");return!1!==r&&void 0!==r||(t=sl(t)),Ta(t,(function(t){var e=t[0],r=t[1];t[0]=r,t[1]=e})),t},simplify:function(t,e){if(!Nt(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=sl(t)),Fa(t,(function(t){!function(t,e,r){var n=t.type;if("Point"===n||"MultiPoint"===n)return t;$l(t,!0);var i=t.coordinates;switch(n){case"LineString":t.coordinates=ac(i,e,r);break;case"MultiLineString":t.coordinates=i.map((function(t){return ac(t,e,r)}));break;case"Polygon":t.coordinates=uc(i,e,r);break;case"MultiPolygon":t.coordinates=i.map((function(t){return uc(t,e,r)}))}}(t,r,n)})),t},bezier:hc,bezierSpline:hc,tag:function(t,e,r,n){return t=sl(t),e=sl(e),Pa(t,(function(t){t.properties||(t.properties={}),Pa(e,(function(e){void 0===t.properties[n]&&zt(t,e)&&(t.properties[n]=e.properties[r])}))})),t},sample:function(t,e){if(!t)throw new Error("featurecollection is required");if(null==e)throw new Error("num is required");if("number"!=typeof e)throw new Error("num must be a number");var r=dt(function(t,e){var r,n,i=t.slice(0),o=t.length,s=o-e;for(;o-- >s;)r=i[n=Math.floor((o+1)*Math.random())],i[n]=i[o],i[o]=r;return i.slice(s)}(t.features,e));return r},envelope:pc,square:gc,circle:dc,midpoint:function(t,e){return Ac(t,Vt(t,e)/2,yc(t,e))},center:vc,centerOfMass:function t(e,r){switch(void 0===r&&(r={}),qt(e)){case"Point":return ct(Qt(e),r.properties);case"Polygon":var n=[];Ta(e,(function(t){n.push(t)}));var i,o,s,a,u,l,c,h,f=mc(e,{properties:r.properties}),p=f.geometry.coordinates,g=0,A=0,d=0,y=n.map((function(t){return[t[0]-p[0],t[1]-p[1]]}));for(i=0;i<n.length-1;i++)a=(o=y[i])[0],l=o[1],u=(s=y[i+1])[0],d+=h=a*(c=s[1])-u*l,g+=(a+u)*h,A+=(l+c)*h;if(0===d)return f;var v=1/(6*(.5*d));return ct([p[0]+v*g,p[1]+v*A],r.properties);default:var m=tl(e);return m?t(m,{properties:r.properties}):mc(e,{properties:r.properties})}},centroid:mc,combine:function(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return Pa(t,(function(t){var r,n,i,o;switch(null===(o=t.geometry)||void 0===o?void 0:o.type){case"Point":e.MultiPoint.coordinates.push(t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"MultiPoint":(r=e.MultiPoint.coordinates).push.apply(r,t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"LineString":e.MultiLineString.coordinates.push(t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"MultiLineString":(n=e.MultiLineString.coordinates).push.apply(n,t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties);break;case"MultiPolygon":(i=e.MultiPolygon.coordinates).push.apply(i,t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties)}})),dt(Object.keys(e).filter((function(t){return e[t].coordinates.length})).sort().map((function(t){return ut({type:t,coordinates:e[t].coordinates},{collectedProperties:e[t].properties})})))},distance:Vt,explode:_c,bbox:Wa,tesselate:function(t){if(!t.geometry||"Polygon"!==t.geometry.type&&"MultiPolygon"!==t.geometry.type)throw new Error("input must be a Polygon or MultiPolygon");var e={type:"FeatureCollection",features:[]};return"Polygon"===t.geometry.type?e.features=Jc(t.geometry.coordinates):t.geometry.coordinates.forEach((function(t){e.features=e.features.concat(Jc(t))})),e},bboxPolygon:fc,booleanPointInPolygon:zt,inside:zt,nearest:Wc,nearestPoint:Wc,nearestPointOnLine:Uh,pointOnLine:Uh,nearestPointToLine:function(t,e,r){void 0===r&&(r={});var n=r.units,i=r.properties||{},o=function(t){var e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return Fa(t,(function(t){"Point"===t.type&&e.push({type:"Feature",properties:{},geometry:t})})),{type:"FeatureCollection",features:e};case"FeatureCollection":return t.features=t.features.filter((function(t){return"Point"===t.geometry.type})),t;default:throw new Error("points must be a Point Collection")}}(t);if(!o.features.length)throw new Error("points must contain features");if(!e)throw new Error("line is required");if("LineString"!==qt(e))throw new Error("line must be a LineString");var s=1/0,a=null;return Pa(o,(function(t){var r=jh(t,e,{units:n});r<s&&(s=r,a=t)})),a&&(a.properties=tu({dist:s},a.properties,i)),a},planepoint:function(t,e){var r=Qt(t),n=Ut(e).coordinates[0];if(n.length<4)throw new Error("OuterRing of a Polygon must have 4 or more Positions.");var i=e.properties||{},o=i.a,s=i.b,a=i.c,u=r[0],l=r[1],c=n[0][0],h=n[0][1],f=void 0!==o?o:n[0][2],p=n[1][0],g=n[1][1],A=void 0!==s?s:n[1][2],d=n[2][0],y=n[2][1],v=void 0!==a?a:n[2][2];return(v*(u-c)*(l-g)+f*(u-p)*(l-y)+A*(u-d)*(l-h)-A*(u-c)*(l-y)-v*(u-p)*(l-h)-f*(u-d)*(l-g))/((u-c)*(l-g)+(u-p)*(l-y)+(u-d)*(l-h)-(u-c)*(l-y)-(u-p)*(l-h)-(u-d)*(l-g))},tin:rl,bearing:yc,destination:Ac,kinks:function(t){var e,r,n={type:"FeatureCollection",features:[]};if("LineString"===(r="Feature"===t.type?t.geometry:t).type)e=[r.coordinates];else if("MultiLineString"===r.type)e=r.coordinates;else if("MultiPolygon"===r.type)e=[].concat.apply([],r.coordinates);else{if("Polygon"!==r.type)throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");e=r.coordinates}return e.forEach((function(t){e.forEach((function(e){for(var r=0;r<t.length-1;r++)for(var i=r;i<e.length-1;i++){if(t===e){if(1===Math.abs(r-i))continue;if(0===r&&i===t.length-2&&t[r][0]===t[t.length-1][0]&&t[r][1]===t[t.length-1][1])continue}var o=Yh(t[r][0],t[r][1],t[r+1][0],t[r+1][1],e[i][0],e[i][1],e[i+1][0],e[i+1][1]);o&&n.features.push(ct([o[0],o[1]]))}}))})),n},pointOnFeature:Hh,pointOnSurface:Hh,area:Wh,along:function(t,e,r){void 0===r&&(r={});for(var n=Ut(t).coordinates,i=0,o=0;o<n.length&&!(e>=i&&o===n.length-1);o++){if(i>=e){var s=e-i;if(s){var a=yc(n[o],n[o-1])-180;return Ac(n[o],s,a,r)}return ct(n[o])}i+=Vt(n[o],n[o+1],r)}return ct(n[n.length-1])},length:tf,lineDistance:tf,lineSlice:function(t,e,r){var n=Pt(r);if("LineString"!==qt(r))throw new Error("line must be a LineString");for(var i,o=Uh(r,t),s=Uh(r,e),a=[(i=o.properties.index<=s.properties.index?[o,s]:[s,o])[0].geometry.coordinates],u=i[0].properties.index+1;u<i[1].properties.index+1;u++)a.push(n[u]);return a.push(i[1].geometry.coordinates),gt(a,r.properties)},lineSliceAlong:ef,pointGrid:lf,truncate:cf,flatten:hf,lineIntersect:Fh,lineChunk:function(t,e,r){if(!Nt(r=r||{}))throw new Error("options is invalid");var n=r.units,i=r.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return Ua(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,r,n){var i=tf(t,{units:r});if(i<=e)return n(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++){n(ef(t,e*s,e*(s+1),{units:r}),s)}}(t,e,n,(function(t){o.push(t)}))})),dt(o)},unkinkPolygon:function(t){var e=[];return Ua(t,(function(t){"Polygon"===t.geometry.type&&Pa(gf(t),(function(r){e.push(ft(r.geometry.coordinates,t.properties))}))})),dt(e)},greatCircle:function(t,e,r){if("object"!=typeof(r=r||{}))throw new Error("options is invalid");var n=r.properties,i=r.npoints,o=r.offset;return t=Qt(t),e=Qt(e),n=n||{},i=i||100,o=o||10,new bf({x:t[0],y:t[1]},{x:e[0],y:e[1]},n).Arc(i,{offset:o}).json()},lineSegment:Kc,lineSplit:function(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var r=qt(t),n=qt(e);if("LineString"!==r)throw new Error("line must be LineString");if("FeatureCollection"===n)throw new Error("splitter cannot be a FeatureCollection");if("GeometryCollection"===n)throw new Error("splitter cannot be a GeometryCollection");var i=cf(e,{precision:7});switch(n){case"Point":return Sf(t,i);case"MultiPoint":return Bf(t,i);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return Bf(t,Fh(t,i))}},lineArc:Nf,polygonToLine:Rf,polygonToLineString:Rf,lineStringToPolygon:Pf,lineToPolygon:Pf,bboxClip:function(t,e){var r=Ut(t),n=r.type,i="Feature"===t.type?t.properties:{},o=r.coordinates;switch(n){case"LineString":case"MultiLineString":var s=[];return"LineString"===n&&(o=[o]),o.forEach((function(t){!function(t,e,r){var n,i,o,s,a,u=t.length,l=Uf(t[0],e),c=[];for(r||(r=[]),n=1;n<u;n++){for(s=t[n-1],i=o=Uf(a=t[n],e);;){if(!(l|i)){c.push(s),i!==o?(c.push(a),n<u-1&&(r.push(c),c=[])):n===u-1&&c.push(a);break}if(l&i)break;l?l=Uf(s=Gf(s,a,l,e),e):i=Uf(a=Gf(s,a,i,e),e)}l=o}c.length&&r.push(c)}(t,e,s)})),1===s.length?gt(s[0],i):yt(s,i);case"Polygon":return ft(qf(o,e),i);case"MultiPolygon":return mt(o.map((function(t){return qf(t,e)})),i);default:throw new Error("geometry "+n+" not supported")}},lineOverlap:xA,sector:function(t,e,r,n,i){if(!Nt(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(null==r)throw new Error("bearing1 is required");if(null==n)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if("object"!=typeof i)throw new Error("options must be an object");if(wA(r)===wA(n))return dc(t,e,i);var s=Pt(t),a=Nf(t,e,r,n,i),u=[[s]];return Ta(a,(function(t){u[0].push(t)})),u[0].push(s),ft(u,o)},rhumbBearing:bA,rhumbDistance:qh,rhumbDestination:SA,polygonTangents:function(t,e){var r,n,i,o,s=Pt(t),a=Pt(e),u=Wa(e),l=0,c=null;switch(s[0]>u[0]&&s[0]<u[2]&&s[1]>u[1]&&s[1]<u[3]&&(l=(c=Wc(t,_c(e))).properties.featureIndex),qt(e)){case"Polygon":r=a[0][l],n=a[0][0],null!==c&&c.geometry.coordinates[1]<s[1]&&(n=a[0][l]),o=NA(a[0][0],a[0][a[0].length-1],s);var h=MA(a[0],s,o,i,r,n);r=h[0],n=h[1];break;case"MultiPolygon":for(var f=0,p=0,g=0,A=0;A<a[0].length;A++){f=A;for(var d=!1,y=0;y<a[0][A].length;y++){if(p=y,g===l){d=!0;break}g++}if(d)break}r=a[0][f][p],n=a[0][f][p],o=NA(a[0][0][0],a[0][0][a[0][0].length-1],s),a.forEach((function(t){var e=MA(t[0],s,o,i,r,n);r=e[0],n=e[1]}))}return dt([ct(r),ct(n)])},rewind:function(t,e){if(!Nt(e=e||{}))throw new Error("options is invalid");var r=e.reverse||!1,n=e.mutate||!1;if(!t)throw new Error("<geojson> is required");if("boolean"!=typeof r)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof n)throw new Error("<mutate> must be a boolean");!1===n&&(t=sl(t));var i=[];switch(t.type){case"GeometryCollection":return Fa(t,(function(t){RA(t,r)})),t;case"FeatureCollection":return Pa(t,(function(t){Pa(RA(t,r),(function(t){i.push(t)}))})),dt(i)}return RA(t,r)},isobands:function(t,e,r){if(!Nt(r=r||{}))throw new Error("options is invalid");var n=r.zProperty||"elevation",i=r.commonProperties||{},o=r.breaksProperties||[];if(Gt(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks is not an Array");if(!Nt(i))throw new Error("commonProperties is not an Object");if(!Array.isArray(o))throw new Error("breaksProperties is not an Array");var s=PA(t,{zProperty:n,flip:!0}),a=function(t,e,r){for(var n=[],i=1;i<e.length;i++){var o=+e[i-1],s=+e[i],a=kd(Pd(FA(t,o,s-o))),u={};u.groupedRings=a,u[r]=o+"-"+s,n.push(u)}return n}(s,e,n);a=function(t,e,r){var n=Wa(r),i=n[2]-n[0],o=n[3]-n[1],s=n[0],a=n[1],u=e[0].length-1,l=e.length-1,c=i/u,h=o/l,f=function(t){t[0]=t[0]*c+s,t[1]=t[1]*h+a};return t.forEach((function(t){t.groupedRings.forEach((function(t){t.forEach((function(t){t.forEach(f)}))}))})),t}(a,s,t);var u=a.map((function(t,e){if(o[e]&&!Nt(o[e]))throw new Error("Each mappedProperty is required to be an Object");var r=tu({},i,o[e]);return r[n]=t[n],mt(t.groupedRings,r)}));return dt(u)},transformRotate:Gd,transformScale:Ud,transformTranslate:function(t,e,r,n){if(!Nt(n=n||{}))throw new Error("options is invalid");var i=n.units,o=n.zTranslation,s=n.mutate;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");if(o&&"number"!=typeof o&&isNaN(o))throw new Error("zTranslation is not a number");if(o=void 0!==o?o:0,0===e&&0===o)return t;if(null==r||isNaN(r))throw new Error("direction is required");return e<0&&(e=-e,r+=180),!1!==s&&void 0!==s||(t=sl(t)),Ta(t,(function(t){var n=Pt(SA(t,e,r,{units:i}));t[0]=n[0],t[1]=n[1],o&&3===t.length&&(t[2]+=o)})),t},lineOffset:function(t,e,r){if(!Nt(r=r||{}))throw new Error("options is invalid");var n=r.units;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");var i=qt(t),o=t.properties;switch(i){case"LineString":return Yd(t,e,n);case"MultiLineString":var s=[];return Ua(t,(function(t){s.push(Yd(t,e,n).geometry.coordinates)})),yt(s,o);default:throw new Error("geometry "+i+" is not supported")}},polygonize:function(t){var e=ty.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();var r=[],n=[];return e.getEdgeRings().filter((function(t){return t.isValid()})).forEach((function(t){t.isHole()?r.push(t):n.push(t)})),r.forEach((function(t){Zd.findEdgeRingContaining(t,n)&&n.push(t)})),dt(n.map((function(t){return t.toPolygon()})))},booleanDisjoint:ey,booleanContains:function(t,e){var r=Ut(t),n=Ut(e),i=r.type,o=n.type,s=r.coordinates,a=n.coordinates;switch(i){case"Point":if("Point"===o)return sy(s,a);throw new Error("feature2 "+o+" geometry not supported");case"MultiPoint":switch(o){case"Point":return function(t,e){var r,n=!1;for(r=0;r<t.coordinates.length;r++)if(sy(t.coordinates[r],e.coordinates)){n=!0;break}return n}(r,n);case"MultiPoint":return function(t,e){for(var r=0,n=e.coordinates;r<n.length;r++){for(var i=n[r],o=!1,s=0,a=t.coordinates;s<a.length;s++){if(sy(i,a[s])){o=!0;break}}if(!o)return!1}return!0}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"Point":return rf(n,r,{ignoreEndVertices:!0});case"LineString":return function(t,e){for(var r=!1,n=0,i=e.coordinates;n<i.length;n++){var o=i[n];if(rf({type:"Point",coordinates:o},t,{ignoreEndVertices:!0})&&(r=!0),!rf({type:"Point",coordinates:o},t,{ignoreEndVertices:!1}))return!1}return r}(r,n);case"MultiPoint":return function(t,e){for(var r=!1,n=0,i=e.coordinates;n<i.length;n++){var o=i[n];if(rf(o,t,{ignoreEndVertices:!0})&&(r=!0),!rf(o,t))return!1}if(r)return!0;return!1}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Point":return zt(n,r,{ignoreBoundary:!0});case"LineString":return function(t,e){var r=!1,n=0,i=Wa(t),o=Wa(e);if(!oy(i,o))return!1;for(;n<e.coordinates.length-1;n++){if(zt({type:"Point",coordinates:ay(e.coordinates[n],e.coordinates[n+1])},t,{ignoreBoundary:!0})){r=!0;break}}return r}(r,n);case"Polygon":return function(t,e){if("Feature"===t.type&&null===t.geometry)return!1;if("Feature"===e.type&&null===e.geometry)return!1;var r=Wa(t),n=Wa(e);if(!oy(r,n))return!1;for(var i=Ut(e).coordinates,o=0,s=i;o<s.length;o++)for(var a=0,u=s[o];a<u.length;a++){if(!zt(u[a],t))return!1}return!0}(r,n);case"MultiPoint":return function(t,e){for(var r=0,n=e.coordinates;r<n.length;r++){if(!zt(n[r],t,{ignoreBoundary:!0}))return!1}return!0}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanCrosses:function(t,e){var r=Ut(t),n=Ut(e),i=r.type,o=n.type;switch(i){case"MultiPoint":switch(o){case"LineString":return uy(r,n);case"Polygon":return cy(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return uy(n,r);case"LineString":return function(t,e){if(Fh(t,e).features.length>0)for(var r=0;r<t.coordinates.length-1;r++)for(var n=0;n<e.coordinates.length-1;n++){var i=!0;if(0!==n&&n!==e.coordinates.length-2||(i=!1),hy(t.coordinates[r],t.coordinates[r+1],e.coordinates[n],i))return!0}return!1}(r,n);case"Polygon":return ly(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return cy(n,r);case"LineString":return ly(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanClockwise:TA,booleanOverlap:function(t,e){var r=Ut(t),n=Ut(e),i=r.type,o=n.type;if("MultiPoint"===i&&"MultiPoint"!==o||("LineString"===i||"MultiLineString"===i)&&"LineString"!==o&&"MultiLineString"!==o||("Polygon"===i||"MultiPolygon"===i)&&"Polygon"!==o&&"MultiPolygon"!==o)throw new Error("features must be of the same type");if("Point"===i)throw new Error("Point geometry not supported");if(new yy({precision:6}).compare(t,e))return!1;var s=0;switch(i){case"MultiPoint":for(var a=0;a<r.coordinates.length;a++)for(var u=0;u<n.coordinates.length;u++){var l=r.coordinates[a],c=n.coordinates[u];if(l[0]===c[0]&&l[1]===c[1])return!0}return!1;case"LineString":case"MultiLineString":ja(t,(function(t){ja(e,(function(e){xA(t,e).features.length&&s++}))}));break;case"Polygon":case"MultiPolygon":ja(t,(function(t){ja(e,(function(e){Fh(t,e).features.length&&s++}))}))}return s>0},booleanPointOnLine:rf,booleanEqual:function(t,e){return Ut(t).type===Ut(e).type&&new yy({precision:6}).compare($l(t),$l(e))},booleanWithin:of,booleanIntersects:vy,clone:sl,cleanCoords:$l,clustersDbscan:function(t,e,r){void 0===r&&(r={}),!0!==r.mutate&&(t=sl(t)),r.minPoints=r.minPoints||3;var n=new Cy.DBSCAN,i=n.run(Oa(t),St(e,r.units),r.minPoints,Vt),o=-1;return i.forEach((function(e){o++,e.forEach((function(e){var r=t.features[e];r.properties||(r.properties={}),r.properties.cluster=o,r.properties.dbscan="core"}))})),n.noise.forEach((function(e){var r=t.features[e];r.properties||(r.properties={}),r.properties.cluster?r.properties.dbscan="edge":r.properties.dbscan="noise"})),t},clustersKmeans:function(t,e){void 0===e&&(e={});var r=t.features.length;e.numberOfClusters=e.numberOfClusters||Math.round(Math.sqrt(r/2)),e.numberOfClusters>r&&(e.numberOfClusters=r),!0!==e.mutate&&(t=sl(t));var n=Oa(t),i=n.slice(0,e.numberOfClusters),o=Ry(n,e.numberOfClusters,i),s={};return o.centroids.forEach((function(t,e){s[e]=t})),Pa(t,(function(t,e){var r=o.idxs[e];t.properties.cluster=r,t.properties.centroid=s[r]})),t},pointToLineDistance:jh,booleanParallel:function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==Qy(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==Qy(e,"line2"))throw new Error("line2 must be a LineString");for(var r=Kc($l(t)).features,n=Kc($l(e)).features,i=0;i<r.length;i++){var o=r[i].geometry.coordinates;if(!n[i])break;if(!Dy(o,n[i].geometry.coordinates))return!1}return!0},shortestPath:function(t,e,r){if(!Nt(r=r||{}))throw new Error("options is invalid");var n=r.resolution,i=r.minDistance,o=r.obstacles||dt([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(n&&!Lt(n)||n<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var s=Qt(t),a=Qt(e);switch(t=ct(s),e=ct(a),qt(o)){case"FeatureCollection":if(0===o.features.length)return gt([s,a]);break;case"Polygon":o=dt([ut(Ut(o))]);break;default:throw new Error("invalid obstacles")}var u=o;u.features.push(t),u.features.push(e);var l=Wa(Ud(fc(Wa(u)),1.15));n||(n=Vt([l[0],l[1]],[l[2],l[1]],r)/100),u.features.pop(),u.features.pop();for(var c=l[0],h=l[1],f=l[2],p=l[3],g=n/Vt([c,h],[f,h],r)*(f-c),A=n/Vt([c,h],[c,p],r)*(p-h),d=f-c,y=p-h,v=Math.floor(d/g),m=Math.floor(y/A),_=(d-v*g)/2,I=[],E=[],x=[],C=[],w=1/0,b=1/0,B=p-(y-m*A)/2,S=0;B>=h;){for(var M=[],L=[],N=c+_,T=0;N<=f;){var R=ct([N,B]),D=Uy(R,o);M.push(D?0:1),L.push(N+"|"+B);var Q=Vt(R,t);!D&&Q<w&&(w=Q,x={x:T,y:S});var P=Vt(R,e);!D&&P<b&&(b=P,C={x:T,y:S}),N+=g,T++}E.push(M),I.push(L),B-=A,S++}var k=new Oy(E,{diagonal:!0}),O=k.grid[x.y][x.x],F=k.grid[C.y][C.x],G=ky.search(k,O,F),U=[s];return G.forEach((function(t){var e=I[t.x][t.y].split("|");U.push([+e[0],+e[1]])})),U.push(a),$l(gt(U))},voronoi:function(t,e){if(!Nt(e=e||{}))throw new Error("options is invalid");var r=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(r))throw new Error("bbox is invalid");return Gt(t,"Point","points"),dt(function(){var t=jy,e=Vy,r=null;function n(n){return new Cv(n.map((function(r,i){var o=[Math.round(t(r,i,n)/Iv)*Iv,Math.round(e(r,i,n)/Iv)*Iv];return o.index=i,o.data=r,o})),r)}return n.polygons=function(t){return n(t).polygons()},n.links=function(t){return n(t).links()},n.triangles=function(t){return n(t).triangles()},n.x=function(e){return arguments.length?(t="function"==typeof e?e:qy(+e),n):t},n.y=function(t){return arguments.length?(e="function"==typeof t?t:qy(+t),n):e},n.extent=function(t){return arguments.length?(r=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],n):r&&[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},n.size=function(t){return arguments.length?(r=null==t?null:[[0,0],[+t[0],+t[1]]],n):r&&[r[1][0]-r[0][0],r[1][1]-r[0][1]]},n}().x((function(t){return t.geometry.coordinates[0]})).y((function(t){return t.geometry.coordinates[1]})).extent([[r[0],r[1]],[r[2],r[3]]]).polygons(t.features).map(wv))},ellipse:bv,centerMean:Sv,centerMedian:function(t,e){if(void 0===e&&(e={}),!Nt(e=e||{}))throw new Error("options is invalid");var r=e.counter||10;if(!Lt(r))throw new Error("counter must be a number");var n=e.weight,i=Sv(t,{weight:e.weight}),o=dt([]);Pa(t,(function(t){var e;o.features.push(mc(t,{properties:{weight:null===(e=t.properties)||void 0===e?void 0:e[n]}}))}));var s={tolerance:e.tolerance,medianCandidates:[]};return Mv(i.geometry.coordinates,[0,0],o,s,r)},standardDeviationalEllipse:function(t,e){if(!Nt(e=e||{}))throw new Error("options is invalid");var r=e.steps||64,n=e.weight,i=e.properties||{};if(!Lt(r))throw new Error("steps must be a number");if(!Nt(i))throw new Error("properties must be a number");var o=Oa(t).length,s=Sv(t,{weight:n}),a=0,u=0,l=0;Pa(t,(function(t){var e=t.properties[n]||1,r=Lv(Pt(t),Pt(s));a+=Math.pow(r.x,2)*e,u+=Math.pow(r.y,2)*e,l+=r.x*r.y*e}));var c=a-u,h=Math.sqrt(Math.pow(c,2)+4*Math.pow(l,2)),f=2*l,p=Math.atan((c+h)/f),g=180*p/Math.PI,A=0,d=0,y=0;Pa(t,(function(t){var e=t.properties[n]||1,r=Lv(Pt(t),Pt(s));A+=Math.pow(r.x*Math.cos(p)-r.y*Math.sin(p),2)*e,d+=Math.pow(r.x*Math.sin(p)+r.y*Math.cos(p),2)*e,y+=e}));var v=Math.sqrt(2*A/y),m=Math.sqrt(2*d/y),_=bv(s,v,m,{units:"degrees",angle:g,steps:r,properties:i}),I=el(t,dt([_])),E={meanCenterCoordinates:Pt(s),semiMajorAxis:v,semiMinorAxis:m,numberOfFeatures:o,angle:g,percentageWithinEllipse:100*Oa(I).length/o};return _.properties.standardDeviationalEllipse=E,_},angle:function(t,e,r,n){if(void 0===n&&(n={}),!Nt(n))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!r)throw new Error("endPoint is required");var i=t,o=e,s=r,a=wt(!0!==n.mercator?yc(i,o):bA(i,o)),u=wt(!0!==n.mercator?yc(s,o):bA(s,o)),l=Math.abs(a-u);return!0===n.explementary?360-l:l},polygonSmooth:function(t,e){var r=[],n=e.iterations||1;if(!t)throw new Error("inputPolys is required");return Fa(t,(function(t,e,i){var o,s,a;switch(t.type){case"Polygon":o=[[]];for(var u=0;u<n;u++)a=[[]],s=t,u>0&&(s=ft(o).geometry),Nv(s,a),o=a.slice(0);r.push(ft(o,i));break;case"MultiPolygon":o=[[[]]];for(var l=0;l<n;l++)a=[[[]]],s=t,l>0&&(s=mt(o).geometry),Tv(s,a),o=a.slice(0);r.push(mt(o,i));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}})),dt(r)},moranIndex:function(t,e){var r=e.inputField,n=e.threshold||1e5,i=e.p||2,o=e.binary||!1,s=Dv(t,{alpha:e.alpha||-1,binary:o,p:i,standardization:e.standardization||!0,threshold:n}),a=[];Pa(t,(function(t){var e=t.properties||{};a.push(e[r])}));for(var u=Qv(a),l=function(t){for(var e=Qv(t),r=0,n=0,i=t;n<i.length;n++){var o=i[n];r+=Math.pow(o-e,2)}return r/t.length}(a),c=0,h=0,f=0,p=0,g=s.length,A=0;A<g;A++){for(var d=0,y=0;y<g;y++)c+=s[A][y]*(a[A]-u)*(a[y]-u),h+=s[A][y],f+=Math.pow(s[A][y]+s[y][A],2),d+=s[A][y]+s[y][A];p+=Math.pow(d,2)}var v=c/h/l,m=-1/(g-1),_=(g*g*(f*=.5)-g*p+h*h*3)/((g-1)*(g+1)*(h*h))-m*m,I=Math.sqrt(_);return{expectedMoranIndex:m,moranIndex:v,stdNorm:I,zNorm:(v-m)/I}},distanceWeight:Dv,bearingToAngle:wt,convertDistance:St,degrees2radians:Bt,distanceToDegrees:Ct,distanceToRadians:xt,radians2degrees:bt,radiansToDistance:Et,difference:function(t,e){var r=Ut(t),n=Ut(e),i=t.properties||{},o=Xm.difference(r.coordinates,n.coordinates);return 0===o.length?null:1===o.length?ft(o[0],i):mt(o,i)},buffer:function(t,e,r){var n=(r=r||{}).units||"kilometers",i=r.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof r)throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return Fa(t,(function(t){var r=tB(t,e,n,i);r&&o.push(r)})),dt(o);case"FeatureCollection":return Pa(t,(function(t){var r=tB(t,e,n,i);r&&Pa(r,(function(t){t&&o.push(t)}))})),dt(o)}return tB(t,e,n,i)},union:function(t,e,r){void 0===r&&(r={});var n=Ut(t),i=Ut(e),o=Xm.union(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?ft(o[0],r.properties):mt(o,r.properties)},intersect:iB,dissolve:function(t,e){if(!Nt(e=e||{}))throw new Error("options is invalid");var r=e.propertyName;Gt(t,"Polygon","dissolve");var n=[];if(!e.propertyName)return hf(mt(Xm.union.apply(null,t.features.map((function(t){return t.geometry.coordinates})))));var i={};Pa(t,(function(t){Object.prototype.hasOwnProperty.call(i,t.properties[r])||(i[t.properties[r]]=[]),i[t.properties[r]].push(t)}));for(var o=Object.keys(i),s=0;s<o.length;s++){var a=mt(Xm.union.apply(null,i[o[s]].map((function(t){return t.geometry.coordinates}))));a.properties[r]=o[s],n.push(a)}return hf(dt(n))},hexGrid:oB,mask:function(t,e){var r,n,i=lB(e),o=null;return"FeatureCollection"===t.type?(n=2===(r=t).features.length?Xm.union(r.features[0].geometry.coordinates,r.features[1].geometry.coordinates):Xm.union.apply(Xm,r.features.map((function(t){return t.geometry.coordinates}))),o=uB(n)):o=uB(Xm.union(t.geometry.coordinates)),o.geometry.coordinates.forEach((function(t){i.geometry.coordinates.push(t[0])})),i},squareGrid:cB,triangleGrid:hB,interpolate:function(t,e,r){if("object"!=typeof(r=r||{}))throw new Error("options is invalid");var n=r.gridType,i=r.property,o=r.weight;if(!t)throw new Error("points is required");if(Gt(t,"Point","input must contain Points"),!e)throw new Error("cellSize is required");if(void 0!==o&&"number"!=typeof o)throw new Error("weight must be a number");i=i||"elevation",n=n||"square",o=o||1;var s,a=Wa(t);switch(n){case"point":case"points":s=lf(a,e,r);break;case"square":case"squares":s=cB(a,e,r);break;case"hex":case"hexes":s=oB(a,e,r);break;case"triangle":case"triangles":s=hB(a,e,r);break;default:throw new Error("invalid gridType")}var u=[];return Pa(s,(function(e){var s=0,a=0;Pa(t,(function(t){var u,l=Vt("point"===n?e:mc(e),t,r);if(void 0!==i&&(u=t.properties[i]),void 0===u&&(u=t.geometry.coordinates[2]),void 0===u)throw new Error("zValue is missing");0===l&&(s=u);var c=1/Math.pow(l,o);a+=c,s+=c*u}));var l=sl(e);l.properties[i]=s/a,u.push(l)})),dt(u)},toMercator:Pv,toWgs84:kv,randomPosition:jv,randomPoint:Vv,randomPolygon:zv,randomLineString:Yv,getCluster:Wv,clusterEach:Kv,clusterReduce:Zv,createBins:$v,applyFilter:tm,propertiesContainsFilter:em,filterProperties:rm,earthRadius:it,factors:ot,unitsFactors:st,areaFactors:at,feature:ut,geometry:lt,point:ct,points:ht,polygon:ft,polygons:pt,lineString:gt,lineStrings:At,featureCollection:dt,multiLineString:yt,multiPoint:vt,multiPolygon:mt,geometryCollection:_t,round:It,radiansToLength:Et,lengthToRadians:xt,lengthToDegrees:Ct,bearingToAzimuth:wt,radiansToDegrees:bt,degreesToRadians:Bt,convertLength:St,convertArea:Mt,isNumber:Lt,isObject:Nt,validateBBox:Tt,validateId:Rt,getCoord:Qt,getCoords:Pt,containsNumber:kt,geojsonType:Ot,featureOf:Ft,collectionOf:Gt,getGeom:Ut,getType:qt,coordAll:Oa,coordEach:Ta,coordReduce:Ra,featureEach:Pa,featureReduce:ka,findPoint:Xa,findSegment:Ha,flattenEach:Ua,flattenReduce:qa,geomEach:Fa,geomReduce:Ga,lineEach:za,lineReduce:Ya,propEach:Da,propReduce:Qa,segmentEach:ja,segmentReduce:Va});t.Arrow3D=ba,t.CoordinateTransform=Na,t.LineGeometry=fa,t.LineMaterial=Vs,t.TextureAnimator=$,t.drawTool=La,t.gisCommon=Xt,t.gltfLoadClass=Po,t.imgClass=V,t.layerClass=Ma,t.line2Object=Ca,t.lineLength=U,t.planeGifClass=ma,t.planeMark=he,t.planeSectorClass=tt,t.radarClass=H,t.rippleWallClass=Gs,t.sectorClass=W,t.shockClass=nt,t.sleep=D,t.tileClass=Ro,t.tripHeight=Ba,t.tripLineClass=Sa,t.tubeClass=Ea,t.turf=fB,t.verticalFatLineClass=da}));
|