map-core-func 0.1.38 → 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.
@@ -1 +1,157 @@
1
- import*as e from"maptalks";import*as t from"three";import{BufferGeometry as r,BufferAttribute as i,Quaternion as n,Matrix4 as a,LoaderUtils as o,FileLoader as s,Loader as A,Color as h,SpotLight as l,PointLight as c,DirectionalLight as u,MeshBasicMaterial as g,sRGBEncoding as d,MeshPhysicalMaterial as f,Vector2 as p,Vector3 as v,InstancedMesh as m,Object3D as I,InterleavedBuffer as y,InterleavedBufferAttribute as C,LinearFilter as E,LinearMipmapLinearFilter as B,RepeatWrapping as w,PointsMaterial as Q,Material as x,LineBasicMaterial as b,MeshStandardMaterial as k,DoubleSide as S,PropertyBinding as _,SkinnedMesh as T,Mesh as D,LineSegments as M,Line as L,LineLoop as R,Points as F,Group as U,PerspectiveCamera as N,MathUtils as G,OrthographicCamera as O,Skeleton as P,AnimationClip as H,Bone as q,TriangleFanDrawMode as j,NearestFilter as z,NearestMipmapNearestFilter as V,LinearMipmapNearestFilter as J,NearestMipmapLinearFilter as K,ClampToEdgeWrapping as Y,MirroredRepeatWrapping as W,FrontSide as X,TextureLoader as Z,ImageBitmapLoader as $,Texture as ee,TriangleStripDrawMode as te,InterpolateLinear as re,Box3 as ie,Sphere as ne,InterpolateDiscrete as ae,VectorKeyframeTrack as oe,QuaternionKeyframeTrack as se,NumberKeyframeTrack as Ae,Interpolant as he,DefaultLoadingManager as le,Spherical as ce,Ray as ue,LoadingManager as ge,Frustum as de,RGBAFormat as fe,RGFormat as pe,RedFormat as ve,FloatType as me,HalfFloatType as Ie,UnsignedByteType as ye,CompressedArrayTexture as Ce,CompressedTexture as Ee,LinearEncoding as Be,RGBA_ASTC_4x4_Format as we,RGBA_BPTC_Format as Qe,RGBA_ETC2_EAC_Format as xe,RGBA_PVRTC_4BPPV1_Format as be,RGBA_S3TC_DXT5_Format as ke,RGB_ETC1_Format as Se,RGB_ETC2_Format as _e,RGB_PVRTC_4BPPV1_Format as Te,RGB_S3TC_DXT1_Format as De,Data3DTexture as Me,DataTexture as Le,Vector4 as Re,Curve as Fe,Euler as Ue,MeshPhongMaterial as Ne,MeshLambertMaterial as Ge,EquirectangularReflectionMapping as Oe,AmbientLight as Pe,Float32BufferAttribute as He,Uint16BufferAttribute as qe,Matrix3 as je,UniformsLib as ze,ShaderLib as Ve,UniformsUtils as Je,ShaderMaterial as Ke,InstancedInterleavedBuffer as Ye,WireframeGeometry as We,InstancedBufferGeometry as Xe,Line3 as Ze}from"three";import{BaseObject as $e,ThreeLayer as et}from"maptalks.three";function tt(){tt=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",s=n.toStringTag||"@@toStringTag";function A(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{A({},"")}catch(e){A=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var a=t&&t.prototype instanceof u?t:u,o=Object.create(a.prototype),s=new Q(n||[]);return i(o,"_invoke",{value:C(e,r,s)}),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=h;var c={};function u(){}function g(){}function d(){}var f={};A(f,a,(function(){return this}));var p=Object.getPrototypeOf,v=p&&p(p(x([])));v&&v!==t&&r.call(v,a)&&(f=v);var m=d.prototype=u.prototype=Object.create(f);function I(e){["next","throw","return"].forEach((function(t){A(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){function n(i,a,o,s){var A=l(e[i],e,a);if("throw"!==A.type){var h=A.arg,c=h.value;return c&&"object"==typeof c&&r.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,o,s)}),(function(e){n("throw",e,o,s)})):t.resolve(c).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 C(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 b()}for(r.method=n,r.arg=a;;){var o=r.delegate;if(o){var s=E(o,r);if(s){if(s===c)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=l(e,t,r);if("normal"===A.type){if(i=r.done?"completed":"suspendedYield",A.arg===c)continue;return{value:A.arg,done:r.done}}"throw"===A.type&&(i="completed",r.method="throw",r.arg=A.arg)}}}function E(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,E(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),c;var n=l(i,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,c;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,c):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function B(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 w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function Q(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(B,this),this.reset(!0)}function x(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:b}}function b(){return{value:void 0,done:!0}}return g.prototype=d,i(m,"constructor",{value:d,configurable:!0}),i(d,"constructor",{value:g,configurable:!0}),g.displayName=A(d,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,A(e,s,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},I(y.prototype),A(y.prototype,o,(function(){return this})),e.AsyncIterator=y,e.async=function(t,r,i,n,a){void 0===a&&(a=Promise);var o=new y(h(t,r,i,n),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},I(m),A(m,s,"Generator"),A(m,a,(function(){return this})),A(m,"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=x,Q.prototype={constructor:Q,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(w),!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,c):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),c},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),w(r),c}},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;w(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:x(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}function rt(e){return rt="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},rt(e)}function it(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 nt(e){return function(){var t=this,r=arguments;return new Promise((function(i,n){var a=e.apply(t,r);function o(e){it(a,i,n,o,s,"next",e)}function s(e){it(a,i,n,o,s,"throw",e)}o(void 0)}))}}function at(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ot(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,Et(i.key),i)}}function st(e,t,r){return t&&ot(e.prototype,t),r&&ot(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function At(e,t,r){return(t=Et(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ht(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&&ct(e,t)}function lt(e){return lt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},lt(e)}function ct(e,t){return ct=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ct(e,t)}function ut(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gt(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=lt(e);if(t){var n=lt(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 ut(e)}(this,r)}}function dt(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=lt(e)););return e}function ft(){return ft="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var i=dt(e,t);if(i){var n=Object.getOwnPropertyDescriptor(i,t);return n.get?n.get.call(arguments.length<3?e:r):n.value}},ft.apply(this,arguments)}function pt(e,t,r,i){return pt="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(e,t,r,i){var n,a=dt(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 At(i,t,r);return!0},pt(e,t,r,i)}function vt(e,t,r,i,n){if(!pt(e,t,r,i||e)&&n)throw new TypeError("failed to set property");return r}function mt(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)||It(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 It(e,t){if(e){if("string"==typeof e)return yt(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)?yt(e,t):void 0}}function yt(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 Ct(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=It(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 Et(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 Bt(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,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=wt(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=[],k=0;k<s[w].length;++k)b.push(s[w][k][x]);var S=wt(b);if(!S)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+w+" morphAttribute."),null;h.morphAttributes[w].push(S)}}return h}function wt(e){for(var t,r,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===r&&(r=s.itemSize),r!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===n&&(n=s.normalized),n!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;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 i(A,r,n)}var Qt=Math.PI/180,xt=6378137;function bt(){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 kt(e){return new Promise((function(t){return setTimeout(t,e)}))}function St(e,t){return t.split("").forEach((function(t){-1===e.indexOf(t)&&(e+=t)})),e}function _t(e,r){return 256*(e=t.MathUtils.clamp(Math.floor(e),0,255))+(r=t.MathUtils.clamp(Math.floor(r),0,255))}function Tt(t){for(var r=1/0,i=1/0,n=-1/0,a=-1/0,o=0,s=t.length;o<s;o++){var A=t[o],h=A.coordinate,l=A.lnglat,c=A.lnglats,u=A.xy,g=A.xys,d=h||l||c||u||g||t[o],f=void 0,p=void 0;Array.isArray(d)?(f=d[0],p=d[1]):d instanceof e.Coordinate&&(f=d.x,p=d.y),r=Math.min(r,f),i=Math.min(i,p),n=Math.max(n,f),a=Math.max(a,p)}return new e.Coordinate((r+n)/2,(i+a)/2)}function Dt(e,r,i,n){var a=e,o=r.getShell(),s=[];o.forEach((function(e){var t=i.coordinateToVector3(e).sub(a);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]=n,c[6]=u.x,c[7]=u.y,c[8]=0,c[3]=g.x,c[4]=g.y,c[5]=n,c[9]=g.x,c[10]=g.y,c[11]=0;var d=new t.BufferGeometry;d.setAttribute("position",new t.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]=n,f[6]=p.x,f[7]=p.y,f[8]=0,f[3]=v.x,f[4]=v.y,f[5]=n,f[9]=v.x,f[10]=v.y,f[11]=0;var m=new t.BufferGeometry;m.setAttribute("position",new t.BufferAttribute(f,3)),m.setIndex([0,2,1,2,3,1]),A.push(m);var I=Bt(A);return I.computeVertexNormals(),I}function Mt(e){return e*Qt}function Lt(e,t){if(!e||!t)return 0;Array.isArray(e)||(e=e.toArray()),Array.isArray(t)||(t=t.toArray());var r=Mt(e[1]),i=Mt(t[1]),n=r-i,a=Mt(e[0])-Mt(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*=xt,Math.round(1e5*r)/1e5}function Rt(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+=Lt(t[i],t[i+1]);return r}var Ft={altitude:0,imageWidth:512,imageHeight:512,texture:null},Ut=function(r){ht(n,$e);var i=gt(n);function n(r,a,o,s){var A;at(this,n);var h=a=e.Util.extend({},Ft,a),l=h.altitude;h.imageHeight,h.imageWidth,r instanceof e.Extent||(r=new e.Extent(r));var c=r,u=c.xmin,g=c.ymin,d=c.xmax,f=c.ymax,p=1/0,v=1/0,m=-1/0,I=-1/0;[[u,g],[u,f],[d,f],[d,g]].forEach((function(e){var t=s.coordinateToVector3(e),r=t.x,i=t.y;p=Math.min(r,p),v=Math.min(i,v),m=Math.max(r,m),I=Math.max(i,I)}));var y=Math.abs(m-p),C=Math.abs(I-v),E=new t.PlaneGeometry(y,C);(A=i.call(this))._initOptions(a),A._createMesh(E,o);var B=s.distanceToVector3(l,l).x,w=s.coordinateToVector3(r.getCenter(),B);return A.getObject3d().position.copy(w),A.parent=null,A.type="Image",A}return st(n)}(),Nt=function(){function r(i,n,a,o,s,A){var h=this;at(this,r),this.threelayer=s,this.map=s.map,this.groupId=A,this.textureLoader=new t.TextureLoader;var l=i.split(","),c=n.split(","),u=parseFloat(l[0]),g=parseFloat(l[1]),d=parseFloat(c[0]),f=parseFloat(c[1]),p=o.maxZoom||11,v=o.renderOrder||0,m=o.opacity||1,I=o.minZoom||3,y=new e.Extent(u,g,d,f);this.xmin_g=u,this.ymin_g=g,this.xmax_g=d,this.ymax_g=f,this.cacheTextureFlag=o.cacheTextureFlag,this.cacheTexture={},this.textureLoader.load(a,(function(e){var r=new t.MeshBasicMaterial({map:e,transparent:!0,opacity:m}),i=new Ut(y,{imageWidth:512,imageHeight:512,maxZoom:p,minZoom:I,interactive:void 0!==o.interactive&&o.interactive},r,h.threelayer);i.object3d.renderOrder=v,h.imgMesh=i,h.imgMesh.parent=h,h.m=r,h.texture=e,h.groupId?h.threelayer.addMesh1(h.imgMesh,h.groupId):h.threelayer.addMesh(h.imgMesh),o.opacityItems&&o.opacityItems.length>0&&!isNaN(o.opacityItems[0])&&!isNaN(o.opacityItems[1])&&o.opacityItems[0]>3&&o.opacityItems[0]<=18&&o.opacityItems[1]>=0&&o.opacityItems[1]<=1&&(h.opacityItems=o.opacityItems,h._bindMapEvents(),h._viewChange()),h.cacheTextureFlag&&void 0===h.cacheTexture[a]&&(h.cacheTexture[a]=e)}))}return st(r,[{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(r,i){var n=this;if(i&&i.leftbottom&&i.righttop){var a=parseFloat(i.leftbottom[0]),o=parseFloat(i.leftbottom[1]),s=parseFloat(i.righttop[0]),A=parseFloat(i.righttop[1]);if(a!==this.xmin_g||o!==this.ymin_g||s!==this.xmax_g||A!==this.ymax_g){var h=new e.Extent(a,o,s,A),l=1/0,c=1/0,u=-1/0,g=-1/0;[[a,o],[a,A],[s,A],[s,o]].forEach((function(e){var t=n.threelayer.coordinateToVector3(e),r=t.x,i=t.y;l=Math.min(r,l),c=Math.min(i,c),u=Math.max(r,u),g=Math.max(i,g)}));for(var d=Math.abs(u-l),f=Math.abs(g-c),p=new t.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=a,this.ymin_g=o,this.xmax_g=s,this.ymax_g=A}}this.cacheTextureFlag?void 0===this.cacheTexture[r]?this.textureLoader.load(r,(function(e){e.magFilter=t.NearestFilter,e.minFilter=t.NearestFilter,n.imgMesh.object3d.material.map=e,n.imgMesh.object3d.material.map.needsUpdate=!0,n.cacheTexture[r]=e})):(this.imgMesh.object3d.material.map=this.cacheTexture[r],this.imgMesh.object3d.material.map.needsUpdate=!0):this.textureLoader.load(r,(function(e){n.texture&&n.texture.dispose(),delete n.texture,e.magFilter=t.NearestFilter,e.minFilter=t.NearestFilter,n.imgMesh.object3d.material.map=e,n.imgMesh.object3d.material.map.needsUpdate=!0,n.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}}]),r}(),Gt={interactive:!1,altitude:0,imageWidth:512,imageHeight:512,texture:null},Ot=function(r){ht(n,$e);var i=gt(n);function n(r,a,o,s,A){var h;at(this,n);var l=(o=e.Util.extend({},Gt,o)).altitude,c=A.distanceToVector3(a,a).x,u=new t.CircleGeometry(c,32);(h=i.call(this))._initOptions(o),h._createMesh(u,s);var g=A.distanceToVector3(l,l).x,d=A.coordinateToVector3(r,g);return h.getObject3d().position.copy(d),h.parent=null,h.type="radarObject",h}return st(n)}(),Pt=function(){function e(r,i,n,a,o,s){at(this,e),this.threelayer=a,this.map=a.map,this.layerClass=o,this.groupId=s,this.imgUrl=n.imgUrl,this.loader=new t.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var A=new t.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:t.DoubleSide,transparent:!0});this.radar=new Ot(r,i,{},A,a),this.radar.parent=this,this.groupId?this.threelayer.addMesh1(this.radar,this.groupId):this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return st(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}(),Ht={radius:100,altitude:0},qt=function(r){ht(n,$e);var i=gt(n);function n(r,a,o,s){var A;at(this,n),a=e.Util.extend({},Ht,a,{layer:s,coordinate:r}),(A=i.call(this))._initOptions(a);var h=a,l=h.altitude,c=h.radius,u=s.distanceToVector3(c,c).x,g=a.thetaStart||0,d=a.thetaLength||90,f=new t.CircleGeometry(u,128,g*Math.PI/180,d*Math.PI/180);A._createMesh(f,o);var p=s.distanceToVector3(l,l).x,v=s.coordinateToVector3(r,p);return A.getObject3d().position.copy(v),A}return st(n)}(),jt=function(){function e(r,i,n,a,o){at(this,e),this.threelayer=a,this.map=a.map,this.layerClass=o;var s=n.thetaLength||90,A=n.rotation||0,h=s/2;this.imgUrl=n.imgUrl,this.loader=new t.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 c=new t.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:t.DoubleSide,transparent:!0,depthTest:!1});this.sector=new qt(r,{thetaStart:l,thetaLength:n.thetaLength,radius:i},c,a),this.threelayer.addMesh(this.sector)}return st(e,[{key:"tick",value:function(e){this._uniforms.time.value+=2.4*e}},{key:"dispose",value:function(){}}]),e}(),zt={altitude:0,height:0},Vt=function(r){ht(n,$e);var i=gt(n);function n(r,a,o,s){var A;at(this,n),o=e.Util.extend({},zt,o,{layer:s}),A=i.call(this);var h=o,l=h.width,c=h.height,u=h.altitude;A._initOptions(o);var g=new t.PlaneGeometry(l,c);g.computeBoundingBox();var d=new t.Mesh(g,a);A._createGroup(),A.getObject3d().add(d);var f=s.distanceToVector3(u,u).x,p=s.coordinateToVector3(r,f);return d.position.set(0,g.boundingBox.max.y,0),A.getObject3d().position.copy(p),A}return st(n)}();function Jt(e,r,i,n,a,o){this.tilesHorizontal=r,this.tilesVertical=i,this.numberOfTiles=n,e.wrapS=e.wrapT=t.RepeatWrapping,e.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=a,this.currentDisplayTime=0,this.currentTile=0,this.flag=o,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 Kt=function(){function e(r,i,n,a,o){var s=this;at(this,e),this.threelayer=a,this.map=a.map,this.layerClass=o;var A=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 h=n.rotation||0,l=A/2,c=a.distanceToVector3(i,i).x,u=Math.sin(l*Math.PI/180)*c*2,g=void 0===n.flag;this.imgUrl=n.imgUrl,this.textureLoader=new t.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(e){s.texture=e,s.annie=new Jt(e,s.tilesHoriz,s.tilesVert,s.numTiles,s.duration,g);var i=new t.MeshBasicMaterial({transparent:!0,map:e,side:t.DoubleSide,depthTest:!1});s.imgObj=new Vt(r,i,{width:u,height:c},a),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 st(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}(),Yt={radius:100,altitude:0},Wt=function(r){ht(n,$e);var i=gt(n);function n(r,a,o,s){var A;at(this,n),a=e.Util.extend({},Yt,a,{layer:s}),A=i.call(this);var h=a,l=h.width;h.height;var c=h.altitude;A._initOptions(a);var u=new t.CircleGeometry(l,32);A._createMesh(u,o);var g=s.distanceToVector3(c,c).x,d=s.coordinateToVector3(r,g);return A.getObject3d().position.copy(d),A}return st(n)}(),Xt=function(){function e(r,i,n,a){var o=this;at(this,e),this.threelayer=n,this.map=n.map,this.layerClass=a,this.time=0,n.coordinateToVector3(r,0),this.imgUrl=i.imgUrl,this.textureLoader=new t.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(e){o.texture=e,o._uniforms={impactPosition:{value:new t.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:o.texture}};var i=new t.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:t.DoubleSide,transparent:!0,depthTest:!1}),a=new Wt(r,{width:2,height:2},i,n);o.threelayer.addMesh(a),o.layerClass.updatables.push(o)}))}return st(e,[{key:"tick",value:function(e){this.time+=.2*e,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),e}(),Zt=6371008.8,$t={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*Zt,kilometers:6371.0088,kilometres:6371.0088,meters:Zt,metres:Zt,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:Zt/1852,radians:1,yards:6967335.223679999};function er(e){return e%360*Math.PI/180}function tr(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 rr(e,t,r){void 0===r&&(r={});var i=tr(e),n=tr(t),a=er(n[1]-i[1]),o=er(n[0]-i[0]),s=er(i[1]),A=er(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=$t[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 ir(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 nr=document.createElement("canvas"),ar=function(){function r(){at(this,r),this.type="gisCommon"}var i;return st(r,null,[{key:"getTexture",value:function(e,r,i,n){var a=e.getContext("2d");a.drawImage(r,i,n);var o=new t.Texture(a.getImageData(0,0,e.width,e.height));return o.minFilter=t.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{key:"getTexture1",value:function(e,r,i,n,a){nr.width=nr.height=128;var o=nr.getContext("2d");o.drawImage(e,r,i,n,a);var s=new t.Texture(o.getImageData(0,0,nr.width,nr.height));return s.minFilter=t.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,r,i){if(1e3*rr({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[r.x,r.y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:e}},"kilometers")<r.radius){var n=i.coordinateToVector3([r.x,r.y],0),a=i.coordinateToVector3(e,0).sub(n).normalize(),o=i.distanceToVector3(r.radius,r.radius).x,s=new t.Vector3(n.x,n.y+o,0).sub(n).normalize(),A=((a.clone().cross(s).z<0?-1:1)*Math.acos(a.dot(s))*180/Math.PI).toFixed(2);(A=parseFloat(A))<0&&(A=A+180+180);var h=parseFloat(r.begin),l=parseFloat(r.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*rr({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=tr(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(ir(n,A[l][0],r.ignoreBoundary)){for(var c=!1,u=1;u<A[l].length&&!c;)ir(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(t,r){var i,n;Array.isArray(t)?(i=t[0],n=t[1]):t instanceof e.Coordinate&&(i=t.x,n=t.y);var a=r.xmin,o=r.ymin,s=r.xmax,A=r.ymax;return a<=i&&i<=s&&o<=n&&n<=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,r,i){nr.width=r,nr.height=i;var n=nr.getContext("2d");n.drawImage(e,0,0,r,i);var a=new t.Texture(n.getImageData(0,0,nr.width,nr.height));return a.magFilter=t.NearestFilter,a.minFilter=t.NearestFilter,a.generateMipmaps=!1,a.needsUpdate=!0,a}},{key:"generateTexture",value:function(e){var r=[64,128,256,512,1024],i=-1/0;e.forEach((function(e){i=Math.max(i,e.w),Math.max(i,e.h)}));var n=Math.sqrt(e.length),a=parseInt(n);n>a&&(a+=1);for(var o=(n=a)*i+5*n,s=0,A=0;A<r.length;A++){if(o<r[A]){s=r[A];break}s=1024}nr.width=nr.height=s;for(var h=nr.getContext("2d"),l=0,c=0,u=[],g=0;g<n;g++){for(var d=5*(g+1)+g*l,f=0;f<n;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 t.Texture(h.getImageData(0,0,nr.width,nr.height));return B.minFilter=t.LinearFilter,B.generateMipmaps=!1,B.needsUpdate=!0,{xys:u,texture:B,textureSize:s}}},{key:"generateTextureNew",value:function(e){var r=[64,128,256,512,1024],i=-1/0;e.forEach((function(e){i=Math.max(i,e.w),Math.max(i,e.h)}));var n=Math.sqrt(e.length),a=parseInt(n);n>a&&(a+=1);for(var o=(n=a)*i+5*n,s=0,A=0;A<r.length;A++){if(o<r[A]){s=r[A];break}s=1024}nr.width=nr.height=s;for(var h=nr.getContext("2d"),l=0,c=0,u=0,g=[],d=0;d<n;d++){for(var f=5*(d+1)+d*l,p=0;p<n;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 t.Texture(h.getImageData(0,0,nr.width,nr.height));return w.minFilter=t.LinearFilter,w.generateMipmaps=!1,w.needsUpdate=!0,{xys:g,texture:w,textureSize:s}}},{key:"generateGifTexture",value:(i=nt(tt().mark((function e(i,n,a){var o,s,A,h,l,c,u,g,d,f,p,v,m;return tt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=Math.sqrt(i.length),s=parseInt(o),A=s,o>s&&(A+=1),(h=document.createElement("canvas")).width=s*n,h.height=A*a,l=h.getContext("2d"),c=0,u=0;case 10:if(!(u<o)){e.next=32;break}g=u*a,d=0,f=0;case 14:if(!(f<o)){e.next=27;break}return p=d,e.next=18,r.addImageProcessImage(i[c]);case 18:if(v=e.sent,l.drawImage(v,p,g,n,a),d+=n,!((c+=1)>=i.length)){e.next=24;break}return e.abrupt("break",27);case 24:f++,e.next=14;break;case 27:if(!(c>=i.length)){e.next=29;break}return e.abrupt("break",32);case 29:u++,e.next=10;break;case 32:return(m=new t.Texture(l.getImageData(0,0,h.width,h.height))).generateMipmaps=!1,m.needsUpdate=!0,e.abrupt("return",{texture:m,colNum:s,rowNum:A});case 36:case"end":return e.stop()}}),e)}))),function(e,t,r){return i.apply(this,arguments)})},{key:"generateTextureOptimize",value:function(e){var r=[64,128,256,512,1024],i=-1/0;e.forEach((function(e){i=Math.max(i,e.w),Math.max(i,e.h)}));var n=Math.sqrt(e.length),a=parseInt(n);n>a&&(a+=1);for(var o=(n=a)*i+5*n,s=0,A=0;A<r.length;A++){if(o<r[A]){s=r[A];break}s=1024}nr.width=nr.height=s;for(var h=nr.getContext("2d"),l=0,c=0,u={},g=0;g<n;g++){for(var d=5*(g+1)+g*l,f=0,p=0;p<n;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 t.Texture(h.getImageData(0,0,nr.width,nr.height));return y.minFilter=t.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,r){nr.width=nr.height=e;var i=nr.width/2,n=nr.height/2;if(r){var a=0;r.forEach((function(e){var t=nr.getContext("2d");t.fillStyle=e.fontcolor,t.font="".concat(e.fontsize,"px Arial"),t.textAlign="center",t.textBaseline="middle",t.fillText(e.txt,i,n+a),a+=e.fontsize}))}var o=new t.Texture(nr);return o.minFilter=t.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{key:"createTextAndBgTexture",value:function(e,r,i,n){var a=document.createElement("canvas");a.width=e,a.height=r;var o=a.getContext("2d");o.drawImage(i,0,0,e,r);var s=a.width/2,A=a.height/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle="#FFF",o.font="".concat(n.fontsize,"px Arial"),o.fillText(n.txt,s,A);var h=new t.Texture(a);return h.magFilter=t.NearestFilter,h.minFilter=t.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 r=e>>16&255,i=e>>8&255,n=255&e;return new t.Color("rgb(".concat(r,",").concat(i,",").concat(n,")"))}},{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}}]),r}();function or(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 sr=Ar;function Ar(e,t){this.x=e,this.y=t}Ar.prototype={clone:function(){return new Ar(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}},Ar.convert=function(e){return e instanceof Ar?e:Array.isArray(e)?new Ar(e[0],e[1]):e};var hr={radius:40,altitude:0},lr=function(r){ht(n,$e);var i=gt(n);function n(r,a,o,s,A,h,l,c){var u;at(this,n);var g=Tt(r);u=i.call(this),a=e.Util.extend({center:g,layer:c},hr,a),u._initOptions(a);var d=u.getLayer().getPick();u._colorMap={},u._datas=r,u._childCount=l;var f=c.coordinateToVector3(g);u.glyphMap=A,u.glyphAtlas=h;for(var p=new t.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]),I=new t.InstancedBufferAttribute(new Float32Array(4*u._childCount),4,!0),y=new t.InstancedBufferAttribute(new Float32Array(4*u._childCount),4,!0),C=new t.InstancedBufferAttribute(new Float32Array(4*u._childCount),4,!0),E=new t.InstancedBufferAttribute(new Float32Array(4*u._childCount),4,!0),B=new t.InstancedBufferAttribute(new Float32Array(3*u._childCount),3,!0),w=0,Q=function(e){var t=r[e],i=t.texts,n=t.markers,a=d.getColor(),o=a.getHex();u._colorMap[o]=e,u._datas[e].colorIndex=o,n&&n.forEach((function(t){if(I.setXYZW(w,t.markerWidth,t.markerHeight,t.markerDx,t.markerDy),y.setXYZW(w,t.u,t.v,-16,16),t.markerColor){var i=_t(0,255);E.setXYZW(w,i,0,0,0);var n=u.getColorVector2(t.markerColor,t.markerOpacity);C.setXYZW(w,n[0],n[1],t.w,t.h)}else{var o=_t(0,0);E.setXYZW(w,o,0,0,0);var s=u.getColorVector2("#fff",t.markerOpacity);C.setXYZW(w,s[0],s[1],t.w,t.h)}B.setXYZ(w,a.r,a.g,a.b),t.markerIndex=w,w+=1,r[e].childNum+=1})),i&&i.forEach((function(t){var i=u.getColorVector2(t.textColor,t.textOpacity),n=_t(255,0);u.buildTextBuffers("".concat(t.text),t.textAnchor,"center",t.textSpacing).forEach((function(o){if(I.setXYZW(w,t.textSize,0,t.textDx,t.textDy),y.setXYZW(w,o[0],o[1],o[2],o[3]),t.textHaloColor){var s=u.getColorVector2(t.textHaloColor,t.textHaloOpacity);C.setXYZW(w,i[0],i[1],s[0],s[1]);var A=t.textHaloRadius;E.setXYZW(w,n,A,0,0)}else C.setXYZW(w,i[0],i[1],0,0),E.setXYZW(w,n,-1.9,0,0);B.setXYZ(w,a.r,a.g,a.b),t.textIndex.push(w),w+=1,r[e].childNum+=1}))}))},x=0;x<r.length;x++)Q(x);p.setIndex(new t.Uint16BufferAttribute(v,1)),p.setAttribute("uv_offset",new t.Float32BufferAttribute(m,4,!0)),p.setAttribute("size",I),p.setAttribute("uv_image",y),p.setAttribute("color",C),p.setAttribute("util",E),p.setAttribute("pickingColor",B),u._createInstancedMesh(p,o,u._childCount),u.getObject3d().instanceMatrix.setUsage(t.DynamicDrawUsage);var b=new t.InstancedMesh(p,s,u._childCount);b.instanceMatrix.setUsage(t.DynamicDrawUsage);var k=d.getColor().getHex();b._colorIndex=k,u.setPickObject3d(b);var S=new t.Object3D;w=0,r.forEach((function(e,t){var i=c.coordinateToVector3(e.coordinate);i.sub(f),e.height&&(i.z=c.altitudeToVector3(e.height).x);for(var n=0;n<r[t].childNum;n++)!1===e.visible?S.position.set(-999,-999,0):S.position.set(i.x,i.y,0),S.updateMatrix(),u.getObject3d().setMatrixAt(w,S.matrix),b.setMatrixAt(w,S.matrix),w+=1}));var _=c.altitudeToVector3(a.altitude,a.altitude).x;return f.z=_,u.getObject3d().position.copy(f),b.position.copy(u.getObject3d().position),u.parent=null,u.pickMesh=b,u.threeLayer=c,u.center=f,u._init(),u}return st(n,[{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,r){var i,n=new t.Color(e).getHexString(),a=(i="#".concat(n),{r:parseInt(i.slice(1,3),16),g:parseInt(i.slice(3,5),16),b:parseInt(i.slice(5,7),16)}),o=a.b;return[_t(a.r,a.g),_t(o,void 0!==r?r:255)]}},{key:"buildTextBuffers",value:function(e,t,r,i){var n=[],a=[0,0],o=or(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 sr(d,f),I=new sr(p,f),y=new sr(d,v),C=new sr(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,r=new t.Object3D;this._datas.forEach((function(t,i){var n=e.threeLayer.coordinateToVector3(t.coordinate);n.sub(e.center),t.height&&(n.z=e.threeLayer.altitudeToVector3(t.height).x),!1===t.visible?r.position.set(-999,-999,0):r.position.set(n.x,n.y,0),r.updateMatrix(),t.markers&&t.markers.forEach((function(t){e.getObject3d().setMatrixAt(t.markerIndex,r.matrix),e.pickMesh.setMatrixAt(t.markerIndex,r.matrix)})),t.texts&&t.texts.forEach((function(t){t.textIndex.forEach((function(t){e.getObject3d().setMatrixAt(t,r.matrix),e.pickMesh.setMatrixAt(t,r.matrix)}))}))})),this.getObject3d().instanceMatrix.needsUpdate=!0,this.pickMesh.instanceMatrix.needsUpdate=!0}}]),n}(),cr=function(){function e(t,r){at(this,e),this.createImage(t,1,r)}return st(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 ur=st((function e(t){at(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),c=l.w,u=l.h,g=new cr({width:c||1,height:u||1});for(var d in t){var f=t[d];for(var p in f){var v=f[+p];if(v&&0!==v.bitmap.width&&0!==v.bitmap.height){var m=r[d][p].rect;cr.copy(v.bitmap,g,{x:0,y:0},{x:m.x+1,y:m.y+1},v.bitmap)}}}this.image=g,this.positions=r})),gr={exports:{}};gr.exports=fr,gr.exports.default=fr;var dr=1e20;function fr(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 pr(e,t,r,i,n,a){for(var o=0;o<t;o++)vr(e,o,t,r,i,n,a);for(var s=0;s<r;s++)vr(e,s*t,1,t,i,n,a)}function vr(e,t,r,i,n,a,o){var s,A,h,l;for(a[0]=0,o[0]=-dr,o[1]=dr,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]=dr}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)}}fr.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(dr,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]=dr;else if(0===c)a[l]=dr,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),pr(this.gridOuter,r,n,this.f,this.v,this.z),pr(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}}},fr.prototype.draw=function(e){return this._draw(e,!1).data},fr.prototype.drawWithMetrics=function(e){return this._draw(e,!0)};var mr=gr.exports,Ir={},yr={};var Cr=function(){function r(e,t,i,n){var a=this;at(this,r);var o=t.pointMinZoom,s=t.pointOrder;if(0!=e.length){var A=[];this.charArray="",this.imgDict={},this.threeLayer=i,this.map=i.map,this.interactive=void 0===t.interactive||t.interactive,this.beginSizeZoom=t.beginSizeZoom||3,this.endSizeZoom=t.endSizeZoom||12,this.spanSizeZoom=this.endSizeZoom-this.beginSizeZoom,this.stepSize=1/(this.endSizeZoom-this.beginSizeZoom+1),this.altitude=t.altitude||0,this.groupId=n,"EPSG:4326"===this.map.getSpatialReference().getProjection().code?this.tileResolution=.0006866455078125:this.tileResolution=76.43702828517625,this.textMinZoom=t.textMinZoom||0,this.textMaxZoom=t.textMaxZoom||30,this.textMinMaxZooms=t.textMinMaxZooms,this.hasAlign=t.hasAlign||!1,this.childCount=0,e.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=t.pointMaxZoom||20,this.order=s||0,this.isToolTip=t.isToolTip||!1,this.clickFunc=t.clickFunc||null,this.cFunc=t.cFunc||null,this.mouseMoveFunc=t.mouseMoveFunc||null,this.mouseOutFunc=t.mouseOutFunc||null,this.mMoveFunc=t.mMoveFunc||null,this.hasAlign=t.hasAlign||!1,this.zoomChangeCallback=t.zoomChangeCallback}else console.error("需要绘制的点位数量为0")}var i,n,a,o;return st(r,[{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=St(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:(o=nt(tt().mark((function e(){var t,r,i,n,a;return tt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],e.t0=tt().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,ar.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",ar.generateTextureOptimize(t));case 19:case"end":return e.stop()}}),e,this)}))),function(){return o.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=Ir[t];return s||(s=Ir[t]=new mr(24,3,8,.25,n,a)),yr[t]||(yr[t]={}),yr[t][r]||(yr[t][r]=s.ctx.measureText(r).width),{id:o,bitmap:new cr({width:30,height:30},s.draw(r)),metrics:{width:24,height:24,left:0,top:-5,advance:(e=o,e>=19968&&e<=40959?24:yr[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 ur(this.glyphMap)}},{key:"addPoint",value:(a=nt(tt().mark((function e(){var r,i,n,a,o,s,A,h=this;return tt().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 r=e.sent,this.textures||(this.textures=[]),this.textures.push(r.texture),this.initGlyphAtlas(),i=this.glyphAtlas.image,n=i.width,a=i.height,o=i.data,(s=new t.DataTexture(o,n,a)).needsUpdate=!0,s.magFilter=t.LinearFilter,s.minFilter=t.LinearFilter,s.format=t.RedFormat,this.textures.push(s),this.m=this._getRawShaderMaterial(r,s,n,a),this.m.depthTest=!1,this.hasAlign&&(this.m.vertexShader="#define HAS_ALIGN\n"+this.m.vertexShader),this.m_pick=this._getRawShaderMaterial(r,s,n,a),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,r.xys[e.key])}))})),(A=new lr(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(){h.m.uniforms.cameraToCenterDistance.value=h.map.cameraToCenterDistance,h.m.uniforms.zoomScale.value=h.tileResolution/h.map.getResolution(),h.m_pick.uniforms.cameraToCenterDistance.value=h.map.cameraToCenterDistance,h.m_pick.uniforms.zoomScale.value=h.tileResolution/h.map.getResolution();for(var e=h._getRate(),t=h.point.object3d.geometry.attributes.size.array,r=0,i=0;i<h.dataItems.length;i++){var n=h.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()}h.point.object3d.geometry.attributes.size.needsUpdate=!0,h.zoomChangeCallback&&h.zoomChangeCallback()},this.isToolTip&&A.setToolTip("hello",{showTimeout:0,eventsPropagation:!0,dx:10}),A.object3d.renderOrder=this.order,this.point=A,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 a.apply(this,arguments)})},{key:"_getRawShaderMaterial",value:function(e,r,i,n){return new t.RawShaderMaterial({uniforms:{imgTexture:{type:"t",value:e.texture},imgTextureSize:{type:"f",value:e.textureSize},sdfTexture:{type:"t",value:r},sdfTextureSize:{value:[i,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:t.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:(n=nt(tt().mark((function e(t){return tt().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 n.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:(i=nt(tt().mark((function e(t){return tt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(e){return i.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(t,r,i){for(var n,a=1/0,o=1/0,s=-1/0,A=-1/0,h=0;h<this.dataItems.length;h++){var l=this.dataItems[h];t.includes(l.code)?(a=Math.min(a,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===(n=this.point)||void 0===n||n.changeVisible(),r&&this.map.fitExtent(new e.Extent(a,o,s,A),i||0)}},{key:"updateByZoom",value:function(){var e=this,r=this.map.getZoom(),i=new t.Object3D,n=0;this.dataItems.forEach((function(t){var a=e.threeLayer.coordinateToVector3(t.coordinate);if(a.sub(e.point.center),t.height&&(a.z=e.threeLayer.altitudeToVector3(t.height).x),t.markers&&(n+=t.markers.length),t.value&&e.showValueFlag)for(var o=0;o<t.value.length;o++)r<e.valueMinZoom||r>e.valueMaxZoom?i.position.set(-999,-999,0):i.position.set(a.x,a.y,0),i.updateMatrix(),e.point.getObject3d().setMatrixAt(n,i.matrix),e.point.pickMesh.setMatrixAt(n,i.matrix),n+=1;if(t.name&&e.showNameFlag)for(var s=0;s<t.name.length;s++)r<e.nameMinZoom||r>e.nameMaxZoom?i.position.set(-999,-999,0):i.position.set(a.x,a.y,0),i.updateMatrix(),e.point.getObject3d().setMatrixAt(n,i.matrix),e.point.pickMesh.setMatrixAt(n,i.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(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}}]),r}();function Er(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 Br=function(){function e(){at(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 st(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}(),wr=function(){function e(){var t=this;at(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 st(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}(),Qr=3,xr=4,br=6378137,kr=6356752.314245179;function Sr(e){return e===Qr||e===xr}function _r(e,t){return e.__lastFrameVisited===t&&e.__used}function Tr(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 Dr(e,t,r){if(Tr(e,t),e.__used=!0,r.markUsed(e),e.__contentEmpty)for(var i=e.children,n=0,a=i.length;n<a;n++)Dr(i[n],t,r)}function Mr(e,t,r){if(e.__contentEmpty&&(!e.__externalTileSet||Sr(e.__loadingState)))for(var i=e.children,n=0,a=i.length;n<a;n++){var o=i[n];o.__depthFromRenderedParent=t,Mr(o,t,r)}else r.requestTileContents(e)}function Lr(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++)Lr(a[o],t,r,e,n+1);r&&r(e,i,n)}}function Rr(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(Tr(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=Rr(l[c],t);h=h||g}if(h&&o)for(var d=0,f=l.length;d<f;d++){Dr(l[d],i,s)}return!0}function Fr(e,t){var r=t.stats,i=t.frameCount;if(_r(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||_r(A,i)}if(a){for(var h=!1,l=!0,c=0,u=n.length;c<u;c++){var g=n[c];if(Fr(g,t),h=h||g.__wasSetVisible||g.__childrenWereVisible,_r(g,i)){var d=g.__allChildrenLoaded||!g.__contentEmpty&&Sr(g.__loadingState)||g.__externalTileSet&&g.__loadingState===xr;l=l&&d}}e.__childrenWereVisible=h,e.__allChildrenLoaded=l}else e.__isLeaf=!0}}function Ur(e,t){var r=t.stats,i=t.frameCount;if(_r(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===Qr?(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=Sr(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];_r(m,i)&&!o.isFull()&&(m.__depthFromRenderedParent=e.__depthFromRenderedParent+1,Mr(m,m.__depthFromRenderedParent,t))}else for(var I=0,y=d.length;I<y;I++){var C=d[I];_r(C,i)&&Ur(C,t)}}}function Nr(e,t){var r=_r(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!==Qr||(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++){Nr(a[o],t)}}}var Gr=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},Or=function(e){return 1/(e.__depthFromRenderedParent+1)},Pr=function(){function e(t,r){at(this,e),this.tileSets={},this.rootURL=t,this.fetchOptions={},this.preprocessURL=null;var i=new Br;i.unloadPriorityCallback=Or;var n=new wr;n.maxJobs=4,n.priorityCallback=Gr;var a=new wr;a.maxJobs=1,a.priorityCallback=Gr,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 st(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&&Lr(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++,Rr(n,this),Fr(n,this),Ur(n,this),Nr(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=Er(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===xr&&(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(),Lr(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=xr):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=Qr,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=Er(e.content.uri);return t.parseTile(i,e,r)}))})).then((function(){e.__loadIndex===s&&(r.parsing--,e.__loadingState=Qr,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 Hr(e){return(new TextDecoder).decode(e)}var qr=function(){function e(t,r,i,n){at(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(Hr(o))}else a={};this.header=a}return st(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}(),jr=function(e){ht(r,qr);var t=gt(r);function r(e,i,n,a,o){var s;return at(this,r),(s=t.call(this,e,n,a,o)).batchSize=i,s}return st(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 ft(lt(r.prototype),"getData",this).call(this,e,this.batchSize,t,i)}}]),r}(),zr=function(){function e(){at(this,e),this.fetchOptions={},this.workingPath=""}return st(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 Vr(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 Jr=function(e){ht(r,zr);var t=gt(r);function r(){return at(this,r),t.apply(this,arguments)}return st(r,[{key:"parse",value:function(e){var t=new DataView(e),r=Vr(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 qr(h,0,a,o),c=28+a+o,u=e.slice(c,c+s+A),g=new jr(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}(),Kr=function(e){ht(r,A);var t=gt(r);function r(e){var i;return at(this,r),(i=t.call(this,e)).dracoLoader=null,i.ktx2Loader=null,i.meshoptDecoder=null,i.pluginCallbacks=[],i.register((function(e){return new ei(e)})),i.register((function(e){return new si(e)})),i.register((function(e){return new Ai(e)})),i.register((function(e){return new ri(e)})),i.register((function(e){return new ii(e)})),i.register((function(e){return new ni(e)})),i.register((function(e){return new ai(e)})),i.register((function(e){return new $r(e)})),i.register((function(e){return new oi(e)})),i.register((function(e){return new ti(e)})),i.register((function(e){return new Xr(e)})),i.register((function(e){return new hi(e)})),i.register((function(e){return new li(e)})),i}return st(r,[{key:"load",value:function(e,t,r,i){var n,a=this;n=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:o.extractUrlBase(e),this.manager.itemStart(e);var A=function(t){i?i(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},h=new s(this.manager);h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(e,(function(r){try{a.parse(r,n,(function(r){t(r),a.manager.itemEnd(e)}),A)}catch(e){A(e)}}),r,A)}},{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,r,i){var n,a={},s={};if("string"==typeof e)n=JSON.parse(e);else if(e instanceof ArrayBuffer){if(o.decodeText(new Uint8Array(e,0,4))===ci){try{a[Wr.KHR_BINARY_GLTF]=new di(e)}catch(e){return void(i&&i(e))}n=JSON.parse(a[Wr.KHR_BINARY_GLTF].content)}else n=JSON.parse(o.decodeText(new Uint8Array(e)))}else n=e;if(void 0===n.asset||n.asset.version[0]<2)i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var A=new Ni(n,{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,a[l.name]=!0}if(n.extensionsUsed)for(var c=0;c<n.extensionsUsed.length;++c){var u=n.extensionsUsed[c],g=n.extensionsRequired||[];switch(u){case Wr.KHR_MATERIALS_UNLIT:a[u]=new Zr;break;case Wr.KHR_DRACO_MESH_COMPRESSION:a[u]=new fi(n,this.dracoLoader);break;case Wr.KHR_TEXTURE_TRANSFORM:a[u]=new pi;break;case Wr.KHR_MESH_QUANTIZATION:a[u]=new vi;break;default:g.indexOf(u)>=0&&void 0===s[u]&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}A.setExtensions(a),A.setPlugins(s),A.parse(r,i)}}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(i,n){r.parse(e,t,i,n)}))}}]),r}();function Yr(){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 Wr={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"},Xr=function(){function e(t){at(this,e),this.parser=t,this.name=Wr.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return st(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,r="light:"+e,i=t.cache.get(r);if(i)return i;var n,a=t.json,o=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e],s=new h(16777215);void 0!==o.color&&s.fromArray(o.color);var A=void 0!==o.range?o.range:0;switch(o.type){case"directional":(n=new u(s)).target.position.set(0,0,-1),n.add(n.target);break;case"point":(n=new c(s)).distance=A;break;case"spot":(n=new l(s)).distance=A,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,n.angle=o.spot.outerConeAngle,n.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,n.target.position.set(0,0,-1),n.add(n.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return n.position.set(0,0,0),n.decay=2,Mi(n,o),void 0!==o.intensity&&(n.intensity=o.intensity),n.name=t.createUniqueName(o.name||"light_"+e),i=Promise.resolve(n),t.cache.add(r,i),i}},{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}(),Zr=function(){function e(){at(this,e),this.name=Wr.KHR_MATERIALS_UNLIT}return st(e,[{key:"getMaterialType",value:function(){return g}},{key:"extendParams",value:function(e,t,r){var i=[];e.color=new h(1,1,1),e.opacity=1;var n=t.pbrMetallicRoughness;if(n){if(Array.isArray(n.baseColorFactor)){var a=n.baseColorFactor;e.color.fromArray(a),e.opacity=a[3]}void 0!==n.baseColorTexture&&i.push(r.assignTexture(e,"map",n.baseColorTexture,d))}return Promise.all(i)}}]),e}(),$r=function(){function e(t){at(this,e),this.parser=t,this.name=Wr.KHR_MATERIALS_EMISSIVE_STRENGTH}return st(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}(),ei=function(){function e(t){at(this,e),this.parser=t,this.name=Wr.KHR_MATERIALS_CLEARCOAT}return st(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f: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];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&n.push(r.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&n.push(r.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(n.push(r.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){var o=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new p(o,o)}return Promise.all(n)}}]),e}(),ti=function(){function e(t){at(this,e),this.parser=t,this.name=Wr.KHR_MATERIALS_IRIDESCENCE}return st(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f: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}(),ri=function(){function e(t){at(this,e),this.parser=t,this.name=Wr.KHR_MATERIALS_SHEEN}return st(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f: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=[];t.sheenColor=new h(0,0,0),t.sheenRoughness=0,t.sheen=1;var a=i.extensions[this.name];return void 0!==a.sheenColorFactor&&t.sheenColor.fromArray(a.sheenColorFactor),void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&n.push(r.assignTexture(t,"sheenColorMap",a.sheenColorTexture,d)),void 0!==a.sheenRoughnessTexture&&n.push(r.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(n)}}]),e}(),ii=function(){function e(t){at(this,e),this.parser=t,this.name=Wr.KHR_MATERIALS_TRANSMISSION}return st(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f: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}(),ni=function(){function e(t){at(this,e),this.parser=t,this.name=Wr.KHR_MATERIALS_VOLUME}return st(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f: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];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&n.push(r.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;var o=a.attenuationColor||[1,1,1];return t.attenuationColor=new h(o[0],o[1],o[2]),Promise.all(n)}}]),e}(),ai=function(){function e(t){at(this,e),this.parser=t,this.name=Wr.KHR_MATERIALS_IOR}return st(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f: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}(),oi=function(){function e(t){at(this,e),this.parser=t,this.name=Wr.KHR_MATERIALS_SPECULAR}return st(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f: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];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&n.push(r.assignTexture(t,"specularIntensityMap",a.specularTexture));var o=a.specularColorFactor||[1,1,1];return t.specularColor=new h(o[0],o[1],o[2]),void 0!==a.specularColorTexture&&n.push(r.assignTexture(t,"specularColorMap",a.specularColorTexture,d)),Promise.all(n)}}]),e}(),si=function(){function e(t){at(this,e),this.parser=t,this.name=Wr.KHR_TEXTURE_BASISU}return st(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}(),Ai=function(){function e(t){at(this,e),this.parser=t,this.name=Wr.EXT_TEXTURE_WEBP,this.isSupported=null}return st(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}(),hi=function(){function e(t){at(this,e),this.name=Wr.EXT_MESHOPT_COMPRESSION,this.parser=t}return st(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}(),li=function(){function e(t){at(this,e),this.name=Wr.EXT_MESH_GPU_INSTANCING,this.parser=t}return st(e,[{key:"createNodeMesh",value:function(e){var t=this,r=this.parser.json,i=r.nodes[e];if(!i.extensions||!i.extensions[this.name]||void 0===i.mesh)return null;var o,s=Ct(r.meshes[i.mesh].primitives);try{for(s.s();!(o=s.n()).done;){var A=o.value;if(A.mode!==Ci.TRIANGLES&&A.mode!==Ci.TRIANGLE_STRIP&&A.mode!==Ci.TRIANGLE_FAN&&void 0!==A.mode)return null}}catch(e){s.e(e)}finally{s.f()}var h=i.extensions[this.name].attributes,l=[],c={},u=function(e){l.push(t.parser.getDependency("accessor",h[e]).then((function(t){return c[e]=t,c[e]})))};for(var g in h)u(g);return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then((function(e){var r,i=e.pop(),o=i.isGroup?i.children:[i],s=e[0].count,A=[],h=Ct(o);try{for(h.s();!(r=h.n()).done;){for(var l=r.value,u=new a,g=new v,d=new n,f=new v(1,1,1),p=new m(l.geometry,l.material,s),y=0;y<s;y++)c.TRANSLATION&&g.fromBufferAttribute(c.TRANSLATION,y),c.ROTATION&&d.fromBufferAttribute(c.ROTATION,y),c.SCALE&&f.fromBufferAttribute(c.SCALE,y),p.setMatrixAt(y,u.compose(g,d,f));for(var C in c)"TRANSLATION"!==C&&"ROTATION"!==C&&"SCALE"!==C&&l.geometry.setAttribute(C,c[C]);I.prototype.copy.call(p,l),p.frustumCulled=!1,t.parser.assignFinalMaterial(p),A.push(p)}}catch(e){h.e(e)}finally{h.f()}return i.isGroup?(i.clear(),i.add.apply(i,A),i):A[0]})))}}]),e}(),ci="glTF",ui=1313821514,gi=5130562,di=st((function e(t){at(this,e),this.name=Wr.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,12);if(this.header={magic:o.decodeText(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==ci)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,n=new DataView(t,12),a=0;a<i;){var s=n.getUint32(a,!0);a+=4;var A=n.getUint32(a,!0);if(a+=4,A===ui){var h=new Uint8Array(t,12+a,s);this.content=o.decodeText(h)}else if(A===gi){var l=12+a;this.body=t.slice(l,l+s)}a+=s}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),fi=function(){function e(t,r){if(at(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Wr.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return st(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=xi[h]||h.toLowerCase();o[l]=a[h]}for(var c in e.attributes){var u=xi[c]||c.toLowerCase();if(void 0!==a[c]){var g=r.accessors[e.attributes[c]],d=Ei[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}(),pi=function(){function e(){at(this,e),this.name=Wr.KHR_TEXTURE_TRANSFORM}return st(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}(),vi=st((function e(){at(this,e),this.name=Wr.KHR_MESH_QUANTIZATION})),mi=function(e){ht(r,he);var t=gt(r);function r(e,i,n,a){return at(this,r),t.call(this,e,i,n,a)}return st(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}(),Ii=new n,yi=function(e){ht(r,mi);var t=gt(r);function r(){return at(this,r),t.apply(this,arguments)}return st(r,[{key:"interpolate_",value:function(e,t,i,n){var a=ft(lt(r.prototype),"interpolate_",this).call(this,e,t,i,n);return Ii.fromArray(a).normalize().toArray(a),a}}]),r}(),Ci={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},Ei={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Bi={9728:z,9729:E,9984:V,9985:J,9986:K,9987:B},wi={33071:Y,33648:W,10497:w},Qi={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},xi={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},bi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},ki={CUBICSPLINE:void 0,LINEAR:re,STEP:ae},Si="OPAQUE",_i="MASK",Ti="BLEND";function Di(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 Mi(e,t){void 0!==t.extras&&("object"===rt(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Li(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 Ri(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 Fi(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 Ui=new a,Ni=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};at(this,e),this.json=t,this.extensions={},this.plugins={},this.options=r,this.cache=new Yr,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,n=!1,a=-1;"undefined"!=typeof navigator&&(i=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),a=(n=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||i||n&&a<98?this.textureLoader=new Z(this.options.manager):this.textureLoader=new $(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new s(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return st(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:{}};Di(n,a,i),Mi(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=Ct(t.children.entries());try{for(o.s();!(a=o.n()).done;){var s=mt(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],r=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[Wr.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(e,n){r.load(o.resolveURL(t.uri,i.path),e,void 0,(function(){n(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,r=this.json,n=this.json.accessors[e];if(void 0===n.bufferView&&void 0===n.sparse){var a=Qi[n.type],o=Ei[n.componentType],s=!0===n.normalized,A=new o(n.count*a);return Promise.resolve(new i(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=Qi[n.type],h=Ei[n.componentType],l=h.BYTES_PER_ELEMENT,c=l*A,u=n.byteOffset||0,g=void 0!==n.bufferView?r.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 y(a,g/l),t.cache.add(p,v)),o=new C(v,A,u%g/l,d)}else a=null===s?new h(n.count*A):new h(s,u,n.count*A),o=new i(a,A,d);if(void 0!==n.sparse){var m=Qi.SCALAR,I=Ei[n.sparse.indices.componentType],E=n.sparse.indices.byteOffset||0,B=n.sparse.values.byteOffset||0,w=new I(e[1],E,n.sparse.count*m),Q=new h(e[2],B,n.sparse.count*A);null!==s&&(o=new i(o.array.slice(),o.itemSize,o.normalized));for(var x=0,b=w.length;x<b;x++){var k=w[x];if(o.setX(k,Q[x*A]),A>=2&&o.setY(k,Q[x*A+1]),A>=3&&o.setZ(k,Q[x*A+2]),A>=4&&o.setW(k,Q[x*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,r){var i=this,n=this.json,a=n.textures[e],o=n.images[t],s=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[s])return this.textureCache[s];var A=this.loadImageSource(t,r).then((function(t){t.flipY=!1,t.name=a.name||o.name||"";var r=(n.samplers||{})[a.sampler]||{};return t.magFilter=Bi[r.magFilter]||E,t.minFilter=Bi[r.minFilter]||B,t.wrapS=wi[r.wrapS]||w,t.wrapT=wi[r.wrapT]||w,i.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[s]=A,A}},{key:"loadImageSource",value:function(e,t){var r=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()}));var n=r.images[e],a=self.URL||self.webkitURL,s=n.uri||"",A=!1;if(void 0!==n.bufferView)s=this.getDependency("bufferView",n.bufferView).then((function(e){A=!0;var t=new Blob([e],{type:n.mimeType});return s=a.createObjectURL(t)}));else if(void 0===n.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(r,n){var a=r;!0===t.isImageBitmapLoader&&(a=function(e){var t=new ee(e);t.needsUpdate=!0,r(t)}),t.load(o.resolveURL(e,i.path),a,void 0,n)}))})).then((function(e){var t;return!0===A&&a.revokeObjectURL(s),e.userData.mimeType=n.mimeType||((t=n.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[Wr.KHR_TEXTURE_TRANSFORM]){var o=void 0!==r.extensions?r.extensions[Wr.KHR_TEXTURE_TRANSFORM]:void 0;if(o){var s=n.associations.get(a);a=n.extensions[Wr.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,r=e.material,i=void 0===t.attributes.tangent,n=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){var o="PointsMaterial:"+r.uuid,s=this.cache.get(o);s||(s=new Q,x.prototype.copy.call(s,r),s.color.copy(r.color),s.map=r.map,s.sizeAttenuation=!1,this.cache.add(o,s)),r=s}else if(e.isLine){var A="LineBasicMaterial:"+r.uuid,h=this.cache.get(A);h||(h=new b,x.prototype.copy.call(h,r),h.color.copy(r.color),this.cache.add(A,h)),r=h}if(i||n||a){var l="ClonedMaterial:"+r.uuid+":";i&&(l+="derivative-tangents:"),n&&(l+="vertex-colors:"),a&&(l+="flat-shading:");var c=this.cache.get(l);c||(c=r.clone(),n&&(c.vertexColors=!0),a&&(c.flatShading=!0),i&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(l,c),this.associations.set(c,this.associations.get(r))),r=c}r.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),e.material=r}},{key:"getMaterialType",value:function(){return k}},{key:"loadMaterial",value:function(e){var t,r=this,i=this.json,n=this.extensions,a=i.materials[e],o={},s=[];if((a.extensions||{})[Wr.KHR_MATERIALS_UNLIT]){var A=n[Wr.KHR_MATERIALS_UNLIT];t=A.getMaterialType(),s.push(A.extendParams(o,a,r))}else{var l=a.pbrMetallicRoughness||{};if(o.color=new h(1,1,1),o.opacity=1,Array.isArray(l.baseColorFactor)){var c=l.baseColorFactor;o.color.fromArray(c),o.opacity=c[3]}void 0!==l.baseColorTexture&&s.push(r.assignTexture(o,"map",l.baseColorTexture,d)),o.metalness=void 0!==l.metallicFactor?l.metallicFactor:1,o.roughness=void 0!==l.roughnessFactor?l.roughnessFactor:1,void 0!==l.metallicRoughnessTexture&&(s.push(r.assignTexture(o,"metalnessMap",l.metallicRoughnessTexture)),s.push(r.assignTexture(o,"roughnessMap",l.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),s.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)}))))}!0===a.doubleSided&&(o.side=S);var u=a.alphaMode||Si;if(u===Ti?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,u===_i&&(o.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==g&&(s.push(r.assignTexture(o,"normalMap",a.normalTexture)),o.normalScale=new p(1,1),void 0!==a.normalTexture.scale)){var f=a.normalTexture.scale;o.normalScale.set(f,f)}return void 0!==a.occlusionTexture&&t!==g&&(s.push(r.assignTexture(o,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(o.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==g&&(o.emissive=(new h).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==g&&s.push(r.assignTexture(o,"emissiveMap",a.emissiveTexture,d)),Promise.all(s).then((function(){var i=new t(o);return a.name&&(i.name=a.name),Mi(i,a),r.associations.set(i,{materials:e}),a.extensions&&Di(n,i,a),i}))}},{key:"createUniqueName",value:function(e){for(var t=_.sanitizeNodeName(e||""),r=t,i=1;this.nodeNamesUsed[r];++i)r=t+"_"+i;return this.nodeNamesUsed[r]=!0,r}},{key:"loadGeometries",value:function(e){var t=this,i=this.extensions,n=this.primitiveCache;function a(e){return i[Wr.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return Gi(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[Wr.KHR_DRACO_MESH_COMPRESSION])?"draco:"+s.bufferView+":"+s.indices+":"+Ri(s.attributes):o.indices+":"+Ri(o.attributes)+":"+o.mode),g=n[u];if(g)A.push(g.promise);else{var d=void 0;d=c.extensions&&c.extensions[Wr.KHR_DRACO_MESH_COMPRESSION]?a(c):Gi(new r,c,t),n[u]={primitive:c,promise:d},A.push(d)}}return Promise.all(A)}},{key:"loadMesh",value:function(e){for(var t,r=this,i=this.json,n=this.extensions,a=i.meshes[e],o=a.primitives,s=[],A=0,h=o.length;A<h;A++){var l=void 0===o[A].material?(void 0===(t=this.cache).DefaultMaterial&&(t.DefaultMaterial=new k({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:X})),t.DefaultMaterial):this.getDependency("material",o[A].material);s.push(l)}return s.push(r.loadGeometries(o)),Promise.all(s).then((function(t){for(var i=t.slice(0,t.length-1),s=t[t.length-1],A=[],h=0,l=s.length;h<l;h++){var c=s[h],u=o[h],g=void 0,d=i[h];if(u.mode===Ci.TRIANGLES||u.mode===Ci.TRIANGLE_STRIP||u.mode===Ci.TRIANGLE_FAN||void 0===u.mode)!0!==(g=!0===a.isSkinnedMesh?new T(c,d):new D(c,d)).isSkinnedMesh||g.geometry.attributes.skinWeight.normalized||g.normalizeSkinWeights(),u.mode===Ci.TRIANGLE_STRIP?g.geometry=Oi(g.geometry,te):u.mode===Ci.TRIANGLE_FAN&&(g.geometry=Oi(g.geometry,j));else if(u.mode===Ci.LINES)g=new M(c,d);else if(u.mode===Ci.LINE_STRIP)g=new L(c,d);else if(u.mode===Ci.LINE_LOOP)g=new R(c,d);else{if(u.mode!==Ci.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+u.mode);g=new F(c,d)}Object.keys(g.geometry.morphAttributes).length>0&&Li(g,a),g.name=r.createUniqueName(a.name||"mesh_"+e),Mi(g,a),u.extensions&&Di(n,g,u),r.assignFinalMaterial(g),A.push(g)}for(var f=0,p=A.length;f<p;f++)r.associations.set(A[f],{meshes:e,primitives:f});if(1===A.length)return A[0];var v=new U;r.associations.set(v,{meshes:e});for(var m=0,I=A.length;m<I;m++)v.add(A[m]);return v}))}},{key:"loadCamera",value:function(e){var t,r=this.json.cameras[e],i=r[r.type];if(i)return"perspective"===r.type?t=new N(G.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===r.type&&(t=new O(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),Mi(t,r),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){for(var t=this.json.skins[e],r=[],i=0,n=t.joints.length;i<n;i++)r.push(this.getDependency("node",t.joints[i]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(e){for(var r=e.pop(),i=e,n=[],o=[],s=0,A=i.length;s<A;s++){var h=i[s];if(h){n.push(h);var l=new a;null!==r&&l.fromArray(r.array,16*s),o.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[s])}return new P(n,o)}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],r=[],i=[],n=[],a=[],o=[],s=0,A=t.channels.length;s<A;s++){var h=t.channels[s],l=t.samplers[h.sampler],c=h.target,u=c.node,g=void 0!==t.parameters?t.parameters[l.input]:l.input,d=void 0!==t.parameters?t.parameters[l.output]:l.output;r.push(this.getDependency("node",u)),i.push(this.getDependency("accessor",g)),n.push(this.getDependency("accessor",d)),a.push(l),o.push(c)}return Promise.all([Promise.all(r),Promise.all(i),Promise.all(n),Promise.all(a),Promise.all(o)]).then((function(r){for(var i=r[0],n=r[1],a=r[2],o=r[3],s=r[4],A=[],h=function(){var e,t=i[l],r=n[l],h=a[l],c=o[l],u=s[l];if(void 0===t)return"continue";switch(t.updateMatrix(),bi[u.path]){case bi.weights:e=Ae;break;case bi.rotation:e=se;break;default:e=oe}var g=t.name?t.name:t.uuid,d=void 0!==c.interpolation?ki[c.interpolation]:re,f=[];bi[u.path]===bi.weights?t.traverse((function(e){e.morphTargetInfluences&&f.push(e.name?e.name:e.uuid)})):f.push(g);var p=h.array;if(h.normalized){for(var v=Fi(p.constructor),m=new Float32Array(p.length),I=0,y=p.length;I<y;I++)m[I]=p[I]*v;p=m}for(var C=0,E=f.length;C<E;C++){var B=new e(f[C]+"."+bi[u.path],r.array,p,d);"CUBICSPLINE"===c.interpolation&&(B.createInterpolant=function(e){return new(this instanceof se?yi:mi)(this.times,this.values,this.getValueSize()/3,e)},B.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),A.push(B)}},l=0,c=i.length;l<c;l++)h();var u=t.name?t.name:"animation_"+e;return new H(u,void 0,A)}))}},{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,r=this.extensions,i=this,n=t.nodes[e],o=n.name?i.createUniqueName(n.name):"";return function(){var t=[],r=i._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));r&&t.push(r),void 0!==n.camera&&t.push(i.getDependency("camera",n.camera).then((function(e){return i._getNodeRef(i.cameraCache,n.camera,e)}))),i._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)}));for(var a=[],o=n.children||[],s=0,A=o.length;s<A;s++)a.push(i.getDependency("node",o[s]));var h=void 0===n.skin?Promise.resolve(null):i.getDependency("skin",n.skin);return Promise.all([Promise.all(t),Promise.all(a),h])}().then((function(t){var s,A=t[0],h=t[1],l=t[2];if((s=!0===n.isBone?new q:A.length>1?new U:1===A.length?A[0]:new I)!==A[0])for(var c=0,u=A.length;c<u;c++)s.add(A[c]);if(n.name&&(s.userData.name=n.name,s.name=o),Mi(s,n),n.extensions&&Di(r,s,n),void 0!==n.matrix){var g=new a;g.fromArray(n.matrix),s.applyMatrix4(g)}else void 0!==n.translation&&s.position.fromArray(n.translation),void 0!==n.rotation&&s.quaternion.fromArray(n.rotation),void 0!==n.scale&&s.scale.fromArray(n.scale);i.associations.has(s)||i.associations.set(s,{}),i.associations.get(s).nodes=e,null!==l&&s.traverse((function(e){e.isSkinnedMesh&&e.bind(l,Ui)}));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,r=this.json.scenes[e],i=this,n=new U;r.name&&(n.name=i.createUniqueName(r.name)),Mi(n,r),r.extensions&&Di(t,n,r);for(var a=r.nodes||[],o=[],s=0,A=a.length;s<A;s++)o.push(i.getDependency("node",a[s]));return Promise.all(o).then((function(e){for(var t=0,r=e.length;t<r;t++)n.add(e[t]);return i.associations=function(e){var t,r=new Map,n=Ct(i.associations);try{for(n.s();!(t=n.n()).done;){var a=mt(t.value,2),o=a[0],s=a[1];(o instanceof x||o instanceof ee)&&r.set(o,s)}}catch(e){n.e(e)}finally{n.f()}return e.traverse((function(e){var t=i.associations.get(e);null!=t&&r.set(e,t)})),r}(n),n}))}}]),e}();function Gi(e,t,r){var i=t.attributes,n=[];function a(t,i){return r.getDependency("accessor",t).then((function(t){e.setAttribute(i,t)}))}for(var o in i){var s=xi[o]||o.toLowerCase();s in e.attributes||n.push(a(i[o],s))}if(void 0!==t.indices&&!e.index){var A=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));n.push(A)}return Mi(e,t),function(e,t,r){var i=t.attributes,n=new ie;if(void 0!==i.POSITION){var a=r.json.accessors[i.POSITION],o=a.min,s=a.max;if(void 0!==o&&void 0!==s){if(n.set(new v(o[0],o[1],o[2]),new v(s[0],s[1],s[2])),a.normalized){var A=Fi(Ei[a.componentType]);n.min.multiplyScalar(A),n.max.multiplyScalar(A)}var h=t.targets;if(void 0!==h){for(var l=new v,c=new v,u=0,g=h.length;u<g;u++){var d=h[u];if(void 0!==d.POSITION){var f=r.json.accessors[d.POSITION],p=f.min,m=f.max;if(void 0!==p&&void 0!==m){if(c.setX(Math.max(Math.abs(p[0]),Math.abs(m[0]))),c.setY(Math.max(Math.abs(p[1]),Math.abs(m[1]))),c.setZ(Math.max(Math.abs(p[2]),Math.abs(m[2]))),f.normalized){var I=Fi(Ei[f.componentType]);c.multiplyScalar(I)}l.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(l)}e.boundingBox=n;var y=new ne;n.getCenter(y.center),y.radius=n.min.distanceTo(n.max)/2,e.boundingSphere=y}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,r),Promise.all(n).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,r):e}))}function Oi(e,t){var r=e.getIndex();if(null===r){var i=[],n=e.getAttribute("position");if(void 0===n)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var a=0;a<n.count;a++)i.push(a);e.setIndex(i),r=e.getIndex()}var o=r.count-2,s=[];if(t===j)for(var A=1;A<=o;A++)s.push(r.getX(0)),s.push(r.getX(A)),s.push(r.getX(A+1));else for(var h=0;h<o;h++)h%2==0?(s.push(r.getX(h)),s.push(r.getX(h+1)),s.push(r.getX(h+2))):(s.push(r.getX(h+2)),s.push(r.getX(h+1)),s.push(r.getX(h)));s.length/3!==o&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var l=e.clone();return l.setIndex(s),l}var Pi=function(e){ht(r,Jr);var t=gt(r);function r(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:le;return at(this,r),(e=t.call(this)).manager=i,e.adjustmentTransform=new a,e}return st(r,[{key:"parse",value:function(e){var t=this,i=ft(lt(r.prototype),"parse",this).call(this,e),n=i.glbBytes.slice().buffer;return new Promise((function(e,r){var a=t.manager,o=t.fetchOptions,s=a.getHandler("path.gltf")||new Kr(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 r=i.batchTable,n=i.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=r,t.featureTable=n,a.batchTable=r,a.featureTable=n,e(t)}),r)}))}}]),r}(),Hi=function(e){ht(r,zr);var t=gt(r);function r(){return at(this,r),t.apply(this,arguments)}return st(r,[{key:"parse",value:function(e){var t=new DataView(e),r=Vr(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 qr(h,0,a,o),c=28+a+o,u=e.slice(c,c+s+A),g=new jr(u,l.getData("BATCH_LENGTH")||l.getData("POINTS_LENGTH"),0,s,A);return Promise.resolve({version:i,featureTable:l,batchTable:g})}}]),r}(),qi={RGB:"color",POSITION:"position"},ji=function(e){ht(n,Hi);var t=gt(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:le;return at(this,n),(e=t.call(this)).manager=r,e}return st(n,[{key:"parse",value:function(e){var t=this;return ft(lt(n.prototype),"parse",this).call(this,e).then(function(){var e=nt(tt().mark((function e(n){var a,o,s,A,h,l,c,u,g,d,f,p,v,m,I,y,C,E;return tt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=n.featureTable,o=new Q,!(s=a.header.extensions)||!s["3DTILES_draco_point_compression"]){e.next=18;break}if(h=s["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 qi&&f in u&&(d[qi[f]]=u[f]);return p={attributeIDs:d,attributeTypes:{position:"Float32Array",color:"Uint8Array"},useUniqueIDs:!0},v=a.getBuffer(l,c),e.next=14,g.decodeGeometry(v,p);case 14:(A=e.sent).attributes.color&&(o.vertexColors=!0),e.next=24;break;case 18:m=a.getData("POINTS_LENGTH"),I=a.getData("POSITION",m,"FLOAT","VEC3"),y=a.getData("RGB",m,"UNSIGNED_BYTE","VEC3"),(A=new r).setAttribute("position",new i(I,3,!1)),null!==y&&(A.setAttribute("color",new i(y,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(e){e in a.header&&console.warn('PNTSLoader: Unsupported FeatureTable feature "'.concat(e,'" detected.'))})),C=new F(A,o),n.scene=C,n.scene.featureTable=a,(E=a.getData("RTC_CENTER"))&&(n.scene.position.x+=E[0],n.scene.position.y+=E[1],n.scene.position.z+=E[2]),e.abrupt("return",n);case 31:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}}]),n}(),zi=function(e){ht(r,zr);var t=gt(r);function r(){return at(this,r),t.apply(this,arguments)}return st(r,[{key:"parse",value:function(e){var t=new DataView(e),r=Vr(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 qr(l,0,a,o),u=32+a+o,g=e.slice(u,u+s+A),d=new jr(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(Hr(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}(),Vi=new v,Ji=new v,Ki=new v,Yi=new v,Wi=new n,Xi=new v,Zi=new a,$i=function(e){ht(r,zi);var t=gt(r);function r(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:le;return at(this,r),(e=t.call(this)).manager=i,e.adjustmentTransform=new a,e}return st(r,[{key:"resolveExternalURL",value:function(e){return this.manager.resolveURL(ft(lt(r.prototype),"resolveExternalURL",this).call(this,e))}},{key:"parse",value:function(e){var t=this;return ft(lt(r.prototype),"parse",this).call(this,e).then((function(e){var r=e.featureTable,i=e.batchTable,n=e.glbBytes.slice().buffer;return new Promise((function(e,a){var o=t.fetchOptions,s=t.manager,A=s.getHandler("path.gltf")||new Kr(s);"include"===o.credentials&&"cors"===o.mode&&A.setCrossOrigin("use-credentials"),"credentials"in o&&A.setWithCredentials("include"===o.credentials),o.headers&&A.setRequestHeader(o.headers);var h=t.workingPath;/[\\/]$/.test(h)||(h+="/");var l=t.adjustmentTransform;A.parse(n,h,(function(t){var n=r.getData("INSTANCES_LENGTH"),a=r.getData("POSITION",n,"FLOAT","VEC3"),o=r.getData("NORMAL_UP",n,"FLOAT","VEC3"),s=r.getData("NORMAL_RIGHT",n,"FLOAT","VEC3"),A=r.getData("SCALE_NON_UNIFORM",n,"FLOAT","VEC3"),h=r.getData("SCALE",n,"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 r.header&&console.warn('I3DMLoader: Unsupported FeatureTable feature "'.concat(e,'" detected.'))}));var c=new Map,u=[];t.scene.traverse((function(e){if(e.isMesh){var t=e.geometry,r=e.material,i=new m(t,r,n);i.position.copy(e.position),i.rotation.copy(e.rotation),i.scale.copy(e.scale),u.push(i),c.set(e,i)}}));for(var g=new v,d=0;d<n;d++)g.x+=a[3*d+0]/n,g.y+=a[3*d+1]/n,g.z+=a[3*d+2]/n;c.forEach((function(e,t){var r=t.parent;r&&(r.remove(t),r.add(e),e.updateMatrixWorld(),e.position.copy(g).applyMatrix4(e.matrixWorld))}));for(var f=0;f<n;f++){Yi.set(a[3*f+0]-g.x,a[3*f+1]-g.y,a[3*f+2]-g.z),o?(Ji.set(o[3*f+0],o[3*f+1],o[3*f+2]),Ki.set(s[3*f+0],s[3*f+1],s[3*f+2]),Vi.crossVectors(Ki,Ji).normalize(),Zi.makeBasis(Ki,Ji,Vi),Wi.setFromRotationMatrix(Zi)):Wi.set(0,0,0,1),h?Xi.setScalar(h[f]):A?Xi.set(A[3*f+0],A[3*f+1],A[3*f+2]):Xi.set(1,1,1),Zi.compose(Yi,Wi,Xi).multiply(l);for(var p=0,I=u.length;p<I;p++){u[p].setMatrixAt(f,Zi)}}t.batchTable=i,t.featureTable=r,t.scene.batchTable=i,t.scene.featureTable=r,e(t)}),a)}))}))}}]),r}(),en=function(e){ht(r,zr);var t=gt(r);function r(){return at(this,r),t.apply(this,arguments)}return st(r,[{key:"parse",value:function(e){var t=new DataView(e),r=Vr(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=Vr(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}(),tn=function(e){ht(r,en);var t=gt(r);function r(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:le;return at(this,r),(e=t.call(this)).manager=i,e.adjustmentTransform=new a,e}return st(r,[{key:"parse",value:function(e){var t=ft(lt(r.prototype),"parse",this).call(this,e),i=this.manager,n=this.adjustmentTransform,a=[];for(var o in t.tiles){var s=t.tiles[o],A=s.type,h=s.buffer;switch(A){case"b3dm":var l=h.slice(),c=new Pi(i);c.workingPath=this.workingPath,c.fetchOptions=this.fetchOptions,c.adjustmentTransform.copy(n);var u=c.parse(l.buffer);a.push(u);break;case"pnts":var g=h.slice(),d=new ji(i);d.workingPath=this.workingPath,d.fetchOptions=this.fetchOptions;var f=d.parse(g.buffer);a.push(f);break;case"i3dm":var p=h.slice(),v=new $i(i);v.workingPath=this.workingPath,v.fetchOptions=this.fetchOptions,v.adjustmentTransform.copy(n);var m=v.parse(p.buffer);a.push(m)}}return Promise.all(a).then((function(e){var t=new U;return e.forEach((function(e){t.add(e.scene)})),{tiles:e,scene:t}}))}}]),r}(),rn=function(){function e(){at(this,e),this.name="CESIUM_RTC"}return st(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}(),nn=function(e){ht(r,zr);var t=gt(r);function r(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:le;return at(this,r),(e=t.call(this)).manager=i,e}return st(r,[{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 Kr(n)).register((function(){return new rn})),"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)}))}}]),r}(),an=new a,on=function(e){ht(r,U);var t=gt(r);function r(e){var i;return at(this,r),(i=t.call(this)).name="TilesRenderer.TilesGroup",i.tilesRenderer=e,i}return st(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?an.copy(this.matrix):an.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1;for(var t=an.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(an);for(var s=this.children,A=0,h=s.length;A<h;A++)s[A].updateMatrixWorld()}}}}]),r}();new ce,new v;var sn=new ce,An=new v,hn=new v,ln=new v,cn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;at(this,e),this.radius=new v(t,r,i)}return st(e,[{key:"getCartographicToPosition",value:function(e,t,r,i){this.getCartographicToNormal(e,t,An);var n=this.radius;hn.copy(An),hn.x*=Math.pow(n.x,2),hn.y*=Math.pow(n.y,2),hn.z*=Math.pow(n.z,2);var a=Math.sqrt(An.dot(hn));return hn.divideScalar(a),i.copy(hn).addScaledVector(An,r)}},{key:"getPositionToCartographic",value:function(e,t){this.getPositionToSurfacePoint(e,hn),this.getPositionToNormal(e,An);var r=ln.subVectors(e,hn);return t.lon=Math.atan2(An.y,An.x),t.lat=Math.asin(An.z),t.height=Math.sign(r.dot(e))*r.length(),t}},{key:"getCartographicToNormal",value:function(e,t,r){return sn.set(1,-e+Math.PI/2,t),r.setFromSpherical(sn).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=hn.copy(e).multiplyScalar(l);if(h<.1)return isFinite(l)?t.copy(c):null;var u,g,d,f,p,v,m,I=ln.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}(),un=Math.PI,gn=un/2,dn=new v,fn=new v,pn=new v,vn=new a,mn=0,In=[];function yn(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?(In[mn]||(In[mn]=new v),mn++,In[mn-1]):new v}function Cn(){mn=0}var En=function(e){ht(r,cn);var t=gt(r);function r(e,i,n){var a,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-gn,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:gn,A=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,h=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*un,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0;return at(this,r),(a=t.call(this,e,i,n)).latStart=o,a.latEnd=s,a.lonStart=A,a.lonEnd=h,a.heightStart=l,a.heightEnd=c,a}return st(r,[{key:"_getPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.latStart,r=this.latEnd,i=this.lonStart,n=this.lonEnd,a=this.heightStart,o=this.heightEnd,s=G.mapLinear(.5,0,1,t,r),A=G.mapLinear(.5,0,1,i,n),h=Math.floor(i/gn)*gn,l=[[-un/2,0],[un/2,0],[0,h],[0,h+un/2],[0,h+un],[0,h+3*un/2],[t,n],[r,n],[t,i],[r,i],[0,i],[0,n],[s,A],[t,A],[r,A],[s,i],[s,n]],c=[],u=l.length,g=0;g<=1;g++)for(var d=G.mapLinear(g,0,1,a,o),f=0,p=u;f<p;f++){var v=mt(l[f],2),m=v[0],I=v[1];if(m>=t&&m<=r&&I>=i&&I<=n){var y=yn(e);c.push(y),this.getCartographicToPosition(m,I,d,y)}}return c}},{key:"getBoundingBox",value:function(e,t){Cn();var r=this.latStart,i=this.latEnd,n=this.lonStart,a=this.lonEnd;if(i-r<un/2){var o=G.mapLinear(.5,0,1,r,i),s=G.mapLinear(.5,0,1,n,a);this.getCartographicToNormal(o,s,pn),fn.set(0,0,1),dn.crossVectors(fn,pn),fn.crossVectors(dn,pn),t.makeBasis(dn,fn,pn)}else dn.set(1,0,0),fn.set(0,1,0),pn.set(0,0,1),t.makeBasis(dn,fn,pn);vn.copy(t).invert();for(var A=this._getPoints(!0),h=0,l=A.length;h<l;h++)A[h].applyMatrix4(vn);e.makeEmpty(),e.setFromPoints(A)}},{key:"getBoundingSphere",value:function(e,t){Cn();var r=this._getPoints(!0);e.makeEmpty(),e.setFromPoints(r,t)}}]),r}();function Bn(e){return Bn="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},Bn(e)}function wn(e){var t=function(e,t){if("object"!==Bn(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!==Bn(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Bn(t)?t:String(t)}function Qn(e,t,r){return(t=wn(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xn(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}const bn=1/Math.PI*180,kn=1/180*Math.PI,Sn={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function _n(e,{precision:t=Sn.precision}={}){return e=function(e){return Math.round(e/Sn.EPSILON)*Sn.EPSILON}(e),"".concat(parseFloat(e.toPrecision(t)))}function Tn(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Dn(e){return function(e,t){return Rn(e,(e=>e*kn),t)}(e)}function Mn(e){return function(e,t){return Rn(e,(e=>e*bn),t)}(e)}function Ln(e,t,r){const i=Sn.EPSILON;r&&(Sn.EPSILON=r);try{if(e===t)return!0;if(Tn(e)&&Tn(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!Ln(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)<=Sn.EPSILON*Math.max(1,Math.abs(e),Math.abs(t))}finally{Sn.EPSILON=i}}function Rn(e,t,r){if(Tn(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 Fn 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:Tn(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Sn)}formatString(e){let t="";for(let r=0;r<this.ELEMENTS;++r)t+=(r>0?", ":"")+_n(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(!Ln(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(Sn.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 Un(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(e));return e}function Nn(e,t,r=""){if(Sn.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 Gn extends Fn{get x(){return this[0]}set x(e){this[0]=Un(e)}get y(){return this[1]}set y(e){this[1]=Un(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 Un(t)}dot(e){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*e[r];return Un(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 xn(e>=0&&e<this.ELEMENTS,"index is out of range"),Un(this[e])}setComponent(e,t){return xn(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 On,Pn=1e-6,Hn="undefined"!=typeof Float32Array?Float32Array:Array;function qn(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 jn(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function zn(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)}),On=new Hn(2),Hn!=Float32Array&&(On[0]=0,On[1]=0),function(){var e=function(){var e=new Hn(3);return Hn!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}()}();const Vn=[0,0,0];let Jn;class Kn extends Gn{static get ZERO(){return Jn||(Jn=new Kn(0,0,0),Object.freeze(Jn)),Jn}constructor(e=0,t=0,r=0){super(-0,-0,-0),1===arguments.length&&Tn(e)?this.copy(e):(Sn.debug&&(Un(e),Un(t),Un(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 Sn.debug&&(Un(e.x),Un(e.y),Un(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]=Un(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&&jn(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=Vn}){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=Vn}){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=Vn}){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 zn(this,this,e),this.check()}transformAsVector(e){return qn(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 Yn extends Fn{toString(){let e="[";if(Sn.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]=Un(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 Wn(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 Xn=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 Zn,$n=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 Hn(4);return Hn!=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"}(Zn||(Zn={}));const ea=45*Math.PI/180,ta=1,ra=.1,ia=500,na=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class aa extends Yn{static get IDENTITY(){return function(){sa||(sa=new aa,Object.freeze(sa));return sa}()}static get ZERO(){return function(){oa||(oa=new aa([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(oa));return oa}()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Zn}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(na)}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=ra,far:o=ia}=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)<Pn&&Math.abs(f-C)<Pn&&Math.abs(p-E)<Pn?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=ra,far:o=ia}=e;return $n(this,t,r,i,n,a,o),this.check()}orthographic(e){const{fovy:t=ea,aspect:r=ta,focalDistance:i=1,near:n=ra,far:a=ia}=e;Aa(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 Aa(t),Xn(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,k=c*v-g*f,S=u*v-g*p,_=m*S-I*k+y*b+C*x-E*Q+B*w;_&&(_=1/_,e[0]=(s*S-A*k+h*b)*_,e[1]=(n*k-i*S-a*b)*_,e[2]=(f*B-p*E+v*C)*_,e[3]=(u*E-c*B-g*C)*_,e[4]=(A*x-o*S-h*Q)*_,e[5]=(r*S-n*x+a*Q)*_,e[6]=(p*y-d*B-v*I)*_,e[7]=(l*B-u*y+g*I)*_,e[8]=(o*k-s*x+h*w)*_,e[9]=(i*x-r*k-a*w)*_,e[10]=(d*E-f*y+v*m)*_,e[11]=(c*y-l*E-g*m)*_,e[12]=(s*Q-o*b-A*w)*_,e[13]=(r*b-i*Q+n*w)*_,e[14]=(f*I-d*C-p*m)*_,e[15]=(l*C-c*I+u*m)*_)}(this,this),this.check()}multiplyLeft(e){return Wn(this,e,this),this.check()}multiplyRight(e){return Wn(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,k=i[0],S=i[1],_=i[2],T=Math.hypot(k,S,_);T<Pn||(k*=T=1/T,S*=T,_*=T,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=k*k*o+a,y=S*k*o+_*n,C=_*k*o-S*n,E=k*S*o-_*n,B=S*S*o+a,w=_*S*o+k*n,Q=k*_*o+S*n,x=S*_*o-k*n,b=_*_*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),Nn(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=zn(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Nn(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=qn(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Nn(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 oa,sa;function Aa(e){if(e>2*Math.PI)throw Error("expected radians")}var ha=.1,la=1e-12,ca=1e-15;Math.PI,Math.PI,Math.PI,Math.PI;function ua(e){return e}function ga(e,t=[]){return function(e,t=[],r=ua){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,Sn._cartographicRadians?ua:Dn)}function da(e,t){return function(e,t,r=ua){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,Sn._cartographicRadians?ua:Mn)}new Kn;const fa=new Kn,pa=new Kn,va=new Kn;const ma=new Kn,Ia={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"}},ya={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Ca={east:new Kn,north:new Kn,up:new Kn,west:new Kn,south:new Kn,down:new Kn},Ea=new Kn,Ba=new Kn,wa=new Kn;function Qa(e,t,r,i,n,a){const o=Ia[t]&&Ia[t][r];let s,A,h;xn(o&&(!i||i===o));const l=ma.copy(n);if(Ln(l.x,0,1e-14)&&Ln(l.y,0,1e-14)){const e=Math.sign(l.z);s=Ea.fromArray(ya[t]),"east"!==t&&"west"!==t&&s.scale(e),A=Ba.fromArray(ya[r]),"east"!==r&&"west"!==r&&A.scale(e),h=wa.fromArray(ya[i]),"east"!==i&&"west"!==i&&h.scale(e)}else{const{up:n,east:a,north:o}=Ca;a.set(-l.y,l.x,0).normalize(),e.geodeticSurfaceNormal(l,n),o.copy(n).cross(a);const{down:c,west:u,south:g}=Ca;c.copy(n).scale(-1),u.copy(a).scale(-1),g.copy(o).scale(-1),s=Ca[t],A=Ca[r],h=Ca[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 xa=new Kn,ba=new Kn,ka=new Kn,Sa=new Kn,_a=new Kn,Ta=new Kn;class Da{constructor(e=0,t=0,r=0){Qn(this,"radii",void 0),Qn(this,"radiiSquared",void 0),Qn(this,"radiiToTheFourth",void 0),Qn(this,"oneOverRadii",void 0),Qn(this,"oneOverRadiiSquared",void 0),Qn(this,"minimumRadius",void 0),Qn(this,"maximumRadius",void 0),Qn(this,"centerToleranceSquared",ha),Qn(this,"squaredXOverSquaredZ",void 0),xn(e>=0),xn(t>=0),xn(r>=0),this.radii=new Kn(e,t,r),this.radiiSquared=new Kn(e*e,t*t,r*r),this.radiiToTheFourth=new Kn(e*e*e*e,t*t*t*t,r*r*r*r),this.oneOverRadii=new Kn(0===e?0:1/e,0===t?0:1/t,0===r?0:1/r),this.oneOverRadiiSquared=new Kn(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=ba,i=ka,[,,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]){Ta.from(e);const r=this.scaleToGeodeticSurface(Ta,Sa);if(!r)return;const i=this.geodeticSurfaceNormal(r,ba),n=_a;n.copy(Ta).subtract(r);const a=Math.atan2(i.y,i.x),o=Math.asin(i.z),s=Math.sign(jn(n,Ta))*function(e){var t=e[0],r=e[1],i=e[2];return Math.hypot(t,r,i)}(n);return da([a,o,s],t)}eastNorthUpToFixedFrame(e,t=new aa){return Qa(this,"east","north","up",e,t)}localFrameToFixedFrame(e,t,r,i,n=new aa){return Qa(this,e,t,r,i,n)}geocentricSurfaceNormal(e,t=[0,0,0]){return xa.from(e).normalize().to(t)}geodeticSurfaceNormalCartographic(e,t=[0,0,0]){const r=ga(e),i=r[0],n=r[1],a=Math.cos(n);return xa.set(a*Math.cos(i),a*Math.sin(i),Math.sin(n)).normalize(),xa.to(t)}geodeticSurfaceNormal(e,t=[0,0,0]){return xa.from(e).scale(this.oneOverRadiiSquared).normalize().to(t)}scaleToGeodeticSurface(e,t){return function(e,t,r=[]){const{oneOverRadii:i,oneOverRadiiSquared:n,centerToleranceSquared:a}=t;fa.from(e);const o=fa.x,s=fa.y,A=fa.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=pa;if(v.copy(e).scale(p),f<a)return v.to(r);const m=n.x,I=n.y,y=n.z,C=va;C.set(v.x*m*2,v.y*I*2,v.z*y*2);let E,B,w,Q,x=(1-p)*fa.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)>la);return fa.scale([E,B,w]).to(r)}(e,this,t)}scaleToGeocentricSurface(e,t=[0,0,0]){Sa.from(e);const r=Sa.x,i=Sa.y,n=Sa.z,a=this.oneOverRadiiSquared,o=1/Math.sqrt(r*r*a.x+i*i*a.y+n*n*a.z);return Sa.multiplyScalar(o).to(t)}transformPositionToScaledSpace(e,t=[0,0,0]){return Sa.from(e).scale(this.oneOverRadii).to(t)}transformPositionFromScaledSpace(e,t=[0,0,0]){return Sa.from(e).scale(this.radii).to(t)}getSurfaceNormalIntersectionWithZAxis(e,t=0,r=[0,0,0]){xn(Ln(this.radii.x,this.radii.y,ca)),xn(this.radii.z>0),Sa.from(e);const i=Sa.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(i)>=this.radii.z-t))return Sa.set(0,0,i).to(r)}}Qn(Da,"WGS84",new Da(6378137,6378137,6356752.314245179));var Ma=new ne,La=new a,Ra=new v,Fa=new v,Ua=new ue,Na=[];function Ga(e,t){return e.distance-t.distance}function Oa(e,t,r){e.traverse((function(e){Object.getPrototypeOf(e).raycast.call(e,t,r)}))}function Pa(e,t,r,i){if(r.has(e)){if(Oa(e.cached.scene,i,Na),Na.length>0){Na.length>1&&Na.sort(Ga);var n=Na[0];return Na.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;La.copy(c);var u=l.sphere;if(!u||(Ma.copy(u),Ma.applyMatrix4(La),i.ray.intersectsSphere(Ma))){var g=l.box,d=l.boxTransform;if(g){if(La.multiply(d).invert(),Ua.copy(i.ray),Ua.applyMatrix4(La),!Ua.intersectBox(g,Ra))continue;Fa.setFromMatrixScale(La);var f=Fa.x;Math.abs(Math.max(Fa.x-Fa.y,Fa.x-Fa.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(Ua.origin)?p.distance=0:p.distance=Ra.distanceToSquared(Ua.origin)*f*f,p.tile=h}}}a.sort(Ga);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)?(Oa(B,i,Na),Na.length>0&&(Na.length>1&&Na.sort(Ga),w=Na[0])):w=Pa(E,t,r,i),w){var Q=w.distance*w.distance;Q<v&&(v=Q,m=w),Na.length=0}}return m}function Ha(e,t,r,i,n){var a=e.cached,o=t.matrixWorld;La.copy(o);var s=a.sphere;if(!s||(Ma.copy(s),Ma.applyMatrix4(La),i.ray.intersectsSphere(Ma))){var A=a.box,h=a.boxTransform;if(!A||(La.multiply(h).invert(),Ua.copy(i.ray).applyMatrix4(La),Ua.intersectsBox(A))){var l=a.scene;if(r.has(e))Oa(l,i,n);else for(var c=e.children,u=0,g=c.length;u<g;u++)Ha(c[u],t,r,i,n)}}}var qa=Symbol("INITIAL_FRUSTUM_CULLED"),ja=new a,za=new a,Va=new a,Ja=new v,Ka=new v,Ya=new v,Wa=new v,Xa=new v,Za=new v,$a=new v,eo=new n,to=new v,ro=new v,io=new v(1,0,0),no=new v(0,1,0);function ao(e,t){e.traverse((function(e){e.frustumCulled=e[qa]&&t}))}var oo=function(e){ht(r,Pr);var t=gt(r);function r(){var e;at(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];(e=t.call.apply(t,[this].concat(n))).group=new on(ut(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 o=new ge;o.setURLModifier((function(t){return e.preprocessURL?e.preprocessURL(t):t})),e.manager=o;var s=ut(e);return e._overridenRaycast=function(e,t){s.optimizeRaycast||Object.getPrototypeOf(this).raycast.call(this,e,t)},e}return st(r,[{key:"autoDisableRendererCulling",get:function(){return this._autoDisableRendererCulling},set:function(e){this._autoDisableRendererCulling!==e&&(vt(lt(r.prototype),"_autoDisableRendererCulling",e,this,!0),this.forEachLoadedModel((function(t){ao(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=Pa(this.root,this.group,this.activeTiles,e);r&&t.push(r)}else Ha(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,r=this.cameraMap;return!r.has(e)&&(r.set(e,new p),t.push(e),!0)}},{key:"setResolution",value:function(e,t,r){var i=this.cameraMap;return!!i.has(e)&&(t instanceof p?i.get(e).copy(t):i.get(e).set(t,r),!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,i=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=ft(lt(r.prototype),"fetchTileSet",this)).call.apply(t,[this,e].concat(a));return s.then((function(t){i.onLoadTileSet&&Promise.resolve().then((function(){i.onLoadTileSet(t,e)}))})),s}},{key:"update",value:function(){var e=this.group,t=this.cameras,i=this.cameraMap,n=this.cameraInfo;if(0!==t.length){for(;n.length>t.length;)n.pop();for(;n.length<t.length;)n.push({frustum:new de,isOrthographic:!1,sseDenominator:-1,position:new v,invScale:-1,pixelSize:0});za.copy(e.matrixWorld).invert(),Ja.setFromMatrixScale(za);var a=Ja.x;Math.abs(Math.max(Ja.x-Ja.y,Ja.x-Ja.z))>1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when calculating screen space error.");for(var o=0,s=n.length;o<s;o++){var A=t[o],h=n[o],l=h.frustum,c=h.position,u=i.get(A);0!==u.width&&0!==u.height||console.warn("TilesRenderer: resolution for camera error calculation is not set.");var g=A.projectionMatrix.elements;if(h.isOrthographic=1===g[15],h.isOrthographic){var d=2/g[0],f=2/g[5];h.pixelSize=Math.max(f/u.height,d/u.width)}else h.sseDenominator=2/g[5]/u.height;h.invScale=a,ja.copy(e.matrixWorld),ja.premultiply(A.matrixWorldInverse),ja.premultiply(A.projectionMatrix),l.setFromProjectionMatrix(ja),c.set(0,0,0),c.applyMatrix4(A.matrixWorld),c.applyMatrix4(za)}ft(lt(r.prototype),"update",this).call(this)}else console.warn("TilesRenderer: no cameras defined. Cannot update 3d tiles.")}},{key:"preprocessNode",value:function(e,t,i){ft(lt(r.prototype),"preprocessNode",this).call(this,e,t,i);var n=new a;if(e.transform)for(var o=e.transform,s=0;s<16;s++)n.elements[s]=o[s];else n.identity();t&&n.premultiply(t.cached.transform);var A=(new a).copy(n).invert(),h=null,l=null,c=null,u=null;if("box"in e.boundingVolume){var g=e.boundingVolume.box;h=new ie,l=new a,c=new a,u=new v;var d=this.threeLayer.distanceToVector3(g[3],g[3]).x,f=this.threeLayer.distanceToVector3(g[4],g[4]).x,p=this.threeLayer.distanceToVector3(g[5],g[5]).x;Ka.set(d,f,p);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;Ya.set(m,I,y);var C=this.threeLayer.distanceToVector3(g[9],g[9]).x,E=this.threeLayer.distanceToVector3(g[10],g[10]).x,B=this.threeLayer.distanceToVector3(g[11],g[11]).x;Wa.set(C,E,B),Xa.set(g[3],g[4],g[5]),Za.set(g[6],g[7],g[8]),$a.set(g[9],g[10],g[11]);var w=Ka.length(),Q=Ya.length(),x=Wa.length(),b=Xa.length(),k=Za.length(),S=$a.length();u.set(w/b,Q/k,x/S),Ka.normalize(),Ya.normalize(),Wa.normalize(),0===w&&Ka.crossVectors(Ya,Wa),0===Q&&Ya.crossVectors(Ka,Wa),0===x&&Wa.crossVectors(Ka,Ya),l.set(Ka.x,Ya.x,Wa.x,g[0],Ka.y,Ya.y,Wa.y,g[1],Ka.z,Ya.z,Wa.z,g[2],0,0,0,1),l.premultiply(n),A.decompose(ro,eo,to);var _=Va.makeRotationFromQuaternion(eo);l.multiply(_);var T=Da.WGS84.cartesianToCartographic([l.elements[12],l.elements[13],l.elements[14]],Ja),D=this.threeLayer.coordinateToVector3([T.x,T.y],T.z),M=this.threeLayer.distanceToVector3(D.z+this.heightOffset,D.z+this.heightOffset).x;l.elements[12]=D.x+this.xOffset,l.elements[13]=D.y+this.yOffset,l.elements[14]=M,c.copy(l).invert(),h.min.set(-w,-Q,-x),h.max.set(w,Q,x)}var L=null;if("sphere"in e.boundingVolume){var R=e.boundingVolume.sphere;(L=new ne).center.set(R[0],R[1],R[2]),L.radius=R[3],L.applyMatrix4(n)}else if("box"in e.boundingVolume){var F=e.boundingVolume.box;L=new ne,h.getBoundingSphere(L),L.center.set(F[0],F[1],F[2]),L.applyMatrix4(n);var U=Da.WGS84.cartesianToCartographic([L.center.x,L.center.y,L.center.z],Ja),N=this.threeLayer.coordinateToVector3([U.x,U.y],U.z);L.center.x=N.x+this.xOffset,L.center.y=N.y+this.yOffset,L.center.z=this.threeLayer.distanceToVector3(N.z+this.heightOffset,N.z+this.heightOffset).x}var G=null;if("region"in e.boundingVolume){var O=mt(e.boundingVolume.region,6),P=O[0],H=O[1],q=O[2],j=O[3],z=O[4],V=O[5];G=new En(br,br,kr,H,j,P,q,z,V),null===L&&(L=new ne,G.getBoundingSphere(L)),null===h&&(h=new ie,l=new a,c=new a,G.getBoundingBox(h,l),c.copy(l).invert())}e.cached={loadIndex:0,transform:n,transformInverse:A,active:!1,inFrustum:[],box:h,boxTransform:l,boxTransformInverse:c,sphere:L,region:G,scene:null,geometry:null,material:null,scale:u}}},{key:"parseTile",value:function(e,t,r){var i=this;t._loadIndex=t._loadIndex||0,t._loadIndex++;var n=t.content.uri.split(/[\\\/]/g);n.pop();var o=n.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 a;switch(c.toLowerCase()){case"x":p.makeRotationAxis(no,-Math.PI/2);break;case"y":p.makeRotationAxis(io,Math.PI/2);break;case"z":p.identity()}var v=(Vr(e)||r).toLowerCase();switch(v){case"b3dm":var m=new Pi(A);m.workingPath=o,m.fetchOptions=s,m.adjustmentTransform.copy(p),l=m.parse(e);break;case"pnts":var I=new ji(A);I.workingPath=o,I.fetchOptions=s,l=I.parse(e);break;case"i3dm":var y=new $i(A);y.workingPath=o,y.fetchOptions=s,y.adjustmentTransform.copy(p),l=y.parse(e);break;case"cmpt":var C=new tn(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 nn(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,n;if(e.isObject3D?(r=e,n=null):(r=e.scene,n=e),t._loadIndex===h){r.updateMatrix(),"glb"!==v&&"gltf"!==v||r.matrix.multiply(p),r.matrix.premultiply(g);var a=Da.WGS84.cartesianToCartographic([r.matrix.elements[12],r.matrix.elements[13],r.matrix.elements[14]],Ja),o=i.threeLayer.coordinateToVector3([a.x,a.y],a.z),s=i.threeLayer.distanceToVector3(o.z+i.heightOffset,o.z+i.heightOffset).x;r.matrix.elements[12]=o.x+i.xOffset,r.matrix.elements[13]=o.y+i.yOffset,r.matrix.elements[14]=s,r.matrix.decompose(r.position,r.quaternion,r.scale),f.decompose(Ka,eo,Ya),r.applyQuaternion(eo),r.scale.copy(d),r.traverse((function(e){e[qa]=e.frustumCulled})),ao(r,!i.autoDisableRendererCulling),r.traverse((function(e){e.raycast=i._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=n,i.onLoadModel&&i.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{Ja.copy(g.position);var v=void 0;A?(Ja.applyMatrix4(s),v=o.distanceToPoint(Ja)):v=Math.max(a.distanceToPoint(Ja),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}}]),r}();new v,new v,new v,new v,new v,new v,new cn(br,br,kr);var so=new WeakMap,Ao=function(e){ht(n,A);var t=gt(n);function n(e){var r;return at(this,n),(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 st(n,[{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,r,i){var n=this,a=new s(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(e){n.decodeDracoFile(e,t).catch(i)}),r,i)}},{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(so.has(e)){var a=so.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)})),so.set(e,{key:n,promise:A}),A}},{key:"_createGeometry",value:function(e){var t=new r;e.index&&t.setIndex(new i(e.index.array,1));for(var n=0;n<e.attributes.length;n++){var a=e.attributes[n],o=a.name,s=a.array,A=a.itemSize;t.setAttribute(o,new i(s,A))}return t}},{key:"_loadLibrary",value:function(e,t){var r=new s(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((function(t,i){r.load(e,t,void 0,i)}))}},{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":rt(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=ho.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}}]),n}();function ho(){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 lo,co,uo,go=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4;at(this,e),this.pool=t,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}return st(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}(),fo=0,po=2,vo=st((function e(){at(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})),mo=function(){function e(t,r,i,n){at(this,e),this._dataView=new DataView(t.buffer,t.byteOffset+r,i),this._littleEndian=n,this._offset=0}return st(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}(),Io=[171,75,84,88,32,50,48,187,13,10,26,10];function yo(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Buffer.from(e).toString("utf8")}function Co(e){var t=new Uint8Array(e.buffer,e.byteOffset,Io.length);if(t[0]!==Io[0]||t[1]!==Io[1]||t[2]!==Io[2]||t[3]!==Io[3]||t[4]!==Io[4]||t[5]!==Io[5]||t[6]!==Io[6]||t[7]!==Io[7]||t[8]!==Io[8]||t[9]!==Io[9]||t[10]!==Io[10]||t[11]!==Io[11])throw new Error("Missing KTX 2.0 identifier.");var r=new vo,i=17*Uint32Array.BYTES_PER_ELEMENT,n=new mo(e,Io.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 mo(e,Io.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 mo(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 mo(e,A,h,!0);I._offset<h;){var y=I._nextUint32(),C=I._scan(y),E=yo(C),B=I._scan(y-C.byteLength);r.keyValue[E]=E.match(/^ktx/i)?yo(B):B,I._offset%4&&I._skip(4-I._offset%4)}if(c<=0)return r;for(var w=new mo(e,l,c,!0),Q=w._nextUint16(),x=w._nextUint16(),b=w._nextUint32(),k=w._nextUint32(),S=w._nextUint32(),_=w._nextUint32(),T=[],D=0;D<a;D++)T.push({imageFlags:w._nextUint32(),rgbSliceByteOffset:w._nextUint32(),rgbSliceByteLength:w._nextUint32(),alphaSliceByteOffset:w._nextUint32(),alphaSliceByteLength:w._nextUint32()});var M=l+w._offset,L=M+b,R=L+k,F=R+S,U=new Uint8Array(e.buffer,e.byteOffset+M,b),N=new Uint8Array(e.buffer,e.byteOffset+L,k),G=new Uint8Array(e.buffer,e.byteOffset+R,S),O=new Uint8Array(e.buffer,e.byteOffset+F,_);return r.globalData={endpointCount:Q,selectorCount:x,imageDescs:T,endpointsData:U,selectorsData:N,tablesData:G,extendedData:O},r}var Eo,Bo,wo,Qo,xo={env:{emscripten_notify_memory_growth:function(e){uo=new Uint8Array(co.exports.memory.buffer)}}},bo=function(){function e(){at(this,e)}return st(e,[{key:"init",value:function(){return lo||(lo="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+ko).then((function(e){return e.arrayBuffer()})).then((function(e){return WebAssembly.instantiate(e,xo)})).then(this._init):WebAssembly.instantiate(Buffer.from(ko,"base64"),xo).then(this._init))}},{key:"_init",value:function(e){co=e.instance,xo.env.emscripten_notify_memory_growth(0)}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!co)throw new Error("ZSTDDecoder: Await .init() before decoding.");var r=e.byteLength,i=co.exports.malloc(r);uo.set(e,i),t=t||Number(co.exports.ZSTD_findDecompressedSize(i,r));var n=co.exports.malloc(t),a=co.exports.ZSTD_decompress(n,t,i,r),o=uo.slice(n,n+a);return co.exports.free(i),co.exports.free(n),o}}]),e}(),ko="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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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",So=new WeakMap,_o=0,To=function(e){ht(i,A);var t,r=gt(i);function i(e){var t;return at(this,i),(t=r.call(this,e)).transcoderPath="",t.transcoderBinary=null,t.transcoderPending=null,t.workerPool=new go,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 st(i,[{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 s(this.manager);t.setPath(this.transcoderPath),t.setWithCredentials(this.withCredentials);var r=t.loadAsync("basis_transcoder.js"),n=new s(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);var a=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([r,a]).then((function(t){var r=mt(t,2),n=r[0],a=r[1],o=i.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(i.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(i.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(i.BasisFormat),"/* basis_transcoder.js */",n,"/* 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}))})),_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(e,t,r,i){var n=this;if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");var a=new s(this.manager);a.setResponseType("arraybuffer"),a.setWithCredentials(this.withCredentials),a.load(e,(function(e){if(So.has(e))return So.get(e).promise.then(t).catch(i);n._createTexture(e).then((function(e){return t?t(e):null})).catch(i)}),r,i)}},{key:"_createTextureFrom",value:function(e,t){var r=e.mipmaps,i=e.width,n=e.height,a=e.format,o=e.type,s=e.error,A=e.dfdTransferFn,h=e.dfdFlags;if("error"===o)return Promise.reject(s);var l=t.layerCount>1?new Ce(r,i,n,t.layerCount,a,ye):new Ee(r,i,n,a,ye);return l.minFilter=1===r.length?E:B,l.magFilter=E,l.generateMipmaps=!1,l.needsUpdate=!0,l.encoding=2===A?d:Be,l.premultiplyAlpha=!!(1&h),l}},{key:"_createTexture",value:(t=nt(tt().mark((function e(t){var r,i,n,a,o=this,s=arguments;return tt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=s.length>1&&void 0!==s[1]?s[1]:{},0===(i=Co(new Uint8Array(t))).vkFormat){e.next=4;break}return e.abrupt("return",Ro(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)})),So.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),_o--,this}}]),i}();To.BasisFormat={ETC1S:0,UASTC_4x4:1},To.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},To.EngineFormat={RGBAFormat:fe,RGBA_ASTC_4x4_Format:we,RGBA_BPTC_Format:Qe,RGBA_ETC2_EAC_Format:xe,RGBA_PVRTC_4BPPV1_Format:be,RGBA_S3TC_DXT5_Format:ke,RGB_ETC1_Format:Se,RGB_ETC2_Format:_e,RGB_PVRTC_4BPPV1_Format:Te,RGB_S3TC_DXT1_Format:De},To.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,k=0;k<f;k++){var S=o.getImageLevelInfo(w,k,0);x=S.origWidth,b=S.origHeight;var _=new Uint8Array(o.getImageTranscodedSizeInBytes(w,k,0,C));if(!o.transcodeImage(_,w,k,0,C,0,-1,-1))throw c(),new Error("THREE.KTX2Loader: .transcodeImage failed.");Q.push(_)}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=Ct(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=Ct(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 Do=(At(Eo={},109,fe),At(Eo,97,fe),At(Eo,37,fe),At(Eo,43,fe),At(Eo,103,pe),At(Eo,83,pe),At(Eo,16,pe),At(Eo,22,pe),At(Eo,100,ve),At(Eo,76,ve),At(Eo,15,ve),At(Eo,9,ve),Eo),Mo=(At(Bo={},109,me),At(Bo,97,Ie),At(Bo,37,ye),At(Bo,43,ye),At(Bo,103,me),At(Bo,83,Ie),At(Bo,16,ye),At(Bo,22,ye),At(Bo,100,me),At(Bo,76,Ie),At(Bo,15,ye),At(Bo,9,ye),Bo),Lo=(At(wo={},43,d),At(wo,22,d),At(wo,15,d),wo);function Ro(e){return Fo.apply(this,arguments)}function Fo(){return Fo=nt(tt().mark((function e(t){var r,i,n,a,o,s,A,h;return tt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.vkFormat,i=t.pixelWidth,n=t.pixelHeight,a=t.pixelDepth,void 0!==Do[r]){e.next=3;break}throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");case 3:if(o=t.levels[0],t.supercompressionScheme!==fo){e.next=8;break}s=o.levelData,e.next=16;break;case 8:if(t.supercompressionScheme!==po){e.next=15;break}return Qo||(Qo=new Promise(function(){var e=nt(tt().mark((function e(t){var r;return tt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new bo,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,Qo;case 12:s=e.sent.decode(o.levelData,o.uncompressedByteLength),e.next=16;break;case 15:throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");case 16:return A=Mo[r]===me?new Float32Array(s.buffer,s.byteOffset,s.byteLength/Float32Array.BYTES_PER_ELEMENT):Mo[r]===Ie?new Uint16Array(s.buffer,s.byteOffset,s.byteLength/Uint16Array.BYTES_PER_ELEMENT):s,(h=0===a?new Le(A,i,n):new Me(A,i,n,a)).type=Mo[r],h.format=Do[r],h.encoding=Lo[r]||Be,h.needsUpdate=!0,e.abrupt("return",Promise.resolve(h));case 23:case"end":return e.stop()}}),e)}))),Fo.apply(this,arguments)}var Uo={altitude:0},No=function(e){ht(i,$e);var r=gt(i);function i(e,n){var a;return at(this,i),(a=r.call(this))._initOptions(Uo),a.object3d=e,a.object3d.__parent=ut(a),a._raycaster=new t.Raycaster,a._mouse=new t.Vector2,a.camera=n,a.selectMesh=null,a}return st(i,[{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)}}]),i}(),Go=6,Oo=!1,Po=!1,Ho=0,qo=function(){function e(t,r,i,n){var a=this;at(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 Ao;h.setDecoderPath(r.decoderPath);var l=new To;l.setTranscoderPath(r.transcoderPath),l.detectSupport(s),t.forEach((function(e){var t=new oo(e.url,i);if(t.errorTarget=Go,t.displayBoxBounds=Oo,t.displaySphereBounds=Po,t.colorMode=parseFloat(Ho),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 Kr(t.manager);n.setDRACOLoader(h),n.setKTX2Loader(l),t.manager.addHandler(/\.gltf$/,n);var o=new No(t.group,A);a.meshs.push(o),a.multiles.push(t)})),this.threelayer.addMesh(this.meshs),this.layerClass.updatables.push(this),this._bindMapEvents()}return st(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}(),jo={radius:100,altitude:0},zo=function(t){ht(i,$e);var r=gt(i);function i(t,n,a,o){var s;at(this,i),a=e.Util.extend({},jo,a,{layer:o,coordinate:t}),(s=r.call(this))._initOptions(a);var A=a.altitude;s._createGroup(),s.getObject3d().add(n);var h=o.distanceToVector3(A,A).x,l=o.coordinateToVector3(t,h);return s.getObject3d().position.copy(l),o.addMesh(ut(s)),s}return st(i)}(),Vo=function(){function e(r,i){at(this,e),this.threeLayer=i;var n=new t.LoadingManager,a=new Kr(n),o=new Ao(n);o.setDecoderPath(r),a.setDRACOLoader(o),n.addHandler(/\.gltf$/,a),n.addHandler(/\.glb$/,a),this.loader=new nn(n)}var r;return st(e,[{key:"addModel",value:(r=nt(tt().mark((function e(t,r,i){var n,a;return tt().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 zo(r,n.scene,i,this.threeLayer),e.abrupt("return",a);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,i){return r.apply(this,arguments)})}]),e}(),Jo=function(e){ht(i,t.Group);var r=gt(i);function i(e,t){var n;return at(this,i),(n=r.call(this)).name=t,n.customId=bt(),e.add(ut(n)),n.customType="layer",n}return st(i)}(),Ko=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(Ko(""))}catch(e){Ko=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}var Yo=Uint8Array,Wo=Uint16Array,Xo=Uint32Array,Zo=new Yo([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),$o=new Yo([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),es=new Yo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ts=function(e,t){for(var r=new Wo(31),i=0;i<31;++i)r[i]=t+=1<<e[i-1];var n=new Xo(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]},rs=ts(Zo,2),is=rs[0],ns=rs[1];is[28]=258,ns[258]=28;for(var as=ts($o,0)[0],os=new Wo(32768),ss=0;ss<32768;++ss){var As=(43690&ss)>>>1|(21845&ss)<<1;As=(61680&(As=(52428&As)>>>2|(13107&As)<<2))>>>4|(3855&As)<<4,os[ss]=((65280&As)>>>8|(255&As)<<8)>>>1}var hs=function(e,t,r){for(var i=e.length,n=0,a=new Wo(t);n<i;++n)++a[e[n]-1];var o,s=new Wo(t);for(n=0;n<t;++n)s[n]=s[n-1]+a[n-1]<<1;if(r){o=new Wo(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[os[c]>>>A]=h}else for(o=new Wo(i),n=0;n<i;++n)e[n]&&(o[n]=os[s[e[n]-1]++]>>>15-e[n]);return o},ls=new Yo(288);for(ss=0;ss<144;++ss)ls[ss]=8;for(ss=144;ss<256;++ss)ls[ss]=9;for(ss=256;ss<280;++ss)ls[ss]=7;for(ss=280;ss<288;++ss)ls[ss]=8;var cs=new Yo(32);for(ss=0;ss<32;++ss)cs[ss]=5;var us=hs(ls,9,1),gs=hs(cs,5,1),ds=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},fs=function(e,t,r){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&r},ps=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&t)},vs=function(e){return(e/8|0)+(7&e&&1)},ms=function(e,t,r){var i=e.length;if(!i||r&&!r.l&&i<5)return t||new Yo(0);var n=!t||r,a=!r||r.i;r||(r={}),t||(t=new Yo(3*i));var o=function(e){var r=t.length;if(e>r){var i=new Yo(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=fs(e,A,1);var f=fs(e,A+1,3);if(A+=3,!f){var p=e[(b=vs(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=us,c=gs,u=9,g=5;else{if(2!=f)throw"invalid block type";var m=fs(e,A,31)+257,I=fs(e,A+10,15)+4,y=m+fs(e,A+5,31)+1;A+=14;for(var C=new Yo(y),E=new Yo(19),B=0;B<I;++B)E[es[B]]=fs(e,A+3*B,7);A+=3*I;var w=ds(E),Q=(1<<w)-1,x=hs(E,w,1);for(B=0;B<y;){var b,k=x[fs(e,A,Q)];if(A+=15&k,(b=k>>>4)<16)C[B++]=b;else{var S=0,_=0;for(16==b?(_=3+fs(e,A,3),A+=2,S=C[B-1]):17==b?(_=3+fs(e,A,7),A+=3):18==b&&(_=11+fs(e,A,127),A+=7);_--;)C[B++]=S}}var T=C.subarray(0,m),D=C.subarray(m);u=ds(T),g=ds(D),l=hs(T,u,1),c=hs(D,g,1)}if(A>d){if(a)throw"unexpected EOF";break}}n&&o(h+131072);for(var M=(1<<u)-1,L=(1<<g)-1,R=A;;R=A){var F=(S=l[ps(e,A)&M])>>>4;if((A+=15&S)>d){if(a)throw"unexpected EOF";break}if(!S)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 N=Zo[B=F-257];U=fs(e,A,(1<<N)-1)+is[B],A+=N}var G=c[ps(e,A)&L],O=G>>>4;if(!G)throw"invalid distance";A+=15&G;D=as[O];if(O>3){N=$o[O];D+=ps(e,A)&(1<<N)-1,A+=N}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-D],t[h+1]=t[h+1-D],t[h+2]=t[h+2-D],t[h+3]=t[h+3-D];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 Wo?Wo:e instanceof Xo?Xo:Yo)(r-t);return i.set(e.subarray(t,r)),i}(t,0,h)},Is=new Yo(0);var ys="undefined"!=typeof TextDecoder&&new TextDecoder;try{ys.decode(Is,{stream:!0}),1}catch(e){}function Cs(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 Es(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 Bs(e,t,r,i,n){var a=function(e,t,r,i,n){for(var a=n<e?n:e,o=[],s=Cs(e,i,t),A=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,k=r-Q;y>=Q&&(B[E][0]=B[C][0]/h[k+1][b],x=B[E][0]*h[b][k]);for(var S=y-1<=k?Q-1:r-y,_=b>=-1?1:-b;_<=S;++_)B[E][_]=(B[C][_]-B[C][_-1])/h[k+1][b+_],x+=B[E][_]*h[b+_][k];y<=k&&(B[E][Q]=-B[C][Q-1]/h[k+1][y],x+=B[E][Q]*h[y][k]),s[Q][y]=x;var T=C;C=E,E=T}}for(var D=r,M=1;M<=i;++M){for(var L=0;L<=r;++L)s[M][L]*=D;D*=r-M}return s}(s,i,e,a,t),h=[],l=0;l<r.length;++l){var c=r[l].clone(),u=c.w;c.x*=u,c.y*=u,c.z*=u,h[l]=c}for(var g=0;g<=a;++g){for(var d=h[s-e].clone().multiplyScalar(A[g][0]),f=1;f<=e;++f)d.add(h[s-e+f].clone().multiplyScalar(A[g][f]));o[g]=d}for(var p=a+1;p<=n+1;++p)o[p]=new Re(0,0,0);return o}(e,t,r,i,n);return function(e){for(var t=e.length,r=[],i=[],n=0;n<t;++n){var a=e[n];r[n]=new v(a.x,a.y,a.z),i[n]=a.w}for(var o=[],s=0;s<t;++s){for(var A=r[s].clone(),h=1;h<=s;++h)A.sub(o[s-h].clone().multiplyScalar(Es(s,h)*i[h]));o[s]=A.divideScalar(i[0])}return o}(a)}var ws,Qs,xs,bs=function(e){ht(r,Fe);var t=gt(r);function r(e,i,n,a,o){var s;at(this,r),(s=t.call(this)).degree=e,s.knots=i,s.controlPoints=[],s.startKnot=a||0,s.endKnot=o||s.knots.length-1;for(var A=0;A<n.length;++A){var h=n[A];s.controlPoints[A]=new Re(h.x,h.y,h.z,h.w)}return s}return st(r,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new v,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=function(e,t,r,i){for(var n=Cs(e,i,t),a=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}(n,i,e,t),o=new Re(0,0,0,0),s=0;s<=e;++s){var A=r[n-e+s],h=a[s],l=A.w*h;o.x+=A.x*l,o.y+=A.y*l,o.z+=A.z*l,o.w+=A.w*h}return o}(this.degree,this.knots,this.controlPoints,r);return 1!==i.w&&i.divideScalar(i.w),t.set(i.x,i.y,i.z)}},{key:"getTangent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new v,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=Bs(this.degree,this.knots,this.controlPoints,r,1);return t.copy(i[1]).normalize(),t}}]),r}(),ks=function(e){ht(r,A);var t=gt(r);function r(e){return at(this,r),t.call(this,e)}return st(r,[{key:"load",value:function(e,t,r,i){var n=this,a=""===n.path?o.extractUrlBase(e):n.path,A=new s(this.manager);A.setPath(n.path),A.setResponseType("arraybuffer"),A.setRequestHeader(n.requestHeader),A.setWithCredentials(n.withCredentials),A.load(e,(function(r){try{t(n.parse(r,a))}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}}),r,i)}},{key:"parse",value:function(e,t){if(function(e){var t="Kaydara FBX Binary \0";return e.byteLength>=t.length&&t===zs(e,0,t.length)}(e))ws=(new Ms).parse(e);else{var r=zs(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}(r))throw new Error("THREE.FBXLoader: Unknown format.");if(Fs(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Fs(r));ws=(new Ds).parse(r)}var i=new Z(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Ss(i,this.manager).parse(ws)}}]),r}(),Ss=function(){function e(t,r){at(this,e),this.textureLoader=t,this.manager=r}return st(e,[{key:"parse",value:function(){Qs=this.parseConnections();var e=this.parseImages(),t=this.parseTextures(e),r=this.parseMaterials(t),i=this.parseDeformers(),n=(new _s).parse(i);return this.parseScene(i,n,r),xs}},{key:"parseConnections",value:function(){var e=new Map;"Connections"in ws&&ws.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 ws.Objects){var r=ws.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 ws.Objects){var r=ws.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 r=this.loadTexture(e,t);r.ID=e.id,r.name=e.attrName;var i=e.WrapModeU,n=e.WrapModeV,a=void 0!==i?i.value:0,o=void 0!==n?n.value:0;if(r.wrapS=0===a?w:Y,r.wrapT=0===o?w:Y,"Scaling"in e){var s=e.Scaling.value;r.repeat.x=s[0],r.repeat.y=s[1]}if("Translation"in e){var A=e.Translation.value;r.offset.x=A[0],r.offset.y=A[1]}return r}},{key:"loadTexture",value:function(e,t){var r,i,n=this.textureLoader.path,a=Qs.get(e.id).children;void 0!==a&&a.length>0&&void 0!==t[a[0].ID]&&(0!==(r=t[a[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0));var o=e.FileName.slice(-3).toLowerCase();if("tga"===o){var s=this.manager.getHandler(".tga");null===s?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new ee):(s.setPath(this.textureLoader.path),i=s.load(r))}else"psd"===o?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new ee):i=this.textureLoader.load(r);return this.textureLoader.setPath(n),i}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in ws.Objects){var r=ws.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 r=e.id,i=e.attrName,n=e.ShadingModel;if("object"===rt(n)&&(n=n.value),!Qs.has(r))return null;var a,o=this.parseParameters(e,t,r);switch(n.toLowerCase()){case"phong":a=new Ne;break;case"lambert":a=new Ge;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',n),a=new Ne}return a.setValues(o),a.name=i,a}},{key:"parseParameters",value:function(e,t,r){var i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=(new h).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(i.color=(new h).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=(new h).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(i.emissive=(new h).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=(new h).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(i.specular=(new h).fromArray(e.SpecularColor.value));var n=this;return Qs.get(r).children.forEach((function(e){var r=e.relationship;switch(r){case"Bump":i.bumpMap=n.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":i.aoMap=n.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=n.getTexture(t,e.ID),void 0!==i.map&&(i.map.encoding=d);break;case"DisplacementColor":i.displacementMap=n.getTexture(t,e.ID);break;case"EmissiveColor":i.emissiveMap=n.getTexture(t,e.ID),void 0!==i.emissiveMap&&(i.emissiveMap.encoding=d);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=n.getTexture(t,e.ID);break;case"ReflectionColor":i.envMap=n.getTexture(t,e.ID),void 0!==i.envMap&&(i.envMap.mapping=Oe,i.envMap.encoding=d);break;case"SpecularColor":i.specularMap=n.getTexture(t,e.ID),void 0!==i.specularMap&&(i.specularMap.encoding=d);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=n.getTexture(t,e.ID),i.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),i}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in ws.Objects&&t in ws.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Qs.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in ws.Objects){var r=ws.Objects.Deformer;for(var i in r){var n=r[i],a=Qs.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 r=[];return e.children.forEach((function(e){var i=t[e.ID];if("Cluster"===i.attrType){var n={ID:e.ID,indices:[],weights:[],transformLink:(new a).fromArray(i.TransformLink.a)};"Indexes"in i&&(n.indices=i.Indexes.a,n.weights=i.Weights.a),r.push(n)}})),{rawBones:r,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=Qs.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,r){xs=new U;var i=this.parseModels(e.skeletons,t,r),n=ws.Objects.Model,a=this;i.forEach((function(e){var t=n[e.ID];a.setLookAtProperties(e,t),Qs.get(e.ID).parents.forEach((function(t){var r=i.get(t.ID);void 0!==r&&r.add(e)})),null===e.parent&&xs.add(e)})),this.bindSkeleton(e.skeletons,t,i),this.createAmbientLight(),xs.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=Hs(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix()}}));var o=(new Ts).parse();1===xs.children.length&&xs.children[0].isGroup&&(xs.children[0].animations=o,xs=xs.children[0]),xs.animations=o}},{key:"parseModels",value:function(e,t,r){var i=new Map,n=ws.Objects.Model;for(var a in n){var o=parseInt(a),s=n[a],A=Qs.get(o),h=this.buildSkeleton(A,e,o,s.attrName);if(!h){switch(s.attrType){case"Camera":h=this.createCamera(A);break;case"Light":h=this.createLight(A);break;case"Mesh":h=this.createMesh(A,t,r);break;case"NurbsCurve":h=this.createCurve(A,t);break;case"LimbNode":case"Root":h=new q;break;default:h=new U}h.name=s.attrName?_.sanitizeNodeName(s.attrName):"",h.ID=o}this.getTransformData(h,s),i.set(o,h)}return i}},{key:"buildSkeleton",value:function(e,t,r,i){var n=null;return e.parents.forEach((function(e){var a=function(){var a=t[o];a.rawBones.forEach((function(t,o){if(t.ID===e.ID){var s=n;(n=new q).matrixWorld.copy(t.transformLink),n.name=i?_.sanitizeNodeName(i):"",n.ID=r,a.bones[o]=n,null!==s&&n.add(s)}}))};for(var o in t)a()})),n}},{key:"createCamera",value:function(e){var t,r;if(e.children.forEach((function(e){var t=ws.Objects.NodeAttribute[e.ID];void 0!==t&&(r=t)})),void 0===r)t=new I;else{var i=0;void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(i=1);var n=1;void 0!==r.NearPlane&&(n=r.NearPlane.value/1e3);var a=1e3;void 0!==r.FarPlane&&(a=r.FarPlane.value/1e3);var o=window.innerWidth,s=window.innerHeight;void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(o=r.AspectWidth.value,s=r.AspectHeight.value);var A=o/s,h=45;void 0!==r.FieldOfView&&(h=r.FieldOfView.value);var l=r.FocalLength?r.FocalLength.value:null;switch(i){case 0:t=new N(h,A,n,a),null!==l&&t.setFocalLength(l);break;case 1:t=new O(-o/2,o/2,s/2,-s/2,n,a);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+i+"."),t=new I}}return t}},{key:"createLight",value:function(e){var t,r;if(e.children.forEach((function(e){var t=ws.Objects.NodeAttribute[e.ID];void 0!==t&&(r=t)})),void 0===r)t=new I;else{var i;i=void 0===r.LightType?0:r.LightType.value;var n=16777215;void 0!==r.Color&&(n=(new h).fromArray(r.Color.value));var a=void 0===r.Intensity?1:r.Intensity.value/100;void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(a=0);var o=0;void 0!==r.FarAttenuationEnd&&(o=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value);switch(i){case 0:t=new c(n,a,o,1);break;case 1:t=new u(n,a);break;case 2:var s=Math.PI/3;void 0!==r.InnerAngle&&(s=G.degToRad(r.InnerAngle.value));var A=0;void 0!==r.OuterAngle&&(A=G.degToRad(r.OuterAngle.value),A=Math.max(A,1)),t=new l(n,a,o,s,A,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),t=new c(n,a)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,r){var i,n=null,a=null,o=[];return e.children.forEach((function(e){t.has(e.ID)&&(n=t.get(e.ID)),r.has(e.ID)&&o.push(r.get(e.ID))})),o.length>1?a=o:o.length>0?a=o[0]:(a=new Ne({color:13421772}),o.push(a)),"color"in n.attributes&&o.forEach((function(e){e.vertexColors=!0})),n.FBX_Deformer?(i=new T(n,a)).normalizeSkinWeights():i=new D(n,a),i}},{key:"createCurve",value:function(e,t){var r=e.children.reduce((function(e,r){return t.has(r.ID)&&(e=t.get(r.ID)),e}),null),i=new b({color:3342591,linewidth:1});return new L(r,i)}},{key:"getTransformData",value:function(e,t){var r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),r.eulerOrder="RotationOrder"in t?qs(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&&Qs.get(e.ID).children.forEach((function(t){if("LookAtProperty"===t.relationship){var r=ws.Objects.Model[t.ID];if("Lcl_Translation"in r){var i=r.Lcl_Translation.value;void 0!==e.target?(e.target.position.fromArray(i),xs.add(e.target)):e.lookAt((new v).fromArray(i))}}}))}},{key:"bindSkeleton",value:function(e,t,r){var i=this.parsePoseNodes(),n=function(){var n=e[a];Qs.get(parseInt(n.ID)).parents.forEach((function(e){if(t.has(e.ID)){var a=e.ID;Qs.get(a).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new P(n.bones),i[e.ID])}))}}))};for(var a in e)n()}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in ws.Objects){var t=ws.Objects.Pose;for(var r in t)if("BindPose"===t[r].attrType&&t[r].NbPoseNodes>0){var i=t[r].PoseNode;Array.isArray(i)?i.forEach((function(t){e[t.Node]=(new a).fromArray(t.Matrix.a)})):e[i.Node]=(new a).fromArray(i.Matrix.a)}}return e}},{key:"createAmbientLight",value:function(){if("GlobalSettings"in ws&&"AmbientColor"in ws.GlobalSettings){var e=ws.GlobalSettings.AmbientColor.value,t=e[0],r=e[1],i=e[2];if(0!==t||0!==r||0!==i){var n=new h(t,r,i);xs.add(new Pe(n,1))}}}}]),e}(),_s=function(){function e(){at(this,e),this.negativeMaterialIndices=!1}return st(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in ws.Objects){var r=ws.Objects.Geometry;for(var i in r){var n=Qs.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 ws.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=qs(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=Hs(A);return this.genGeometry(t,o,n,h)}}},{key:"genGeometry",value:function(e,t,i,n){var a=new r;e.attrName&&(a.name=e.attrName);var o=this.parseGeoNode(e,t),s=this.genBuffers(o),A=new He(s.vertex,3);if(A.applyMatrix4(n),a.setAttribute("position",A),s.colors.length>0&&a.setAttribute("color",new He(s.colors,3)),t&&(a.setAttribute("skinIndex",new qe(s.weightsIndices,4)),a.setAttribute("skinWeight",new He(s.vertexWeights,4)),a.FBX_Deformer=t),s.normal.length>0){var h=(new je).getNormalMatrix(n),l=new He(s.normal,3);l.applyNormalMatrix(h),a.setAttribute("normal",l)}if(s.uvs.forEach((function(e,t){var r="uv"+(t+1).toString();0===t&&(r="uv"),a.setAttribute(r,new He(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=Gs(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=Gs(g,r,u,e.normal);o.push(E[0],E[1],E[2])}e.material&&"AllSame"!==e.material.mappingType&&(d=Gs(g,r,u,e.material)[0])<0&&(c.negativeMaterialIndices=!0,d=0),e.uv&&e.uv.forEach((function(e,t){var i=Gs(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=ws.Objects.Geometry[r.geoID];void 0!==a&&n.genMorphGeometry(e,t,a,i,r.name)}))}))}}},{key:"genMorphGeometry",value:function(e,t,r,i,n){for(var a=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],o=void 0!==r.Vertices?r.Vertices.a:[],s=void 0!==r.Indexes?r.Indexes.a:[],A=3*e.attributes.position.count,h=new Float32Array(A),l=0;l<s.length;l++){var c=3*s[l];h[c]=o[3*l],h[c+1]=o[3*l+1],h[c+2]=o[3*l+2]}var u={vertexIndices:a,vertexPositions:h},g=this.genBuffers(u),d=new He(g.vertex,3);d.name=n||r.attrName,d.applyMatrix4(i),e.morphAttributes.position.push(d)}},{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;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 Re).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 bs(a,o,s,i,n).getPoints(12*s.length);return(new r).setFromPoints(u)}}]),e}(),Ts=function(){function e(){at(this,e)}return st(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!==ws.Objects.AnimationCurve){var e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);var t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}}},{key:"parseAnimationCurveNodes",value:function(){var e=ws.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=ws.Objects.AnimationCurve;for(var r in t){var i={id:t[r].id,times:t[r].KeyTime.a.map(Us),values:t[r].KeyValueFloat.a},n=Qs.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=ws.Objects.AnimationLayer,r=new Map,i=function(){var t=[],i=Qs.get(parseInt(n));void 0!==i&&(i.children.forEach((function(r,i){if(e.has(r.ID)){var n=e.get(r.ID);if(void 0!==n.curves.x||void 0!==n.curves.y||void 0!==n.curves.z){if(void 0===t[i]){var o=Qs.get(r.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==o){var s=ws.Objects.Model[o.toString()];if(void 0===s)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",r);var A={modelName:s.attrName?_.sanitizeNodeName(s.attrName):"",ID:s.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};xs.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 a),"PreRotation"in s&&(A.preRotation=s.PreRotation.value),"PostRotation"in s&&(A.postRotation=s.PostRotation.value),t[i]=A}}t[i]&&(t[i][n.attr]=n)}else if(void 0!==n.curves.morph){if(void 0===t[i]){var h=Qs.get(r.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,l=Qs.get(h).parents[0].ID,c=Qs.get(l).parents[0].ID,u=Qs.get(c).parents[0].ID,g=ws.Objects.Model[u],d={modelName:g.attrName?_.sanitizeNodeName(g.attrName):"",morphName:ws.Objects.Deformer[h].attrName};t[i]=d}t[i][n.attr]=n}}})),r.set(parseInt(n),t))};for(var n in t)i();return r}},{key:"parseAnimStacks",value:function(e){var t=ws.Objects.AnimationStack,r={};for(var i in t){var n=Qs.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=[],r=this;return e.layer.forEach((function(e){t=t.concat(r.generateTracks(e))})),new H(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],r=new v,i=new n,a=new v;if(e.transform&&e.transform.decompose(r,i,a),r=r.toArray(),i=(new Ue).setFromQuaternion(i,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,r,"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,i,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,r,i){var n=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(n,t,r);return new oe(e+"."+i,n,a)}},{key:"generateRotationTrack",value:function(e,t,r,i,a,o){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(G.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(G.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(G.degToRad));var s=this.getTimesForAllAxes(t),A=this.getKeyframeTrackValues(s,t,r);void 0!==i&&((i=i.map(G.degToRad)).push(o),i=(new Ue).fromArray(i),i=(new n).setFromEuler(i)),void 0!==a&&((a=a.map(G.degToRad)).push(o),a=(new Ue).fromArray(a),a=(new n).setFromEuler(a).invert());for(var h=new n,l=new Ue,c=[],u=0;u<A.length;u+=3)l.set(A[u],A[u+1],A[u+2],o),h.setFromEuler(l),void 0!==i&&h.premultiply(i),void 0!==a&&h.multiply(a),h.toArray(c,u/3*4);return new se(e+".quaternion",s,c)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,r=t.values.map((function(e){return e/100})),i=xs.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Ae(e.modelName+".morphTargetInfluences["+i+"]",t.times,r)}},{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=Vs(e.times,t,c),e.values=Vs(e.values,t,u)}}}}]),e}(),Ds=function(){function e(){at(this,e)}return st(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 Rs,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=js(n))}else this.parseNodeSpecialProperty(e,i,n)}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=js(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=js(A)}this.getPrevNode()[n]={type:a,type2:o,flag:s,value:A},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),Ms=function(){function e(){at(this,e)}return st(e,[{key:"parse",value:function(e){var t=new Ls(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 Rs;!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 ms((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 Ls(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}(),Ls=function(){function e(t,r){at(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r}return st(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=[],r=0;r<e;r++)t[r]=this.getUint8();var i=t.indexOf(0);return i>=0&&(t=t.slice(0,i)),o.decodeText(new Uint8Array(t))}}]),e}(),Rs=function(){function e(){at(this,e)}return st(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function Fs(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 Us(e){return e/46186158e3}var Ns=[];function Gs(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}(Ns,i.buffer,a,o)}var Os=new Ue,Ps=new v;function Hs(e){var t=new a,r=new a,i=new a,n=new a,o=new a,s=new a,A=new a,h=new a,l=new a,c=new a,u=new a,g=new a,d=e.inheritType?e.inheritType:0;if(e.translation&&t.setPosition(Ps.fromArray(e.translation)),e.preRotation){var f=e.preRotation.map(G.degToRad);f.push(e.eulerOrder||Ue.DefaultOrder),r.makeRotationFromEuler(Os.fromArray(f))}if(e.rotation){var p=e.rotation.map(G.degToRad);p.push(e.eulerOrder||Ue.DefaultOrder),i.makeRotationFromEuler(Os.fromArray(p))}if(e.postRotation){var m=e.postRotation.map(G.degToRad);m.push(e.eulerOrder||Ue.DefaultOrder),n.makeRotationFromEuler(Os.fromArray(m)),n.invert()}e.scale&&o.scale(Ps.fromArray(e.scale)),e.scalingOffset&&A.setPosition(Ps.fromArray(e.scalingOffset)),e.scalingPivot&&s.setPosition(Ps.fromArray(e.scalingPivot)),e.rotationOffset&&h.setPosition(Ps.fromArray(e.rotationOffset)),e.rotationPivot&&l.setPosition(Ps.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(u.copy(e.parentMatrix),c.copy(e.parentMatrixWorld));var I=r.clone().multiply(i).multiply(n),y=new a;y.extractRotation(c);var C=new a;C.copyPosition(c);var E=C.clone().invert().multiply(c),B=y.clone().invert().multiply(E),w=o,Q=new a;if(0===d)Q.copy(y).multiply(I).multiply(B).multiply(w);else if(1===d)Q.copy(y).multiply(B).multiply(I).multiply(w);else{var x=(new a).scale((new v).setFromMatrixScale(u)).clone().invert(),b=B.clone().multiply(x);Q.copy(y).multiply(I).multiply(b).multiply(w)}var k=l.clone().invert(),S=s.clone().invert(),_=t.clone().multiply(h).multiply(l).multiply(r).multiply(i).multiply(n).multiply(k).multiply(A).multiply(s).multiply(o).multiply(S),T=(new a).copyPosition(_),D=c.clone().multiply(T);return g.copyPosition(D),(_=g.clone().multiply(Q)).premultiply(c.invert()),_}function qs(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 js(e){return e.split(",").map((function(e){return parseFloat(e)}))}function zs(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),o.decodeText(new Uint8Array(e,t,r))}function Vs(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}var Js=function(){function e(r,i,n,a,o){at(this,e),this.threelayer=a,this.map=a.map,this.groupId=o,this.loader=new ks,this.loader.load(r,(function(e){e.traverse((function(e){e instanceof t.Mesh&&(e.geometry.computeVertexNormals(),e.scale.set(.04,.04,.04),e.rotation.set(1*Math.PI/2,1*-Math.PI/2,0))}));var r=a.toModel(e,{coordinate:i,altitude:n.altitude||0});o?a.addMesh1(r,o):a.addMesh(r),r.object3d.rotation.z=Math.PI/2}))}return st(e,[{key:"dispose",value:function(){}}]),e}(),Ks={altitude:0,speed:.015,height:10},Ys=function(r){ht(n,$e);var i=gt(n);function n(t,r,a,o,s){var A;at(this,n),Array.isArray(t)&&(t=new e.Polygon([t])),r=e.Util.extend({},Ks,r,{layer:o,polygon:t}),(A=i.call(this)).parent=s,A._initOptions(r);var h=r,l=h.altitude,c=h.height,u=A.createGeometry(t,o,c);A._createMesh(u,a);var g=o.altitudeToVector3(l,l).x,d=o.coordinateToVector3(t.getCenter(),g);return A.getObject3d().position.copy(d),A}return st(n,[{key:"createGeometry",value:function(e,r,i){i=r.altitudeToVector3(i,i).x;var n=r.coordinateToVector3(e.getCenter()),a=e.getShell(),o=[],s=[];a.forEach((function(e){var t=r.coordinateToVector3(e).sub(n);o.push(t),s.push(t.x),s.push(t.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<o.length-1;f++){var m=o[f],I=o[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++]=i,g[v++]=0===f?0:h[f-1]/d,g[v++]=1,u[p++]=m.x,u[p++]=m.y,u[p++]=i,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++]=i,g[v++]=y/d,g[v++]=1}var C=new t.BufferGeometry;return C.setAttribute("position",new t.BufferAttribute(new Float32Array(u),3)),C.setAttribute("uv",new t.BufferAttribute(new Float32Array(g),2)),C}}]),n}(),Ws=function(){function e(r,i,n,a,o){at(this,e),this.threelayer=n,this.map=n.map,this.groupId=a,this.layerClass=o,this.opacity=i.opacity||.8,this.fadeOpacity=i.fadeOpacity||.65,this.color=i.color||"#0099FF",this.fadeColor=i.fadeColor||"#000",this.num=i.num||5,this.hiz=i.hiz||.15,this.data=r.data,this.coords=r.coords,this._uniforms={time:{type:"pv2",value:0},color:{type:"uvs",value:new t.Color(this.color)},fadeColor:{type:"uvs",value:new t.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 t.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:t.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:t.DoubleSide});this.interactive=void 0===i.interactive||i.interactive,this.groundWall=new Ys(this.coords,{height:i.height||1e3,interactive:this.interactive},s,n,this),a?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this),this.clickFunc=i.clickFunc,this._bindMapEvents()}return st(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}(),Xs=function(){function e(r,i,n,a,o){if(at(this,e),this.threelayer=n,this.map=n.map,this.layerClass=o,this.opacity=i.opacity||.8,this.color=i.color||"#0099FF",this.fadeColor=i.fadeColor||"#000",this.repeatX=i.repeatX||10,this.speed=i.speed||.01,i.imgUrl){this.loader=new t.TextureLoader,this.texture=this.loader.load(i.imgUrl),this._uniforms={time:{type:"pv2",value:0},map:{value:this.texture},repeatX:{value:this.repeatX},uvTransform:{value:this.elements}};var s=new t.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:t.DoubleSide});this.groundWall=new Ys(r,{height:i.height||1e3},s,n),a?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this)}}return st(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}();ze.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new p(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},Ve.line={uniforms:Je.merge([ze.common,ze.fog,ze.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 Zs,$s,eA=function(e){ht(r,Ke);var t=gt(r);function r(e){var i;return at(this,r),(i=t.call(this,{type:"LineMaterial",uniforms:Je.clone(Ve.line.uniforms),vertexShader:Ve.line.vertexShader,fragmentShader:Ve.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(ut(i),{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)}}}),i.setValues(e),i}return st(r)}(),tA=function(){function t(e,r,i,n){at(this,t),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 eA({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 eA({color:r.lineColor||"rgb(15,159,190)",transparent:!0,linewidth:r.linewidth||1});var a=[];e.features.forEach((function(e){var t=e.geometry;a.push(t)})),this.lineItems=a}var r;return st(t,[{key:"addLine",value:(r=nt(tt().mark((function t(){var r,i,n=this;return tt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[],this.lineItems.forEach((function(t){"Polygon"===t.type?t.coordinates.forEach((function(t){var i=new e.LineString(t);r.push(i)})):t.coordinates.forEach((function(t){var i=new e.LineString(t[0]);r.push(i)}))})),r.length>0&&(i=this.threeLayer.toFatLines(r,{altitude:1,interactive:!1},this.lineMaterial),this.dashed&&(i.zoomChange=function(){if(n.map){var e=n.map.pixelToDistance(1,0);n.lineMaterial.dashScale=18.93/e}}),this.groupId?this.threeLayer.addMesh1(i,this.groupId):this.threeLayer.addMesh(i),this.line=i),t.abrupt("return",this);case 4:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})}]),t}(),rA={altitude:0},iA=function(r){ht(n,$e);var i=gt(n);function n(r,a,o,s){var A;at(this,n),a=e.Util.extend({layer:s},rA,a),(A=i.call(this))._initOptions(a),A.height=a.height||50;for(var h=1/0,l=1/0,c=-1/0,u=-1/0,g=0;g<r.length;g++){var d=r[g].getCenter();h=Math.min(h,d.x),l=Math.min(l,d.y),c=Math.max(c,d.x),u=Math.max(u,d.y)}var f=new e.Coordinate((h+c)/2,(l+u)/2),p=s.coordinateToVector3(f),v=s.altitudeToVector3(A.height,A.height).x,m=[];A._geometriesAttributes=[],A._colorMap={};for(var I=0;I<r.length;I++){var y=Dt(p,r[I],s,v),C=y.attributes.position.array;A._geometriesAttributes[I]={position:{count:C.length/3}},m.push(y)}A._datas=r,A._uniforms={time:{type:"pv2",value:0},color:{type:"uvs",value:new t.Color("#0099FF")},fadeColor:{type:"uvs",value:new t.Color("#000")},opacity:{type:"pv2",value:A.opacity},num:{type:"pv2",value:5},hiz:{type:"pv2",value:.15}},new t.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:t.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:t.DoubleSide});var E=new t.MeshBasicMaterial({side:t.DoubleSide,transparent:!0,opacity:.5,depthTest:!1,color:"blue"});A._createMesh(m[0],E);var B=s.coordinateToVector3(f,0);return A.getObject3d().position.copy(B),A._setPickObject3d(),A._init(),A}return st(n,[{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(),r=this.getLayer().getPick(),i=this._geometriesAttributes.length,n=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),a=0,o=0;o<i;o++){var s=r.getColor(),A=s.getHex();this._colorMap[A]=o;var h=this._geometriesAttributes[o].position.count;this._datas[o].colorIndex=A;for(var l=0;l<h;l++)n[a]=s.r,n[a+1]=s.g,n[a+2]=s.b,a+=3}e.setAttribute("pickColor",new t.BufferAttribute(n,3,!0));var c=new t.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:t.DoubleSide,transparent:!0}),u=r.getColor().getHex(),g=new t.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}}]),n}(),nA=function(){function t(e,r,i,n,a){at(this,t),this.map=i.map,this.threeLayer=i,this.groupId=n,this.layerClass=a;var o=[];e.features.forEach((function(e){var t=e.geometry;o.push(t)})),this.lineItems=o}var r;return st(t,[{key:"addLine",value:(r=nt(tt().mark((function t(){var r,i;return tt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=[],this.lineItems.forEach((function(t){"Polygon"===t.type?r.push(t):t.coordinates.forEach((function(t){var i=new e.Polygon(t);r.push(i)}))})),i=new iA(r,{},null,this.threeLayer),this.groupId?this.threeLayer.addMesh1(i,this.groupId):this.threeLayer.addMesh(i);case 4:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})}]),t}(),aA=new ie,oA=new v,sA=function(e){ht(r,Xe);var t=gt(r);function r(){var e;at(this,r),(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 He([-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 He([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return st(r,[{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 r=new Ye(t,6,1);return this.setAttribute("instanceStart",new C(r,3,0)),this.setAttribute("instanceEnd",new C(r,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 r=new Ye(t,6,1);return this.setAttribute("instanceColorStart",new C(r,3,0)),this.setAttribute("instanceColorEnd",new C(r,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 We(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 ie);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),aA.setFromBufferAttribute(t),this.boundingBox.union(aA))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new ne),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var r=this.boundingSphere.center;this.boundingBox.getCenter(r);for(var i=0,n=0,a=e.count;n<a;n++)oA.fromBufferAttribute(e,n),i=Math.max(i,r.distanceToSquared(oA)),oA.fromBufferAttribute(t,n),i=Math.max(i,r.distanceToSquared(oA));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(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}]),r}(),AA=new v,hA=new v,lA=new Re,cA=new Re,uA=new Re,gA=new v,dA=new a,fA=new Ze,pA=new v,vA=new ie,mA=new ne,IA=new Re;function yA(e,t,r){return IA.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),IA.multiplyScalar(1/IA.w),IA.x=$s/r.width,IA.y=$s/r.height,IA.applyMatrix4(e.projectionMatrixInverse),IA.multiplyScalar(1/IA.w),Math.abs(Math.max(IA.x,IA.y))}var CA=function(e){ht(r,D);var t=gt(r);function r(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new sA,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new eA({color:16777215*Math.random()});return at(this,r),(e=t.call(this,i,n)).isLineSegments2=!0,e.type="LineSegments2",e}return st(r,[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*t.count),n=0,a=0,o=t.count;n<o;n++,a+=2)AA.fromBufferAttribute(t,n),hA.fromBufferAttribute(r,n),i[a]=0===a?0:i[a-1],i[a+1]=i[a]+AA.distanceTo(hA);var s=new Ye(i,2,1);return e.setAttribute("instanceDistanceStart",new C(s,1,0)),e.setAttribute("instanceDistanceEnd",new C(s,1,1)),this}},{key:"raycast",value:function(e,t){var r=this.material.worldUnits,i=e.camera;null!==i||r||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');var n=void 0!==e.params.Line2&&e.params.Line2.threshold||0;Zs=e.ray;var a,o=this.matrixWorld,s=this.geometry,A=this.material;($s=A.linewidth+n,null===s.boundingSphere&&s.computeBoundingSphere(),mA.copy(s.boundingSphere).applyMatrix4(o),r)?a=.5*$s:a=yA(i,Math.max(i.near,mA.distanceToPoint(Zs.origin)),A.resolution);if(mA.radius+=a,!1!==Zs.intersectsSphere(mA)){var h;if(null===s.boundingBox&&s.computeBoundingBox(),vA.copy(s.boundingBox).applyMatrix4(o),r)h=.5*$s;else h=yA(i,Math.max(i.near,vA.distanceToPoint(Zs.origin)),A.resolution);vA.expandByScalar(h),!1!==Zs.intersectsBox(vA)&&(r?function(e,t){for(var r=e.matrixWorld,i=e.geometry,n=i.attributes.instanceStart,a=i.attributes.instanceEnd,o=0,s=Math.min(i.instanceCount,n.count);o<s;o++){fA.start.fromBufferAttribute(n,o),fA.end.fromBufferAttribute(a,o),fA.applyMatrix4(r);var A=new v,h=new v;Zs.distanceSqToSegment(fA.start,fA.end,h,A),h.distanceTo(A)<.5*$s&&t.push({point:h,pointOnLine:A,distance:Zs.origin.distanceTo(h),object:e,face:null,faceIndex:o,uv:null,uv2:null})}}(this,t):function(e,t,r){var i=t.projectionMatrix,n=e.material.resolution,a=e.matrixWorld,o=e.geometry,s=o.attributes.instanceStart,A=o.attributes.instanceEnd,h=Math.min(o.instanceCount,s.count),l=-t.near;Zs.at(1,uA),uA.w=1,uA.applyMatrix4(t.matrixWorldInverse),uA.applyMatrix4(i),uA.multiplyScalar(1/uA.w),uA.x*=n.x/2,uA.y*=n.y/2,uA.z=0,gA.copy(uA),dA.multiplyMatrices(t.matrixWorldInverse,a);for(var c=0,u=h;c<u;c++)if(lA.fromBufferAttribute(s,c),cA.fromBufferAttribute(A,c),lA.w=1,cA.w=1,lA.applyMatrix4(dA),cA.applyMatrix4(dA),!(lA.z>l&&cA.z>l)){if(lA.z>l){var g=lA.z-cA.z,d=(lA.z-l)/g;lA.lerp(cA,d)}else if(cA.z>l){var f=cA.z-lA.z,p=(cA.z-l)/f;cA.lerp(lA,p)}lA.applyMatrix4(i),cA.applyMatrix4(i),lA.multiplyScalar(1/lA.w),cA.multiplyScalar(1/cA.w),lA.x*=n.x/2,lA.y*=n.y/2,cA.x*=n.x/2,cA.y*=n.y/2,fA.start.copy(lA),fA.start.z=0,fA.end.copy(cA),fA.end.z=0;var m=fA.closestPointToPointParameter(gA,!0);fA.at(m,pA);var I=G.lerp(lA.z,cA.z,m),y=I>=-1&&I<=1,C=gA.distanceTo(pA)<.5*$s;if(y&&C){fA.start.fromBufferAttribute(s,c),fA.end.fromBufferAttribute(A,c),fA.start.applyMatrix4(a),fA.end.applyMatrix4(a);var E=new v,B=new v;Zs.distanceSqToSegment(fA.start,fA.end,B,E),r.push({point:B,pointOnLine:E,distance:Zs.origin.distanceTo(B),object:e,face:null,faceIndex:c,uv:null,uv2:null})}}}(this,i,t))}}}]),r}(),EA=function(e){ht(r,sA);var t=gt(r);function r(){var e;return at(this,r),(e=t.call(this)).isLineGeometry=!0,e.type="LineGeometry",e}return st(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 ft(lt(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 ft(lt(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}(),BA=function(e){ht(r,CA);var t=gt(r);function r(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new EA,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new eA({color:16777215*Math.random()});return at(this,r),(e=t.call(this,i,n)).isLine2=!0,e.type="Line2",e}return st(r)}(),wA={altitude:0,height:10},QA=function(t){ht(i,$e);var r=gt(i);function i(t,n,a,o){var s;at(this,i),n=e.Util.extend({},wA,n,{layer:o,coordinate:t}),s=r.call(this);var A=n,h=A.altitude,l=A.height;s._initOptions(n),s.map=o.map;var c=o.altitudeToVector3(l,l).x;s.beginSizeZoom=n.beginSizeZoom||3,s.endSizeZoom=n.endSizeZoom||12,s.spanSizeZoom=s.endSizeZoom-s.beginSizeZoom,s.stepSize=1/(s.endSizeZoom-s.beginSizeZoom+1);var u=[];u.push(0,0,c),u.push(0,0,0);var g=new EA;g.setPositions(u),s.object3d=new BA(g,a),s.object3d.computeLineDistances(),s.object3d.scale.set(1,1,1),s.object3d.__parent=ut(s);var d=o.distanceToVector3(h,h).x,f=o.coordinateToVector3(t,d);return s.getObject3d().position.copy(f),n.closeZoomChange||(s.zoomChange=function(){var e=s.getMap();if(e){var t=e.pixelToDistance(1,0);g.attributes.instanceStart.data.array[2]=c*t*s._getRate(),g.attributes.instanceStart.needsUpdate=!0}}),s}return st(i,[{key:"_getRate",value:function(){var e=this.map.getZoom()-this.beginSizeZoom;return(e=e>this.spanSizeZoom?this.spanSizeZoom:e)*this.stepSize+this.stepSize}}]),i}(),xA=function(){function t(e,r,i,n){var a=this;at(this,t),0!=e.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=[],e.forEach((function(e){var t;t=a.dashed?new eA({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 eA({color:e.color||"#35FFAC",linewidth:r.lineWidth||4,dashed:!1,transparent:!0,opacity:r.opacity||1}),a._setMaterialRes(i,t);var n=new QA([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=e):console.error("需要绘制的点位数量为0")}return st(t,[{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(t,r,i){for(var n=1/0,a=1/0,o=-1/0,s=-1/0,A=0;A<this.dataItems.length;A++){var h=this.dataItems[A];t.includes(h.code)?(n=Math.min(n,this.dataItems[A].longitude),a=Math.min(a,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(),r&&this.map.fitExtent(new e.Extent(n,a,o,s),i||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()}))}}]),t}(),bA={altitude:0,height:0},kA=function(r){ht(n,$e);var i=gt(n);function n(r,a,o,s){var A;at(this,n),o=e.Util.extend({},bA,o,{layer:s}),A=i.call(this);var h=o,l=h.width,c=h.height,u=h.altitude;A._initOptions(o);var g=new t.PlaneGeometry(l,c);A._createMesh(g,a);var d=s.distanceToVector3(u,u).x,f=s.coordinateToVector3(r,d);return A.getObject3d().position.copy(f),A}return st(n)}(),SA=function(){function r(i,n,a,o,s,A,h){var l=this;at(this,r),this.threelayer=s,this.map=s.map,this.layerClass=A,this.groupId=h,this.millsec=o.millsec||1e3,this.duration=o.duration||75;var c=i.split(","),u=n.split(","),g=parseFloat(c[0]),d=parseFloat(c[1]),f=parseFloat(u[0]),p=parseFloat(u[1]),v=new e.Extent(g,d,f,p),m=1/0,I=1/0,y=-1/0,C=-1/0;[[g,d],[g,p],[f,p],[f,d]].forEach((function(e){var t=l.threelayer.coordinateToVector3(e),r=t.x,i=t.y;m=Math.min(r,m),I=Math.min(i,I),y=Math.max(r,y),C=Math.max(i,C)}));var E=Math.abs(y-m),B=Math.abs(C-I);a.length>1&&ar.generateGifTexture(a,o.width,o.height).then((function(e){l.texture=e.texture,l.annie=new Jt(e.texture,e.colNum,e.rowNum,a.length,l.duration,e.colNum==e.rowNum);var r=new t.MeshBasicMaterial({map:e.texture,transparent:!0,opacity:void 0!==o.opacity?parseFloat(o.opacity):1}),i=new kA(v.getCenter(),r,{width:E,height:B,interactive:!1},s);l.groupId?l.threelayer.addMesh1(i,l.groupId):l.threelayer.addMesh(i),l.imgObj=i,l.layerClass.updatables.push(l)}))}return st(r,[{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()}}]),r}(),_A={radius:50,altitude:0},TA=function(r){ht(n,$e);var i=gt(n);function n(r,a,o,s){var A;at(this,n),a=e.Util.extend({},_A,a,{layer:s}),A=i.call(this),a.altitude,A._initOptions(a);var h=Tt(r),l=s.coordinateToVector3(h),c=[];r.forEach((function(e){var t=s.coordinateToVector3(e);t.sub(l),c.push(t)}));var u=new t.CatmullRomCurve3(c),g=s.distanceToVector3(a.radius,a.radius).x,d=new t.TubeGeometry(u,2,g,20,!1);return A._createMesh(d,o),A.parent=null,A.getObject3d().position.set(l.x,l.y,g/2),A}return st(n)}(),DA=function(){function e(r,i,n,a){at(this,e),this.threelayer=n,this.map=n.map,this.groupId=a;var o=new t.MeshMatcapMaterial({color:i.color||"red",side:t.DoubleSide});this.m=o;var s=new TA(r,{radius:i.radius||2},o,n);s.parent=this,this.groupId?this.threelayer.addMesh1(s,this.groupId):this.threelayer.addMesh(s),this.mesh=s}return st(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}(),MA={radius:100,altitude:0},LA=function(t){ht(i,$e);var r=gt(i);function i(t,n,a,o,s){var A;at(this,i),n=e.Util.extend({},MA,n,{layer:s,coordinate:t}),(A=r.call(this))._initOptions(n);var h=n.altitude;A.object3d=new BA(a,o),A.object3d.computeLineDistances(),A.object3d.scale.set(1,1,1),A.object3d.__parent=ut(A);var l=s.distanceToVector3(h,h).x,c=s.coordinateToVector3(t,l);return A.getObject3d().position.copy(c),A}return st(i)}(),RA={altitude:0,height:0},FA=function(r){ht(n,$e);var i=gt(n);function n(r,a,o,s){var A;at(this,n),o=e.Util.extend({},RA,o,{layer:s}),A=i.call(this);var h=o;h.width,h.height;var l=h.altitude;A._initOptions(o);var c=[],u=new t.ConeGeometry(1,2,10);u.translate(0,2.5,0),c.push(u);var g=new t.CylinderGeometry(.4,.6,3,10);c.push(g);var d=Bt(c);d.computeVertexNormals(),A._createMesh(d,a);var f=s.distanceToVector3(l,l).x,p=s.coordinateToVector3(r,f);return A.getObject3d().position.copy(p),A}return st(n)}(),UA=function(){function r(i,n,a,o,s){at(this,r),this.threelayer=a,this.map=a.map,this.layerClass=o,this.groupId=s;var A=void 0===n.lineFlag||!1!==n.lineFlag,h=n.heightDiv||4,l=n.pointsLen||20,c=n.arrowColor||"rgb(0,255,255)",u=n.arrowNum||5;this.speedFactor=n.speedFactor||2e-4,this.material=null,this.curve=null,this.meshs=[],this.arrows=[],this.up=new t.Vector3(0,1,0),this.axis=new t.Vector3,A&&(this.lineMaterial=new eA({color:n.lineColor||"red",transparent:!0,linewidth:n.linewidth||4}),this._setMaterialRes(a,this.lineMaterial));var g=new t.MeshBasicMaterial({color:c,side:t.DoubleSide,transparent:!0});this.material=g;var d=new e.LineString(i),f=Rt(d)/h,p=a.distanceToVector3(f,f).x,v=i[0],m=i[1],I=[v[0]/2+m[0]/2,v[1]/2+m[1]/2],y=a.coordinateToVector3(d.getCenter()),C=a.coordinateToVector3(v).sub(y),E=a.coordinateToVector3(m).sub(y),B=a.coordinateToVector3(I,p).sub(y),w=new t.CatmullRomCurve3([C,B,E],!1,"catmullrom");this.curve=w,this.centerPt=y;var Q=w.getPoints(l),x=[];Q.forEach((function(e){x.push(e.x,e.y,e.z)}));var b=new EA;b.setPositions(x);var k=new LA(d.getCenter(),{interactive:!1},b,this.lineMaterial,a);this.meshs.push(k),this.ArrowNum=u;var S=1/this.ArrowNum;this.addSpan=Math.floor(100*S)/100;for(var _=0;_<this.ArrowNum;_++){var T=new FA(i[0],g,{},a);T.object3d.renderOrder=n.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 i;return st(r,[{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:(i=nt(tt().mark((function e(r){var i;return tt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.promiseToDoSomething(r);case 2:return i=e.sent,this.texture=new t.CanvasTexture(i.canvas),this.material=new t.MeshBasicMaterial({map:this.texture,side:t.DoubleSide,transparent:!0}),e.abrupt("return",this.material);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return i.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}}]),r}(),NA=function(){function r(i,n,a,o,s){var A=this;at(this,r),this.threelayer=a,this.map=a.map,this.layerClass=o,this.groupId=s;var h=n.heightDiv||4,l=n.pointsLen||20;this.sum=0,this.meshs=[];var c=new e.LineString(i),u=Rt(c)/h,g=a.distanceToVector3(u,u).x,d=i[0],f=i[1],p=[d[0]/2+f[0]/2,d[1]/2+f[1]/2],v=a.coordinateToVector3(c.getCenter()),m=a.coordinateToVector3(d).sub(v),I=a.coordinateToVector3(f).sub(v),y=a.coordinateToVector3(p,g).sub(v);this.lineMaterialDash=new eA({color:n.lineDashColor||"red",transparent:!0,linewidth:n.lineDashWidth||4,dashed:!0,defines:{USE_DASH:""},dashScale:1,dashSize:n.dashSize||20,gapSize:1}),this.lineMaterial=new eA({color:n.lineColor||"red",transparent:!0,linewidth:n.lineWidth||2,opacity:n.lineOpacity||.4}),this._setMaterialRes(a,this.lineMaterialDash),this._setMaterialRes(a,this.lineMaterial);var C=new t.CatmullRomCurve3([m,y,I],!1,"catmullrom").getPoints(l),E=[];C.forEach((function(e){E.push(e.x,e.y,e.z)}));var B=new EA;B.setPositions(E);var w=new LA(c.getCenter(),{interactive:!1},B,this.lineMaterialDash,a),Q=new LA(c.getCenter(),{interactive:!1},B,this.lineMaterial,a),x=Q.object3d.geometry.attributes.instanceDistanceEnd.array;this.len=x[x.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(Q,this.groupId),this.threelayer.addMesh1(w,this.groupId)):(this.threelayer.addMesh(Q),this.threelayer.addMesh(w)),this.meshs.push(Q),this.meshs.push(w),this.layerClass.updatables.push(this)}return st(r,[{key:"tick",value:function(e){this.shaderDash&&(this.sum+=this.dur*e*.01,this.sum%=1,this.shaderDash.uniforms.actionRatio.value=this.sum)}},{key:"setPath",value:function(e,r,i,n){for(var a=e.geometry.attributes.position,o=new t.CatmullRomCurve3([r,n,i],!1,"catmullrom").getPoints(20),s=0;s<=19;s++){var A=o[s];a.setXYZ(s,A.x,A.y,A.z)}a.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()}}]),r}();et.prototype._recursionMesh=function(e){for(;e&&e.parent!==this.getScene()&&!e.parent.customType;)e=e.parent;return e},et.prototype.identify=function(r,i){var n=this;if(!r)return console.error("coordinate is null,it should be Coordinate"),[];if(Array.isArray(r)&&(r=new e.Coordinate(r)),!(r instanceof e.Coordinate))return console.error("coordinate type is error,it should be Coordinate"),[];var a=this.getMap().coordToContainerPoint(r);this._containerPoint=a;var o=a.x,s=a.y;this._initRaycaster(),this.fire("identify",{coordinate:r,options:i});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=o/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(r){var i=r.__parent;if(i&&i.getOptions){var n=i;n.getOptions().interactive&&n.isVisible()&&(n.identify&&e.Util.isFunction(n.identify)?p.push(n):f.push(r))}else(r instanceof t.Mesh||r instanceof t.Group)&&(r.customType?r.children.forEach((function(t){var r=t.__parent;if(r&&r.getOptions){var i=r;i.getOptions().interactive&&i.isVisible()&&(i.identify&&e.Util.isFunction(i.identify)?p.push(i):f.push(t))}})):f.push(r))}));var v=[],m=A.intersectObjects(f,!0);m&&Array.isArray(m)&&m.length&&(v=m.map((function(t){var r=t.object,i=t.instanceId,a=(r=n._recursionMesh(r)||{}).__parent||r;return a.faceIndex=t.faceIndex,a.index=t.index,a.intersect=t,e.Util.isNumber(i)&&(a.instanceId=i),a}))),this.renderPickScene(),p.length&&p.forEach((function(e){e.identify(r)&&v.push(e)}));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=(i=e.Util.extend({},i)).count;return e.Util.isNumber(E)&&E>0?v.slice(0,E):v},et.prototype._zoomend=function(){var t=this.getScene();if(t){var r=this.getMap().getZoom();t.children.forEach((function(t){if(t.customType)t.children.forEach((function(t){var i=t.__parent;if(i&&i.getOptions){var n=i;n.zoomChange&&e.Util.isFunction(n.zoomChange)&&n.zoomChange(r);var a=n.getMinZoom(),o=n.getMaxZoom();r<a||r>o?(n.isVisible()&&(n.getObject3d().visible=!1),n._zoomVisible=!1):a<=r&&r<=o&&(n._visible&&(n.getObject3d().visible=!0),n._zoomVisible=!0)}}));else{var i=t.__parent;if(i&&i.getOptions){var n=i;n.zoomChange&&e.Util.isFunction(n.zoomChange)&&n.zoomChange(r);var a=n.getMinZoom(),o=n.getMaxZoom();r<a||r>o?(n.isVisible()&&(n.getObject3d().visible=!1),n._zoomVisible=!1):a<=r&&r<=o&&(n._visible&&(n.getObject3d().visible=!0),n._zoomVisible=!0)}}}))}},et.prototype.addMesh1=function(e,t){var r=this,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return this;Array.isArray(e)||(e=[e]);var n=this.getScene(),a=void 0;if(t&&(a=n.getObjectByProperty("customId",t)),e.forEach((function(e){if(e instanceof $e){var t;if(a)a.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(),i){var o=this._getRenderer();o&&o.setToRedraw()}return this},et.prototype.removeMesh1=function(r,i){var n=this,a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!r)return this;Array.isArray(r)||(r=[r]);var o=this.getScene(),s=o.getObjectByProperty("customId",i);if(r.forEach((function(r){if(r instanceof $e){s?s.remove(r.getObject3d()):o.remove(r.getObject3d()),r.isAdd&&(r.isAdd=!1,r._fire("remove",{target:r})),r._animation&&e.Util.isFunction(r._animation)&&delete n._animationBaseObjectMap[r.getObject3d().uuid];var i=n._delayMeshes;if(i.length)for(var a=0,A=i.length;a<A;a++)if(i[a]===r){i.splice(a,1);break}}else r instanceof t.Object3D&&o.remove(r)})),a){var A=this._getRenderer();A&&A.setToRedraw()}return this};var GA=function(){function e(r,i){var n=this;at(this,e),this.map=i,this.animationId=null,this.updatables=[];var a=bt();this.threeLayer=new et(a,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new t.Clock;var o=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=Ct(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,r,i){var n=new t.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),r.add(n),o()},this.threeLayer.addTo(i),this.layerId=a,this.layerName=r,this.dirty=!1,this.initFlag=!1}var r;return st(e,[{key:"createGroup",value:(r=nt(tt().mark((function e(t){return tt().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,kt(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 r.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 Jo(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=bt();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,r=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=Ct(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(i){e.threeLayer.prepareToDraw=function(e,n,a){var o=new t.DirectionalLight(16777215);o.position.set(0,-10,10).normalize(),n.add(o),n.add(new t.AmbientLight(16777215)),r(),i()}}))}},{key:"drawRadar",value:function(e,t,r){var i=this;return new Promise((function(n){if(i.threeLayer.getScene()){var a=new Pt(e,t,r||{},i.threeLayer,i);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new Pt(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 jt(e,t,r||{},i.threeLayer,i);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new jt(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 Kt(e,t,r||{},i.threeLayer,i);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new Kt(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 Nt(e,t,r,i,a.threeLayer,n);o(s)}else a.initFlag=!0,a.prepareToDraw().then((function(){var s=new Nt(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 Xt(e,t||{},r.threeLayer,r);i(n)}else r.initFlag=!0,r.prepareToDraw().then((function(){var n=new Xt(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 Cr(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 Cr(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 qo(e,t,r.threeLayer,r);i(n)}else r.initFlag=!0,r.prepareToDraw().then((function(){var n=new qo(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 Vo(e,t.threeLayer);r(i)}else t.initFlag=!0,t.prepareToDraw().then((function(){var i=new Vo(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 Js(e,t,r,n.threeLayer,i);a(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new Js(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 Ws(e,t||{},i.threeLayer,r,i);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new Ws(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 Xs(e,t||{},i.threeLayer,r,i);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new Xs(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 tA(e,t,i.threeLayer,r);a.addLine().then((function(){n(a)}))}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new tA(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 nA(e,t,i.threeLayer,r,i);a.addLine().then((function(){n(a)}))}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new nA(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 xA(e,t||{},i.threeLayer,r);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new xA(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 DA(e,t||{},i.threeLayer,r);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new DA(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 SA(e,t,r,i||{},a.threeLayer,a,n);o(s)}else a.initFlag=!0,a.prepareToDraw().then((function(){var s=new SA(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 UA(e,t||{},i.threeLayer,i,r);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new UA(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 NA(e,t||{},i.threeLayer,i,r);n(a)}else i.initFlag=!0,i.prepareToDraw().then((function(){var a=new NA(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}(),OA=function(){function t(r,i,n,a){at(this,t),this.map=a,this.geometry=null,this.selectGeometry=null,this.isEndSelect=!1,this.drawTool=new e.DrawTool({mode:r,symbol:{lineColor:n.lineColor||"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:n.polygonFill||"#E40D56",polygonOpacity:.2}}).addTo(this.map).enable(),this._bindEvent(),this._drawEnd=i,this.mode=r,this.toolLayer=new e.VectorLayer(e.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 st(t,[{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}}]),t}();export{FA as Arrow3D,EA as LineGeometry,eA as LineMaterial,Jt as TextureAnimator,OA as drawTool,ar as gisCommon,Vo as gltfLoadClass,Nt as imgClass,GA as layerClass,LA as line2Object,Rt as lineLength,SA as planeGifClass,Cr as planeMark,Kt as planeSectorClass,Pt as radarClass,Ws as rippleWallClass,jt as sectorClass,Xt as shockClass,kt as sleep,qo as tileClass,UA as tripHeight,NA as tripLineClass,DA as tubeClass,xA as verticalFatLineClass};
1
+ import*as t from"maptalks";import*as e from"three";import{BufferGeometry as n,BufferAttribute as r,Quaternion as i,Matrix4 as o,LoaderUtils as s,FileLoader as a,Loader as u,Color as l,SpotLight as c,PointLight as h,DirectionalLight as f,MeshBasicMaterial as p,sRGBEncoding as g,MeshPhysicalMaterial as A,Vector2 as d,Vector3 as y,InstancedMesh as v,Object3D as m,InterleavedBuffer as _,InterleavedBufferAttribute as I,LinearFilter as E,LinearMipmapLinearFilter as C,RepeatWrapping as x,PointsMaterial as w,Material as b,LineBasicMaterial as B,MeshStandardMaterial as S,DoubleSide as M,PropertyBinding as L,SkinnedMesh as N,Mesh as T,LineSegments as R,Line as Q,LineLoop as D,Points as P,Group as k,PerspectiveCamera as O,MathUtils as F,OrthographicCamera as G,Skeleton as U,AnimationClip as q,Bone as j,TriangleFanDrawMode as z,NearestFilter as V,NearestMipmapNearestFilter as Y,LinearMipmapNearestFilter as H,NearestMipmapLinearFilter as X,ClampToEdgeWrapping as J,MirroredRepeatWrapping as W,FrontSide as K,TextureLoader as Z,ImageBitmapLoader as $,Texture as tt,TriangleStripDrawMode as et,InterpolateLinear as nt,Box3 as rt,Sphere as it,InterpolateDiscrete as ot,VectorKeyframeTrack as st,QuaternionKeyframeTrack as at,NumberKeyframeTrack as ut,Interpolant as lt,DefaultLoadingManager as ct,Spherical as ht,Ray as ft,LoadingManager as pt,Frustum as gt,RGBAFormat as At,RGFormat as dt,RedFormat as yt,FloatType as vt,HalfFloatType as mt,UnsignedByteType as _t,CompressedArrayTexture as It,CompressedTexture as Et,LinearEncoding as Ct,RGBA_ASTC_4x4_Format as xt,RGBA_BPTC_Format as wt,RGBA_ETC2_EAC_Format as bt,RGBA_PVRTC_4BPPV1_Format as Bt,RGBA_S3TC_DXT5_Format as St,RGB_ETC1_Format as Mt,RGB_ETC2_Format as Lt,RGB_PVRTC_4BPPV1_Format as Nt,RGB_S3TC_DXT1_Format as Tt,Data3DTexture as Rt,DataTexture as Qt,Vector4 as Dt,Curve as Pt,Euler as kt,MeshPhongMaterial as Ot,MeshLambertMaterial as Ft,EquirectangularReflectionMapping as Gt,AmbientLight as Ut,Float32BufferAttribute as qt,Uint16BufferAttribute as jt,Matrix3 as zt,UniformsLib as Vt,ShaderLib as Yt,UniformsUtils as Ht,ShaderMaterial as Xt,InstancedInterleavedBuffer as Jt,WireframeGeometry as Wt,InstancedBufferGeometry as Kt,Line3 as Zt}from"three";import{BaseObject as $t,ThreeLayer as te}from"maptalks.three";function ee(){ee=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var o=e&&e.prototype instanceof f?e:f,s=Object.create(o.prototype),a=new w(i||[]);return r(s,"_invoke",{value:I(t,n,a)}),s}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function f(){}function p(){}function g(){}var A={};u(A,o,(function(){return this}));var d=Object.getPrototypeOf,y=d&&d(d(b([])));y&&y!==e&&n.call(y,o)&&(A=y);var v=g.prototype=f.prototype=Object.create(A);function m(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var u=c(t[r],t,o);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return i("throw",t,s,a)}))}a(u.arg)}var o;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}})}function I(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return B()}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=E(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=c(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function E(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var i=c(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;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,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}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 x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function w(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 r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:B}}function B(){return{value:void 0,done:!0}}return p.prototype=g,r(v,"constructor",{value:g,configurable:!0}),r(g,"constructor",{value:p,configurable:!0}),p.displayName=u(g,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,u(t,a,"GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},m(_.prototype),u(_.prototype,s,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var s=new _(l(e,n,r,i),o);return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},m(v),u(v,a,"Generator"),u(v,o,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=b,w.prototype={constructor:w,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(x),!t)for(var e in this)"t"===e.charAt(0)&&n.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 r(n,r){return s.type="throw",s.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.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,h):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),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),x(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;x(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:b(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function ne(t){return ne="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},ne(t)}function re(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function ie(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){re(o,r,i,s,a,"next",t)}function a(t){re(o,r,i,s,a,"throw",t)}s(void 0)}))}}function oe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function se(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ee(r.key),r)}}function ae(t,e,n){return e&&se(t.prototype,e),n&&se(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ue(t,e,n){return(e=Ee(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function le(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&&he(t,e)}function ce(t){return ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ce(t)}function he(t,e){return he=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},he(t,e)}function fe(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function pe(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 n,r=ce(t);if(e){var i=ce(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.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 fe(t)}(this,n)}}function ge(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=ce(t)););return t}function Ae(){return Ae="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=ge(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Ae.apply(this,arguments)}function de(t,e,n,r){return de="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,n,r){var i,o=ge(t,e);if(o){if((i=Object.getOwnPropertyDescriptor(o,e)).set)return i.set.call(r,n),!0;if(!i.writable)return!1}if(i=Object.getOwnPropertyDescriptor(r,e)){if(!i.writable)return!1;i.value=n,Object.defineProperty(r,e,i)}else ue(r,e,n);return!0},de(t,e,n,r)}function ye(t,e,n,r,i){if(!de(t,e,n,r||t)&&i)throw new TypeError("failed to set property");return n}function ve(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],u=!0,l=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);u=!0);}catch(t){l=!0,i=t}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}(t,e)||me(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 me(t,e){if(t){if("string"==typeof t)return _e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_e(t,e):void 0}}function _e(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Ie(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=me(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},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(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Ee(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;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 Ce(t){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=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 n,c=0,h=0;h<t.length;++h){var f=t[h],p=0;if(r!==(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(r)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(r){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 C=xe(s[E]);if(!C)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+E+" attribute."),null;l.setAttribute(E,C)}for(var x in a){var w=a[x][0].length;if(0===w)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[x]=[];for(var b=0;b<w;++b){for(var B=[],S=0;S<a[x].length;++S)B.push(a[x][S][b]);var M=xe(B);if(!M)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+x+" morphAttribute."),null;l.morphAttributes[x].push(M)}}return l}function xe(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(u,n,i)}var we=Math.PI/180,be=6378137;function Be(){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 Se(t){return new Promise((function(e){return setTimeout(e,t)}))}function Me(t,e){return e.split("").forEach((function(e){-1===t.indexOf(e)&&(t+=e)})),t}function Le(t,n){return 256*(t=e.MathUtils.clamp(Math.floor(t),0,255))+(n=e.MathUtils.clamp(Math.floor(n),0,255))}function Ne(e){for(var n=1/0,r=1/0,i=-1/0,o=-1/0,s=0,a=e.length;s<a;s++){var u=e[s],l=u.coordinate,c=u.lnglat,h=u.lnglats,f=u.xy,p=u.xys,g=l||c||h||f||p||e[s],A=void 0,d=void 0;Array.isArray(g)?(A=g[0],d=g[1]):g instanceof t.Coordinate&&(A=g.x,d=g.y),n=Math.min(n,A),r=Math.min(r,d),i=Math.max(i,A),o=Math.max(o,d)}return new t.Coordinate((n+i)/2,(r+o)/2)}function Te(t,n,r,i){var o=t,s=n.getShell(),a=[];s.forEach((function(t){var e=r.coordinateToVector3(t).sub(o);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]=i,h[6]=f.x,h[7]=f.y,h[8]=0,h[3]=p.x,h[4]=p.y,h[5]=i,h[9]=p.x,h[10]=p.y,h[11]=0;var g=new e.BufferGeometry;g.setAttribute("position",new e.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]=i,A[6]=d.x,A[7]=d.y,A[8]=0,A[3]=y.x,A[4]=y.y,A[5]=i,A[9]=y.x,A[10]=y.y,A[11]=0;var v=new e.BufferGeometry;v.setAttribute("position",new e.BufferAttribute(A,3)),v.setIndex([0,2,1,2,3,1]),u.push(v);var m=Ce(u);return m.computeVertexNormals(),m}function Re(t){return t*we}function Qe(t,e){if(!t||!e)return 0;Array.isArray(t)||(t=t.toArray()),Array.isArray(e)||(e=e.toArray());var n=Re(t[1]),r=Re(e[1]),i=n-r,o=Re(t[0])-Re(e[0]);return n=2*Math.asin(Math.sqrt(Math.pow(Math.sin(i/2),2)+Math.cos(n)*Math.cos(r)*Math.pow(Math.sin(o/2),2))),n*=be,Math.round(1e5*n)/1e5}function De(t){for(var e=function(t){return t.getCoordinates().map((function(t){return t.toArray()}))}(t),n=0,r=0,i=e.length;r<i-1;r++)n+=Qe(e[r],e[r+1]);return n}var Pe={altitude:0,imageWidth:512,imageHeight:512,texture:null},ke=function(n){le(i,$t);var r=pe(i);function i(n,o,s,a){var u;oe(this,i);var l=o=t.Util.extend({},Pe,o),c=l.altitude;l.imageHeight,l.imageWidth,n instanceof t.Extent||(n=new t.Extent(n));var h=n,f=h.xmin,p=h.ymin,g=h.xmax,A=h.ymax,d=1/0,y=1/0,v=-1/0,m=-1/0;[[f,p],[f,A],[g,A],[g,p]].forEach((function(t){var e=a.coordinateToVector3(t),n=e.x,r=e.y;d=Math.min(n,d),y=Math.min(r,y),v=Math.max(n,v),m=Math.max(r,m)}));var _=Math.abs(v-d),I=Math.abs(m-y),E=new e.PlaneGeometry(_,I);(u=r.call(this))._initOptions(o),u._createMesh(E,s);var C=a.distanceToVector3(c,c).x,x=a.coordinateToVector3(n.getCenter(),C);return u.getObject3d().position.copy(x),u.parent=null,u.type="Image",u}return ae(i)}(),Oe=function(){function n(r,i,o,s,a,u){var l=this;oe(this,n),this.threelayer=a,this.map=a.map,this.groupId=u,this.textureLoader=new e.TextureLoader;var c=r.split(","),h=i.split(","),f=parseFloat(c[0]),p=parseFloat(c[1]),g=parseFloat(h[0]),A=parseFloat(h[1]),d=s.maxZoom||11,y=s.renderOrder||0,v=s.opacity||1,m=s.minZoom||3,_=new t.Extent(f,p,g,A);this.xmin_g=f,this.ymin_g=p,this.xmax_g=g,this.ymax_g=A,this.cacheTextureFlag=s.cacheTextureFlag,this.cacheTexture={},this.textureLoader.load(o,(function(t){var n=new e.MeshBasicMaterial({map:t,transparent:!0,opacity:v}),r=new ke(_,{imageWidth:512,imageHeight:512,maxZoom:d,minZoom:m,interactive:void 0!==s.interactive&&s.interactive},n,l.threelayer);r.object3d.renderOrder=y,l.imgMesh=r,l.imgMesh.parent=l,l.m=n,l.texture=t,l.groupId?l.threelayer.addMesh1(l.imgMesh,l.groupId):l.threelayer.addMesh(l.imgMesh),s.opacityItems&&s.opacityItems.length>0&&!isNaN(s.opacityItems[0])&&!isNaN(s.opacityItems[1])&&s.opacityItems[0]>3&&s.opacityItems[0]<=18&&s.opacityItems[1]>=0&&s.opacityItems[1]<=1&&(l.opacityItems=s.opacityItems,l._bindMapEvents(),l._viewChange()),l.cacheTextureFlag&&void 0===l.cacheTexture[o]&&(l.cacheTexture[o]=t)}))}return ae(n,[{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(n,r){var i=this;if(r&&r.leftbottom&&r.righttop){var o=parseFloat(r.leftbottom[0]),s=parseFloat(r.leftbottom[1]),a=parseFloat(r.righttop[0]),u=parseFloat(r.righttop[1]);if(o!==this.xmin_g||s!==this.ymin_g||a!==this.xmax_g||u!==this.ymax_g){var l=new t.Extent(o,s,a,u),c=1/0,h=1/0,f=-1/0,p=-1/0;[[o,s],[o,u],[a,u],[a,s]].forEach((function(t){var e=i.threelayer.coordinateToVector3(t),n=e.x,r=e.y;c=Math.min(n,c),h=Math.min(r,h),f=Math.max(n,f),p=Math.max(r,p)}));for(var g=Math.abs(f-c),A=Math.abs(p-h),d=new e.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=o,this.ymin_g=s,this.xmax_g=a,this.ymax_g=u}}this.cacheTextureFlag?void 0===this.cacheTexture[n]?this.textureLoader.load(n,(function(t){t.magFilter=e.NearestFilter,t.minFilter=e.NearestFilter,i.imgMesh.object3d.material.map=t,i.imgMesh.object3d.material.map.needsUpdate=!0,i.cacheTexture[n]=t})):(this.imgMesh.object3d.material.map=this.cacheTexture[n],this.imgMesh.object3d.material.map.needsUpdate=!0):this.textureLoader.load(n,(function(t){i.texture&&i.texture.dispose(),delete i.texture,t.magFilter=e.NearestFilter,t.minFilter=e.NearestFilter,i.imgMesh.object3d.material.map=t,i.imgMesh.object3d.material.map.needsUpdate=!0,i.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}}]),n}(),Fe={interactive:!1,altitude:0,imageWidth:512,imageHeight:512,texture:null},Ge=function(n){le(i,$t);var r=pe(i);function i(n,o,s,a,u){var l;oe(this,i);var c=(s=t.Util.extend({},Fe,s)).altitude,h=u.distanceToVector3(o,o).x,f=new e.CircleGeometry(h,32);(l=r.call(this))._initOptions(s),l._createMesh(f,a);var p=u.distanceToVector3(c,c).x,g=u.coordinateToVector3(n,p);return l.getObject3d().position.copy(g),l.parent=null,l.type="radarObject",l}return ae(i)}(),Ue=function(){function t(n,r,i,o,s,a){oe(this,t),this.threelayer=o,this.map=o.map,this.layerClass=s,this.groupId=a,this.imgUrl=i.imgUrl,this.loader=new e.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var u=new e.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:e.DoubleSide,transparent:!0});this.radar=new Ge(n,r,{},u,o),this.radar.parent=this,this.groupId?this.threelayer.addMesh1(this.radar,this.groupId):this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return ae(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}(),qe={radius:100,altitude:0},je=function(n){le(i,$t);var r=pe(i);function i(n,o,s,a){var u;oe(this,i),o=t.Util.extend({},qe,o,{layer:a,coordinate:n}),(u=r.call(this))._initOptions(o);var l=o,c=l.altitude,h=l.radius,f=a.distanceToVector3(h,h).x,p=o.thetaStart||0,g=o.thetaLength||90,A=new e.CircleGeometry(f,128,p*Math.PI/180,g*Math.PI/180);u._createMesh(A,s);var d=a.distanceToVector3(c,c).x,y=a.coordinateToVector3(n,d);return u.getObject3d().position.copy(y),u}return ae(i)}(),ze=function(){function t(n,r,i,o,s){oe(this,t),this.threelayer=o,this.map=o.map,this.layerClass=s;var a=i.thetaLength||90,u=i.rotation||0,l=a/2;this.imgUrl=i.imgUrl,this.loader=new e.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 h=new e.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:e.DoubleSide,transparent:!0,depthTest:!1});this.sector=new je(n,{thetaStart:c,thetaLength:i.thetaLength,radius:r},h,o),this.threelayer.addMesh(this.sector)}return ae(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"dispose",value:function(){}}]),t}(),Ve={altitude:0,height:0},Ye=function(n){le(i,$t);var r=pe(i);function i(n,o,s,a){var u;oe(this,i),s=t.Util.extend({},Ve,s,{layer:a}),u=r.call(this);var l=s,c=l.width,h=l.height,f=l.altitude;u._initOptions(s);var p=new e.PlaneGeometry(c,h);p.computeBoundingBox();var g=new e.Mesh(p,o);u._createGroup(),u.getObject3d().add(g);var A=a.distanceToVector3(f,f).x,d=a.coordinateToVector3(n,A);return g.position.set(0,p.boundingBox.max.y,0),u.getObject3d().position.copy(d),u}return ae(i)}();function He(t,n,r,i,o,s){this.tilesHorizontal=n,this.tilesVertical=r,this.numberOfTiles=i,t.wrapS=t.wrapT=e.RepeatWrapping,t.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=o,this.currentDisplayTime=0,this.currentTile=0,this.flag=s,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 n=this.currentTile%this.tilesHorizontal;t.offset.x=n/this.tilesHorizontal;var r=Math.floor(this.currentTile/this.tilesHorizontal);this.flag?t.offset.y=this.tilesVertical-r/this.tilesVertical:t.offset.y=1-r/this.tilesVertical-1/this.tilesVertical}}}var Xe=function(){function t(n,r,i,o,s){var a=this;oe(this,t),this.threelayer=o,this.map=o.map,this.layerClass=s;var u=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 l=i.rotation||0,c=u/2,h=o.distanceToVector3(r,r).x,f=Math.sin(c*Math.PI/180)*h*2,p=void 0===i.flag;this.imgUrl=i.imgUrl,this.textureLoader=new e.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){a.texture=t,a.annie=new He(t,a.tilesHoriz,a.tilesVert,a.numTiles,a.duration,p);var r=new e.MeshBasicMaterial({transparent:!0,map:t,side:e.DoubleSide,depthTest:!1});a.imgObj=new Ye(n,r,{width:f,height:h},o),a.imgObj.object3d.renderOrder=1,a.imgObj.object3d.rotation.z=l*Math.PI/180,a.threelayer.addMesh(a.imgObj),a.layerClass.updatables.push(a)}))}return ae(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}(),Je={radius:100,altitude:0},We=function(n){le(i,$t);var r=pe(i);function i(n,o,s,a){var u;oe(this,i),o=t.Util.extend({},Je,o,{layer:a}),u=r.call(this);var l=o,c=l.width;l.height;var h=l.altitude;u._initOptions(o);var f=new e.CircleGeometry(c,32);u._createMesh(f,s);var p=a.distanceToVector3(h,h).x,g=a.coordinateToVector3(n,p);return u.getObject3d().position.copy(g),u}return ae(i)}(),Ke=function(){function t(n,r,i,o){var s=this;oe(this,t),this.threelayer=i,this.map=i.map,this.layerClass=o,this.time=0,i.coordinateToVector3(n,0),this.imgUrl=r.imgUrl,this.textureLoader=new e.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){s.texture=t,s._uniforms={impactPosition:{value:new e.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:s.texture}};var r=new e.ShaderMaterial({uniforms:s._uniforms,vertexShader:"\n varying vec3 vPosition;\n varying vec2 vUv;\n void main(){\n vUv = uv;\n vPosition = position;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D map;\n uniform vec3 impactPosition;\n uniform float impactMaxRadius;\n uniform float impactRatio;\n varying vec3 vPosition;\n varying vec2 vUv;\n void main() {\n float dist = distance(vPosition, impactPosition);\n float curRadius = impactMaxRadius * impactRatio;\n float sstep = smoothstep(0., curRadius, dist) - smoothstep(curRadius - ( 0.25 * impactRatio ), curRadius, dist);\n sstep = 1. - sstep * (1. - impactRatio);\n vec3 col = mix(vec3(1., 0.5, 0.0625), vec3(1., 0.25, 0.125), impactRatio);\n gl_FragColor = texture2D(map, vUv);\n gl_FragColor = vec4( mix( col, gl_FragColor.rgb, sstep), 1.0 );\n }",side:e.DoubleSide,transparent:!0,depthTest:!1}),o=new We(n,{width:2,height:2},r,i);s.threelayer.addMesh(o),s.layerClass.updatables.push(s)}))}return ae(t,[{key:"tick",value:function(t){this.time+=.2*t,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),t}(),Ze=6371008.8,$e={centimeters:100*Ze,centimetres:100*Ze,degrees:Ze/111325,feet:3.28084*Ze,inches:39.37*Ze,kilometers:Ze/1e3,kilometres:Ze/1e3,meters:Ze,metres:Ze,miles:Ze/1609.344,millimeters:1e3*Ze,millimetres:1e3*Ze,nauticalmiles:Ze/1852,radians:1,yards:1.0936*Ze},tn={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/Ze,yards:1.0936133},en={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 nn(t,e,n){void 0===n&&(n={});var r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function rn(t,e,n){switch(t){case"Point":return on(e).geometry;case"LineString":return ln(e).geometry;case"Polygon":return an(e).geometry;case"MultiPoint":return pn(e).geometry;case"MultiLineString":return fn(e).geometry;case"MultiPolygon":return gn(e).geometry;default:throw new Error(t+" is invalid")}}function on(t,e,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(!wn(t[0])||!wn(t[1]))throw new Error("coordinates must contain numbers");return nn({type:"Point",coordinates:t},e,n)}function sn(t,e,n){return void 0===n&&(n={}),hn(t.map((function(t){return on(t,e)})),n)}function an(t,e,n){void 0===n&&(n={});for(var r=0,i=t;r<i.length;r++){var o=i[r];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 nn({type:"Polygon",coordinates:t},e,n)}function un(t,e,n){return void 0===n&&(n={}),hn(t.map((function(t){return an(t,e)})),n)}function ln(t,e,n){if(void 0===n&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return nn({type:"LineString",coordinates:t},e,n)}function cn(t,e,n){return void 0===n&&(n={}),hn(t.map((function(t){return ln(t,e)})),n)}function hn(t,e){void 0===e&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function fn(t,e,n){return void 0===n&&(n={}),nn({type:"MultiLineString",coordinates:t},e,n)}function pn(t,e,n){return void 0===n&&(n={}),nn({type:"MultiPoint",coordinates:t},e,n)}function gn(t,e,n){return void 0===n&&(n={}),nn({type:"MultiPolygon",coordinates:t},e,n)}function An(t,e,n){return void 0===n&&(n={}),nn({type:"GeometryCollection",geometries:t},e,n)}function dn(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function yn(t,e){void 0===e&&(e="kilometers");var n=$e[e];if(!n)throw new Error(e+" units is invalid");return t*n}function vn(t,e){void 0===e&&(e="kilometers");var n=$e[e];if(!n)throw new Error(e+" units is invalid");return t/n}function mn(t,e){return In(vn(t,e))}function _n(t){var e=t%360;return e<0&&(e+=360),e}function In(t){return 180*(t%(2*Math.PI))/Math.PI}function En(t){return t%360*Math.PI/180}function Cn(t,e,n){if(void 0===e&&(e="kilometers"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return yn(vn(t,e),n)}function xn(t,e,n){if(void 0===e&&(e="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var r=en[e];if(!r)throw new Error("invalid original units");var i=en[n];if(!i)throw new Error("invalid final units");return t/r*i}function wn(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function bn(t){return!!t&&t.constructor===Object}function Bn(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(!wn(t))throw new Error("bbox must only contain numbers")}))}function Sn(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 Mn=Object.freeze({__proto__:null,earthRadius:Ze,factors:$e,unitsFactors:tn,areaFactors:en,feature:nn,geometry:rn,point:on,points:sn,polygon:an,polygons:un,lineString:ln,lineStrings:cn,featureCollection:hn,multiLineString:fn,multiPoint:pn,multiPolygon:gn,geometryCollection:An,round:dn,radiansToLength:yn,lengthToRadians:vn,lengthToDegrees:mn,bearingToAzimuth:_n,radiansToDegrees:In,degreesToRadians:En,convertLength:Cn,convertArea:xn,isNumber:wn,isObject:bn,validateBBox:Bn,validateId:Sn});function Ln(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 Nn(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 Tn(t){if(t.length>1&&wn(t[0])&&wn(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return Tn(t[0]);throw new Error("coordinates must only contain numbers")}function Rn(t,e,n){if(!e||!n)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.type)}function Qn(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}function Dn(t,e,n){if(!t)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+n+", FeatureCollection required");for(var r=0,i=t.features;r<i.length;r++){var o=i[r];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+o.geometry.type)}}function Pn(t){return"Feature"===t.type?t.geometry:t}function kn(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}var On=Object.freeze({__proto__:null,getCoord:Ln,getCoords:Nn,containsNumber:Tn,geojsonType:Rn,featureOf:Qn,collectionOf:Dn,getGeom:Pn,getType:kn});function Fn(t,e,n){void 0===n&&(n={});var r=Ln(t),i=Ln(e),o=En(i[1]-r[1]),s=En(i[0]-r[0]),a=En(r[1]),u=En(i[1]),l=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(u);return yn(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),n.units)}function Gn(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r=Ln(t),i=Pn(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]}(r,s))return!1;"Polygon"===o&&(a=[a]);for(var u=!1,l=0;l<a.length&&!u;l++)if(Un(r,a[l][0],n.ignoreBoundary)){for(var c=!1,h=1;h<a[l].length&&!c;)Un(r,a[l][h],!n.ignoreBoundary)&&(c=!0),h++;c||(u=!0)}return u}function Un(t,e,n){var r=!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!n;a>t[1]!=l>t[1]&&t[0]<(u-s)*(t[1]-a)/(l-a)+s&&(r=!r)}return r}var qn=document.createElement("canvas"),jn=function(){function n(){oe(this,n),this.type="gisCommon"}var r;return ae(n,null,[{key:"getTexture",value:function(t,n,r,i){var o=t.getContext("2d");o.drawImage(n,r,i);var s=new e.Texture(o.getImageData(0,0,t.width,t.height));return s.minFilter=e.LinearFilter,s.generateMipmaps=!1,s.needsUpdate=!0,s}},{key:"getTexture1",value:function(t,n,r,i,o){qn.width=qn.height=128;var s=qn.getContext("2d");s.drawImage(t,n,r,i,o);var a=new e.Texture(s.getImageData(0,0,qn.width,qn.height));return a.minFilter=e.LinearFilter,a.generateMipmaps=!1,a.needsUpdate=!0,a}},{key:"addImageProcessImage",value:function(t){return new Promise((function(e,n){var r=document.createElement("img");r&&!r.crossOrigin&&(r.crossOrigin="Anonymous"),r.onload=function(){return e(r)},r.onerror=n,r.setAttribute("src",t)}))}},{key:"addImageProcess",value:function(t){return new Promise((function(e,n){var r=document.createElement("img");r.onload=function(){return e(r)},r.onerror=n,r.setAttribute("src","data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(t))))}))}},{key:"containsCoordinate3",value:function(t,n,r){if(1e3*Fn({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[n.x,n.y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t}},"kilometers")<n.radius){var i=r.coordinateToVector3([n.x,n.y],0),o=r.coordinateToVector3(t,0).sub(i).normalize(),s=r.distanceToVector3(n.radius,n.radius).x,a=new e.Vector3(i.x,i.y+s,0).sub(i).normalize(),u=((o.clone().cross(a).z<0?-1:1)*Math.acos(o.dot(a))*180/Math.PI).toFixed(2);(u=parseFloat(u))<0&&(u=u+180+180);var l=parseFloat(n.begin),c=parseFloat(n.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*Fn({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 Gn({type:"Feature",geometry:{type:"Point",coordinates:t}},{type:"Feature",geometry:{type:"Polygon",coordinates:e.geometry.coordinates[0]}})}},{key:"containsCoordinate",value:function(e,n){var r,i;Array.isArray(e)?(r=e[0],i=e[1]):e instanceof t.Coordinate&&(r=e.x,i=e.y);var o=n.xmin,s=n.ymin,a=n.xmax,u=n.ymax;return o<=r&&r<=a&&s<=i&&i<=u}},{key:"isInLevels",value:function(t,e){for(var n=!1,r=0;r<t.rangeArr.length;r+=2){var i=1*t.rangeArr[r],o=1*t.rangeArr[r+1];if(e>i&&e<=o){n=!0;break}}return n}},{key:"getExtent",value:function(t){if(0!==t.length){var e=1/0,n=1/0,r=-1/0,i=-1/0;return 1===t.length?(e=1*t[0].longitude-.5,n=1*t[0].latitude-.5,r=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),n=Math.min(n,s),r=Math.max(r,o),i=Math.max(i,s)})),{minX:e,minY:n,maxX:r,maxY:i}}}},{key:"vector2Pixel",value:function(t,e,n){var r=t.project(n),i=e.width/2,o=e.height/2;return{x:Math.round(r.x*i+i),y:Math.round(-r.y*o+o)}}},{key:"generateTextureOne",value:function(t,n,r){qn.width=n,qn.height=r;var i=qn.getContext("2d");i.drawImage(t,0,0,n,r);var o=new e.Texture(i.getImageData(0,0,qn.width,qn.height));return o.magFilter=e.NearestFilter,o.minFilter=e.NearestFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{key:"generateTexture",value:function(t){var n=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var i=Math.sqrt(t.length),o=parseInt(i);i>o&&(o+=1);for(var s=(i=o)*r+5*i,a=0,u=0;u<n.length;u++){if(s<n[u]){a=n[u];break}a=1024}qn.width=qn.height=a;for(var l=qn.getContext("2d"),c=0,h=0,f=[],p=0;p<i;p++){for(var g=5*(p+1)+p*c,A=0;A<i;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 C=new e.Texture(l.getImageData(0,0,qn.width,qn.height));return C.minFilter=e.LinearFilter,C.generateMipmaps=!1,C.needsUpdate=!0,{xys:f,texture:C,textureSize:a}}},{key:"generateTextureNew",value:function(t){var n=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var i=Math.sqrt(t.length),o=parseInt(i);i>o&&(o+=1);for(var s=(i=o)*r+5*i,a=0,u=0;u<n.length;u++){if(s<n[u]){a=n[u];break}a=1024}qn.width=qn.height=a;for(var l=qn.getContext("2d"),c=0,h=0,f=0,p=[],g=0;g<i;g++){for(var A=5*(g+1)+g*c,d=0;d<i;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,C=t[h].offy||0;l.drawImage(t[h].src,y+_+E,A+I+C,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 x=new e.Texture(l.getImageData(0,0,qn.width,qn.height));return x.minFilter=e.LinearFilter,x.generateMipmaps=!1,x.needsUpdate=!0,{xys:p,texture:x,textureSize:a}}},{key:"generateGifTexture",value:(r=ie(ee().mark((function t(r,i,o){var s,a,u,l,c,h,f,p,g,A,d,y,v;return ee().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:s=Math.sqrt(r.length),a=parseInt(s),u=a,s>a&&(u+=1),(l=document.createElement("canvas")).width=a*i,l.height=u*o,c=l.getContext("2d"),h=0,f=0;case 10:if(!(f<s)){t.next=32;break}p=f*o,g=0,A=0;case 14:if(!(A<s)){t.next=27;break}return d=g,t.next=18,n.addImageProcessImage(r[h]);case 18:if(y=t.sent,c.drawImage(y,d,p,i,o),g+=i,!((h+=1)>=r.length)){t.next=24;break}return t.abrupt("break",27);case 24:A++,t.next=14;break;case 27:if(!(h>=r.length)){t.next=29;break}return t.abrupt("break",32);case 29:f++,t.next=10;break;case 32:return(v=new e.Texture(c.getImageData(0,0,l.width,l.height))).generateMipmaps=!1,v.needsUpdate=!0,t.abrupt("return",{texture:v,colNum:a,rowNum:u});case 36:case"end":return t.stop()}}),t)}))),function(t,e,n){return r.apply(this,arguments)})},{key:"generateTextureOptimize",value:function(t){var n=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var i=Math.sqrt(t.length),o=parseInt(i);i>o&&(o+=1);for(var s=(i=o)*r+5*i,a=0,u=0;u<n.length;u++){if(s<n[u]){a=n[u];break}a=1024}qn.width=qn.height=a;for(var l=qn.getContext("2d"),c=0,h=0,f={},p=0;p<i;p++){for(var g=5*(p+1)+p*c,A=0,d=0;d<i;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 e.Texture(l.getImageData(0,0,qn.width,qn.height));return _.minFilter=e.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,n){qn.width=qn.height=t;var r=qn.width/2,i=qn.height/2;if(n){var o=0;n.forEach((function(t){var e=qn.getContext("2d");e.fillStyle=t.fontcolor,e.font="".concat(t.fontsize,"px Arial"),e.textAlign="center",e.textBaseline="middle",e.fillText(t.txt,r,i+o),o+=t.fontsize}))}var s=new e.Texture(qn);return s.minFilter=e.LinearFilter,s.generateMipmaps=!1,s.needsUpdate=!0,s}},{key:"createTextAndBgTexture",value:function(t,n,r,i){var o=document.createElement("canvas");o.width=t,o.height=n;var s=o.getContext("2d");s.drawImage(r,0,0,t,n);var a=o.width/2,u=o.height/2;s.textAlign="center",s.textBaseline="middle",s.fillStyle="#FFF",s.font="".concat(i.fontsize,"px Arial"),s.fillText(i.txt,a,u);var l=new e.Texture(o);return l.magFilter=e.NearestFilter,l.minFilter=e.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 n=t>>16&255,r=t>>8&255,i=255&t;return new e.Color("rgb(".concat(n,",").concat(r,",").concat(i,")"))}},{key:"createSimpleShader",value:function(t,e,n){return t.uniforms.texture1={value:e},t.uniforms.size1={value:n},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 n=(t.match(/[\u4e00-\u9fa5]/g)||"").length;return n*e+.5*(t.length-n)*e}}]),n}();function zn(t,e,n,r,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,n,r,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;n.forEach((function(t){if(t.split("").forEach((function(t){var n=e[u],r=t.charCodeAt(0),i=n&&n[r];i&&(f.push({glyph:r,x:l,y:c+0,vertical:!1,scale:1,fontStack:u}),l+=i.metrics.advance+a)})),f.length!==g){var n=l-a;h=Math.max(n,h),function(t,e,n,r,i){if(i){var o=t[r],s=e[o.fontStack],a=s&&s[o.glyph];if(a)for(var u=a.metrics.advance*o.scale,l=(t[r].x+u)*i,c=n;c<=r;c++)t[c].x-=l}}(f,e,g,f.length-1,p)}l=0,c+=r}));var A=function(t){var e=.5,n=.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":n=1;break;case"top":case"top-right":case"top-left":n=0}return{horizontalAlign:e,verticalAlign:n}}(i),d=A.horizontalAlign,y=A.verticalAlign;!function(t,e,n,r,i,o,s){for(var a=(e-n)*i,u=(-r*s+.5)*o,l=0;l<t.length;l++)t[l].x+=a,t[l].y+=u}(f,p,d,y,h,r,n.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,n),!!h.length&&f}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Vn(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})})),e}var Yn=Hn;function Hn(t,e){this.x=t,this.y=e}Hn.prototype={clone:function(){return new Hn(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,n=t.y-this.y;return e*e+n*n},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,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,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),n=Math.sin(t),r=e*this.x-n*this.y,i=n*this.x+e*this.y;return this.x=r,this.y=i,this},_rotateAround:function(t,e){var n=Math.cos(t),r=Math.sin(t),i=e.x+n*(this.x-e.x)-r*(this.y-e.y),o=e.y+r*(this.x-e.x)+n*(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}},Hn.convert=function(t){return t instanceof Hn?t:Array.isArray(t)?new Hn(t[0],t[1]):t};var Xn={radius:40,altitude:0},Jn=function(n){le(i,$t);var r=pe(i);function i(n,o,s,a,u,l,c,h){var f;oe(this,i);var p=Ne(n);f=r.call(this),o=t.Util.extend({center:p,layer:h},Xn,o),f._initOptions(o);var g=f.getLayer().getPick();f._colorMap={},f._datas=n,f._childCount=c;var A=h.coordinateToVector3(p);f.glyphMap=u,f.glyphAtlas=l;for(var d=new e.InstancedBufferGeometry,y=new Uint16Array([0,1,2,2,3,0]),v=new Float32Array([0,1,-.5,-.5,1,1,.5,-.5,1,0,.5,.5,0,0,-.5,.5]),m=new e.InstancedBufferAttribute(new Float32Array(4*f._childCount),4,!0),_=new e.InstancedBufferAttribute(new Float32Array(4*f._childCount),4,!0),I=new e.InstancedBufferAttribute(new Float32Array(4*f._childCount),4,!0),E=new e.InstancedBufferAttribute(new Float32Array(4*f._childCount),4,!0),C=new e.InstancedBufferAttribute(new Float32Array(3*f._childCount),3,!0),x=0,w=function(t){var e=n[t],r=e.texts,i=e.markers,o=g.getColor(),s=o.getHex();f._colorMap[s]=t,f._datas[t].colorIndex=s,i&&i.forEach((function(e){if(m.setXYZW(x,e.markerWidth,e.markerHeight,e.markerDx,e.markerDy),_.setXYZW(x,e.u,e.v,-16,16),e.markerColor){var r=Le(0,255);E.setXYZW(x,r,0,0,0);var i=f.getColorVector2(e.markerColor,e.markerOpacity);I.setXYZW(x,i[0],i[1],e.w,e.h)}else{var s=Le(0,0);E.setXYZW(x,s,0,0,0);var a=f.getColorVector2("#fff",e.markerOpacity);I.setXYZW(x,a[0],a[1],e.w,e.h)}C.setXYZ(x,o.r,o.g,o.b),e.markerIndex=x,x+=1,n[t].childNum+=1})),r&&r.forEach((function(e){var r=f.getColorVector2(e.textColor,e.textOpacity),i=Le(255,0);f.buildTextBuffers("".concat(e.text),e.textAnchor,"center",e.textSpacing).forEach((function(s){if(m.setXYZW(x,e.textSize,0,e.textDx,e.textDy),_.setXYZW(x,s[0],s[1],s[2],s[3]),e.textHaloColor){var a=f.getColorVector2(e.textHaloColor,e.textHaloOpacity);I.setXYZW(x,r[0],r[1],a[0],a[1]);var u=e.textHaloRadius;E.setXYZW(x,i,u,0,0)}else I.setXYZW(x,r[0],r[1],0,0),E.setXYZW(x,i,-1.9,0,0);C.setXYZ(x,o.r,o.g,o.b),e.textIndex.push(x),x+=1,n[t].childNum+=1}))}))},b=0;b<n.length;b++)w(b);d.setIndex(new e.Uint16BufferAttribute(y,1)),d.setAttribute("uv_offset",new e.Float32BufferAttribute(v,4,!0)),d.setAttribute("size",m),d.setAttribute("uv_image",_),d.setAttribute("color",I),d.setAttribute("util",E),d.setAttribute("pickingColor",C),f._createInstancedMesh(d,s,f._childCount),f.getObject3d().instanceMatrix.setUsage(e.DynamicDrawUsage);var B=new e.InstancedMesh(d,a,f._childCount);B.instanceMatrix.setUsage(e.DynamicDrawUsage);var S=g.getColor().getHex();B._colorIndex=S,f.setPickObject3d(B);var M=new e.Object3D;x=0,n.forEach((function(t,e){var r=h.coordinateToVector3(t.coordinate);r.sub(A),t.height&&(r.z=h.altitudeToVector3(t.height).x);for(var i=0;i<n[e].childNum;i++)!1===t.visible?M.position.set(-999,-999,0):M.position.set(r.x,r.y,0),M.updateMatrix(),f.getObject3d().setMatrixAt(x,M.matrix),B.setMatrixAt(x,M.matrix),x+=1}));var L=h.altitudeToVector3(o.altitude,o.altitude).x;return A.z=L,f.getObject3d().position.copy(A),B.position.copy(f.getObject3d().position),f.parent=null,f.pickMesh=B,f.threeLayer=h,f.center=A,f._init(),f}return ae(i,[{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,n){var r,i=new e.Color(t).getHexString(),o=(r="#".concat(i),{r:parseInt(r.slice(1,3),16),g:parseInt(r.slice(3,5),16),b:parseInt(r.slice(5,7),16)}),s=o.b;return[Le(o.r,o.g),Le(s,void 0!==n?n:255)]}},{key:"buildTextBuffers",value:function(t,e,n,r){var i=[],o=[0,0],s=zn(t,this.glyphMap,"sans-serif",0,24,e,n,r,o,1);if(s){var a=function(t,e,n,r){for(var i=t.positionedGlyphs,o=[],s=0;s<i.length;s++){var a=i[s],u=r[a.fontStack],l=u&&u[a.glyph];if(l){var c=l.rect;if(c){var h=l.metrics.advance*a.scale/2,f=n?[a.x+h,a.y]:[0,0],p=n?[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 Yn(g,A),m=new Yn(d,A),_=new Yn(g,y),I=new Yn(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,n=new e.Object3D;this._datas.forEach((function(e,r){var i=t.threeLayer.coordinateToVector3(e.coordinate);i.sub(t.center),e.height&&(i.z=t.threeLayer.altitudeToVector3(e.height).x),!1===e.visible?n.position.set(-999,-999,0):n.position.set(i.x,i.y,0),n.updateMatrix(),e.markers&&e.markers.forEach((function(e){t.getObject3d().setMatrixAt(e.markerIndex,n.matrix),t.pickMesh.setMatrixAt(e.markerIndex,n.matrix)})),e.texts&&e.texts.forEach((function(e){e.textIndex.forEach((function(e){t.getObject3d().setMatrixAt(e,n.matrix),t.pickMesh.setMatrixAt(e,n.matrix)}))}))})),this.getObject3d().instanceMatrix.needsUpdate=!0,this.pickMesh.instanceMatrix.needsUpdate=!0}}]),i}(),Wn=function(){function t(e,n){oe(this,t),this.createImage(e,1,n)}return ae(t,[{key:"createImage",value:function(t,e,n){var r=t.width,i=t.height;if(n){if(n.length!==r*i*e)throw new RangeError("mismatched image size")}else n=new Uint8Array(r*i*e);this.width=r,this.height=i,this.data=n}},{key:"resize",value:function(){}}],[{key:"copy",value:function(t,e,n,r,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||n.x>t.width-i.width||n.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||r.x>e.width-i.width||r.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=((n.y+u)*t.width+n.x)*o,c=((r.y+u)*e.width+r.x)*o,h=0;h<i.width*o;h++)a[c+h]=s[l+h];return e}}]),t}();var Kn=ae((function t(e){oe(this,t);var n={},r=[];for(var i in e){var o=e[i],s=n[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};r.push(l),s[a]={rect:l,metrics:u.metrics}}}}var c=function(t){let e=0,n=0;for(const r of t)e+=r.w*r.h,n=Math.max(n,r.w);t.sort(((t,e)=>e.h-t.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),n),h:1/0}];let i=0,o=0;for(const e of t)for(let t=r.length-1;t>=0;t--){const n=r[t];if(!(e.w>n.w||e.h>n.h)){if(e.x=n.x,e.y=n.y,o=Math.max(o,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===n.w&&e.h===n.h){const e=r.pop();t<r.length&&(r[t]=e)}else e.h===n.h?(n.x+=e.w,n.w-=e.w):e.w===n.w?(n.y+=e.h,n.h-=e.h):(r.push({x:n.x+e.w,y:n.y,w:n.w-e.w,h:e.h}),n.y+=e.h,n.h-=e.h);break}}return{w:i,h:o,fill:e/(i*o)||0}}(r),h=c.w,f=c.h,p=new Wn({width:h||1,height:f||1});for(var g in e){var A=e[g];for(var d in A){var y=A[+d];if(y&&0!==y.bitmap.width&&0!==y.bitmap.height){var v=n[g][d].rect;Wn.copy(y.bitmap,p,{x:0,y:0},{x:v.x+1,y:v.y+1},y.bitmap)}}}this.image=p,this.positions=n})),Zn={exports:{}};Zn.exports=tr,Zn.exports.default=tr;var $n=1e20;function tr(t,e,n,r,i,o){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=r||.25,this.fontFamily=i||"sans-serif",this.fontWeight=o||"normal",this.radius=n||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 er(t,e,n,r,i,o){for(var s=0;s<e;s++)nr(t,s,e,n,r,i,o);for(var a=0;a<n;a++)nr(t,a*e,1,e,r,i,o)}function nr(t,e,n,r,i,o,s){var a,u,l,c;for(o[0]=0,s[0]=-$n,s[1]=$n,a=0;a<r;a++)i[a]=t[e+a*n];for(a=1,u=0,l=0;a<r;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]=$n}for(a=0,u=0;a<r;a++){for(;s[u+1]<a;)u++;c=o[u],t[e+a*n]=i[c]+(a-c)*(a-c)}}tr.prototype._draw=function(t,e){var n,r,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,n=(r=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"):(n=r=this.size,i=o=this.size,s=19*this.fontSize/24,a=u=0,l=this.middle,this.ctx.textBaseline="middle"),r&&o&&(this.ctx.clearRect(u,a,r,o),this.ctx.fillText(t,this.buffer,l),c=this.ctx.getImageData(u,a,r,o));var g=new Uint8ClampedArray(n*i);return function(t,e,n,r,i,o,s){o.fill($n,0,e*n),s.fill(0,0,e*n);for(var a=(e-r)/2,u=0;u<i;u++)for(var l=0;l<r;l++){var c=(u+a)*e+l+a,h=t.data[4*(u*r+l)+3]/255;if(1===h)o[c]=0,s[c]=$n;else if(0===h)o[c]=$n,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,n,i,r,o,this.gridOuter,this.gridInner),er(this.gridOuter,n,i,this.f,this.v,this.z),er(this.gridInner,n,i,this.f,this.v,this.z),function(t,e,n,r,i,o,s){for(var a=0;a<e*n;a++){var u=Math.sqrt(r[a])-Math.sqrt(i[a]);t[a]=Math.round(255-255*(u/o+s))}}(g,n,i,this.gridOuter,this.gridInner,this.radius,this.cutoff),{data:g,metrics:{width:r,height:o,sdfWidth:n,sdfHeight:i,top:s,left:0,advance:f}}},tr.prototype.draw=function(t){return this._draw(t,!1).data},tr.prototype.drawWithMetrics=function(t){return this._draw(t,!0)};var rr=Zn.exports,ir={},or={};var sr=function(){function n(t,e,r,i){var o=this;oe(this,n);var s=e.pointMinZoom,a=e.pointOrder;if(0!=t.length){var u=[];this.charArray="",this.imgDict={},this.threeLayer=r,this.map=r.map,this.interactive=void 0===e.interactive||e.interactive,this.beginSizeZoom=e.beginSizeZoom||3,this.endSizeZoom=e.endSizeZoom||12,this.spanSizeZoom=this.endSizeZoom-this.beginSizeZoom,this.stepSize=1/(this.endSizeZoom-this.beginSizeZoom+1),this.altitude=e.altitude||0,this.groupId=i,"EPSG:4326"===this.map.getSpatialReference().getProjection().code?this.tileResolution=.0006866455078125:this.tileResolution=76.43702828517625,this.textMinZoom=e.textMinZoom||0,this.textMaxZoom=e.textMaxZoom||30,this.textMinMaxZooms=e.textMinMaxZooms,this.hasAlign=e.hasAlign||!1,this.childCount=0,t.slice(0,1/0).map((function(t){1*t.longitude>70&&1*t.longitude<138&&1*t.latitude>0&&1*t.latitude<56&&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=e.pointMaxZoom||20,this.order=a||0,this.isToolTip=e.isToolTip||!1,this.clickFunc=e.clickFunc||null,this.cFunc=e.cFunc||null,this.mouseMoveFunc=e.mouseMoveFunc||null,this.mouseOutFunc=e.mouseOutFunc||null,this.mMoveFunc=e.mMoveFunc||null,this.hasAlign=e.hasAlign||!1,this.zoomChangeCallback=e.zoomChangeCallback}else console.error("需要绘制的点位数量为0")}var r,i,o,s;return ae(n,[{key:"_putImgToDict",value:function(t,e,n){void 0===this.imgDict[t]?this.imgDict[t]={imgSrc:t,width:e,height:n}:(this.imgDict[t].width=(this.imgDict[t].width+e)/2,this.imgDict[t].height=(this.imgDict[t].height+n)/2)}},{key:"_bindDataItem",value:function(t,e){var n={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},r=e.texts;if(r){n.texts=[];for(var i=0,o=0;o<r.length;o++){var s=r[o];if(s.text&&s.text.length>0){i+=s.text.length,this.charArray=Me(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})),n.texts.push(a)}}this.childCount+=i}var u=e.markers;if(u){n.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),n.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(n)}},{key:"_loadTexture",value:(s=ie(ee().mark((function t(){var e,n,r,i,o;return ee().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],t.t0=ee().keys(this.imgDict);case 2:if((t.t1=t.t0()).done){t.next=18;break}if(n=t.t1.value,r=n,!n.includes(".svg")){t.next=12;break}return t.next=8,fetch(n);case 8:return i=t.sent,t.next=11,i.text();case 11:r=t.sent;case 12:return t.next=14,jn.addImageProcess(r);case 14:o=t.sent,e.push({key:n,src:o,w:this.imgDict[n].width,h:this.imgDict[n].height,iw:this.imgDict[n].width,ih:this.imgDict[n].height}),t.next=2;break;case 18:return t.abrupt("return",jn.generateTextureOptimize(e));case 19:case"end":return t.stop()}}),t,this)}))),function(){return s.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]:"",n=arguments.length>1?arguments[1]:void 0,r=function(t){var e=t.trim().substring(0,t.lastIndexOf(" ")),n="400";return/bold/i.test(t)?n="900":/medium/i.test(t)?n="500":/light/i.test(t)&&(n="200"),{fontFamily:e,fontWeight:n}}(e),i=r.fontFamily,o=r.fontWeight,s=n.charCodeAt(0),a=ir[e];return a||(a=ir[e]=new rr(24,3,8,.25,i,o)),or[e]||(or[e]={}),or[e][n]||(or[e][n]=a.ctx.measureText(n).width),{id:s,bitmap:new Wn({width:30,height:30},a.draw(n)),metrics:{width:24,height:24,left:0,top:-5,advance:(t=s,t>=19968&&t<=40959?24:or[e][n])}}}("",t)})).reduce((function(t,e){return t[e.id]=e,t}),{});this.glyphMap||(this.glyphMap={}),this.glyphMap["sans-serif"]=t,this.glyphAtlas=new Kn(this.glyphMap)}},{key:"addPoint",value:(o=ie(ee().mark((function t(){var n,r,i,o,s,a,u,l=this;return ee().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 n=t.sent,this.textures||(this.textures=[]),this.textures.push(n.texture),this.initGlyphAtlas(),r=this.glyphAtlas.image,i=r.width,o=r.height,s=r.data,(a=new e.DataTexture(s,i,o)).needsUpdate=!0,a.magFilter=e.LinearFilter,a.minFilter=e.LinearFilter,a.format=e.RedFormat,this.textures.push(a),this.m=this._getRawShaderMaterial(n,a,i,o),this.m.depthTest=!1,this.hasAlign&&(this.m.vertexShader="#define HAS_ALIGN\n"+this.m.vertexShader),this.m_pick=this._getRawShaderMaterial(n,a,i,o),this.hasAlign&&(this.m_pick.vertexShader="#define HAS_ALIGN\n"+this.m_pick.vertexShader),this.m_pick.vertexShader="#define PICKING\n"+this.m_pick.vertexShader,this.m_pick.fragmentShader="#define PICKING\n"+this.m_pick.fragmentShader,this.dataItems.forEach((function(t){t.markers&&t.markers.forEach((function(t){t=Object.assign(t,n.xys[t.key])}))})),(u=new Jn(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 t=l._getRate(),e=l.point.object3d.geometry.attributes.size.array,n=0,r=0;r<l.dataItems.length;r++){var i=l.dataItems[r];if(i.markers)for(var o=0;o<i.markers.length;o++)e[4*n+0]=i.markers[o].markerWidth*t,e[4*n+1]=i.markers[o].markerHeight*t,e[4*n+2]=i.markers[o].markerDx*t,e[4*n+3]=i.markers[o].markerDy*t,n+=1;if(i.texts)for(var s=function(){var r=i.texts[a].textSize,o=i.texts[a].textDx,s=i.texts[a].textDy;i.texts[a].textIndex.forEach((function(){e[4*n+0]=r*t,e[4*n+1]=0,e[4*n+2]=o*t,e[4*n+3]=s*t,n+=1}))},a=0;a<i.texts.length;a++)s()}l.point.object3d.geometry.attributes.size.needsUpdate=!0,l.zoomChangeCallback&&l.zoomChangeCallback()},this.isToolTip&&u.setToolTip("hello",{showTimeout:0,eventsPropagation:!0,dx:10}),u.object3d.renderOrder=this.order,this.point=u,this.point.parent=this,this.groupId?this.threeLayer.addMesh1(this.point,this.groupId):this.threeLayer.addMesh(this.point),this._bindMapEvents(),t.abrupt("return",this);case 32:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{key:"_getRawShaderMaterial",value:function(t,n,r,i){return new e.RawShaderMaterial({uniforms:{imgTexture:{type:"t",value:t.texture},imgTextureSize:{type:"f",value:t.textureSize},sdfTexture:{type:"t",value:n},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:e.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:(i=ie(ee().mark((function t(e){return ee().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 i.apply(this,arguments)})},{key:"_setPointEvent",value:function(t){var e=t.selectMesh;if("mousemove"===t.type&&e){var n=e.name;if(this.isToolTip)this.point.getToolTip()._content="".concat(n)}"click"===t.type&&e&&this.clickFunc&&!this.cFunc&&this.addContent(e)}},{key:"findItemByCode",value:function(t){for(var e=0;e<this.dataItems.length;e++)if(this.dataItems[e].code===t)return e}},{key:"changeParaValue",value:(r=ie(ee().mark((function t(e){return ee().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))),function(t){return r.apply(this,arguments)})},{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}},{key:"show",value:function(){var t,e;null===(t=this.point)||void 0===t||t.show();for(var n=0;n<this.dataItems.length;n++){this.dataItems[n].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(e,n,r){for(var i,o=1/0,s=1/0,a=-1/0,u=-1/0,l=0;l<this.dataItems.length;l++){var c=this.dataItems[l];e.includes(c.code)?(o=Math.min(o,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===(i=this.point)||void 0===i||i.changeVisible(),n&&this.map.fitExtent(new t.Extent(o,s,a,u),r||0)}},{key:"updateByZoom",value:function(){var t=this,n=this.map.getZoom(),r=new e.Object3D,i=0;this.dataItems.forEach((function(e){var o=t.threeLayer.coordinateToVector3(e.coordinate);if(o.sub(t.point.center),e.height&&(o.z=t.threeLayer.altitudeToVector3(e.height).x),e.markers&&(i+=e.markers.length),e.value&&t.showValueFlag)for(var s=0;s<e.value.length;s++)n<t.valueMinZoom||n>t.valueMaxZoom?r.position.set(-999,-999,0):r.position.set(o.x,o.y,0),r.updateMatrix(),t.point.getObject3d().setMatrixAt(i,r.matrix),t.point.pickMesh.setMatrixAt(i,r.matrix),i+=1;if(e.name&&t.showNameFlag)for(var a=0;a<e.name.length;a++)n<t.nameMinZoom||n>t.nameMaxZoom?r.position.set(-999,-999,0):r.position.set(o.x,o.y,0),r.updateMatrix(),t.point.getObject3d().setMatrixAt(i,r.matrix),t.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(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}}]),n}();function ar(t){var e;try{e=new URL(t,"http://fakehost.com/")}catch(t){return null}var n=e.pathname.split("/").pop(),r=n.lastIndexOf(".");return-1===r||r===n.length-1?null:n.substring(r+1)}var ur=function(){function t(){oe(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 ae(t,[{key:"isFull",value:function(){return this.itemSet.size>=this.maxSize}},{key:"add",value:function(t,e){var n=this.itemSet;if(n.has(t))return!1;if(this.isFull())return!1;var r=this.usedSet,i=this.itemList,o=this.callbacks;return i.push(t),r.add(t),n.set(t,Date.now()),o.set(t,e),!0}},{key:"remove",value:function(t){var e=this.usedSet,n=this.itemSet,r=this.itemList,i=this.callbacks;if(n.has(t)){i.get(t)(t);var o=r.indexOf(t);return r.splice(o,1),e.delete(t),n.delete(t),i.delete(t),!0}return!1}},{key:"markUsed",value:function(t){var e=this.itemSet,n=this.usedSet;e.has(t)&&!n.has(t)&&(e.set(t,Date.now()),n.add(t))}},{key:"markAllUnused",value:function(){this.usedSet.clear()}},{key:"unloadUnusedContent",value:function(){var t=this.unloadPercent,e=this.minSize,n=this.itemList,r=this.itemSet,i=this.usedSet,o=this.callbacks,s=n.length-i.size,a=n.length-e,u=this.unloadPriorityCallback||this.defaultPriorityCallback;if(a>0&&s>0){n.sort((function(t,e){var n=i.has(t),r=i.has(e);return n&&r?0:n||r?n?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=n.splice(0,h),p=0,g=f.length;p<g;p++){var A=f[p];o.get(A)(A),r.delete(A),o.delete(A)}}}},{key:"scheduleUnload",value:function(){var t,e=this,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scheduled||(this.scheduled=!0,t=function(){e.scheduled=!1,e.unloadUnusedContent(),n&&e.markAllUnused()},Promise.resolve().then(t))}}]),t}(),lr=function(){function t(){var e=this;oe(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 ae(t,[{key:"sort",value:function(){var t=this.priorityCallback;this.items.sort(t)}},{key:"add",value:function(t,e){var n=this;return new Promise((function(r,i){var o=n.items,s=n.callbacks;o.push(t),s.set(t,(function(){return e.apply(void 0,arguments).then(r).catch(i)})),n.autoUpdate&&n.scheduleJobRun()}))}},{key:"remove",value:function(t){var e=this.items,n=this.callbacks,r=e.indexOf(t);-1!==r&&(e.splice(r,1),n.delete(t))}},{key:"tryRunJobs",value:function(){var t=this;this.sort();for(var e=this.items,n=this.callbacks,r=this.maxJobs,i=this.currJobs;r>i&&e.length>0;){i++;var o=e.pop(),s=n.get(o);n.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}(),cr=3,hr=4,fr=6378137,pr=6356752.314245179;function gr(t){return t===cr||t===hr}function Ar(t,e){return t.__lastFrameVisited===e&&t.__used}function dr(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 yr(t,e,n){if(dr(t,e),t.__used=!0,n.markUsed(t),t.__contentEmpty)for(var r=t.children,i=0,o=r.length;i<o;i++)yr(r[i],e,n)}function vr(t,e,n){if(t.__contentEmpty&&(!t.__externalTileSet||gr(t.__loadingState)))for(var r=t.children,i=0,o=r.length;i<o;i++){var s=r[i];s.__depthFromRenderedParent=e,vr(s,e,n)}else n.requestTileContents(t)}function mr(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=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,r,i))n&&n(t,r,i);else{for(var o=t.children,s=0,a=o.length;s<a;s++)mr(o[s],e,n,t,i+1);n&&n(t,r,i)}}function _r(t,e){var n=e.stats,r=e.frameCount,i=e.errorTarget,o=e.maxDepth,s=e.loadSiblings,a=e.lruCache,u=e.stopAtEmptyTiles;if(dr(t,r),!1===e.tileInView(t))return!1;if(t.__used=!0,a.markUsed(t),t.__inFrustum=!0,n.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=_r(c[h],e);l=l||p}if(l&&s)for(var g=0,A=c.length;g<A;g++){yr(c[g],r,a)}return!0}function Ir(t,e){var n=e.stats,r=e.frameCount;if(Ar(t,r)){n.used++;for(var i=t.children,o=!1,s=0,a=i.length;s<a;s++){var u=i[s];o=o||Ar(u,r)}if(o){for(var l=!1,c=!0,h=0,f=i.length;h<f;h++){var p=i[h];if(Ir(p,e),l=l||p.__wasSetVisible||p.__childrenWereVisible,Ar(p,r)){var g=p.__allChildrenLoaded||!p.__contentEmpty&&gr(p.__loadingState)||p.__externalTileSet&&p.__loadingState===hr;c=c&&g}}t.__childrenWereVisible=l,t.__allChildrenLoaded=c}else t.__isLeaf=!0}}function Er(t,e){var n=e.stats,r=e.frameCount;if(Ar(t,r)){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===cr?(t.__inFrustum&&(t.__visible=!0,n.visible++),t.__active=!0,n.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=gr(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,n.visible++),t.__active=!0,n.active++),"ADD"!==t.refine&&u&&!A&&f)for(var d=0,y=g.length;d<y;d++){var v=g[d];Ar(v,r)&&!s.isFull()&&(v.__depthFromRenderedParent=t.__depthFromRenderedParent+1,vr(v,v.__depthFromRenderedParent,e))}else for(var m=0,_=g.length;m<_;m++){var I=g[m];Ar(I,r)&&Er(I,e)}}}function Cr(t,e){var n=Ar(t,e.frameCount);if(n||t.__usedLastFrame){var r=!1,i=!1;n&&(r=t.__active,i=e.displayActiveTiles&&t.__active||t.__visible),t.__contentEmpty||t.__loadingState!==cr||(t.__wasSetActive!==r&&e.setTileActive(t,r),t.__wasSetVisible!==i&&e.setTileVisible(t,i)),t.__wasSetActive=r,t.__wasSetVisible=i,t.__usedLastFrame=n;for(var o=t.children,s=0,a=o.length;s<a;s++){Cr(o[s],e)}}}var xr=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},wr=function(t){return 1/(t.__depthFromRenderedParent+1)},br=function(){function t(e,n){oe(this,t),this.tileSets={},this.rootURL=e,this.fetchOptions={},this.preprocessURL=null;var r=new ur;r.unloadPriorityCallback=wr;var i=new lr;i.maxJobs=4,i.priorityCallback=xr;var o=new lr;o.maxJobs=1,o.priorityCallback=xr,this.lruCache=r,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=n,this.heightOffset=0,this.xOffset=0,this.yOffset=0}return ae(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 n=this.tileSets[this.rootURL];n&&n.root&&mr(n.root,t,e)}},{key:"update",value:function(){var t=this.stats,e=this.lruCache,n=this.tileSets,r=n[this.rootURL];if(this.rootURL in n){if(r&&r.root){var i=r.root;t.inFrustum=0,t.used=0,t.active=0,t.visible=0,this.frameCount++,_r(i,this),Ir(i,this),Er(i,this),Cr(i,this),e.scheduleUnload()}}else this.loadRootTileSet(this.rootURL)}},{key:"parseTile",value:function(t,e,n){return null}},{key:"disposeTile",value:function(t){}},{key:"preprocessNode",value:function(t,e,n){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,n+"/").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 r=ar(t.content.uri),i=Boolean(r&&"json"===r.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===hr&&(t.__loadingState=0)})),t.failed=0)}},{key:"fetchTileSet",value:function(t,e){var n=this,r=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(),mr(e.root,(function(t,e){return n.preprocessNode(t,e,o)}),null,r,r?r.__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 n=this.fetchTileSet(this.preprocessURL?this.preprocessURL(t):t,this.fetchOptions).then((function(n){e[t]=n}));return n.catch((function(n){console.error(n),e[t]=n})),e[t]=n,n}},{key:"requestTileContents",value:function(t){var e=this;if(0===t.__loadingState){var n=this.stats,r=this.lruCache,i=this.downloadQueue,o=this.parseQueue,s=t.__externalTileSet;r.add(t,(function(t){1===t.__loadingState?(t.__loadAbort.abort(),t.__loadAbort=null):s?t.children.length=0:e.disposeTile(t),1===t.__loadingState?n.downloading--:2===t.__loadingState&&n.parsing--,t.__loadingState=0,t.__loadIndex++,o.remove(t),i.remove(t)})),t.__loadIndex++;var a=t.__loadIndex,u=new AbortController,l=u.signal;n.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?n.parsing--:1===t.__loadingState&&n.downloading--,n.failed++,console.error('TilesRenderer : Failed to load tile at url "'.concat(t.content.uri,'".')),console.error(e),t.__loadingState=hr):r.remove(t))};s?i.add(t,(function(t){if(t.__loadIndex!==a)return Promise.resolve();var n=e.preprocessURL?e.preprocessURL(t.content.uri):t.content.uri;return e.fetchTileSet(n,Object.assign({signal:l},e.fetchOptions),t)})).then((function(e){t.__loadIndex===a&&(n.downloading--,t.__loadAbort=null,t.__loadingState=cr,t.children.push(e.root))})).catch(c):i.add(t,(function(t){if(t.__loadIndex!==a)return Promise.resolve();var n=e.preprocessURL?e.preprocessURL(t.content.uri):t.content.uri;return fetch(n,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(r){if(t.__loadIndex===a)return n.downloading--,n.parsing++,t.__loadAbort=null,t.__loadingState=2,o.add(t,(function(t){if(t.__loadIndex!==a)return Promise.resolve();var n=ar(t.content.uri);return e.parseTile(r,t,n)}))})).then((function(){t.__loadIndex===a&&(n.parsing--,t.__loadingState=cr,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 n=0,r=e.length;n<r;n++)t.remove(e[n]);this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0}}]),t}();function Br(t){return(new TextDecoder).decode(t)}var Sr=function(){function t(e,n,r,i){oe(this,t),this.buffer=e,this.binOffset=n+r,this.binLength=i;var o=null;if(0!==r){var s=new Uint8Array(e,n,r);o=JSON.parse(Br(s))}else o={};this.header=o}return ae(t,[{key:"getKeys",value:function(){return Object.keys(this.header)}},{key:"getData",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=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||r,p=o.componentType||n;if("type"in o&&r&&o.type!==r)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 n=this.buffer,r=this.binOffset;return n.slice(r+t,r+t+e)}}]),t}(),Mr=function(t){le(n,Sr);var e=pe(n);function n(t,r,i,o,s){var a;return oe(this,n),(a=e.call(this,t,i,o,s)).batchSize=r,a}return ae(n,[{key:"getData",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return Ae(ce(n.prototype),"getData",this).call(this,t,this.batchSize,e,r)}}]),n}(),Lr=function(){function t(){oe(this,t),this.fetchOptions={},this.workingPath=""}return ae(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(n){return""===e.workingPath&&(e.workingPath=e.workingPathForURL(t)),e.parse(n)}))}},{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 Nr(t){var e;if(e=t instanceof DataView?t:new DataView(t),"{"===String.fromCharCode(e.getUint8(0)))return null;for(var n="",r=0;r<4;r++)n+=String.fromCharCode(e.getUint8(r));return n}var Tr=function(t){le(n,Lr);var e=pe(n);function n(){return oe(this,n),e.apply(this,arguments)}return ae(n,[{key:"parse",value:function(t){var e=new DataView(t),n=Nr(e);console.assert("b3dm"===n);var r=e.getUint32(4,!0);console.assert(1===r);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 Sr(l,0,o,s),h=28+o+s,f=t.slice(h,h+a+u),p=new Mr(f,c.getData("BATCH_LENGTH"),0,a,u),g=h+a+u;return{version:r,featureTable:c,batchTable:p,glbBytes:new Uint8Array(t,g,i-g)}}}]),n}(),Rr=function(t){le(n,u);var e=pe(n);function n(t){var r;return oe(this,n),(r=e.call(this,t)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(t){return new Fr(t)})),r.register((function(t){return new Yr(t)})),r.register((function(t){return new Hr(t)})),r.register((function(t){return new Ur(t)})),r.register((function(t){return new qr(t)})),r.register((function(t){return new jr(t)})),r.register((function(t){return new zr(t)})),r.register((function(t){return new Or(t)})),r.register((function(t){return new Vr(t)})),r.register((function(t){return new Gr(t)})),r.register((function(t){return new Pr(t)})),r.register((function(t){return new Xr(t)})),r.register((function(t){return new Jr(t)})),r}return ae(n,[{key:"load",value:function(t,e,n,r){var i,o=this;i=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:s.extractUrlBase(t),this.manager.itemStart(t);var u=function(e){r?r(e):console.error(e),o.manager.itemError(t),o.manager.itemEnd(t)},l=new a(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(t,(function(n){try{o.parse(n,i,(function(n){e(n),o.manager.itemEnd(t)}),u)}catch(t){u(t)}}),n,u)}},{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,r){var i,o={},a={};if("string"==typeof t)i=JSON.parse(t);else if(t instanceof ArrayBuffer){if(s.decodeText(new Uint8Array(t,0,4))===Wr){try{o[Dr.KHR_BINARY_GLTF]=new $r(t)}catch(t){return void(r&&r(t))}i=JSON.parse(o[Dr.KHR_BINARY_GLTF].content)}else i=JSON.parse(s.decodeText(new Uint8Array(t)))}else i=t;if(void 0===i.asset||i.asset.version[0]<2)r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var u=new Ci(i,{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,o[c.name]=!0}if(i.extensionsUsed)for(var h=0;h<i.extensionsUsed.length;++h){var f=i.extensionsUsed[h],p=i.extensionsRequired||[];switch(f){case Dr.KHR_MATERIALS_UNLIT:o[f]=new kr;break;case Dr.KHR_DRACO_MESH_COMPRESSION:o[f]=new ti(i,this.dracoLoader);break;case Dr.KHR_TEXTURE_TRANSFORM:o[f]=new ei;break;case Dr.KHR_MESH_QUANTIZATION:o[f]=new ni;break;default:p.indexOf(f)>=0&&void 0===a[f]&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}u.setExtensions(o),u.setPlugins(a),u.parse(n,r)}}},{key:"parseAsync",value:function(t,e){var n=this;return new Promise((function(r,i){n.parse(t,e,r,i)}))}}]),n}();function Qr(){var t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}var Dr={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"},Pr=function(){function t(e){oe(this,t),this.parser=e,this.name=Dr.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return ae(t,[{key:"_markDefs",value:function(){for(var t=this.parser,e=this.parser.json.nodes||[],n=0,r=e.length;n<r;n++){var i=e[n];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,r=e.cache.get(n);if(r)return r;var i,o=e.json,s=((o.extensions&&o.extensions[this.name]||{}).lights||[])[t],a=new l(16777215);void 0!==s.color&&a.fromArray(s.color);var u=void 0!==s.range?s.range:0;switch(s.type){case"directional":(i=new f(a)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new h(a)).distance=u;break;case"spot":(i=new c(a)).distance=u,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,i.angle=s.spot.outerConeAngle,i.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return i.position.set(0,0,0),i.decay=2,vi(i,s),void 0!==s.intensity&&(i.intensity=s.intensity),i.name=e.createUniqueName(s.name||"light_"+t),r=Promise.resolve(i),e.cache.add(n,r),r}},{key:"getDependency",value:function(t,e){if("light"===t)return this._loadLight(e)}},{key:"createNodeAttachment",value:function(t){var e=this,n=this.parser,r=n.json.nodes[t],i=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then((function(t){return n._getNodeRef(e.cache,i,t)}))}}]),t}(),kr=function(){function t(){oe(this,t),this.name=Dr.KHR_MATERIALS_UNLIT}return ae(t,[{key:"getMaterialType",value:function(){return p}},{key:"extendParams",value:function(t,e,n){var r=[];t.color=new l(1,1,1),t.opacity=1;var i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){var o=i.baseColorFactor;t.color.fromArray(o),t.opacity=o[3]}void 0!==i.baseColorTexture&&r.push(n.assignTexture(t,"map",i.baseColorTexture,g))}return Promise.all(r)}}]),t}(),Or=function(){function t(e){oe(this,t),this.parser=e,this.name=Dr.KHR_MATERIALS_EMISSIVE_STRENGTH}return ae(t,[{key:"extendMaterialParams",value:function(t,e){var n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var r=n.extensions[this.name].emissiveStrength;return void 0!==r&&(e.emissiveIntensity=r),Promise.resolve()}}]),t}(),Fr=function(){function t(e){oe(this,t),this.parser=e,this.name=Dr.KHR_MATERIALS_CLEARCOAT}return ae(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?A:null}},{key:"extendMaterialParams",value:function(t,e){var n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],o=r.extensions[this.name];if(void 0!==o.clearcoatFactor&&(e.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&i.push(n.assignTexture(e,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(e.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&i.push(n.assignTexture(e,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(i.push(n.assignTexture(e,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var s=o.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new d(s,s)}return Promise.all(i)}}]),t}(),Gr=function(){function t(e){oe(this,t),this.parser=e,this.name=Dr.KHR_MATERIALS_IRIDESCENCE}return ae(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?A:null}},{key:"extendMaterialParams",value:function(t,e){var n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],o=r.extensions[this.name];return void 0!==o.iridescenceFactor&&(e.iridescence=o.iridescenceFactor),void 0!==o.iridescenceTexture&&i.push(n.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(n.assignTexture(e,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(i)}}]),t}(),Ur=function(){function t(e){oe(this,t),this.parser=e,this.name=Dr.KHR_MATERIALS_SHEEN}return ae(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?A:null}},{key:"extendMaterialParams",value:function(t,e){var n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[];e.sheenColor=new l(0,0,0),e.sheenRoughness=0,e.sheen=1;var o=r.extensions[this.name];return void 0!==o.sheenColorFactor&&e.sheenColor.fromArray(o.sheenColorFactor),void 0!==o.sheenRoughnessFactor&&(e.sheenRoughness=o.sheenRoughnessFactor),void 0!==o.sheenColorTexture&&i.push(n.assignTexture(e,"sheenColorMap",o.sheenColorTexture,g)),void 0!==o.sheenRoughnessTexture&&i.push(n.assignTexture(e,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(i)}}]),t}(),qr=function(){function t(e){oe(this,t),this.parser=e,this.name=Dr.KHR_MATERIALS_TRANSMISSION}return ae(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?A:null}},{key:"extendMaterialParams",value:function(t,e){var n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],o=r.extensions[this.name];return void 0!==o.transmissionFactor&&(e.transmission=o.transmissionFactor),void 0!==o.transmissionTexture&&i.push(n.assignTexture(e,"transmissionMap",o.transmissionTexture)),Promise.all(i)}}]),t}(),jr=function(){function t(e){oe(this,t),this.parser=e,this.name=Dr.KHR_MATERIALS_VOLUME}return ae(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?A:null}},{key:"extendMaterialParams",value:function(t,e){var n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],o=r.extensions[this.name];e.thickness=void 0!==o.thicknessFactor?o.thicknessFactor:0,void 0!==o.thicknessTexture&&i.push(n.assignTexture(e,"thicknessMap",o.thicknessTexture)),e.attenuationDistance=o.attenuationDistance||1/0;var s=o.attenuationColor||[1,1,1];return e.attenuationColor=new l(s[0],s[1],s[2]),Promise.all(i)}}]),t}(),zr=function(){function t(e){oe(this,t),this.parser=e,this.name=Dr.KHR_MATERIALS_IOR}return ae(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?A:null}},{key:"extendMaterialParams",value:function(t,e){var n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var r=n.extensions[this.name];return e.ior=void 0!==r.ior?r.ior:1.5,Promise.resolve()}}]),t}(),Vr=function(){function t(e){oe(this,t),this.parser=e,this.name=Dr.KHR_MATERIALS_SPECULAR}return ae(t,[{key:"getMaterialType",value:function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?A:null}},{key:"extendMaterialParams",value:function(t,e){var n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],o=r.extensions[this.name];e.specularIntensity=void 0!==o.specularFactor?o.specularFactor:1,void 0!==o.specularTexture&&i.push(n.assignTexture(e,"specularIntensityMap",o.specularTexture));var s=o.specularColorFactor||[1,1,1];return e.specularColor=new l(s[0],s[1],s[2]),void 0!==o.specularColorTexture&&i.push(n.assignTexture(e,"specularColorMap",o.specularColorTexture,g)),Promise.all(i)}}]),t}(),Yr=function(){function t(e){oe(this,t),this.parser=e,this.name=Dr.KHR_TEXTURE_BASISU}return ae(t,[{key:"loadTexture",value:function(t){var e=this.parser,n=e.json,r=n.textures[t];if(!r.extensions||!r.extensions[this.name])return null;var i=r.extensions[this.name],o=e.options.ktx2Loader;if(!o){if(n.extensionsRequired&&n.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}(),Hr=function(){function t(e){oe(this,t),this.parser=e,this.name=Dr.EXT_TEXTURE_WEBP,this.isSupported=null}return ae(t,[{key:"loadTexture",value:function(t){var e=this.name,n=this.parser,r=n.json,i=r.textures[t];if(!i.extensions||!i.extensions[e])return null;var o=i.extensions[e],s=r.images[o.source],a=n.textureLoader;if(s.uri){var u=n.options.manager.getHandler(s.uri);null!==u&&(a=u)}return this.detectSupport().then((function(i){if(i)return n.loadTextureImage(t,o.source,a);if(r.extensionsRequired&&r.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.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}(),Xr=function(){function t(e){oe(this,t),this.name=Dr.EXT_MESHOPT_COMPRESSION,this.parser=e}return ae(t,[{key:"loadBufferView",value:function(t){var e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){var r=n.extensions[this.name],i=this.parser.getDependency("buffer",r.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=r.byteOffset||0,n=r.byteLength||0,i=r.count,s=r.byteStride,a=new Uint8Array(t,e,n);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(i,s,a,r.mode,r.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,r.mode,r.filter),t}))}))}return null}}]),t}(),Jr=function(){function t(e){oe(this,t),this.name=Dr.EXT_MESH_GPU_INSTANCING,this.parser=e}return ae(t,[{key:"createNodeMesh",value:function(t){var e=this,n=this.parser.json,r=n.nodes[t];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;var s,a=Ie(n.meshes[r.mesh].primitives);try{for(a.s();!(s=a.n()).done;){var u=s.value;if(u.mode!==si.TRIANGLES&&u.mode!==si.TRIANGLE_STRIP&&u.mode!==si.TRIANGLE_FAN&&void 0!==u.mode)return null}}catch(t){a.e(t)}finally{a.f()}var l=r.extensions[this.name].attributes,c=[],h={},f=function(t){c.push(e.parser.getDependency("accessor",l[t]).then((function(e){return h[t]=e,h[t]})))};for(var p in l)f(p);return c.length<1?null:(c.push(this.parser.createNodeMesh(t)),Promise.all(c).then((function(t){var n,r=t.pop(),s=r.isGroup?r.children:[r],a=t[0].count,u=[],l=Ie(s);try{for(l.s();!(n=l.n()).done;){for(var c=n.value,f=new o,p=new y,g=new i,A=new y(1,1,1),d=new v(c.geometry,c.material,a),_=0;_<a;_++)h.TRANSLATION&&p.fromBufferAttribute(h.TRANSLATION,_),h.ROTATION&&g.fromBufferAttribute(h.ROTATION,_),h.SCALE&&A.fromBufferAttribute(h.SCALE,_),d.setMatrixAt(_,f.compose(p,g,A));for(var I in h)"TRANSLATION"!==I&&"ROTATION"!==I&&"SCALE"!==I&&c.geometry.setAttribute(I,h[I]);m.prototype.copy.call(d,c),d.frustumCulled=!1,e.parser.assignFinalMaterial(d),u.push(d)}}catch(t){l.e(t)}finally{l.f()}return r.isGroup?(r.clear(),r.add.apply(r,u),r):u[0]})))}}]),t}(),Wr="glTF",Kr=1313821514,Zr=5130562,$r=ae((function t(e){oe(this,t),this.name=Dr.KHR_BINARY_GLTF,this.content=null,this.body=null;var n=new DataView(e,0,12);if(this.header={magic:s.decodeText(new Uint8Array(e.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==Wr)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 r=this.header.length-12,i=new DataView(e,12),o=0;o<r;){var a=i.getUint32(o,!0);o+=4;var u=i.getUint32(o,!0);if(o+=4,u===Kr){var l=new Uint8Array(e,12+o,a);this.content=s.decodeText(l)}else if(u===Zr){var c=12+o;this.body=e.slice(c,c+a)}o+=a}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),ti=function(){function t(e,n){if(oe(this,t),!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Dr.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=n,this.dracoLoader.preload()}return ae(t,[{key:"decodePrimitive",value:function(t,e){var n=this.json,r=this.dracoLoader,i=t.extensions[this.name].bufferView,o=t.extensions[this.name].attributes,s={},a={},u={};for(var l in o){var c=hi[l]||l.toLowerCase();s[c]=o[l]}for(var h in t.attributes){var f=hi[h]||h.toLowerCase();if(void 0!==o[h]){var p=n.accessors[t.attributes[h]],g=ai[p.componentType];u[f]=g.name,a[f]=!0===p.normalized}}return e.getDependency("bufferView",i).then((function(t){return new Promise((function(e){r.decodeDracoFile(t,(function(t){for(var n in t.attributes){var r=t.attributes[n],i=a[n];void 0!==i&&(r.normalized=i)}e(t)}),s,u)}))}))}}]),t}(),ei=function(){function t(){oe(this,t),this.name=Dr.KHR_TEXTURE_TRANSFORM}return ae(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}(),ni=ae((function t(){oe(this,t),this.name=Dr.KHR_MESH_QUANTIZATION})),ri=function(t){le(n,lt);var e=pe(n);function n(t,r,i,o){return oe(this,n),e.call(this,t,r,i,o)}return ae(n,[{key:"copySampleValue_",value:function(t){for(var e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r*3+r,o=0;o!==r;o++)e[o]=n[i+o];return e}},{key:"interpolate_",value:function(t,e,n,r){for(var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=2*s,u=3*s,l=r-e,c=(n-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],C=o[p+m]*l;i[m]=y*_+v*I+A*E+d*C}return i}}]),n}(),ii=new i,oi=function(t){le(n,ri);var e=pe(n);function n(){return oe(this,n),e.apply(this,arguments)}return ae(n,[{key:"interpolate_",value:function(t,e,r,i){var o=Ae(ce(n.prototype),"interpolate_",this).call(this,t,e,r,i);return ii.fromArray(o).normalize().toArray(o),o}}]),n}(),si={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},ai={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ui={9728:V,9729:E,9984:Y,9985:H,9986:X,9987:C},li={33071:J,33648:W,10497:x},ci={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},hi={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},fi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},pi={CUBICSPLINE:void 0,LINEAR:nt,STEP:ot},gi="OPAQUE",Ai="MASK",di="BLEND";function yi(t,e,n){for(var r in n.extensions)void 0===t[r]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=n.extensions[r])}function vi(t,e){void 0!==e.extras&&("object"===ne(e.extras)?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function mi(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(var n=0,r=e.weights.length;n<r;n++)t.morphTargetInfluences[n]=e.weights[n];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 _i(t){for(var e="",n=Object.keys(t).sort(),r=0,i=n.length;r<i;r++)e+=n[r]+":"+t[n[r]]+";";return e}function Ii(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 Ei=new o,Ci=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};oe(this,t),this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new Qr,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 r=!1,i=!1,o=-1;"undefined"!=typeof navigator&&(r=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),o=(i=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||i&&o<98?this.textureLoader=new Z(this.options.manager):this.textureLoader=new $(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new a(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return ae(t,[{key:"setExtensions",value:function(t){this.extensions=t}},{key:"setPlugins",value:function(t){this.plugins=t}},{key:"parse",value:function(t,e){var n=this,r=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([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(e){var o={scene:e[0][r.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:r.asset,parser:n,userData:{}};yi(i,o,r),vi(o,r),Promise.all(n._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||[],n=this.json.meshes||[],r=0,i=e.length;r<i;r++)for(var o=e[r].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&&(n[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,n){var r=this;if(t.refs[e]<=1)return n;var i=n.clone();return function t(e,n){var i=r.associations.get(e);null!=i&&r.associations.set(n,i);var o,s=Ie(e.children.entries());try{for(s.s();!(o=s.n()).done;){var a=ve(o.value,2),u=a[0];t(a[1],n.children[u])}}catch(t){s.e(t)}finally{s.f()}}(n,i),i.name+="_instance_"+t.uses[e]++,i}},{key:"_invokeOne",value:function(t){var e=Object.values(this.plugins);e.push(this);for(var n=0;n<e.length;n++){var r=t(e[n]);if(r)return r}return null}},{key:"_invokeAll",value:function(t){var e=Object.values(this.plugins);e.unshift(this);for(var n=[],r=0;r<e.length;r++){var i=t(e[r]);i&&n.push(i)}return n}},{key:"getDependency",value:function(t,e){var n=t+":"+e,r=this.cache.get(n);if(!r){switch(t){case"scene":r=this.loadScene(e);break;case"node":r=this._invokeOne((function(t){return t.loadNode&&t.loadNode(e)}));break;case"mesh":r=this._invokeOne((function(t){return t.loadMesh&&t.loadMesh(e)}));break;case"accessor":r=this.loadAccessor(e);break;case"bufferView":r=this._invokeOne((function(t){return t.loadBufferView&&t.loadBufferView(e)}));break;case"buffer":r=this.loadBuffer(e);break;case"material":r=this._invokeOne((function(t){return t.loadMaterial&&t.loadMaterial(e)}));break;case"texture":r=this._invokeOne((function(t){return t.loadTexture&&t.loadTexture(e)}));break;case"skin":r=this.loadSkin(e);break;case"animation":r=this._invokeOne((function(t){return t.loadAnimation&&t.loadAnimation(e)}));break;case"camera":r=this.loadCamera(e);break;default:if(!(r=this._invokeOne((function(n){return n!=this&&n.getDependency&&n.getDependency(t,e)}))))throw new Error("Unknown type: "+t)}this.cache.add(n,r)}return r}},{key:"getDependencies",value:function(t){var e=this.cache.get(t);if(!e){var n=this,r=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(r.map((function(e,r){return n.getDependency(t,r)}))),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[Dr.KHR_BINARY_GLTF].body);var r=this.options;return new Promise((function(t,i){n.load(s.resolveURL(e.uri,r.path),t,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))}))}))}},{key:"loadBufferView",value:function(t){var e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){var n=e.byteLength||0,r=e.byteOffset||0;return t.slice(r,r+n)}))}},{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=ci[i.type],s=ai[i.componentType],a=!0===i.normalized,u=new s(i.count*o);return Promise.resolve(new r(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=ci[i.type],l=ai[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 _(o,p/c),e.cache.add(d,y)),s=new I(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(o,u,g);if(void 0!==i.sparse){var v=ci.SCALAR,m=ai[i.sparse.indices.componentType],E=i.sparse.indices.byteOffset||0,C=i.sparse.values.byteOffset||0,x=new m(t[1],E,i.sparse.count*v),w=new l(t[2],C,i.sparse.count*u);null!==a&&(s=new r(s.array.slice(),s.itemSize,s.normalized));for(var b=0,B=x.length;b<B;b++){var S=x[b];if(s.setX(S,w[b*u]),u>=2&&s.setY(S,w[b*u+1]),u>=3&&s.setZ(S,w[b*u+2]),u>=4&&s.setW(S,w[b*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,n=this.options,r=e.textures[t].source,i=e.images[r],o=this.textureLoader;if(i.uri){var s=n.manager.getHandler(i.uri);null!==s&&(o=s)}return this.loadTextureImage(t,r,o)}},{key:"loadTextureImage",value:function(t,e,n){var r=this,i=this.json,o=i.textures[t],s=i.images[e],a=(s.uri||s.bufferView)+":"+o.sampler;if(this.textureCache[a])return this.textureCache[a];var u=this.loadImageSource(e,n).then((function(e){e.flipY=!1,e.name=o.name||s.name||"";var n=(i.samplers||{})[o.sampler]||{};return e.magFilter=ui[n.magFilter]||E,e.minFilter=ui[n.minFilter]||C,e.wrapS=li[n.wrapS]||x,e.wrapT=li[n.wrapT]||x,r.associations.set(e,{textures:t}),e})).catch((function(){return null}));return this.textureCache[a]=u,u}},{key:"loadImageSource",value:function(t,e){var n=this.json,r=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then((function(t){return t.clone()}));var i=n.images[t],o=self.URL||self.webkitURL,a=i.uri||"",u=!1;if(void 0!==i.bufferView)a=this.getDependency("bufferView",i.bufferView).then((function(t){u=!0;var e=new Blob([t],{type:i.mimeType});return a=o.createObjectURL(e)}));else if(void 0===i.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,i){var o=n;!0===e.isImageBitmapLoader&&(o=function(t){var e=new tt(t);e.needsUpdate=!0,n(e)}),e.load(s.resolveURL(t,r.path),o,void 0,i)}))})).then((function(t){var e;return!0===u&&o.revokeObjectURL(a),t.userData.mimeType=i.mimeType||((e=i.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(t){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),t}));return this.sourceCache[t]=l,l}},{key:"assignTexture",value:function(t,e,n,r){var i=this;return this.getDependency("texture",n.index).then((function(o){if(!o)return null;if(void 0===n.texCoord||0==n.texCoord||"aoMap"===e&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+e+" not yet supported."),i.extensions[Dr.KHR_TEXTURE_TRANSFORM]){var s=void 0!==n.extensions?n.extensions[Dr.KHR_TEXTURE_TRANSFORM]:void 0;if(s){var a=i.associations.get(o);o=i.extensions[Dr.KHR_TEXTURE_TRANSFORM].extendTexture(o,s),i.associations.set(o,a)}}return void 0!==r&&(o.encoding=r),t[e]=o,o}))}},{key:"assignFinalMaterial",value:function(t){var e=t.geometry,n=t.material,r=void 0===e.attributes.tangent,i=void 0!==e.attributes.color,o=void 0===e.attributes.normal;if(t.isPoints){var s="PointsMaterial:"+n.uuid,a=this.cache.get(s);a||(a=new w,b.prototype.copy.call(a,n),a.color.copy(n.color),a.map=n.map,a.sizeAttenuation=!1,this.cache.add(s,a)),n=a}else if(t.isLine){var u="LineBasicMaterial:"+n.uuid,l=this.cache.get(u);l||(l=new B,b.prototype.copy.call(l,n),l.color.copy(n.color),this.cache.add(u,l)),n=l}if(r||i||o){var c="ClonedMaterial:"+n.uuid+":";r&&(c+="derivative-tangents:"),i&&(c+="vertex-colors:"),o&&(c+="flat-shading:");var h=this.cache.get(c);h||(h=n.clone(),i&&(h.vertexColors=!0),o&&(h.flatShading=!0),r&&(h.normalScale&&(h.normalScale.y*=-1),h.clearcoatNormalScale&&(h.clearcoatNormalScale.y*=-1)),this.cache.add(c,h),this.associations.set(h,this.associations.get(n))),n=h}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 S}},{key:"loadMaterial",value:function(t){var e,n=this,r=this.json,i=this.extensions,o=r.materials[t],s={},a=[];if((o.extensions||{})[Dr.KHR_MATERIALS_UNLIT]){var u=i[Dr.KHR_MATERIALS_UNLIT];e=u.getMaterialType(),a.push(u.extendParams(s,o,n))}else{var c=o.pbrMetallicRoughness||{};if(s.color=new l(1,1,1),s.opacity=1,Array.isArray(c.baseColorFactor)){var h=c.baseColorFactor;s.color.fromArray(h),s.opacity=h[3]}void 0!==c.baseColorTexture&&a.push(n.assignTexture(s,"map",c.baseColorTexture,g)),s.metalness=void 0!==c.metallicFactor?c.metallicFactor:1,s.roughness=void 0!==c.roughnessFactor?c.roughnessFactor:1,void 0!==c.metallicRoughnessTexture&&(a.push(n.assignTexture(s,"metalnessMap",c.metallicRoughnessTexture)),a.push(n.assignTexture(s,"roughnessMap",c.metallicRoughnessTexture))),e=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),a.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,s)}))))}!0===o.doubleSided&&(s.side=M);var f=o.alphaMode||gi;if(f===di?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,f===Ai&&(s.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&e!==p&&(a.push(n.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new d(1,1),void 0!==o.normalTexture.scale)){var A=o.normalTexture.scale;s.normalScale.set(A,A)}return void 0!==o.occlusionTexture&&e!==p&&(a.push(n.assignTexture(s,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(s.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&e!==p&&(s.emissive=(new l).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&e!==p&&a.push(n.assignTexture(s,"emissiveMap",o.emissiveTexture,g)),Promise.all(a).then((function(){var r=new e(s);return o.name&&(r.name=o.name),vi(r,o),n.associations.set(r,{materials:t}),o.extensions&&yi(i,r,o),r}))}},{key:"createUniqueName",value:function(t){for(var e=L.sanitizeNodeName(t||""),n=e,r=1;this.nodeNamesUsed[n];++r)n=e+"_"+r;return this.nodeNamesUsed[n]=!0,n}},{key:"loadGeometries",value:function(t){var e=this,r=this.extensions,i=this.primitiveCache;function o(t){return r[Dr.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(n){return xi(n,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[Dr.KHR_DRACO_MESH_COMPRESSION])?"draco:"+a.bufferView+":"+a.indices+":"+_i(a.attributes):s.indices+":"+_i(s.attributes)+":"+s.mode),p=i[f];if(p)u.push(p.promise);else{var g=void 0;g=h.extensions&&h.extensions[Dr.KHR_DRACO_MESH_COMPRESSION]?o(h):xi(new n,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,r=this.json,i=this.extensions,o=r.meshes[t],s=o.primitives,a=[],u=0,l=s.length;u<l;u++){var c=void 0===s[u].material?(void 0===(e=this.cache).DefaultMaterial&&(e.DefaultMaterial=new S({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:K})),e.DefaultMaterial):this.getDependency("material",s[u].material);a.push(c)}return a.push(n.loadGeometries(s)),Promise.all(a).then((function(e){for(var r=e.slice(0,e.length-1),a=e[e.length-1],u=[],l=0,c=a.length;l<c;l++){var h=a[l],f=s[l],p=void 0,g=r[l];if(f.mode===si.TRIANGLES||f.mode===si.TRIANGLE_STRIP||f.mode===si.TRIANGLE_FAN||void 0===f.mode)!0!==(p=!0===o.isSkinnedMesh?new N(h,g):new T(h,g)).isSkinnedMesh||p.geometry.attributes.skinWeight.normalized||p.normalizeSkinWeights(),f.mode===si.TRIANGLE_STRIP?p.geometry=wi(p.geometry,et):f.mode===si.TRIANGLE_FAN&&(p.geometry=wi(p.geometry,z));else if(f.mode===si.LINES)p=new R(h,g);else if(f.mode===si.LINE_STRIP)p=new Q(h,g);else if(f.mode===si.LINE_LOOP)p=new D(h,g);else{if(f.mode!==si.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);p=new P(h,g)}Object.keys(p.geometry.morphAttributes).length>0&&mi(p,o),p.name=n.createUniqueName(o.name||"mesh_"+t),vi(p,o),f.extensions&&yi(i,p,f),n.assignFinalMaterial(p),u.push(p)}for(var A=0,d=u.length;A<d;A++)n.associations.set(u[A],{meshes:t,primitives:A});if(1===u.length)return u[0];var y=new k;n.associations.set(y,{meshes:t});for(var v=0,m=u.length;v<m;v++)y.add(u[v]);return y}))}},{key:"loadCamera",value:function(t){var e,n=this.json.cameras[t],r=n[n.type];if(r)return"perspective"===n.type?e=new O(F.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===n.type&&(e=new G(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),vi(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=[],r=0,i=e.joints.length;r<i;r++)n.push(this.getDependency("node",e.joints[r]));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(),r=t,i=[],s=[],a=0,u=r.length;a<u;a++){var l=r[a];if(l){i.push(l);var c=new o;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 U(i,s)}))}},{key:"loadAnimation",value:function(t){for(var e=this.json.animations[t],n=[],r=[],i=[],o=[],s=[],a=0,u=e.channels.length;a<u;a++){var l=e.channels[a],c=e.samplers[l.sampler],h=l.target,f=h.node,p=void 0!==e.parameters?e.parameters[c.input]:c.input,g=void 0!==e.parameters?e.parameters[c.output]:c.output;n.push(this.getDependency("node",f)),r.push(this.getDependency("accessor",p)),i.push(this.getDependency("accessor",g)),o.push(c),s.push(h)}return Promise.all([Promise.all(n),Promise.all(r),Promise.all(i),Promise.all(o),Promise.all(s)]).then((function(n){for(var r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],u=[],l=function(){var t,e=r[c],n=i[c],l=o[c],h=s[c],f=a[c];if(void 0===e)return"continue";switch(e.updateMatrix(),fi[f.path]){case fi.weights:t=ut;break;case fi.rotation:t=at;break;default:t=st}var p=e.name?e.name:e.uuid,g=void 0!==h.interpolation?pi[h.interpolation]:nt,A=[];fi[f.path]===fi.weights?e.traverse((function(t){t.morphTargetInfluences&&A.push(t.name?t.name:t.uuid)})):A.push(p);var d=l.array;if(l.normalized){for(var y=Ii(d.constructor),v=new Float32Array(d.length),m=0,_=d.length;m<_;m++)v[m]=d[m]*y;d=v}for(var I=0,E=A.length;I<E;I++){var C=new t(A[I]+"."+fi[f.path],n.array,d,g);"CUBICSPLINE"===h.interpolation&&(C.createInterpolant=function(t){return new(this instanceof at?oi:ri)(this.times,this.values,this.getValueSize()/3,t)},C.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(C)}},c=0,h=r.length;c<h;c++)l();var f=e.name?e.name:"animation_"+t;return new q(f,void 0,u)}))}},{key:"createNodeMesh",value:function(t){var e=this.json,n=this,r=e.nodes[t];return void 0===r.mesh?null:n.getDependency("mesh",r.mesh).then((function(t){var e=n._getNodeRef(n.meshCache,r.mesh,t);return void 0!==r.weights&&e.traverse((function(t){if(t.isMesh)for(var e=0,n=r.weights.length;e<n;e++)t.morphTargetInfluences[e]=r.weights[e]})),e}))}},{key:"loadNode",value:function(t){var e=this.json,n=this.extensions,r=this,i=e.nodes[t],s=i.name?r.createUniqueName(i.name):"";return function(){var e=[],n=r._invokeOne((function(e){return e.createNodeMesh&&e.createNodeMesh(t)}));n&&e.push(n),void 0!==i.camera&&e.push(r.getDependency("camera",i.camera).then((function(t){return r._getNodeRef(r.cameraCache,i.camera,t)}))),r._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){e.push(t)}));for(var o=[],s=i.children||[],a=0,u=s.length;a<u;a++)o.push(r.getDependency("node",s[a]));var l=void 0===i.skin?Promise.resolve(null):r.getDependency("skin",i.skin);return Promise.all([Promise.all(e),Promise.all(o),l])}().then((function(e){var a,u=e[0],l=e[1],c=e[2];if((a=!0===i.isBone?new j:u.length>1?new k:1===u.length?u[0]:new m)!==u[0])for(var h=0,f=u.length;h<f;h++)a.add(u[h]);if(i.name&&(a.userData.name=i.name,a.name=s),vi(a,i),i.extensions&&yi(n,a,i),void 0!==i.matrix){var p=new o;p.fromArray(i.matrix),a.applyMatrix4(p)}else void 0!==i.translation&&a.position.fromArray(i.translation),void 0!==i.rotation&&a.quaternion.fromArray(i.rotation),void 0!==i.scale&&a.scale.fromArray(i.scale);r.associations.has(a)||r.associations.set(a,{}),r.associations.get(a).nodes=t,null!==c&&a.traverse((function(t){t.isSkinnedMesh&&t.bind(c,Ei)}));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],r=this,i=new k;n.name&&(i.name=r.createUniqueName(n.name)),vi(i,n),n.extensions&&yi(e,i,n);for(var o=n.nodes||[],s=[],a=0,u=o.length;a<u;a++)s.push(r.getDependency("node",o[a]));return Promise.all(s).then((function(t){for(var e=0,n=t.length;e<n;e++)i.add(t[e]);return r.associations=function(t){var e,n=new Map,i=Ie(r.associations);try{for(i.s();!(e=i.n()).done;){var o=ve(e.value,2),s=o[0],a=o[1];(s instanceof b||s instanceof tt)&&n.set(s,a)}}catch(t){i.e(t)}finally{i.f()}return t.traverse((function(t){var e=r.associations.get(t);null!=e&&n.set(t,e)})),n}(i),i}))}}]),t}();function xi(t,e,n){var r=e.attributes,i=[];function o(e,r){return n.getDependency("accessor",e).then((function(e){t.setAttribute(r,e)}))}for(var s in r){var a=hi[s]||s.toLowerCase();a in t.attributes||i.push(o(r[s],a))}if(void 0!==e.indices&&!t.index){var u=n.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));i.push(u)}return vi(t,e),function(t,e,n){var r=e.attributes,i=new rt;if(void 0!==r.POSITION){var o=n.json.accessors[r.POSITION],s=o.min,a=o.max;if(void 0!==s&&void 0!==a){if(i.set(new y(s[0],s[1],s[2]),new y(a[0],a[1],a[2])),o.normalized){var u=Ii(ai[o.componentType]);i.min.multiplyScalar(u),i.max.multiplyScalar(u)}var l=e.targets;if(void 0!==l){for(var c=new y,h=new y,f=0,p=l.length;f<p;f++){var g=l[f];if(void 0!==g.POSITION){var A=n.json.accessors[g.POSITION],d=A.min,v=A.max;if(void 0!==d&&void 0!==v){if(h.setX(Math.max(Math.abs(d[0]),Math.abs(v[0]))),h.setY(Math.max(Math.abs(d[1]),Math.abs(v[1]))),h.setZ(Math.max(Math.abs(d[2]),Math.abs(v[2]))),A.normalized){var m=Ii(ai[A.componentType]);h.multiplyScalar(m)}c.max(h)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(c)}t.boundingBox=i;var _=new it;i.getCenter(_.center),_.radius=i.min.distanceTo(i.max)/2,t.boundingSphere=_}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,e,n),Promise.all(i).then((function(){return void 0!==e.targets?function(t,e,n){for(var r=!1,i=!1,o=!1,s=0,a=e.length;s<a;s++){var u=e[s];if(void 0!==u.POSITION&&(r=!0),void 0!==u.NORMAL&&(i=!0),void 0!==u.COLOR_0&&(o=!0),r&&i&&o)break}if(!r&&!i&&!o)return Promise.resolve(t);for(var l=[],c=[],h=[],f=0,p=e.length;f<p;f++){var g=e[f];if(r){var A=void 0!==g.POSITION?n.getDependency("accessor",g.POSITION):t.attributes.position;l.push(A)}if(i){var d=void 0!==g.NORMAL?n.getDependency("accessor",g.NORMAL):t.attributes.normal;c.push(d)}if(o){var y=void 0!==g.COLOR_0?n.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 n=e[0],s=e[1],a=e[2];return r&&(t.morphAttributes.position=n),i&&(t.morphAttributes.normal=s),o&&(t.morphAttributes.color=a),t.morphTargetsRelative=!0,t}))}(t,e.targets,n):t}))}function wi(t,e){var n=t.getIndex();if(null===n){var r=[],i=t.getAttribute("position");if(void 0===i)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var o=0;o<i.count;o++)r.push(o);t.setIndex(r),n=t.getIndex()}var s=n.count-2,a=[];if(e===z)for(var u=1;u<=s;u++)a.push(n.getX(0)),a.push(n.getX(u)),a.push(n.getX(u+1));else for(var l=0;l<s;l++)l%2==0?(a.push(n.getX(l)),a.push(n.getX(l+1)),a.push(n.getX(l+2))):(a.push(n.getX(l+2)),a.push(n.getX(l+1)),a.push(n.getX(l)));a.length/3!==s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var c=t.clone();return c.setIndex(a),c}var bi=function(t){le(n,Tr);var e=pe(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct;return oe(this,n),(t=e.call(this)).manager=r,t.adjustmentTransform=new o,t}return ae(n,[{key:"parse",value:function(t){var e=this,r=Ae(ce(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 Rr(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}(),Bi=function(t){le(n,Lr);var e=pe(n);function n(){return oe(this,n),e.apply(this,arguments)}return ae(n,[{key:"parse",value:function(t){var e=new DataView(t),n=Nr(e);console.assert("pnts"===n);var r=e.getUint32(4,!0);console.assert(1===r);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 Sr(l,0,o,s),h=28+o+s,f=t.slice(h,h+a+u),p=new Mr(f,c.getData("BATCH_LENGTH")||c.getData("POINTS_LENGTH"),0,a,u);return Promise.resolve({version:r,featureTable:c,batchTable:p})}}]),n}(),Si={RGB:"color",POSITION:"position"},Mi=function(t){le(i,Bi);var e=pe(i);function i(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct;return oe(this,i),(t=e.call(this)).manager=n,t}return ae(i,[{key:"parse",value:function(t){var e=this;return Ae(ce(i.prototype),"parse",this).call(this,t).then(function(){var t=ie(ee().mark((function t(i){var o,s,a,u,l,c,h,f,p,g,A,d,y,v,m,_,I,E;return ee().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=i.featureTable,s=new w,!(a=o.header.extensions)||!a["3DTILES_draco_point_compression"]){t.next=18;break}if(l=a["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 Si&&A in f&&(g[Si[A]]=f[A]);return d={attributeIDs:g,attributeTypes:{position:"Float32Array",color:"Uint8Array"},useUniqueIDs:!0},y=o.getBuffer(c,h),t.next=14,p.decodeGeometry(y,d);case 14:(u=t.sent).attributes.color&&(s.vertexColors=!0),t.next=24;break;case 18:v=o.getData("POINTS_LENGTH"),m=o.getData("POSITION",v,"FLOAT","VEC3"),_=o.getData("RGB",v,"UNSIGNED_BYTE","VEC3"),(u=new n).setAttribute("position",new r(m,3,!1)),null!==_&&(u.setAttribute("color",new r(_,3,!0)),s.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 o.header&&console.warn('PNTSLoader: Unsupported FeatureTable feature "'.concat(t,'" detected.'))})),I=new P(u,s),i.scene=I,i.scene.featureTable=o,(E=o.getData("RTC_CENTER"))&&(i.scene.position.x+=E[0],i.scene.position.y+=E[1],i.scene.position.z+=E[2]),t.abrupt("return",i);case 31:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}}]),i}(),Li=function(t){le(n,Lr);var e=pe(n);function n(){return oe(this,n),e.apply(this,arguments)}return ae(n,[{key:"parse",value:function(t){var e=new DataView(t),n=Nr(e);console.assert("i3dm"===n);var r=e.getUint32(4,!0);console.assert(1===r);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 Sr(c,0,o,s),f=32+o+s,p=t.slice(f,f+a+u),g=new Mr(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(Br(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:r,featureTable:h,batchTable:g,glbBytes:y}}))}}]),n}(),Ni=new y,Ti=new y,Ri=new y,Qi=new y,Di=new i,Pi=new y,ki=new o,Oi=function(t){le(n,Li);var e=pe(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct;return oe(this,n),(t=e.call(this)).manager=r,t.adjustmentTransform=new o,t}return ae(n,[{key:"resolveExternalURL",value:function(t){return this.manager.resolveURL(Ae(ce(n.prototype),"resolveExternalURL",this).call(this,t))}},{key:"parse",value:function(t){var e=this;return Ae(ce(n.prototype),"parse",this).call(this,t).then((function(t){var n=t.featureTable,r=t.batchTable,i=t.glbBytes.slice().buffer;return new Promise((function(t,o){var s=e.fetchOptions,a=e.manager,u=a.getHandler("path.gltf")||new Rr(a);"include"===s.credentials&&"cors"===s.mode&&u.setCrossOrigin("use-credentials"),"credentials"in s&&u.setWithCredentials("include"===s.credentials),s.headers&&u.setRequestHeader(s.headers);var l=e.workingPath;/[\\/]$/.test(l)||(l+="/");var c=e.adjustmentTransform;u.parse(i,l,(function(e){var i=n.getData("INSTANCES_LENGTH"),o=n.getData("POSITION",i,"FLOAT","VEC3"),s=n.getData("NORMAL_UP",i,"FLOAT","VEC3"),a=n.getData("NORMAL_RIGHT",i,"FLOAT","VEC3"),u=n.getData("SCALE_NON_UNIFORM",i,"FLOAT","VEC3"),l=n.getData("SCALE",i,"FLOAT","SCALAR");["RTC_CENTER","QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","EAST_NORTH_UP","POSITION_QUANTIZED","NORMAL_UP_OCT32P","NORMAL_RIGHT_OCT32P"].forEach((function(t){t in n.header&&console.warn('I3DMLoader: Unsupported FeatureTable feature "'.concat(t,'" detected.'))}));var h=new Map,f=[];e.scene.traverse((function(t){if(t.isMesh){var e=t.geometry,n=t.material,r=new v(e,n,i);r.position.copy(t.position),r.rotation.copy(t.rotation),r.scale.copy(t.scale),f.push(r),h.set(t,r)}}));for(var p=new y,g=0;g<i;g++)p.x+=o[3*g+0]/i,p.y+=o[3*g+1]/i,p.z+=o[3*g+2]/i;h.forEach((function(t,e){var n=e.parent;n&&(n.remove(e),n.add(t),t.updateMatrixWorld(),t.position.copy(p).applyMatrix4(t.matrixWorld))}));for(var A=0;A<i;A++){Qi.set(o[3*A+0]-p.x,o[3*A+1]-p.y,o[3*A+2]-p.z),s?(Ti.set(s[3*A+0],s[3*A+1],s[3*A+2]),Ri.set(a[3*A+0],a[3*A+1],a[3*A+2]),Ni.crossVectors(Ri,Ti).normalize(),ki.makeBasis(Ri,Ti,Ni),Di.setFromRotationMatrix(ki)):Di.set(0,0,0,1),l?Pi.setScalar(l[A]):u?Pi.set(u[3*A+0],u[3*A+1],u[3*A+2]):Pi.set(1,1,1),ki.compose(Qi,Di,Pi).multiply(c);for(var d=0,m=f.length;d<m;d++){f[d].setMatrixAt(A,ki)}}e.batchTable=r,e.featureTable=n,e.scene.batchTable=r,e.scene.featureTable=n,t(e)}),o)}))}))}}]),n}(),Fi=function(t){le(n,Lr);var e=pe(n);function n(){return oe(this,n),e.apply(this,arguments)}return ae(n,[{key:"parse",value:function(t){var e=new DataView(t),n=Nr(e);console.assert("cmpt"===n,'CMPTLoader: The magic bytes equal "cmpt".');var r=e.getUint32(4,!0);console.assert(1===r,'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=Nr(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:r,tiles:s}}}]),n}(),Gi=function(t){le(n,Fi);var e=pe(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct;return oe(this,n),(t=e.call(this)).manager=r,t.adjustmentTransform=new o,t}return ae(n,[{key:"parse",value:function(t){var e=Ae(ce(n.prototype),"parse",this).call(this,t),r=this.manager,i=this.adjustmentTransform,o=[];for(var s in e.tiles){var a=e.tiles[s],u=a.type,l=a.buffer;switch(u){case"b3dm":var c=l.slice(),h=new bi(r);h.workingPath=this.workingPath,h.fetchOptions=this.fetchOptions,h.adjustmentTransform.copy(i);var f=h.parse(c.buffer);o.push(f);break;case"pnts":var p=l.slice(),g=new Mi(r);g.workingPath=this.workingPath,g.fetchOptions=this.fetchOptions;var A=g.parse(p.buffer);o.push(A);break;case"i3dm":var d=l.slice(),y=new Oi(r);y.workingPath=this.workingPath,y.fetchOptions=this.fetchOptions,y.adjustmentTransform.copy(i);var v=y.parse(d.buffer);o.push(v)}}return Promise.all(o).then((function(t){var e=new k;return t.forEach((function(t){e.add(t.scene)})),{tiles:t,scene:e}}))}}]),n}(),Ui=function(){function t(){oe(this,t),this.name="CESIUM_RTC"}return ae(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}(),qi=function(t){le(n,Lr);var e=pe(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct;return oe(this,n),(t=e.call(this)).manager=r,t}return ae(n,[{key:"parse",value:function(t){var e=this;return new Promise((function(n,r){var i=e.manager,o=e.fetchOptions,s=i.getHandler("path.gltf")||i.getHandler("path.glb");s||((s=new Rr(i)).register((function(){return new Ui})),"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){n(t)}),r)}))}}]),n}(),ji=new o,zi=function(t){le(n,k);var e=pe(n);function n(t){var r;return oe(this,n),(r=e.call(this)).name="TilesRenderer.TilesGroup",r.tilesRenderer=t,r}return ae(n,[{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?ji.copy(this.matrix):ji.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1;for(var e=ji.elements,n=this.matrixWorld.elements,r=!1,i=0;i<16;i++){var o=e[i],s=n[i];if(Math.abs(o-s)>Number.EPSILON){r=!0;break}}if(r){this.matrixWorld.copy(ji);for(var a=this.children,u=0,l=a.length;u<l;u++)a[u].updateMatrixWorld()}}}}]),n}();new ht,new y;var Vi=new ht,Yi=new y,Hi=new y,Xi=new y,Ji=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,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;oe(this,t),this.radius=new y(e,n,r)}return ae(t,[{key:"getCartographicToPosition",value:function(t,e,n,r){this.getCartographicToNormal(t,e,Yi);var i=this.radius;Hi.copy(Yi),Hi.x*=Math.pow(i.x,2),Hi.y*=Math.pow(i.y,2),Hi.z*=Math.pow(i.z,2);var o=Math.sqrt(Yi.dot(Hi));return Hi.divideScalar(o),r.copy(Hi).addScaledVector(Yi,n)}},{key:"getPositionToCartographic",value:function(t,e){this.getPositionToSurfacePoint(t,Hi),this.getPositionToNormal(t,Yi);var n=Xi.subVectors(t,Hi);return e.lon=Math.atan2(Yi.y,Yi.x),e.lat=Math.asin(Yi.z),e.height=Math.sign(n.dot(t))*n.length(),e}},{key:"getCartographicToNormal",value:function(t,e,n){return Vi.set(1,-t+Math.PI/2,e),n.setFromSpherical(Vi).normalize(),function(t){var e=t.x,n=t.y,r=t.z;t.x=r,t.y=e,t.z=n}(n),n}},{key:"getPositionToNormal",value:function(t,e){var n=this.radius;return e.copy(t),e.x/=Math.pow(n.x,2),e.y/=Math.pow(n.y,2),e.z/=Math.pow(n.z,2),e.normalize(),e}},{key:"getPositionToSurfacePoint",value:function(t,e){var n=this.radius,r=1/Math.pow(n.x,2),i=1/Math.pow(n.y,2),o=1/Math.pow(n.z,2),s=t.x*t.x*r,a=t.y*t.y*i,u=t.z*t.z*o,l=s+a+u,c=Math.sqrt(1/l),h=Hi.copy(t).multiplyScalar(c);if(l<.1)return isFinite(c)?e.copy(h):null;var f,p,g,A,d,y,v,m=Xi.set(h.x*r*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)*r))*p)+a*(y=(g=1/(1+_*i))*g)+u*(v=(A=1/(1+_*o))*A)-1)/(-2*(s*(d*p)*r+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}(),Wi=Math.PI,Ki=Wi/2,Zi=new y,$i=new y,to=new y,eo=new o,no=0,ro=[];function io(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?(ro[no]||(ro[no]=new y),no++,ro[no-1]):new y}function oo(){no=0}var so=function(t){le(n,Ji);var e=pe(n);function n(t,r,i){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-Ki,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Ki,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*Wi,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0;return oe(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=h,o}return ae(n,[{key:"_getPoints",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.latStart,n=this.latEnd,r=this.lonStart,i=this.lonEnd,o=this.heightStart,s=this.heightEnd,a=F.mapLinear(.5,0,1,e,n),u=F.mapLinear(.5,0,1,r,i),l=Math.floor(r/Ki)*Ki,c=[[-Wi/2,0],[Wi/2,0],[0,l],[0,l+Wi/2],[0,l+Wi],[0,l+3*Wi/2],[e,i],[n,i],[e,r],[n,r],[0,r],[0,i],[a,u],[e,u],[n,u],[a,r],[a,i]],h=[],f=c.length,p=0;p<=1;p++)for(var g=F.mapLinear(p,0,1,o,s),A=0,d=f;A<d;A++){var y=ve(c[A],2),v=y[0],m=y[1];if(v>=e&&v<=n&&m>=r&&m<=i){var _=io(t);h.push(_),this.getCartographicToPosition(v,m,g,_)}}return h}},{key:"getBoundingBox",value:function(t,e){oo();var n=this.latStart,r=this.latEnd,i=this.lonStart,o=this.lonEnd;if(r-n<Wi/2){var s=F.mapLinear(.5,0,1,n,r),a=F.mapLinear(.5,0,1,i,o);this.getCartographicToNormal(s,a,to),$i.set(0,0,1),Zi.crossVectors($i,to),$i.crossVectors(Zi,to),e.makeBasis(Zi,$i,to)}else Zi.set(1,0,0),$i.set(0,1,0),to.set(0,0,1),e.makeBasis(Zi,$i,to);eo.copy(e).invert();for(var u=this._getPoints(!0),l=0,c=u.length;l<c;l++)u[l].applyMatrix4(eo);t.makeEmpty(),t.setFromPoints(u)}},{key:"getBoundingSphere",value:function(t,e){oo();var n=this._getPoints(!0);t.makeEmpty(),t.setFromPoints(n,e)}}]),n}();function ao(t){return ao="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},ao(t)}function uo(t){var e=function(t,e){if("object"!==ao(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!==ao(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===ao(e)?e:String(e)}function lo(t,e,n){return(e=uo(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function co(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}const ho=1/Math.PI*180,fo=1/180*Math.PI,po={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function go(t,{precision:e=po.precision}={}){return t=function(t){return Math.round(t/po.EPSILON)*po.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function Ao(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function yo(t){return function(t,e){return _o(t,(t=>t*fo),e)}(t)}function vo(t){return function(t,e){return _o(t,(t=>t*ho),e)}(t)}function mo(t,e,n){const r=po.EPSILON;n&&(po.EPSILON=n);try{if(t===e)return!0;if(Ao(t)&&Ao(e)){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(!mo(t[n],e[n]))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)<=po.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))}finally{po.EPSILON=r}}function _o(t,e,n){if(Ao(t)){const r=t;n=n||function(t){return t.clone?t.clone():new Array(t.length)}(r);for(let i=0;i<n.length&&i<r.length;++i)n[i]=e(t[i],i,n);return n}return e(t)}class Io 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 n=0;n<this.ELEMENTS;++n)this[n]=t[n+e];return this.check()}toArray(t=[],e=0){for(let n=0;n<this.ELEMENTS;++n)t[e+n]=this[n];return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Ao(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(po)}formatString(t){let e="";for(let n=0;n<this.ELEMENTS;++n)e+=(n>0?", ":"")+go(this[n],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(!mo(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,n){if(void 0===n)return this.lerp(this,t,e);for(let r=0;r<this.ELEMENTS;++r){const i=t[r];this[r]=i+n*(e[r]-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 n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),e[n]);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(po.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 n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t),e);return this.check()}get elements(){return this}}function Eo(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(t));return t}function Co(t,e,n=""){if(po.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(n," some fields set to invalid numbers'"));return t}class xo extends Io{get x(){return this[0]}set x(t){this[0]=Eo(t)}get y(){return this[1]}set y(t){this[1]=Eo(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 n=0;n<this.ELEMENTS;++n){const r=this[n]-t[n];e+=r*r}return Eo(e)}dot(t){let e=0;for(let n=0;n<this.ELEMENTS;++n)e+=this[n]*t[n];return Eo(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 co(t>=0&&t<this.ELEMENTS,"index is out of range"),Eo(this[t])}setComponent(t,e){return co(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 wo,bo=1e-6,Bo="undefined"!=typeof Float32Array?Float32Array:Array;function So(t,e,n){const r=e[0],i=e[1],o=e[2],s=n[3]*r+n[7]*i+n[11]*o||1;return t[0]=(n[0]*r+n[4]*i+n[8]*o)/s,t[1]=(n[1]*r+n[5]*i+n[9]*o)/s,t[2]=(n[2]*r+n[6]*i+n[10]*o)/s,t}function Mo(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Lo(t,e,n){var r=e[0],i=e[1],o=e[2],s=n[3]*r+n[7]*i+n[11]*o+n[15];return s=s||1,t[0]=(n[0]*r+n[4]*i+n[8]*o+n[12])/s,t[1]=(n[1]*r+n[5]*i+n[9]*o+n[13])/s,t[2]=(n[2]*r+n[6]*i+n[10]*o+n[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)}),wo=new Bo(2),Bo!=Float32Array&&(wo[0]=0,wo[1]=0),function(){var t=function(){var t=new Bo(3);return Bo!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}()}();const No=[0,0,0];let To;class Ro extends xo{static get ZERO(){return To||(To=new Ro(0,0,0),Object.freeze(To)),To}constructor(t=0,e=0,n=0){super(-0,-0,-0),1===arguments.length&&Ao(t)?this.copy(t):(po.debug&&(Eo(t),Eo(e),Eo(n)),this[0]=t,this[1]=e,this[2]=n)}set(t,e,n){return this[0]=t,this[1]=e,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return po.debug&&(Eo(t.x),Eo(t.y),Eo(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]=Eo(t)}angle(t){return n=t,r=(e=this)[0],i=e[1],o=e[2],s=n[0],a=n[1],u=n[2],l=Math.sqrt(r*r+i*i+o*o)*Math.sqrt(s*s+a*a+u*u),c=l&&Mo(e,n)/l,Math.acos(Math.min(Math.max(c,-1),1));var e,n,r,i,o,s,a,u,l,c}cross(t){return function(t,e,n){var r=e[0],i=e[1],o=e[2],s=n[0],a=n[1],u=n[2];t[0]=i*u-o*a,t[1]=o*s-r*u,t[2]=r*a-i*s}(this,this,t),this.check()}rotateX({radians:t,origin:e=No}){return function(t,e,n,r){var i=[],o=[];i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[0],o[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),o[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2]}(this,this,e,t),this.check()}rotateY({radians:t,origin:e=No}){return function(t,e,n,r){var i=[],o=[];i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),o[1]=i[1],o[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2]}(this,this,e,t),this.check()}rotateZ({radians:t,origin:e=No}){return function(t,e,n,r){var i=[],o=[];i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),o[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),o[2]=i[2],t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2]}(this,this,e,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Lo(this,this,t),this.check()}transformAsVector(t){return So(this,this,t),this.check()}transformByMatrix3(t){return function(t,e,n){var r=e[0],i=e[1],o=e[2];t[0]=r*n[0]+i*n[3]+o*n[6],t[1]=r*n[1]+i*n[4]+o*n[7],t[2]=r*n[2]+i*n[5]+o*n[8]}(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,n){const r=e[0],i=e[1];t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t[2]=e[2]}(this,this,t),this.check()}transformByQuaternion(t){return function(t,e,n){var r=n[0],i=n[1],o=n[2],s=n[3],a=e[0],u=e[1],l=e[2],c=i*l-o*u,h=o*a-r*l,f=r*u-i*a,p=i*f-o*h,g=o*c-r*f,A=r*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 Qo extends Io{toString(){let t="[";if(po.printRowMajor){t+="row-major:";for(let e=0;e<this.RANK;++e)for(let n=0;n<this.RANK;++n)t+=" ".concat(this[n*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,n){return this[e*this.RANK+t]=Eo(n),this}getColumn(t,e=new Array(this.RANK).fill(-0)){const n=t*this.RANK;for(let t=0;t<this.RANK;++t)e[t]=this[n+t];return e}setColumn(t,e){const n=t*this.RANK;for(let t=0;t<this.RANK;++t)this[n+t]=e[t];return this}}function Do(t,e,n){var r=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=n[0],_=n[1],I=n[2],E=n[3];return t[0]=m*r+_*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=n[4],_=n[5],I=n[6],E=n[7],t[4]=m*r+_*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=n[8],_=n[9],I=n[10],E=n[11],t[8]=m*r+_*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=n[12],_=n[13],I=n[14],E=n[15],t[12]=m*r+_*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 Po=function(t,e,n,r,i){var o,s=1/Math.tan(e/2);return t[0]=s/n,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/(r-i),t[10]=(i+r)*o,t[14]=2*i*r*o):(t[10]=-1,t[14]=-2*r),t};var ko,Oo=function(t,e,n,r,i,o,s){var a=1/(e-n),u=1/(r-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+n)*a,t[13]=(i+r)*u,t[14]=(s+o)*l,t[15]=1,t};!function(){var t=function(){var t=new Bo(4);return Bo!=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"}(ko||(ko={}));const Fo=45*Math.PI/180,Go=1,Uo=.1,qo=500,jo=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class zo extends Qo{static get IDENTITY(){return function(){Yo||(Yo=new zo,Object.freeze(Yo));return Yo}()}static get ZERO(){return function(){Vo||(Vo=new zo([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Vo));return Vo}()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return ko}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,n,r,i,o,s,a,u,l,c,h,f,p,g,A){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,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,n,r,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]=n,this[9]=s,this[10]=c,this[11]=g,this[12]=r,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(jo)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=n+n,a=r+r,u=i+i,l=n*s,c=r*s,h=r*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:n,bottom:r,top:i,near:o=Uo,far:s=qo}=t;return s===1/0?function(t,e,n,r,i,o){const s=2*o/(n-e),a=2*o/(i-r),u=(n+e)/(n-e),l=(i+r)/(i-r),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,n,r,i,o):function(t,e,n,r,i,o,s){var a=1/(n-e),u=1/(i-r),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]=(n+e)*a,t[9]=(i+r)*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,n,r,i,o,s),this.check()}lookAt(t){const{eye:e,center:n=[0,0,0],up:r=[0,1,0]}=t;return function(t,e,n,r){var i,o,s,a,u,l,c,h,f,p,g=e[0],A=e[1],d=e[2],y=r[0],v=r[1],m=r[2],_=n[0],I=n[1],E=n[2];Math.abs(g-_)<bo&&Math.abs(A-I)<bo&&Math.abs(d-E)<bo?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,n,r),this.check()}ortho(t){const{left:e,right:n,bottom:r,top:i,near:o=Uo,far:s=qo}=t;return Oo(this,e,n,r,i,o,s),this.check()}orthographic(t){const{fovy:e=Fo,aspect:n=Go,focalDistance:r=1,near:i=Uo,far:o=qo}=t;Ho(e);const s=e/2,a=r*Math.tan(s),u=a*n;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:n=1,near:r=.1,far:i=500}=t;return Ho(e),Po(this,e,n,r,i),this.check()}determinant(){return e=(t=this)[0],n=t[1],r=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-n*o)*(h*d-f*A)-(e*a-r*o)*(c*d-f*g)+(e*u-i*o)*(c*A-h*g)+(n*a-r*s)*(l*d-f*p)-(n*u-i*s)*(l*A-h*p)+(r*u-i*a)*(l*g-c*p);var t,e,n,r,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 n=this.getScale(e),r=1/n[0],i=1/n[1],o=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*r,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*r,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 n=this.getScale(e),r=1/n[0],i=1/n[1],o=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*r,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*r,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return function(t,e){if(t===e){var n=e[1],r=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]=n,t[6]=e[9],t[7]=e[13],t[8]=r,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 n=e[0],r=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=n*a-r*s,m=n*u-i*s,_=n*l-o*s,I=r*u-i*a,E=r*l-o*a,C=i*l-o*u,x=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+C*x;L&&(L=1/L,t[0]=(a*M-u*S+l*B)*L,t[1]=(i*S-r*M-o*B)*L,t[2]=(A*C-d*E+y*I)*L,t[3]=(f*E-h*C-p*I)*L,t[4]=(u*b-s*M-l*w)*L,t[5]=(n*M-i*b+o*w)*L,t[6]=(d*_-g*C-y*m)*L,t[7]=(c*C-f*_+p*m)*L,t[8]=(s*S-a*b+l*x)*L,t[9]=(r*b-n*S-o*x)*L,t[10]=(g*E-A*_+y*v)*L,t[11]=(h*_-c*E-p*v)*L,t[12]=(a*w-s*B-u*x)*L,t[13]=(n*B-r*w+i*x)*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 Do(this,t,this),this.check()}multiplyRight(t){return Do(this,this,t),this.check()}rotateX(t){return function(t,e,n){var r=Math.sin(n),i=Math.cos(n),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*r,t[5]=s*i+c*r,t[6]=a*i+h*r,t[7]=u*i+f*r,t[8]=l*i-o*r,t[9]=c*i-s*r,t[10]=h*i-a*r,t[11]=f*i-u*r}(this,this,t),this.check()}rotateY(t){return function(t,e,n){var r=Math.sin(n),i=Math.cos(n),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*r,t[1]=s*i-c*r,t[2]=a*i-h*r,t[3]=u*i-f*r,t[8]=o*r+l*i,t[9]=s*r+c*i,t[10]=a*r+h*i,t[11]=u*r+f*i}(this,this,t),this.check()}rotateZ(t){return function(t,e,n){var r=Math.sin(n),i=Math.cos(n),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*r,t[1]=s*i+c*r,t[2]=a*i+h*r,t[3]=u*i+f*r,t[4]=l*i-o*r,t[5]=c*i-s*r,t[6]=h*i-a*r,t[7]=f*i-u*r}(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,n,r){var i,o,s,a,u,l,c,h,f,p,g,A,d,y,v,m,_,I,E,C,x,w,b,B,S=r[0],M=r[1],L=r[2],N=Math.hypot(S,M,L);N<bo||(S*=N=1/N,M*=N,L*=N,i=Math.sin(n),s=1-(o=Math.cos(n)),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,C=M*M*s+o,x=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*C+A*x,t[5]=u*E+f*C+d*x,t[6]=l*E+p*C+y*x,t[7]=c*E+g*C+v*x,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,n){var r=n[0],i=n[1],o=n[2];t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,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,n){var r,i,o,s,a,u,l,c,h,f,p,g,A=n[0],d=n[1],y=n[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]):(r=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]=r,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]=r*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,n){var r=e[0],i=e[1],o=e[2],s=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*s,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*s,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*s,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*s,t}(e||[-0,-0,-0,-0],t,this),Co(e,4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:n}=t;let r;switch(n){case 2:r=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t}(e||[-0,-0],t,this);break;case 3:r=Lo(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Co(r,t.length),r}transformAsVector(t,e){let n;switch(t.length){case 2:n=function(t,e,n){const r=e[0],i=e[1],o=n[3]*r+n[7]*i||1;return t[0]=(n[0]*r+n[4]*i)/o,t[1]=(n[1]*r+n[5]*i)/o,t}(e||[-0,-0],t,this);break;case 3:n=So(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Co(n,t.length),n}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,n){return this.identity().translate([t,e,n])}}let Vo,Yo;function Ho(t){if(t>2*Math.PI)throw Error("expected radians")}var Xo=.1,Jo=1e-12,Wo=1e-15;Math.PI,Math.PI,Math.PI,Math.PI;function Ko(t){return t}function Zo(t,e=[]){return function(t,e=[],n=Ko){return"longitude"in t?(e[0]=n(t.longitude),e[1]=n(t.latitude),e[2]=t.height):"x"in t?(e[0]=n(t.x),e[1]=n(t.y),e[2]=t.z):(e[0]=n(t[0]),e[1]=n(t[1]),e[2]=t[2]),e}(t,e,po._cartographicRadians?Ko:yo)}function $o(t,e){return function(t,e,n=Ko){return"longitude"in e?(e.longitude=n(t[0]),e.latitude=n(t[1]),e.height=t[2]):"x"in e?(e.x=n(t[0]),e.y=n(t[1]),e.z=t[2]):(e[0]=n(t[0]),e[1]=n(t[1]),e[2]=t[2]),e}(t,e,po._cartographicRadians?Ko:vo)}new Ro;const ts=new Ro,es=new Ro,ns=new Ro;const rs=new Ro,is={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"}},os={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},ss={east:new Ro,north:new Ro,up:new Ro,west:new Ro,south:new Ro,down:new Ro},as=new Ro,us=new Ro,ls=new Ro;function cs(t,e,n,r,i,o){const s=is[e]&&is[e][n];let a,u,l;co(s&&(!r||r===s));const c=rs.copy(i);if(mo(c.x,0,1e-14)&&mo(c.y,0,1e-14)){const t=Math.sign(c.z);a=as.fromArray(os[e]),"east"!==e&&"west"!==e&&a.scale(t),u=us.fromArray(os[n]),"east"!==n&&"west"!==n&&u.scale(t),l=ls.fromArray(os[r]),"east"!==r&&"west"!==r&&l.scale(t)}else{const{up:i,east:o,north:s}=ss;o.set(-c.y,c.x,0).normalize(),t.geodeticSurfaceNormal(c,i),s.copy(i).cross(o);const{down:h,west:f,south:p}=ss;h.copy(i).scale(-1),f.copy(o).scale(-1),p.copy(s).scale(-1),a=ss[e],u=ss[n],l=ss[r]}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 hs=new Ro,fs=new Ro,ps=new Ro,gs=new Ro,As=new Ro,ds=new Ro;class ys{constructor(t=0,e=0,n=0){lo(this,"radii",void 0),lo(this,"radiiSquared",void 0),lo(this,"radiiToTheFourth",void 0),lo(this,"oneOverRadii",void 0),lo(this,"oneOverRadiiSquared",void 0),lo(this,"minimumRadius",void 0),lo(this,"maximumRadius",void 0),lo(this,"centerToleranceSquared",Xo),lo(this,"squaredXOverSquaredZ",void 0),co(t>=0),co(e>=0),co(n>=0),this.radii=new Ro(t,e,n),this.radiiSquared=new Ro(t*t,e*e,n*n),this.radiiToTheFourth=new Ro(t*t*t*t,e*e*e*e,n*n*n*n),this.oneOverRadii=new Ro(0===t?0:1/t,0===e?0:1/e,0===n?0:1/n),this.oneOverRadiiSquared=new Ro(0===t?0:1/(t*t),0===e?0:1/(e*e),0===n?0:1/(n*n)),this.minimumRadius=Math.min(t,e,n),this.maximumRadius=Math.max(t,e,n),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 n=fs,r=ps,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,n),r.copy(this.radiiSquared).scale(n);const o=Math.sqrt(n.dot(r));return r.scale(1/o),n.scale(i),r.add(n),r.to(e)}cartesianToCartographic(t,e=[0,0,0]){ds.from(t);const n=this.scaleToGeodeticSurface(ds,gs);if(!n)return;const r=this.geodeticSurfaceNormal(n,fs),i=As;i.copy(ds).subtract(n);const o=Math.atan2(r.y,r.x),s=Math.asin(r.z),a=Math.sign(Mo(i,ds))*function(t){var e=t[0],n=t[1],r=t[2];return Math.hypot(e,n,r)}(i);return $o([o,s,a],e)}eastNorthUpToFixedFrame(t,e=new zo){return cs(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,n,r,i=new zo){return cs(this,t,e,n,r,i)}geocentricSurfaceNormal(t,e=[0,0,0]){return hs.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const n=Zo(t),r=n[0],i=n[1],o=Math.cos(i);return hs.set(o*Math.cos(r),o*Math.sin(r),Math.sin(i)).normalize(),hs.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return hs.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,n=[]){const{oneOverRadii:r,oneOverRadiiSquared:i,centerToleranceSquared:o}=e;ts.from(t);const s=ts.x,a=ts.y,u=ts.z,l=r.x,c=r.y,h=r.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=es;if(y.copy(t).scale(d),A<o)return y.to(n);const v=i.x,m=i.y,_=i.z,I=ns;I.set(y.x*v*2,y.y*m*2,y.z*_*2);let E,C,x,w,b=(1-d)*ts.len()/(.5*I.len()),B=0;do{b-=B,E=1/(1+b*v),C=1/(1+b*m),x=1/(1+b*_);const t=E*E,e=C*C,n=x*x;w=f*t+p*e+g*n-1,B=w/(-2*(f*(t*E)*v+p*(e*C)*m+g*(n*x)*_))}while(Math.abs(w)>Jo);return ts.scale([E,C,x]).to(n)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){gs.from(t);const n=gs.x,r=gs.y,i=gs.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(n*n*o.x+r*r*o.y+i*i*o.z);return gs.multiplyScalar(s).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return gs.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return gs.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,n=[0,0,0]){co(mo(this.radii.x,this.radii.y,Wo)),co(this.radii.z>0),gs.from(t);const r=gs.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(r)>=this.radii.z-e))return gs.set(0,0,r).to(n)}}lo(ys,"WGS84",new ys(6378137,6378137,6356752.314245179));var vs=new it,ms=new o,_s=new y,Is=new y,Es=new ft,Cs=[];function xs(t,e){return t.distance-e.distance}function ws(t,e,n){t.traverse((function(t){Object.getPrototypeOf(t).raycast.call(t,e,n)}))}function bs(t,e,n,r){if(n.has(t)){if(ws(t.cached.scene,r,Cs),Cs.length>0){Cs.length>1&&Cs.sort(xs);var i=Cs[0];return Cs.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;ms.copy(h);var f=c.sphere;if(!f||(vs.copy(f),vs.applyMatrix4(ms),r.ray.intersectsSphere(vs))){var p=c.box,g=c.boxTransform;if(p){if(ms.multiply(g).invert(),Es.copy(r.ray),Es.applyMatrix4(ms),!Es.intersectBox(p,_s))continue;Is.setFromMatrixScale(ms);var A=Is.x;Math.abs(Math.max(Is.x-Is.y,Is.x-Is.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(Es.origin)?d.distance=0:d.distance=_s.distanceToSquared(Es.origin)*A*A,d.tile=l}}}o.sort(xs);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,C=E.cached.scene,x=null;if(n.has(E)?(ws(C,r,Cs),Cs.length>0&&(Cs.length>1&&Cs.sort(xs),x=Cs[0])):x=bs(E,e,n,r),x){var w=x.distance*x.distance;w<y&&(y=w,v=x),Cs.length=0}}return v}function Bs(t,e,n,r,i){var o=t.cached,s=e.matrixWorld;ms.copy(s);var a=o.sphere;if(!a||(vs.copy(a),vs.applyMatrix4(ms),r.ray.intersectsSphere(vs))){var u=o.box,l=o.boxTransform;if(!u||(ms.multiply(l).invert(),Es.copy(r.ray).applyMatrix4(ms),Es.intersectsBox(u))){var c=o.scene;if(n.has(t))ws(c,r,i);else for(var h=t.children,f=0,p=h.length;f<p;f++)Bs(h[f],e,n,r,i)}}}var Ss=Symbol("INITIAL_FRUSTUM_CULLED"),Ms=new o,Ls=new o,Ns=new o,Ts=new y,Rs=new y,Qs=new y,Ds=new y,Ps=new y,ks=new y,Os=new y,Fs=new i,Gs=new y,Us=new y,qs=new y(1,0,0),js=new y(0,1,0);function zs(t,e){t.traverse((function(t){t.frustumCulled=t[Ss]&&e}))}var Vs=function(t){le(n,br);var e=pe(n);function n(){var t;oe(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];(t=e.call.apply(e,[this].concat(i))).group=new zi(fe(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 s=new pt;s.setURLModifier((function(e){return t.preprocessURL?t.preprocessURL(e):e})),t.manager=s;var a=fe(t);return t._overridenRaycast=function(t,e){a.optimizeRaycast||Object.getPrototypeOf(this).raycast.call(this,t,e)},t}return ae(n,[{key:"autoDisableRendererCulling",get:function(){return this._autoDisableRendererCulling},set:function(t){this._autoDisableRendererCulling!==t&&(ye(ce(n.prototype),"_autoDisableRendererCulling",t,this,!0),this.forEachLoadedModel((function(e){zs(e,!t)})))}},{key:"getBounds",value:function(t){if(!this.root)return!1;var e=this.root.cached,n=e.box,r=e.boxTransform;if(n)return t.copy(n),t.applyMatrix4(r),!0;var i=e.sphere;return!!i&&(i.getBoundingBox(t),!0)}},{key:"getOrientedBounds",value:function(t,e){if(!this.root)return!1;var n=this.root.cached,r=n.box,i=n.boxTransform;if(r)return t.copy(r),e.copy(i),!0;var o=n.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 n=e.cached.scene;n&&t(n,e)}))}},{key:"raycast",value:function(t,e){if(this.root)if(t.firstHitOnly){var n=bs(this.root,this.group,this.activeTiles,t);n&&e.push(n)}else Bs(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 d),e.push(t),!0)}},{key:"setResolution",value:function(t,e,n){var r=this.cameraMap;return!!r.has(t)&&(e instanceof d?r.get(t).copy(e):r.get(t).set(e,n),!0)}},{key:"setResolutionFromRenderer",value:function(t,e){var n=this.cameraMap;if(!n.has(t))return!1;var r=n.get(t);return e.getSize(r),r.multiplyScalar(e.getPixelRatio()),!0}},{key:"deleteCamera",value:function(t){var e=this.cameras,n=this.cameraMap;if(n.has(t)){var r=e.indexOf(t);return e.splice(r,1),n.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=Ae(ce(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,r=this.cameraMap,i=this.cameraInfo;if(0!==e.length){for(;i.length>e.length;)i.pop();for(;i.length<e.length;)i.push({frustum:new gt,isOrthographic:!1,sseDenominator:-1,position:new y,invScale:-1,pixelSize:0});Ls.copy(t.matrixWorld).invert(),Ts.setFromMatrixScale(Ls);var o=Ts.x;Math.abs(Math.max(Ts.x-Ts.y,Ts.x-Ts.z))>1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when calculating screen space error.");for(var s=0,a=i.length;s<a;s++){var u=e[s],l=i[s],c=l.frustum,h=l.position,f=r.get(u);0!==f.width&&0!==f.height||console.warn("TilesRenderer: resolution for camera error calculation is not set.");var p=u.projectionMatrix.elements;if(l.isOrthographic=1===p[15],l.isOrthographic){var g=2/p[0],A=2/p[5];l.pixelSize=Math.max(A/f.height,g/f.width)}else l.sseDenominator=2/p[5]/f.height;l.invScale=o,Ms.copy(t.matrixWorld),Ms.premultiply(u.matrixWorldInverse),Ms.premultiply(u.projectionMatrix),c.setFromProjectionMatrix(Ms),h.set(0,0,0),h.applyMatrix4(u.matrixWorld),h.applyMatrix4(Ls)}Ae(ce(n.prototype),"update",this).call(this)}else console.warn("TilesRenderer: no cameras defined. Cannot update 3d tiles.")}},{key:"preprocessNode",value:function(t,e,r){Ae(ce(n.prototype),"preprocessNode",this).call(this,t,e,r);var i=new o;if(t.transform)for(var s=t.transform,a=0;a<16;a++)i.elements[a]=s[a];else i.identity();e&&i.premultiply(e.cached.transform);var u=(new o).copy(i).invert(),l=null,c=null,h=null,f=null;if("box"in t.boundingVolume){var p=t.boundingVolume.box;l=new rt,c=new o,h=new o,f=new y;var g=this.threeLayer.distanceToVector3(p[3],p[3]).x,A=this.threeLayer.distanceToVector3(p[4],p[4]).x,d=this.threeLayer.distanceToVector3(p[5],p[5]).x;Rs.set(g,A,d);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;Qs.set(v,m,_);var I=this.threeLayer.distanceToVector3(p[9],p[9]).x,E=this.threeLayer.distanceToVector3(p[10],p[10]).x,C=this.threeLayer.distanceToVector3(p[11],p[11]).x;Ds.set(I,E,C),Ps.set(p[3],p[4],p[5]),ks.set(p[6],p[7],p[8]),Os.set(p[9],p[10],p[11]);var x=Rs.length(),w=Qs.length(),b=Ds.length(),B=Ps.length(),S=ks.length(),M=Os.length();f.set(x/B,w/S,b/M),Rs.normalize(),Qs.normalize(),Ds.normalize(),0===x&&Rs.crossVectors(Qs,Ds),0===w&&Qs.crossVectors(Rs,Ds),0===b&&Ds.crossVectors(Rs,Qs),c.set(Rs.x,Qs.x,Ds.x,p[0],Rs.y,Qs.y,Ds.y,p[1],Rs.z,Qs.z,Ds.z,p[2],0,0,0,1),c.premultiply(i),u.decompose(Us,Fs,Gs);var L=Ns.makeRotationFromQuaternion(Fs);c.multiply(L);var N=ys.WGS84.cartesianToCartographic([c.elements[12],c.elements[13],c.elements[14]],Ts),T=this.threeLayer.coordinateToVector3([N.x,N.y],N.z),R=this.threeLayer.distanceToVector3(T.z+this.heightOffset,T.z+this.heightOffset).x;c.elements[12]=T.x+this.xOffset,c.elements[13]=T.y+this.yOffset,c.elements[14]=R,h.copy(c).invert(),l.min.set(-x,-w,-b),l.max.set(x,w,b)}var Q=null;if("sphere"in t.boundingVolume){var D=t.boundingVolume.sphere;(Q=new it).center.set(D[0],D[1],D[2]),Q.radius=D[3],Q.applyMatrix4(i)}else if("box"in t.boundingVolume){var P=t.boundingVolume.box;Q=new it,l.getBoundingSphere(Q),Q.center.set(P[0],P[1],P[2]),Q.applyMatrix4(i);var k=ys.WGS84.cartesianToCartographic([Q.center.x,Q.center.y,Q.center.z],Ts),O=this.threeLayer.coordinateToVector3([k.x,k.y],k.z);Q.center.x=O.x+this.xOffset,Q.center.y=O.y+this.yOffset,Q.center.z=this.threeLayer.distanceToVector3(O.z+this.heightOffset,O.z+this.heightOffset).x}var F=null;if("region"in t.boundingVolume){var G=ve(t.boundingVolume.region,6),U=G[0],q=G[1],j=G[2],z=G[3],V=G[4],Y=G[5];F=new so(fr,fr,pr,q,z,U,j,V,Y),null===Q&&(Q=new it,F.getBoundingSphere(Q)),null===l&&(l=new rt,c=new o,h=new o,F.getBoundingBox(l,c),h.copy(c).invert())}t.cached={loadIndex:0,transform:i,transformInverse:u,active:!1,inFrustum:[],box:l,boxTransform:c,boxTransformInverse:h,sphere:Q,region:F,scene:null,geometry:null,material:null,scale:f}}},{key:"parseTile",value:function(t,e,n){var r=this;e._loadIndex=e._loadIndex||0,e._loadIndex++;var i=e.content.uri.split(/[\\\/]/g);i.pop();var s=i.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 o;switch(h.toLowerCase()){case"x":d.makeRotationAxis(js,-Math.PI/2);break;case"y":d.makeRotationAxis(qs,Math.PI/2);break;case"z":d.identity()}var y=(Nr(t)||n).toLowerCase();switch(y){case"b3dm":var v=new bi(u);v.workingPath=s,v.fetchOptions=a,v.adjustmentTransform.copy(d),c=v.parse(t);break;case"pnts":var m=new Mi(u);m.workingPath=s,m.fetchOptions=a,c=m.parse(t);break;case"i3dm":var _=new Oi(u);_.workingPath=s,_.fetchOptions=a,_.adjustmentTransform.copy(d),c=_.parse(t);break;case"cmpt":var I=new Gi(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 qi(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 n,i;if(t.isObject3D?(n=t,i=null):(n=t.scene,i=t),e._loadIndex===l){n.updateMatrix(),"glb"!==y&&"gltf"!==y||n.matrix.multiply(d),n.matrix.premultiply(p);var o=ys.WGS84.cartesianToCartographic([n.matrix.elements[12],n.matrix.elements[13],n.matrix.elements[14]],Ts),s=r.threeLayer.coordinateToVector3([o.x,o.y],o.z),a=r.threeLayer.distanceToVector3(s.z+r.heightOffset,s.z+r.heightOffset).x;n.matrix.elements[12]=s.x+r.xOffset,n.matrix.elements[13]=s.y+r.yOffset,n.matrix.elements[14]=a,n.matrix.decompose(n.position,n.quaternion,n.scale),A.decompose(Rs,Fs,Qs),n.applyQuaternion(Fs),n.scale.copy(g),n.traverse((function(t){t[Ss]=t.frustumCulled})),zs(n,!r.autoDisableRendererCulling),n.traverse((function(t){t.raycast=r._overridenRaycast}));var u=[],c=[],h=[];n.traverse((function(t){if(t.geometry&&c.push(t.geometry),t.material){var e=t.material;for(var n in u.push(t.material),e){var r=e[n];r&&r.isTexture&&h.push(r)}}})),f.materials=u,f.geometry=c,f.textures=h,f.scene=n,f.metadata=i,r.onLoadModel&&r.onLoadModel(n,e)}}))}},{key:"disposeTile",value:function(t){var e=t.cached;if(e.scene){for(var n=e.materials,r=e.geometry,i=e.textures,o=e.scene.parent,s=0,a=r.length;s<a;s++)r[s].dispose();for(var u=0,l=n.length;u<l;u++)n[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 n=t.cached.scene,r=this.visibleTiles,i=this.group;e?(i.add(n),r.add(t),n.updateMatrixWorld(!0)):(i.remove(n),r.delete(t)),this.onTileVisibilityChange&&this.onTileVisibilityChange(n,t,e)}},{key:"setTileActive",value:function(t,e){var n=this.activeTiles;e?n.add(t):n.delete(t)}},{key:"calculateError",value:function(t){for(var e=t.cached,n=e.inFrustum,r=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=r.length;h<f;h++)if(n[h]){var p=i[h],g=p.invScale,A=void 0;if(p.isOrthographic){var d=p.pixelSize;A=t.geometricError/(d*g)}else{Ts.copy(p.position);var y=void 0;u?(Ts.applyMatrix4(a),y=s.distanceToPoint(Ts)):y=Math.max(o.distanceToPoint(Ts),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,n=e.sphere,r=e.inFrustum;if(n){for(var i=this.cameraInfo,o=!1,s=0,a=i.length;s<a;s++){i[s].frustum.intersectsSphere(n)?(o=!0,r[s]=!0):r[s]=!1}return o}return!0}}]),n}();new y,new y,new y,new y,new y,new y,new Ji(fr,fr,pr);var Ys=new WeakMap,Hs=function(t){le(i,u);var e=pe(i);function i(t){var n;return oe(this,i),(n=e.call(this,t)).decoderPath="",n.decoderConfig={},n.decoderBinary=null,n.decoderPending=null,n.workerLimit=4,n.workerPool=[],n.workerNextTaskID=1,n.workerSourceURL="",n.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},n.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},n}return ae(i,[{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,r){var i=this,o=new a(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(t){i.decodeDracoFile(t,e).catch(r)}),n,r)}},{key:"decodeDracoFile",value:function(t,e,n,r){var i={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n};return this.decodeGeometry(t,i).then(e)}},{key:"decodeGeometry",value:function(t,e){var n,r=this,i=JSON.stringify(e);if(Ys.has(t)){var o=Ys.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(r){return n=r,new Promise((function(r,i){n._callbacks[s]={resolve:r,reject:i},n.postMessage({type:"decode",id:s,taskConfig:e,buffer:t},[t])}))})).then((function(t){return r._createGeometry(t.geometry)}));return u.catch((function(){return!0})).then((function(){n&&s&&r._releaseTask(n,s)})),Ys.set(t,{key:i,promise:u}),u}},{key:"_createGeometry",value:function(t){var e=new n;t.index&&e.setIndex(new r(t.index.array,1));for(var i=0;i<t.attributes.length;i++){var o=t.attributes[i],s=o.name,a=o.array,u=o.itemSize;e.setAttribute(s,new r(a,u))}return e}},{key:"_loadLibrary",value:function(t,e){var n=new a(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":ne(WebAssembly))||"js"===this.decoderConfig.type,n=[];return e?n.push(this._loadLibrary("draco_decoder.js","text")):(n.push(this._loadLibrary("draco_wasm_wrapper.js","text")),n.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(n).then((function(n){var r=n[0];e||(t.decoderConfig.wasmBinary=n[1]);var i=Xs.toString(),o=["/* draco decoder */",r,"","/* 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 n=this;return this._initDecoder().then((function(){if(n.workerPool.length<n.workerLimit){var r=new Worker(n.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:n.decoderConfig}),r.onmessage=function(t){var e=t.data;switch(e.type){case"decode":r._callbacks[e.id].resolve(e);break;case"error":r._callbacks[e.id].reject(e);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+e.type+'"')}},n.workerPool.push(r)}else n.workerPool.sort((function(t,e){return t._taskLoad>e._taskLoad?-1:1}));var i=n.workerPool[n.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}}]),i}();function Xs(){var t,e;function n(t,e,n,r,i,o){var s=o.num_components(),a=n.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(n,o,l,u,c);var h=new i(t.HEAPF32.buffer,c,a).slice();return t._free(c),{name:r,array:h,itemSize:s}}onmessage=function(r){var i=r.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,r=new e.Decoder,a=new e.DecoderBuffer;a.Init(new Int8Array(o),o.byteLength);try{var u=function(t,e,r,i){var o,s,a=i.attributeIDs,u=i.attributeTypes,l=e.GetEncodedGeometryType(r);if(l===t.TRIANGULAR_MESH)o=new t.Mesh,s=e.DecodeBufferToMesh(r,o);else{if(l!==t.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new t.PointCloud,s=e.DecodeBufferToPointCloud(r,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(n(t,e,o,h,f,p))}l===t.TRIANGULAR_MESH&&(c.index=function(t,e,n){var r=n.num_faces(),i=3*r,o=4*i,s=t._malloc(o);e.GetTrianglesUInt32Array(n,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,r,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(r)}}))}}}var Js,Ws,Ks,Zs=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4;oe(this,t),this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}return ae(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 n=this.workersResolve[t];if(n&&n(e),this.queue.length){var r=this.queue.shift(),i=r.resolve,o=r.msg,s=r.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 n=this;return new Promise((function(r){var i=n._getIdleWorker();-1!==i?(n._initWorker(i),n.workerStatus|=1<<i,n.workersResolve[i]=r,n.workers[i].postMessage(t,e)):n.queue.push({resolve:r,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}(),$s=0,ta=2,ea=ae((function t(){oe(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})),na=function(){function t(e,n,r,i){oe(this,t),this._dataView=new DataView(e.buffer,e.byteOffset+n,r),this._littleEndian=i,this._offset=0}return ae(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,n=this._offset,r=0;this._dataView.getUint8(this._offset)!==e&&r<t;)r++,this._offset++;return r<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,r)}}]),t}(),ra=[171,75,84,88,32,50,48,187,13,10,26,10];function ia(t){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(t):Buffer.from(t).toString("utf8")}function oa(t){var e=new Uint8Array(t.buffer,t.byteOffset,ra.length);if(e[0]!==ra[0]||e[1]!==ra[1]||e[2]!==ra[2]||e[3]!==ra[3]||e[4]!==ra[4]||e[5]!==ra[5]||e[6]!==ra[6]||e[7]!==ra[7]||e[8]!==ra[8]||e[9]!==ra[9]||e[10]!==ra[10]||e[11]!==ra[11])throw new Error("Missing KTX 2.0 identifier.");var n=new ea,r=17*Uint32Array.BYTES_PER_ELEMENT,i=new na(t,ra.length,r,!0);n.vkFormat=i._nextUint32(),n.typeSize=i._nextUint32(),n.pixelWidth=i._nextUint32(),n.pixelHeight=i._nextUint32(),n.pixelDepth=i._nextUint32(),n.layerCount=i._nextUint32(),n.faceCount=i._nextUint32();var o=i._nextUint32();n.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 na(t,ra.length+r,3*o*8,!0),p=0;p<o;p++)n.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+f._nextUint64(),f._nextUint64()),uncompressedByteLength:f._nextUint64()});for(var g=new na(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}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(A);for(var m=new na(t,u,l,!0);m._offset<l;){var _=m._nextUint32(),I=m._scan(_),E=ia(I),C=m._scan(_-I.byteLength);n.keyValue[E]=E.match(/^ktx/i)?ia(C):C,m._offset%4&&m._skip(4-m._offset%4)}if(h<=0)return n;for(var x=new na(t,c,h,!0),w=x._nextUint16(),b=x._nextUint16(),B=x._nextUint32(),S=x._nextUint32(),M=x._nextUint32(),L=x._nextUint32(),N=[],T=0;T<o;T++)N.push({imageFlags:x._nextUint32(),rgbSliceByteOffset:x._nextUint32(),rgbSliceByteLength:x._nextUint32(),alphaSliceByteOffset:x._nextUint32(),alphaSliceByteLength:x._nextUint32()});var R=c+x._offset,Q=R+B,D=Q+S,P=D+M,k=new Uint8Array(t.buffer,t.byteOffset+R,B),O=new Uint8Array(t.buffer,t.byteOffset+Q,S),F=new Uint8Array(t.buffer,t.byteOffset+D,M),G=new Uint8Array(t.buffer,t.byteOffset+P,L);return n.globalData={endpointCount:w,selectorCount:b,imageDescs:N,endpointsData:k,selectorsData:O,tablesData:F,extendedData:G},n}var sa,aa,ua,la,ca={env:{emscripten_notify_memory_growth:function(t){Ks=new Uint8Array(Ws.exports.memory.buffer)}}},ha=function(){function t(){oe(this,t)}return ae(t,[{key:"init",value:function(){return Js||(Js="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+fa).then((function(t){return t.arrayBuffer()})).then((function(t){return WebAssembly.instantiate(t,ca)})).then(this._init):WebAssembly.instantiate(Buffer.from(fa,"base64"),ca).then(this._init))}},{key:"_init",value:function(t){Ws=t.instance,ca.env.emscripten_notify_memory_growth(0)}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!Ws)throw new Error("ZSTDDecoder: Await .init() before decoding.");var n=t.byteLength,r=Ws.exports.malloc(n);Ks.set(t,r),e=e||Number(Ws.exports.ZSTD_findDecompressedSize(r,n));var i=Ws.exports.malloc(e),o=Ws.exports.ZSTD_decompress(i,e,r,n),s=Ks.slice(i,i+o);return Ws.exports.free(r),Ws.exports.free(i),s}}]),t}(),fa="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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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",pa=new WeakMap,ga=0,Aa=function(t){le(r,u);var e,n=pe(r);function r(t){var e;return oe(this,r),(e=n.call(this,t)).transcoderPath="",e.transcoderBinary=null,e.transcoderPending=null,e.workerPool=new Zs,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 ae(r,[{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 a(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);var n=e.loadAsync("basis_transcoder.js"),i=new a(this.manager);i.setPath(this.transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);var o=i.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([n,o]).then((function(e){var n=ve(e,2),i=n[0],o=n[1],s=r.BasisWorker.toString(),a=["/* constants */","let _EngineFormat = "+JSON.stringify(r.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(r.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(r.BasisFormat),"/* basis_transcoder.js */",i,"/* 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),n=t.transcoderBinary.slice(0);return e.postMessage({type:"init",config:t.workerConfig,transcoderBinary:n},[n]),e}))})),ga>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),ga++}return this.transcoderPending}},{key:"load",value:function(t,e,n,r){var i=this;if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");var o=new a(this.manager);o.setResponseType("arraybuffer"),o.setWithCredentials(this.withCredentials),o.load(t,(function(t){if(pa.has(t))return pa.get(t).promise.then(e).catch(r);i._createTexture(t).then((function(t){return e?e(t):null})).catch(r)}),n,r)}},{key:"_createTextureFrom",value:function(t,e){var n=t.mipmaps,r=t.width,i=t.height,o=t.format,s=t.type,a=t.error,u=t.dfdTransferFn,l=t.dfdFlags;if("error"===s)return Promise.reject(a);var c=e.layerCount>1?new It(n,r,i,e.layerCount,o,_t):new Et(n,r,i,o,_t);return c.minFilter=1===n.length?E:C,c.magFilter=E,c.generateMipmaps=!1,c.needsUpdate=!0,c.encoding=2===u?g:Ct,c.premultiplyAlpha=!!(1&l),c}},{key:"_createTexture",value:(e=ie(ee().mark((function t(e){var n,r,i,o,s=this,a=arguments;return ee().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=a.length>1&&void 0!==a[1]?a[1]:{},0===(r=oa(new Uint8Array(e))).vkFormat){t.next=4;break}return t.abrupt("return",ma(r));case 4:return i=n,o=this.init().then((function(){return s.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:i},[e])})).then((function(t){return s._createTextureFrom(t.data,r)})),pa.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),ga--,this}}]),r}();Aa.BasisFormat={ETC1S:0,UASTC_4x4:1},Aa.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},Aa.EngineFormat={RGBAFormat:At,RGBA_ASTC_4x4_Format:xt,RGBA_BPTC_Format:wt,RGBA_ETC2_EAC_Format:bt,RGBA_PVRTC_4BPPV1_Format:Bt,RGBA_S3TC_DXT5_Format:St,RGB_ETC1_Format:Mt,RGB_ETC2_Format:Lt,RGB_PVRTC_4BPPV1_Format:Nt,RGB_S3TC_DXT1_Format:Tt},Aa.BasisWorker=function(){var t,e,n,r=_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){n={wasmBinary:h,onRuntimeInitialized:t},BASIS(n)})).then((function(){n.initializeBasis(),void 0===n.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 n.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,n,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(n)&&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=r.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 C=[],x=0;x<d;x++){for(var w=[],b=void 0,B=void 0,S=0;S<A;S++){var M=s.getImageLevelInfo(x,S,0);b=M.origWidth,B=M.origHeight;var L=new Uint8Array(s.getImageTranscodedSizeInBytes(x,S,0,I));if(!s.transcodeImage(L,x,S,0,I,0,-1,-1))throw h(),new Error("THREE.KTX2Loader: .transcodeImage failed.");w.push(L)}C.push({data:c(w),width:b,height:B})}return h(),{width:p,height:g,hasAlpha:y,mipmaps:C,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:[r.RGBA_ASTC_4x4_Format,r.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:[r.RGBA_BPTC_Format,r.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.BC1,i.BC3],engineFormat:[r.RGB_S3TC_DXT1_Format,r.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.ETC1,i.ETC2],engineFormat:[r.RGB_ETC2_Format,r.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC_4x4],transcoderFormat:[i.ETC1],engineFormat:[r.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:[r.RGB_PVRTC_4BPPV1_Format,r.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,n=0,r=Ie(t);try{for(r.s();!(e=r.n()).done;){n+=e.value.byteLength}}catch(t){r.e(t)}finally{r.f()}var i,o=new Uint8Array(n),s=0,a=Ie(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 da=(ue(sa={},109,At),ue(sa,97,At),ue(sa,37,At),ue(sa,43,At),ue(sa,103,dt),ue(sa,83,dt),ue(sa,16,dt),ue(sa,22,dt),ue(sa,100,yt),ue(sa,76,yt),ue(sa,15,yt),ue(sa,9,yt),sa),ya=(ue(aa={},109,vt),ue(aa,97,mt),ue(aa,37,_t),ue(aa,43,_t),ue(aa,103,vt),ue(aa,83,mt),ue(aa,16,_t),ue(aa,22,_t),ue(aa,100,vt),ue(aa,76,mt),ue(aa,15,_t),ue(aa,9,_t),aa),va=(ue(ua={},43,g),ue(ua,22,g),ue(ua,15,g),ua);function ma(t){return _a.apply(this,arguments)}function _a(){return _a=ie(ee().mark((function t(e){var n,r,i,o,s,a,u,l;return ee().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.vkFormat,r=e.pixelWidth,i=e.pixelHeight,o=e.pixelDepth,void 0!==da[n]){t.next=3;break}throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");case 3:if(s=e.levels[0],e.supercompressionScheme!==$s){t.next=8;break}a=s.levelData,t.next=16;break;case 8:if(e.supercompressionScheme!==ta){t.next=15;break}return la||(la=new Promise(function(){var t=ie(ee().mark((function t(e){var n;return ee().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new ha,t.next=3,n.init();case 3:e(n);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())),t.next=12,la;case 12:a=t.sent.decode(s.levelData,s.uncompressedByteLength),t.next=16;break;case 15:throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");case 16:return u=ya[n]===vt?new Float32Array(a.buffer,a.byteOffset,a.byteLength/Float32Array.BYTES_PER_ELEMENT):ya[n]===mt?new Uint16Array(a.buffer,a.byteOffset,a.byteLength/Uint16Array.BYTES_PER_ELEMENT):a,(l=0===o?new Qt(u,r,i):new Rt(u,r,i,o)).type=ya[n],l.format=da[n],l.encoding=va[n]||Ct,l.needsUpdate=!0,t.abrupt("return",Promise.resolve(l));case 23:case"end":return t.stop()}}),t)}))),_a.apply(this,arguments)}var Ia={altitude:0},Ea=function(t){le(r,$t);var n=pe(r);function r(t,i){var o;return oe(this,r),(o=n.call(this))._initOptions(Ia),o.object3d=t,o.object3d.__parent=fe(o),o._raycaster=new e.Raycaster,o._mouse=new e.Vector2,o.camera=i,o.selectMesh=null,o}return ae(r,[{key:"getSelectMesh",value:function(){return this.selectMesh}},{key:"identify",value:function(t){var e=this.getMap().coordToContainerPoint(t),n=e.x,r=e.y,i=this._raycaster,o=this._mouse,s=this.camera,a=this.getMap().getSize(),u=a.width,l=a.height;o.x=n/u*2-1,o.y=-r/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}(),Ca=6,xa=!1,wa=!1,ba=0,Ba=function(){function t(e,n,r,i){var o=this;oe(this,t),this.threelayer=r,this.map=r.map,this.layerClass=i,this.statsUpdate=n.statsUpdate;var s=r.getScene(),a=r.getRenderer().context;a.outputEncoding=THREE.sRGBEncoding;var u=r.getCamera();this.scene=s,this.renderer=a,this.camera=u,this.multiles=[],this.meshs=[];var l=new Hs;l.setDecoderPath(n.decoderPath);var c=new Aa;c.setTranscoderPath(n.transcoderPath),c.detectSupport(a),e.forEach((function(t){var e=new Vs(t.url,r);if(e.errorTarget=Ca,e.displayBoxBounds=xa,e.displaySphereBounds=wa,e.colorMode=parseFloat(ba),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 n=o.multiles[0];e.lruCache=n.lruCache,e.downloadQueue=n.downloadQueue}e.fetchOptions.mode="cors";var i=new Rr(e.manager);i.setDRACOLoader(l),i.setKTX2Loader(c),e.manager.addHandler(/\.gltf$/,i);var s=new Ea(e.group,u);o.meshs.push(s),o.multiles.push(e)})),this.threelayer.addMesh(this.meshs),this.layerClass.updatables.push(this),this._bindMapEvents()}return ae(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 n=e.object;if(n.geometry.getAttribute("_batchid")){for(var r=n;!r.batchTable;)r=r.parent;var i=r.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}(),Sa={radius:100,altitude:0},Ma=function(e){le(r,$t);var n=pe(r);function r(e,i,o,s){var a;oe(this,r),o=t.Util.extend({},Sa,o,{layer:s,coordinate:e}),(a=n.call(this))._initOptions(o);var u=o.altitude;a._createGroup(),a.getObject3d().add(i);var l=s.distanceToVector3(u,u).x,c=s.coordinateToVector3(e,l);return a.getObject3d().position.copy(c),s.addMesh(fe(a)),a}return ae(r)}(),La=function(){function t(n,r){oe(this,t),this.threeLayer=r;var i=new e.LoadingManager,o=new Rr(i),s=new Hs(i);s.setDecoderPath(n),o.setDRACOLoader(s),i.addHandler(/\.gltf$/,o),i.addHandler(/\.glb$/,o),this.loader=new qi(i)}var n;return ae(t,[{key:"addModel",value:(n=ie(ee().mark((function t(e,n,r){var i,o;return ee().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 Ma(n,i.scene,r,this.threeLayer),t.abrupt("return",o);case 6:case"end":return t.stop()}}),t,this)}))),function(t,e,r){return n.apply(this,arguments)})}]),t}(),Na=function(t){le(r,e.Group);var n=pe(r);function r(t,e){var i;return oe(this,r),(i=n.call(this)).name=e,i.customId=Be(),t.add(fe(i)),i.customType="layer",i}return ae(r)}(),Ta=function(t){return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};try{URL.revokeObjectURL(Ta(""))}catch(t){Ta=function(t){return"data:application/javascript;charset=UTF-8,"+encodeURI(t)}}var Ra=Uint8Array,Qa=Uint16Array,Da=Uint32Array,Pa=new Ra([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]),ka=new Ra([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]),Oa=new Ra([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fa=function(t,e){for(var n=new Qa(31),r=0;r<31;++r)n[r]=e+=1<<t[r-1];var i=new Da(n[30]);for(r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)i[o]=o-n[r]<<5|r;return[n,i]},Ga=Fa(Pa,2),Ua=Ga[0],qa=Ga[1];Ua[28]=258,qa[258]=28;for(var ja=Fa(ka,0)[0],za=new Qa(32768),Va=0;Va<32768;++Va){var Ya=(43690&Va)>>>1|(21845&Va)<<1;Ya=(61680&(Ya=(52428&Ya)>>>2|(13107&Ya)<<2))>>>4|(3855&Ya)<<4,za[Va]=((65280&Ya)>>>8|(255&Ya)<<8)>>>1}var Ha=function(t,e,n){for(var r=t.length,i=0,o=new Qa(e);i<r;++i)++o[t[i]-1];var s,a=new Qa(e);for(i=0;i<e;++i)a[i]=a[i-1]+o[i-1]<<1;if(n){s=new Qa(1<<e);var u=15-e;for(i=0;i<r;++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[za[h]>>>u]=l}else for(s=new Qa(r),i=0;i<r;++i)t[i]&&(s[i]=za[a[t[i]-1]++]>>>15-t[i]);return s},Xa=new Ra(288);for(Va=0;Va<144;++Va)Xa[Va]=8;for(Va=144;Va<256;++Va)Xa[Va]=9;for(Va=256;Va<280;++Va)Xa[Va]=7;for(Va=280;Va<288;++Va)Xa[Va]=8;var Ja=new Ra(32);for(Va=0;Va<32;++Va)Ja[Va]=5;var Wa=Ha(Xa,9,1),Ka=Ha(Ja,5,1),Za=function(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},$a=function(t,e,n){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(7&e)&n},tu=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},eu=function(t){return(t/8|0)+(7&t&&1)},nu=function(t,e,n){var r=t.length;if(!r||n&&!n.l&&r<5)return e||new Ra(0);var i=!e||n,o=!n||n.i;n||(n={}),e||(e=new Ra(3*r));var s=function(t){var n=e.length;if(t>n){var r=new Ra(Math.max(2*n,t));r.set(e),e=r}},a=n.f||0,u=n.p||0,l=n.b||0,c=n.l,h=n.d,f=n.m,p=n.n,g=8*r;do{if(!c){n.f=a=$a(t,u,1);var A=$a(t,u+1,3);if(u+=3,!A){var d=t[(B=eu(u)+4)-4]|t[B-3]<<8,y=B+d;if(y>r){if(o)throw"unexpected EOF";break}i&&s(l+d),e.set(t.subarray(B,y),l),n.b=l+=d,n.p=u=8*y;continue}if(1==A)c=Wa,h=Ka,f=9,p=5;else{if(2!=A)throw"invalid block type";var v=$a(t,u,31)+257,m=$a(t,u+10,15)+4,_=v+$a(t,u+5,31)+1;u+=14;for(var I=new Ra(_),E=new Ra(19),C=0;C<m;++C)E[Oa[C]]=$a(t,u+3*C,7);u+=3*m;var x=Za(E),w=(1<<x)-1,b=Ha(E,x,1);for(C=0;C<_;){var B,S=b[$a(t,u,w)];if(u+=15&S,(B=S>>>4)<16)I[C++]=B;else{var M=0,L=0;for(16==B?(L=3+$a(t,u,3),u+=2,M=I[C-1]):17==B?(L=3+$a(t,u,7),u+=3):18==B&&(L=11+$a(t,u,127),u+=7);L--;)I[C++]=M}}var N=I.subarray(0,v),T=I.subarray(v);f=Za(N),p=Za(T),c=Ha(N,f,1),h=Ha(T,p,1)}if(u>g){if(o)throw"unexpected EOF";break}}i&&s(l+131072);for(var R=(1<<f)-1,Q=(1<<p)-1,D=u;;D=u){var P=(M=c[tu(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){D=u,c=null;break}var k=P-254;if(P>264){var O=Pa[C=P-257];k=$a(t,u,(1<<O)-1)+Ua[C],u+=O}var F=h[tu(t,u)&Q],G=F>>>4;if(!F)throw"invalid distance";u+=15&F;T=ja[G];if(G>3){O=ka[G];T+=tu(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}}n.l=c,n.p=D,n.b=l,c&&(a=1,n.m=f,n.d=h,n.n=p)}while(!a);return l==e.length?e:function(t,e,n){(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length);var r=new(t instanceof Qa?Qa:t instanceof Da?Da:Ra)(n-e);return r.set(t.subarray(e,n)),r}(e,0,l)},ru=new Ra(0);var iu="undefined"!=typeof TextDecoder&&new TextDecoder;try{iu.decode(ru,{stream:!0}),1}catch(t){}function ou(t,e,n){var r=n.length-t-1;if(e>=n[r])return r-1;if(e<=n[t])return t;for(var i=t,o=r,s=Math.floor((i+o)/2);e<n[s]||e>=n[s+1];)e<n[s]?o=s:i=s,s=Math.floor((i+o)/2);return s}function su(t,e){for(var n=1,r=2;r<=t;++r)n*=r;for(var i=1,o=2;o<=e;++o)i*=o;for(var s=2;s<=t-e;++s)i*=s;return n/i}function au(t,e,n,r,i){var o=function(t,e,n,r,i){for(var o=i<t?i:t,s=[],a=ou(t,r,e),u=function(t,e,n,r,i){for(var o=[],s=0;s<=n;++s)o[s]=0;for(var a=[],u=0;u<=r;++u)a[u]=o.slice(0);for(var l=[],c=0;c<=n;++c)l[c]=o.slice(0);l[0][0]=1;for(var h=o.slice(0),f=o.slice(0),p=1;p<=n;++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<=n;++m)a[0][m]=l[m][n];for(var _=0;_<=n;++_){for(var I=0,E=1,C=[],x=0;x<=n;++x)C[x]=o.slice(0);C[0][0]=1;for(var w=1;w<=r;++w){var b=0,B=_-w,S=n-w;_>=w&&(C[E][0]=C[I][0]/l[S+1][B],b=C[E][0]*l[B][S]);for(var M=_-1<=S?w-1:n-_,L=B>=-1?1:-B;L<=M;++L)C[E][L]=(C[I][L]-C[I][L-1])/l[S+1][B+L],b+=C[E][L]*l[B+L][S];_<=S&&(C[E][w]=-C[I][w-1]/l[S+1][_],b+=C[E][w]*l[_][S]),a[w][_]=b;var N=I;I=E,E=N}}for(var T=n,R=1;R<=r;++R){for(var Q=0;Q<=n;++Q)a[R][Q]*=T;T*=n-R}return a}(a,r,t,o,e),l=[],c=0;c<n.length;++c){var h=n[c].clone(),f=h.w;h.x*=f,h.y*=f,h.z*=f,l[c]=h}for(var p=0;p<=o;++p){for(var g=l[a-t].clone().multiplyScalar(u[p][0]),A=1;A<=t;++A)g.add(l[a-t+A].clone().multiplyScalar(u[p][A]));s[p]=g}for(var d=o+1;d<=i+1;++d)s[d]=new Dt(0,0,0);return s}(t,e,n,r,i);return function(t){for(var e=t.length,n=[],r=[],i=0;i<e;++i){var o=t[i];n[i]=new y(o.x,o.y,o.z),r[i]=o.w}for(var s=[],a=0;a<e;++a){for(var u=n[a].clone(),l=1;l<=a;++l)u.sub(s[a-l].clone().multiplyScalar(su(a,l)*r[l]));s[a]=u.divideScalar(r[0])}return s}(o)}var uu,lu,cu,hu=function(t){le(n,Pt);var e=pe(n);function n(t,r,i,o,s){var a;oe(this,n),(a=e.call(this)).degree=t,a.knots=r,a.controlPoints=[],a.startKnot=o||0,a.endKnot=s||a.knots.length-1;for(var u=0;u<i.length;++u){var l=i[u];a.controlPoints[u]=new Dt(l.x,l.y,l.z,l.w)}return a}return ae(n,[{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new y,n=this.knots[this.startKnot]+t*(this.knots[this.endKnot]-this.knots[this.startKnot]),r=function(t,e,n,r){for(var i=ou(t,r,e),o=function(t,e,n,r){var i=[],o=[],s=[];i[0]=1;for(var a=1;a<=n;++a){o[a]=e-r[t+1-a],s[a]=r[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}(i,r,t,e),s=new Dt(0,0,0,0),a=0;a<=t;++a){var u=n[i-t+a],l=o[a],c=u.w*l;s.x+=u.x*c,s.y+=u.y*c,s.z+=u.z*c,s.w+=u.w*l}return s}(this.degree,this.knots,this.controlPoints,n);return 1!==r.w&&r.divideScalar(r.w),e.set(r.x,r.y,r.z)}},{key:"getTangent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new y,n=this.knots[0]+t*(this.knots[this.knots.length-1]-this.knots[0]),r=au(this.degree,this.knots,this.controlPoints,n,1);return e.copy(r[1]).normalize(),e}}]),n}(),fu=function(t){le(n,u);var e=pe(n);function n(t){return oe(this,n),e.call(this,t)}return ae(n,[{key:"load",value:function(t,e,n,r){var i=this,o=""===i.path?s.extractUrlBase(t):i.path,u=new a(this.manager);u.setPath(i.path),u.setResponseType("arraybuffer"),u.setRequestHeader(i.requestHeader),u.setWithCredentials(i.withCredentials),u.load(t,(function(n){try{e(i.parse(n,o))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}}),n,r)}},{key:"parse",value:function(t,e){if(function(t){var e="Kaydara FBX Binary \0";return t.byteLength>=e.length&&e===Mu(t,0,e.length)}(t))uu=(new yu).parse(t);else{var n=Mu(t);if(!function(t){var e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],n=0;function r(e){var r=t[e-1];return t=t.slice(n+e),n++,r}for(var i=0;i<e.length;++i){if(r(1)===e[i])return!1}return!0}(n))throw new Error("THREE.FBXLoader: Unknown format.");if(_u(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+_u(n));uu=(new du).parse(n)}var r=new Z(this.manager).setPath(this.resourcePath||e).setCrossOrigin(this.crossOrigin);return new pu(r,this.manager).parse(uu)}}]),n}(),pu=function(){function t(e,n){oe(this,t),this.textureLoader=e,this.manager=n}return ae(t,[{key:"parse",value:function(){lu=this.parseConnections();var t=this.parseImages(),e=this.parseTextures(t),n=this.parseMaterials(e),r=this.parseDeformers(),i=(new gu).parse(r);return this.parseScene(r,i,n),cu}},{key:"parseConnections",value:function(){var t=new Map;"Connections"in uu&&uu.Connections.connections.forEach((function(e){var n=e[0],r=e[1],i=e[2];t.has(n)||t.set(n,{parents:[],children:[]});var o={ID:r,relationship:i};t.get(n).parents.push(o),t.has(r)||t.set(r,{parents:[],children:[]});var s={ID:n,relationship:i};t.get(r).children.push(s)}));return t}},{key:"parseImages",value:function(){var t={},e={};if("Video"in uu.Objects){var n=uu.Objects.Video;for(var r in n){var i=n[r];if(t[parseInt(r)]=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(n[r]);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,n=t.Content,r=t.RelativeFilename||t.Filename,i=r.slice(r.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 ",r),e="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof n)return"data:"+e+";base64,"+n;var o=new Uint8Array(n);return window.URL.createObjectURL(new Blob([o],{type:e}))}},{key:"parseTextures",value:function(t){var e=new Map;if("Texture"in uu.Objects){var n=uu.Objects.Texture;for(var r in n){var i=this.parseTexture(n[r],t);e.set(parseInt(r),i)}}return e}},{key:"parseTexture",value:function(t,e){var n=this.loadTexture(t,e);n.ID=t.id,n.name=t.attrName;var r=t.WrapModeU,i=t.WrapModeV,o=void 0!==r?r.value:0,s=void 0!==i?i.value:0;if(n.wrapS=0===o?x:J,n.wrapT=0===s?x:J,"Scaling"in t){var a=t.Scaling.value;n.repeat.x=a[0],n.repeat.y=a[1]}if("Translation"in t){var u=t.Translation.value;n.offset.x=u[0],n.offset.y=u[1]}return n}},{key:"loadTexture",value:function(t,e){var n,r,i=this.textureLoader.path,o=lu.get(t.id).children;void 0!==o&&o.length>0&&void 0!==e[o[0].ID]&&(0!==(n=e[o[0].ID]).indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0));var s=t.FileName.slice(-3).toLowerCase();if("tga"===s){var a=this.manager.getHandler(".tga");null===a?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),r=new tt):(a.setPath(this.textureLoader.path),r=a.load(n))}else"psd"===s?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),r=new tt):r=this.textureLoader.load(n);return this.textureLoader.setPath(i),r}},{key:"parseMaterials",value:function(t){var e=new Map;if("Material"in uu.Objects){var n=uu.Objects.Material;for(var r in n){var i=this.parseMaterial(n[r],t);null!==i&&e.set(parseInt(r),i)}}return e}},{key:"parseMaterial",value:function(t,e){var n=t.id,r=t.attrName,i=t.ShadingModel;if("object"===ne(i)&&(i=i.value),!lu.has(n))return null;var o,s=this.parseParameters(t,e,n);switch(i.toLowerCase()){case"phong":o=new Ot;break;case"lambert":o=new Ft;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),o=new Ot}return o.setValues(s),o.name=r,o}},{key:"parseParameters",value:function(t,e,n){var r={};t.BumpFactor&&(r.bumpScale=t.BumpFactor.value),t.Diffuse?r.color=(new l).fromArray(t.Diffuse.value):!t.DiffuseColor||"Color"!==t.DiffuseColor.type&&"ColorRGB"!==t.DiffuseColor.type||(r.color=(new l).fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(r.displacementScale=t.DisplacementFactor.value),t.Emissive?r.emissive=(new l).fromArray(t.Emissive.value):!t.EmissiveColor||"Color"!==t.EmissiveColor.type&&"ColorRGB"!==t.EmissiveColor.type||(r.emissive=(new l).fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(r.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(r.opacity=parseFloat(t.Opacity.value)),r.opacity<1&&(r.transparent=!0),t.ReflectionFactor&&(r.reflectivity=t.ReflectionFactor.value),t.Shininess&&(r.shininess=t.Shininess.value),t.Specular?r.specular=(new l).fromArray(t.Specular.value):t.SpecularColor&&"Color"===t.SpecularColor.type&&(r.specular=(new l).fromArray(t.SpecularColor.value));var i=this;return lu.get(n).children.forEach((function(t){var n=t.relationship;switch(n){case"Bump":r.bumpMap=i.getTexture(e,t.ID);break;case"Maya|TEX_ao_map":r.aoMap=i.getTexture(e,t.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=i.getTexture(e,t.ID),void 0!==r.map&&(r.map.encoding=g);break;case"DisplacementColor":r.displacementMap=i.getTexture(e,t.ID);break;case"EmissiveColor":r.emissiveMap=i.getTexture(e,t.ID),void 0!==r.emissiveMap&&(r.emissiveMap.encoding=g);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=i.getTexture(e,t.ID);break;case"ReflectionColor":r.envMap=i.getTexture(e,t.ID),void 0!==r.envMap&&(r.envMap.mapping=Gt,r.envMap.encoding=g);break;case"SpecularColor":r.specularMap=i.getTexture(e,t.ID),void 0!==r.specularMap&&(r.specularMap.encoding=g);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=i.getTexture(e,t.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}})),r}},{key:"getTexture",value:function(t,e){return"LayeredTexture"in uu.Objects&&e in uu.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),e=lu.get(e).children[0].ID),t.get(e)}},{key:"parseDeformers",value:function(){var t={},e={};if("Deformer"in uu.Objects){var n=uu.Objects.Deformer;for(var r in n){var i=n[r],o=lu.get(parseInt(r));if("Skin"===i.attrType){var s=this.parseSkeleton(o,n);s.ID=r,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[r]=s}else if("BlendShape"===i.attrType){var a={id:r};a.rawTargets=this.parseMorphTargets(o,n),a.id=r,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),e[r]=a}}}return{skeletons:t,morphTargets:e}}},{key:"parseSkeleton",value:function(t,e){var n=[];return t.children.forEach((function(t){var r=e[t.ID];if("Cluster"===r.attrType){var i={ID:t.ID,indices:[],weights:[],transformLink:(new o).fromArray(r.TransformLink.a)};"Indexes"in r&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}})),{rawBones:n,bones:[]}}},{key:"parseMorphTargets",value:function(t,e){for(var n=[],r=0;r<t.children.length;r++){var i=t.children[r],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=lu.get(parseInt(i.ID)).children.filter((function(t){return void 0===t.relationship}))[0].ID,n.push(s)}return n}},{key:"parseScene",value:function(t,e,n){cu=new k;var r=this.parseModels(t.skeletons,e,n),i=uu.Objects.Model,o=this;r.forEach((function(t){var e=i[t.ID];o.setLookAtProperties(t,e),lu.get(t.ID).parents.forEach((function(e){var n=r.get(e.ID);void 0!==n&&n.add(t)})),null===t.parent&&cu.add(t)})),this.bindSkeleton(t.skeletons,e,r),this.createAmbientLight(),cu.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=bu(t.userData.transformData);t.applyMatrix4(e),t.updateWorldMatrix()}}));var s=(new Au).parse();1===cu.children.length&&cu.children[0].isGroup&&(cu.children[0].animations=s,cu=cu.children[0]),cu.animations=s}},{key:"parseModels",value:function(t,e,n){var r=new Map,i=uu.Objects.Model;for(var o in i){var s=parseInt(o),a=i[o],u=lu.get(s),l=this.buildSkeleton(u,t,s,a.attrName);if(!l){switch(a.attrType){case"Camera":l=this.createCamera(u);break;case"Light":l=this.createLight(u);break;case"Mesh":l=this.createMesh(u,e,n);break;case"NurbsCurve":l=this.createCurve(u,e);break;case"LimbNode":case"Root":l=new j;break;default:l=new k}l.name=a.attrName?L.sanitizeNodeName(a.attrName):"",l.ID=s}this.getTransformData(l,a),r.set(s,l)}return r}},{key:"buildSkeleton",value:function(t,e,n,r){var i=null;return t.parents.forEach((function(t){var o=function(){var o=e[s];o.rawBones.forEach((function(e,s){if(e.ID===t.ID){var a=i;(i=new j).matrixWorld.copy(e.transformLink),i.name=r?L.sanitizeNodeName(r):"",i.ID=n,o.bones[s]=i,null!==a&&i.add(a)}}))};for(var s in e)o()})),i}},{key:"createCamera",value:function(t){var e,n;if(t.children.forEach((function(t){var e=uu.Objects.NodeAttribute[t.ID];void 0!==e&&(n=e)})),void 0===n)e=new m;else{var r=0;void 0!==n.CameraProjectionType&&1===n.CameraProjectionType.value&&(r=1);var i=1;void 0!==n.NearPlane&&(i=n.NearPlane.value/1e3);var o=1e3;void 0!==n.FarPlane&&(o=n.FarPlane.value/1e3);var s=window.innerWidth,a=window.innerHeight;void 0!==n.AspectWidth&&void 0!==n.AspectHeight&&(s=n.AspectWidth.value,a=n.AspectHeight.value);var u=s/a,l=45;void 0!==n.FieldOfView&&(l=n.FieldOfView.value);var c=n.FocalLength?n.FocalLength.value:null;switch(r){case 0:e=new O(l,u,i,o),null!==c&&e.setFocalLength(c);break;case 1:e=new G(-s/2,s/2,a/2,-a/2,i,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+r+"."),e=new m}}return e}},{key:"createLight",value:function(t){var e,n;if(t.children.forEach((function(t){var e=uu.Objects.NodeAttribute[t.ID];void 0!==e&&(n=e)})),void 0===n)e=new m;else{var r;r=void 0===n.LightType?0:n.LightType.value;var i=16777215;void 0!==n.Color&&(i=(new l).fromArray(n.Color.value));var o=void 0===n.Intensity?1:n.Intensity.value/100;void 0!==n.CastLightOnObject&&0===n.CastLightOnObject.value&&(o=0);var s=0;void 0!==n.FarAttenuationEnd&&(s=void 0!==n.EnableFarAttenuation&&0===n.EnableFarAttenuation.value?0:n.FarAttenuationEnd.value);switch(r){case 0:e=new h(i,o,s,1);break;case 1:e=new f(i,o);break;case 2:var a=Math.PI/3;void 0!==n.InnerAngle&&(a=F.degToRad(n.InnerAngle.value));var u=0;void 0!==n.OuterAngle&&(u=F.degToRad(n.OuterAngle.value),u=Math.max(u,1)),e=new c(i,o,s,a,u,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),e=new h(i,o)}void 0!==n.CastShadows&&1===n.CastShadows.value&&(e.castShadow=!0)}return e}},{key:"createMesh",value:function(t,e,n){var r,i=null,o=null,s=[];return t.children.forEach((function(t){e.has(t.ID)&&(i=e.get(t.ID)),n.has(t.ID)&&s.push(n.get(t.ID))})),s.length>1?o=s:s.length>0?o=s[0]:(o=new Ot({color:13421772}),s.push(o)),"color"in i.attributes&&s.forEach((function(t){t.vertexColors=!0})),i.FBX_Deformer?(r=new N(i,o)).normalizeSkinWeights():r=new T(i,o),r}},{key:"createCurve",value:function(t,e){var n=t.children.reduce((function(t,n){return e.has(n.ID)&&(t=e.get(n.ID)),t}),null),r=new B({color:3342591,linewidth:1});return new Q(n,r)}},{key:"getTransformData",value:function(t,e){var n={};"InheritType"in e&&(n.inheritType=parseInt(e.InheritType.value)),n.eulerOrder="RotationOrder"in e?Bu(e.RotationOrder.value):"ZYX","Lcl_Translation"in e&&(n.translation=e.Lcl_Translation.value),"PreRotation"in e&&(n.preRotation=e.PreRotation.value),"Lcl_Rotation"in e&&(n.rotation=e.Lcl_Rotation.value),"PostRotation"in e&&(n.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(n.scale=e.Lcl_Scaling.value),"ScalingOffset"in e&&(n.scalingOffset=e.ScalingOffset.value),"ScalingPivot"in e&&(n.scalingPivot=e.ScalingPivot.value),"RotationOffset"in e&&(n.rotationOffset=e.RotationOffset.value),"RotationPivot"in e&&(n.rotationPivot=e.RotationPivot.value),t.userData.transformData=n}},{key:"setLookAtProperties",value:function(t,e){"LookAtProperty"in e&&lu.get(t.ID).children.forEach((function(e){if("LookAtProperty"===e.relationship){var n=uu.Objects.Model[e.ID];if("Lcl_Translation"in n){var r=n.Lcl_Translation.value;void 0!==t.target?(t.target.position.fromArray(r),cu.add(t.target)):t.lookAt((new y).fromArray(r))}}}))}},{key:"bindSkeleton",value:function(t,e,n){var r=this.parsePoseNodes(),i=function(){var i=t[o];lu.get(parseInt(i.ID)).parents.forEach((function(t){if(e.has(t.ID)){var o=t.ID;lu.get(o).parents.forEach((function(t){n.has(t.ID)&&n.get(t.ID).bind(new U(i.bones),r[t.ID])}))}}))};for(var o in t)i()}},{key:"parsePoseNodes",value:function(){var t={};if("Pose"in uu.Objects){var e=uu.Objects.Pose;for(var n in e)if("BindPose"===e[n].attrType&&e[n].NbPoseNodes>0){var r=e[n].PoseNode;Array.isArray(r)?r.forEach((function(e){t[e.Node]=(new o).fromArray(e.Matrix.a)})):t[r.Node]=(new o).fromArray(r.Matrix.a)}}return t}},{key:"createAmbientLight",value:function(){if("GlobalSettings"in uu&&"AmbientColor"in uu.GlobalSettings){var t=uu.GlobalSettings.AmbientColor.value,e=t[0],n=t[1],r=t[2];if(0!==e||0!==n||0!==r){var i=new l(e,n,r);cu.add(new Ut(i,1))}}}}]),t}(),gu=function(){function t(){oe(this,t),this.negativeMaterialIndices=!1}return ae(t,[{key:"parse",value:function(t){var e=new Map;if("Geometry"in uu.Objects){var n=uu.Objects.Geometry;for(var r in n){var i=lu.get(parseInt(r)),o=this.parseGeometry(i,n[r],t);e.set(parseInt(r),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,n){switch(e.attrType){case"Mesh":return this.parseMeshGeometry(t,e,n);case"NurbsCurve":return this.parseNurbsGeometry(e)}}},{key:"parseMeshGeometry",value:function(t,e,n){var r=n.skeletons,i=[],o=t.parents.map((function(t){return uu.Objects.Model[t.ID]}));if(0!==o.length){var s=t.children.reduce((function(t,e){return void 0!==r[e.ID]&&(t=r[e.ID]),t}),null);t.children.forEach((function(t){void 0!==n.morphTargets[t.ID]&&i.push(n.morphTargets[t.ID])}));var a=o[0],u={};"RotationOrder"in a&&(u.eulerOrder=Bu(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=bu(u);return this.genGeometry(e,s,i,l)}}},{key:"genGeometry",value:function(t,e,r,i){var o=new n;t.attrName&&(o.name=t.attrName);var s=this.parseGeoNode(t,e),a=this.genBuffers(s),u=new qt(a.vertex,3);if(u.applyMatrix4(i),o.setAttribute("position",u),a.colors.length>0&&o.setAttribute("color",new qt(a.colors,3)),e&&(o.setAttribute("skinIndex",new jt(a.weightsIndices,4)),o.setAttribute("skinWeight",new qt(a.vertexWeights,4)),o.FBX_Deformer=e),a.normal.length>0){var l=(new zt).getNormalMatrix(i),c=new qt(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 qt(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,r,i),o}},{key:"parseGeoNode",value:function(t,e){var n={};if(n.vertexPositions=void 0!==t.Vertices?t.Vertices.a:[],n.vertexIndices=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(n.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(n.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(n.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){n.uv=[];for(var r=0;t.LayerElementUV[r];)t.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(t.LayerElementUV[r])),r++}return n.weightTable={},null!==e&&(n.skeleton=e,e.rawBones.forEach((function(t,e){t.indices.forEach((function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:e,weight:t.weights[i]})}))}))),n}},{key:"genBuffers",value:function(t){var e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=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=Cu(p,n,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 n=t,r=d[e];_.forEach((function(t,e,i){if(n>t){i[e]=n,n=t;var o=m[e];m[e]=r,r=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=Cu(p,n,f,t.normal);s.push(E[0],E[1],E[2])}t.material&&"AllSame"!==t.material.mappingType&&(g=Cu(p,n,f,t.material)[0])<0&&(h.negativeMaterialIndices=!0,g=0),t.uv&&t.uv.forEach((function(t,e){var r=Cu(p,n,f,t);void 0===u[e]&&(u[e]=[]),u[e].push(r[0]),u[e].push(r[1])})),r++,A&&(r>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,r),n++,r=0,o=[],s=[],a=[],u=[],l=[],c=[])})),e}},{key:"genFace",value:function(t,e,n,r,i,o,s,a,u,l){for(var c=function(l){t.vertex.push(e.vertexPositions[n[0]]),t.vertex.push(e.vertexPositions[n[1]]),t.vertex.push(e.vertexPositions[n[2]]),t.vertex.push(e.vertexPositions[n[3*(l-1)]]),t.vertex.push(e.vertexPositions[n[3*(l-1)+1]]),t.vertex.push(e.vertexPositions[n[3*(l-1)+2]]),t.vertex.push(e.vertexPositions[n[3*l]]),t.vertex.push(e.vertexPositions[n[3*l+1]]),t.vertex.push(e.vertexPositions[n[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(r),t.materialIndex.push(r),t.materialIndex.push(r)),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,n){void 0===t.uvs[n]&&(t.uvs[n]=[]),t.uvs[n].push(s[n][0]),t.uvs[n].push(s[n][1]),t.uvs[n].push(s[n][2*(l-1)]),t.uvs[n].push(s[n][2*(l-1)+1]),t.uvs[n].push(s[n][2*l]),t.uvs[n].push(s[n][2*l+1])}))},h=2;h<l;h++)c(h)}},{key:"addMorphTargets",value:function(t,e,n,r){if(0!==n.length){t.morphTargetsRelative=!0,t.morphAttributes.position=[];var i=this;n.forEach((function(n){n.rawTargets.forEach((function(n){var o=uu.Objects.Geometry[n.geoID];void 0!==o&&i.genMorphGeometry(t,e,o,r,n.name)}))}))}}},{key:"genMorphGeometry",value:function(t,e,n,r,i){for(var o=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],s=void 0!==n.Vertices?n.Vertices.a:[],a=void 0!==n.Indexes?n.Indexes.a:[],u=3*t.attributes.position.count,l=new Float32Array(u),c=0;c<a.length;c++){var h=3*a[c];l[h]=s[3*c],l[h+1]=s[3*c+1],l[h+2]=s[3*c+2]}var f={vertexIndices:o,vertexPositions:l},p=this.genBuffers(f),g=new qt(p.vertex,3);g.name=i||n.attrName,g.applyMatrix4(r),t.morphAttributes.position.push(g)}},{key:"parseNormals",value:function(t){var e=t.MappingInformationType,n=t.ReferenceInformationType,r=t.Normals.a,i=[];return"IndexToDirect"===n&&("NormalIndex"in t?i=t.NormalIndex.a:"NormalsIndex"in t&&(i=t.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:e,referenceType:n}}},{key:"parseUVs",value:function(t){var e=t.MappingInformationType,n=t.ReferenceInformationType,r=t.UV.a,i=[];return"IndexToDirect"===n&&(i=t.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:e,referenceType:n}}},{key:"parseVertexColors",value:function(t){var e=t.MappingInformationType,n=t.ReferenceInformationType,r=t.Colors.a,i=[];return"IndexToDirect"===n&&(i=t.ColorIndex.a),{dataSize:4,buffer:r,indices:i,mappingType:e,referenceType:n}}},{key:"parseMaterialIndices",value:function(t){var e=t.MappingInformationType,n=t.ReferenceInformationType;if("NoMappingInformation"===e)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};for(var r=t.Materials.a,i=[],o=0;o<r.length;++o)i.push(o);return{dataSize:1,buffer:r,indices:i,mappingType:e,referenceType:n}}},{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 n;for(var r,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 Dt).fromArray(u,l));if("Closed"===t.Form)a.push(a[0]);else if("Periodic"===t.Form){r=o,i=s.length-1-r;for(var h=0;h<o;++h)a.push(a[h])}var f=new hu(o,s,a,r,i).getPoints(12*a.length);return(new n).setFromPoints(f)}}]),t}(),Au=function(){function t(){oe(this,t)}return ae(t,[{key:"parse",value:function(){var t=[],e=this.parseClips();if(void 0!==e)for(var n in e){var r=e[n],i=this.addClip(r);t.push(i)}return t}},{key:"parseClips",value:function(){if(void 0!==uu.Objects.AnimationCurve){var t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);var e=this.parseAnimationLayers(t);return this.parseAnimStacks(e)}}},{key:"parseAnimationCurveNodes",value:function(){var t=uu.Objects.AnimationCurveNode,e=new Map;for(var n in t){var r=t[n];if(null!==r.attrName.match(/S|R|T|DeformPercent/)){var i={id:r.id,attr:r.attrName,curves:{}};e.set(i.id,i)}}return e}},{key:"parseAnimationCurves",value:function(t){var e=uu.Objects.AnimationCurve;for(var n in e){var r={id:e[n].id,times:e[n].KeyTime.a.map(Iu),values:e[n].KeyValueFloat.a},i=lu.get(r.id);if(void 0!==i){var o=i.parents[0].ID,s=i.parents[0].relationship;s.match(/X/)?t.get(o).curves.x=r:s.match(/Y/)?t.get(o).curves.y=r:s.match(/Z/)?t.get(o).curves.z=r:s.match(/d|DeformPercent/)&&t.has(o)&&(t.get(o).curves.morph=r)}}}},{key:"parseAnimationLayers",value:function(t){var e=uu.Objects.AnimationLayer,n=new Map,r=function(){var e=[],r=lu.get(parseInt(i));void 0!==r&&(r.children.forEach((function(n,r){if(t.has(n.ID)){var i=t.get(n.ID);if(void 0!==i.curves.x||void 0!==i.curves.y||void 0!==i.curves.z){if(void 0===e[r]){var s=lu.get(n.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID;if(void 0!==s){var a=uu.Objects.Model[s.toString()];if(void 0===a)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",n);var u={modelName:a.attrName?L.sanitizeNodeName(a.attrName):"",ID:a.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};cu.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 o),"PreRotation"in a&&(u.preRotation=a.PreRotation.value),"PostRotation"in a&&(u.postRotation=a.PostRotation.value),e[r]=u}}e[r]&&(e[r][i.attr]=i)}else if(void 0!==i.curves.morph){if(void 0===e[r]){var l=lu.get(n.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID,c=lu.get(l).parents[0].ID,h=lu.get(c).parents[0].ID,f=lu.get(h).parents[0].ID,p=uu.Objects.Model[f],g={modelName:p.attrName?L.sanitizeNodeName(p.attrName):"",morphName:uu.Objects.Deformer[l].attrName};e[r]=g}e[r][i.attr]=i}}})),n.set(parseInt(i),e))};for(var i in e)r();return n}},{key:"parseAnimStacks",value:function(t){var e=uu.Objects.AnimationStack,n={};for(var r in e){var i=lu.get(parseInt(r)).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);n[r]={name:e[r].attrName,layer:o}}return n}},{key:"addClip",value:function(t){var e=[],n=this;return t.layer.forEach((function(t){e=e.concat(n.generateTracks(t))})),new q(t.name,-1,e)}},{key:"generateTracks",value:function(t){var e=[],n=new y,r=new i,o=new y;if(t.transform&&t.transform.decompose(n,r,o),n=n.toArray(),r=(new kt).setFromQuaternion(r,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,r,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,r){var i=this.getTimesForAllAxes(e),o=this.getKeyframeTrackValues(i,e,n);return new st(t+"."+r,i,o)}},{key:"generateRotationTrack",value:function(t,e,n,r,o,s){void 0!==e.x&&(this.interpolateRotations(e.x),e.x.values=e.x.values.map(F.degToRad)),void 0!==e.y&&(this.interpolateRotations(e.y),e.y.values=e.y.values.map(F.degToRad)),void 0!==e.z&&(this.interpolateRotations(e.z),e.z.values=e.z.values.map(F.degToRad));var a=this.getTimesForAllAxes(e),u=this.getKeyframeTrackValues(a,e,n);void 0!==r&&((r=r.map(F.degToRad)).push(s),r=(new kt).fromArray(r),r=(new i).setFromEuler(r)),void 0!==o&&((o=o.map(F.degToRad)).push(s),o=(new kt).fromArray(o),o=(new i).setFromEuler(o).invert());for(var l=new i,c=new kt,h=[],f=0;f<u.length;f+=3)c.set(u[f],u[f+1],u[f+2],s),l.setFromEuler(c),void 0!==r&&l.premultiply(r),void 0!==o&&l.multiply(o),l.toArray(h,f/3*4);return new at(t+".quaternion",a,h)}},{key:"generateMorphTrack",value:function(t){var e=t.DeformPercent.curves.morph,n=e.values.map((function(t){return t/100})),r=cu.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new ut(t.modelName+".morphTargetInfluences["+r+"]",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 n=1,r=e[0],i=1;i<e.length;i++){var o=e[i];o!==r&&(e[n]=o,r=o,n++)}e=e.slice(0,n)}return e}},{key:"getKeyframeTrackValues",value:function(t,e,n){var r=n,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 n=e.x.values[o];i.push(n),r[0]=n}else i.push(r[0]);if(-1!==s){var u=e.y.values[s];i.push(u),r[1]=u}else i.push(r[1]);if(-1!==a){var l=e.z.values[a];i.push(l),r[2]=l}else i.push(r[2])})),i}},{key:"interpolateRotations",value:function(t){for(var e=1;e<t.values.length;e++){var n=t.values[e-1],r=t.values[e]-n,i=Math.abs(r);if(i>=180){for(var o=i/180,s=r/o,a=n+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=Lu(t.times,e,h),t.values=Lu(t.values,e,f)}}}}]),t}(),du=function(){function t(){oe(this,t)}return ae(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 mu,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var e=this,n=t.split(/[\r\n]+/);return n.forEach((function(t,r){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,n[++r]):u?e.popStack():t.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(t)}})),this.allNodes}},{key:"parseNodeBegin",value:function(t,e){var n=e[1].trim().replace(/^"/,"").replace(/"$/,""),r=e[2].split(",").map((function(t){return t.trim().replace(/^"/,"").replace(/"$/,"")})),i={name:n},o=this.parseNodeAttr(r),s=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(n,i):n in s?("PoseNode"===n?s.PoseNode.push(i):void 0!==s[n].id&&(s[n]={},s[n][s[n].id]=s[n]),""!==o.id&&(s[n][o.id]=i)):"number"==typeof o.id?(s[n]={},s[n][o.id]=i):"Properties70"!==n&&(s[n]="PoseNode"===n?[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 n="",r="";return t.length>1&&(n=t[1].replace(/^(\w+)::/,""),r=t[2]),{id:e,name:n,type:r}}},{key:"parseNodeProperty",value:function(t,e,n){var r=e[1].replace(/^"/,"").replace(/"$/,"").trim(),i=e[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===r&&","===i&&(i=n.replace(/"/g,"").replace(/,$/,"").trim());var o=this.getCurrentNode();if("Properties70"!==o.name){if("C"===r){var s=i.split(",").slice(1),a=parseInt(s[0]),u=parseInt(s[1]),l=i.split(",").slice(3);r="connections",function(t,e){for(var n=0,r=t.length,i=e.length;n<i;n++,r++)t[r]=e[n]}(i=[a,u],l=l.map((function(t){return t.trim().replace(/^"/,"")}))),void 0===o[r]&&(o[r]=[])}"Node"===r&&(o.id=i),r in o&&Array.isArray(o[r])?o[r].push(i):"a"!==r?o[r]=i:o.a=i,this.setCurrentProp(o,r),"a"===r&&","!==i.slice(-1)&&(o.a=Su(i))}else this.parseNodeSpecialProperty(t,r,i)}},{key:"parseNodePropertyContinued",value:function(t){var e=this.getCurrentNode();e.a+=t,","!==t.slice(-1)&&(e.a=Su(e.a))}},{key:"parseNodeSpecialProperty",value:function(t,e,n){var r=n.split('",').map((function(t){return t.trim().replace(/^\"/,"").replace(/\s/,"_")})),i=r[0],o=r[1],s=r[2],a=r[3],u=r[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=Su(u)}this.getPrevNode()[i]={type:o,type2:s,flag:a,value:u},this.setCurrentProp(this.getPrevNode(),i)}}]),t}(),yu=function(){function t(){oe(this,t)}return ae(t,[{key:"parse",value:function(t){var e=new vu(t);e.skip(23);var n=e.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);for(var r=new mu;!this.endOfContent(e);){var i=this.parseNode(e,n);null!==i&&r.add(i.name,i)}return r}},{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 n={},r=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===r)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(n.singleProperty=1===i&&t.getOffset()===r;r>t.getOffset();){var f=this.parseNode(t,e);null!==f&&this.parseSubNode(s,n,f)}return n.propertyList=a,"number"==typeof l&&(n.id=l),""!==c&&(n.attrName=c),""!==h&&(n.attrType=h),""!==s&&(n.name=s),n}},{key:"parseSubNode",value:function(t,e,n){if(!0===n.singleProperty){var r=n.propertyList[0];Array.isArray(r)?(e[n.name]=n,n.a=r):e[n.name]=r}else if("Connections"===t&&"C"===n.name){var i=[];n.propertyList.forEach((function(t,e){0!==e&&i.push(t)})),void 0===e.connections&&(e.connections=[]),e.connections.push(i)}else if("Properties70"===n.name){Object.keys(n).forEach((function(t){e[t]=n[t]}))}else if("Properties70"===t&&"P"===n.name){var o,s=n.propertyList[0],a=n.propertyList[1],u=n.propertyList[2],l=n.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_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],e[s]={type:a,type2:u,flag:l,value:o}}else void 0===e[n.name]?"number"==typeof n.id?(e[n.name]={},e[n.name][n.id]=n):e[n.name]=n:"PoseNode"===n.name?(Array.isArray(e[n.name])||(e[n.name]=[e[n.name]]),e[n.name].push(n)):void 0===e[n.name][n.id]&&(e[n.name][n.id]=n)}},{key:"parseProperty",value:function(t){var e,n=t.getString(1);switch(n){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 r=t.getUint32(),i=t.getUint32(),o=t.getUint32();if(0===i)switch(n){case"b":case"c":return t.getBooleanArray(r);case"d":return t.getFloat64Array(r);case"f":return t.getFloat32Array(r);case"i":return t.getInt32Array(r);case"l":return t.getInt64Array(r)}var s=function(t,e){return nu((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 vu(s.buffer);switch(n){case"b":case"c":return a.getBooleanArray(r);case"d":return a.getFloat64Array(r);case"f":return a.getFloat32Array(r);case"i":return a.getInt32Array(r);case"l":return a.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+n)}}}]),t}(),vu=function(){function t(e,n){oe(this,t),this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===n||n}return ae(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=[],n=0;n<t;n++)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=[],n=0;n<t;n++)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=[],n=0;n<t;n++)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=[],n=0;n<t;n++)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=[],n=0;n<t;n++)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 r=e.indexOf(0);return r>=0&&(e=e.slice(0,r)),s.decodeText(new Uint8Array(e))}}]),t}(),mu=function(){function t(){oe(this,t)}return ae(t,[{key:"add",value:function(t,e){this[t]=e}}]),t}();function _u(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 Iu(t){return t/46186158e3}var Eu=[];function Cu(t,e,n,r){var i;switch(r.mappingType){case"ByPolygonVertex":i=t;break;case"ByPolygon":i=e;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}"IndexToDirect"===r.referenceType&&(i=r.indices[i]);var o=i*r.dataSize,s=o+r.dataSize;return function(t,e,n,r){for(var i=n,o=0;i<r;i++,o++)t[o]=e[i];return t}(Eu,r.buffer,o,s)}var xu=new kt,wu=new y;function bu(t){var e=new o,n=new o,r=new o,i=new o,s=new o,a=new o,u=new o,l=new o,c=new o,h=new o,f=new o,p=new o,g=t.inheritType?t.inheritType:0;if(t.translation&&e.setPosition(wu.fromArray(t.translation)),t.preRotation){var A=t.preRotation.map(F.degToRad);A.push(t.eulerOrder||kt.DefaultOrder),n.makeRotationFromEuler(xu.fromArray(A))}if(t.rotation){var d=t.rotation.map(F.degToRad);d.push(t.eulerOrder||kt.DefaultOrder),r.makeRotationFromEuler(xu.fromArray(d))}if(t.postRotation){var v=t.postRotation.map(F.degToRad);v.push(t.eulerOrder||kt.DefaultOrder),i.makeRotationFromEuler(xu.fromArray(v)),i.invert()}t.scale&&s.scale(wu.fromArray(t.scale)),t.scalingOffset&&u.setPosition(wu.fromArray(t.scalingOffset)),t.scalingPivot&&a.setPosition(wu.fromArray(t.scalingPivot)),t.rotationOffset&&l.setPosition(wu.fromArray(t.rotationOffset)),t.rotationPivot&&c.setPosition(wu.fromArray(t.rotationPivot)),t.parentMatrixWorld&&(f.copy(t.parentMatrix),h.copy(t.parentMatrixWorld));var m=n.clone().multiply(r).multiply(i),_=new o;_.extractRotation(h);var I=new o;I.copyPosition(h);var E=I.clone().invert().multiply(h),C=_.clone().invert().multiply(E),x=s,w=new o;if(0===g)w.copy(_).multiply(m).multiply(C).multiply(x);else if(1===g)w.copy(_).multiply(C).multiply(m).multiply(x);else{var b=(new o).scale((new y).setFromMatrixScale(f)).clone().invert(),B=C.clone().multiply(b);w.copy(_).multiply(m).multiply(B).multiply(x)}var S=c.clone().invert(),M=a.clone().invert(),L=e.clone().multiply(l).multiply(c).multiply(n).multiply(r).multiply(i).multiply(S).multiply(u).multiply(a).multiply(s).multiply(M),N=(new o).copyPosition(L),T=h.clone().multiply(N);return p.copyPosition(T),(L=p.clone().multiply(w)).premultiply(h.invert()),L}function Bu(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 Su(t){return t.split(",").map((function(t){return parseFloat(t)}))}function Mu(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=t.byteLength),s.decodeText(new Uint8Array(t,e,n))}function Lu(t,e,n){return t.slice(0,e).concat(n).concat(t.slice(e))}var Nu=function(){function t(n,r,i,o,s){oe(this,t),this.threelayer=o,this.map=o.map,this.groupId=s,this.loader=new fu,this.loader.load(n,(function(t){t.traverse((function(t){t instanceof e.Mesh&&(t.geometry.computeVertexNormals(),t.scale.set(.04,.04,.04),t.rotation.set(1*Math.PI/2,1*-Math.PI/2,0))}));var n=o.toModel(t,{coordinate:r,altitude:i.altitude||0});s?o.addMesh1(n,s):o.addMesh(n),n.object3d.rotation.z=Math.PI/2}))}return ae(t,[{key:"dispose",value:function(){}}]),t}(),Tu={altitude:0,speed:.015,height:10},Ru=function(n){le(i,$t);var r=pe(i);function i(e,n,o,s,a){var u;oe(this,i),Array.isArray(e)&&(e=new t.Polygon([e])),n=t.Util.extend({},Tu,n,{layer:s,polygon:e}),(u=r.call(this)).parent=a,u._initOptions(n);var l=n,c=l.altitude,h=l.height,f=u.createGeometry(e,s,h);u._createMesh(f,o);var p=s.altitudeToVector3(c,c).x,g=s.coordinateToVector3(e.getCenter(),p);return u.getObject3d().position.copy(g),u}return ae(i,[{key:"createGeometry",value:function(t,n,r){r=n.altitudeToVector3(r,r).x;var i=n.coordinateToVector3(t.getCenter()),o=t.getShell(),s=[],a=[];o.forEach((function(t){var e=n.coordinateToVector3(t).sub(i);s.push(e),a.push(e.x),a.push(e.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<s.length-1;A++){var v=s[A],m=s[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 e.BufferGeometry;return I.setAttribute("position",new e.BufferAttribute(new Float32Array(f),3)),I.setAttribute("uv",new e.BufferAttribute(new Float32Array(p),2)),I}}]),i}(),Qu=function(){function t(n,r,i,o,s){oe(this,t),this.threelayer=i,this.map=i.map,this.groupId=o,this.layerClass=s,this.opacity=r.opacity||.8,this.fadeOpacity=r.fadeOpacity||.65,this.color=r.color||"#0099FF",this.fadeColor=r.fadeColor||"#000",this.num=r.num||5,this.hiz=r.hiz||.15,this.data=n.data,this.coords=n.coords,this._uniforms={time:{type:"pv2",value:0},color:{type:"uvs",value:new e.Color(this.color)},fadeColor:{type:"uvs",value:new e.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 e.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:e.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:e.DoubleSide});this.interactive=void 0===r.interactive||r.interactive,this.groundWall=new Ru(this.coords,{height:r.height||1e3,interactive:this.interactive},a,i,this),o?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this),this.clickFunc=r.clickFunc,this._bindMapEvents()}return ae(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}(),Du=function(){function t(n,r,i,o,s){if(oe(this,t),this.threelayer=i,this.map=i.map,this.layerClass=s,this.opacity=r.opacity||.8,this.color=r.color||"#0099FF",this.fadeColor=r.fadeColor||"#000",this.repeatX=r.repeatX||10,this.speed=r.speed||.01,r.imgUrl){this.loader=new e.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 e.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:e.DoubleSide});this.groundWall=new Ru(n,{height:r.height||1e3},a,i),o?this.threelayer.addMesh1(this.groundWall,this.groupId):this.threelayer.addMesh(this.groundWall),this.layerClass.updatables.push(this)}}return ae(t,[{key:"setUvTransform",value:function(t,e,n,r,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}();Vt.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new d(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},Yt.line={uniforms:Ht.merge([Vt.common,Vt.fog,Vt.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 Pu,ku,Ou=function(t){le(n,Xt);var e=pe(n);function n(t){var r;return oe(this,n),(r=e.call(this,{type:"LineMaterial",uniforms:Ht.clone(Yt.line.uniforms),vertexShader:Yt.line.vertexShader,fragmentShader:Yt.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(fe(r),{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)}}}),r.setValues(t),r}return ae(n)}(),Fu=function(){function e(t,n,r,i){oe(this,e),this.map=r.map,this.threeLayer=r,this.groupId=i,this.dashed=void 0!==n.dashed&&n.dashed,this.dashScale=void 0!==n.dashScale?n.dashScale:2,this.dashSize=void 0!==n.dashSize?n.dashSize:1,this.gapSize=void 0!==n.gapSize?n.gapSize:1,this.dashed?this.lineMaterial=new Ou({color:n.lineColor||"rgb(15,159,190)",transparent:!0,linewidth:n.linewidth||1,dashed:!0,defines:{USE_DASH:""},dashScale:this.dashScale,dashSize:this.dashSize,gapSize:this.gapSize}):this.lineMaterial=new Ou({color:n.lineColor||"rgb(15,159,190)",transparent:!0,linewidth:n.linewidth||1});var o=[];t.features.forEach((function(t){var e=t.geometry;o.push(e)})),this.lineItems=o}var n;return ae(e,[{key:"addLine",value:(n=ie(ee().mark((function e(){var n,r,i=this;return ee().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=[],this.lineItems.forEach((function(e){"Polygon"===e.type?e.coordinates.forEach((function(e){var r=new t.LineString(e);n.push(r)})):e.coordinates.forEach((function(e){var r=new t.LineString(e[0]);n.push(r)}))})),n.length>0&&(r=this.threeLayer.toFatLines(n,{altitude:1,interactive:!1},this.lineMaterial),this.dashed&&(r.zoomChange=function(){if(i.map){var t=i.map.pixelToDistance(1,0);i.lineMaterial.dashScale=18.93/t}}),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 n.apply(this,arguments)})},{key:"dispose",value:function(){this.groupId?this.threelayer.removeMesh1(this.line,this.groupId):this.threelayer.removeMesh(this.line),this.line.object3d.geometry&&this.line.object3d.geometry.dispose(),this.line.object3d.material&&this.line.object3d.material.dispose(),this.lineMaterial&&this.lineMaterial.dispose()}}]),e}(),Gu={altitude:0},Uu=function(n){le(i,$t);var r=pe(i);function i(n,o,s,a){var u;oe(this,i),o=t.Util.extend({layer:a},Gu,o),(u=r.call(this))._initOptions(o),u.height=o.height||50;for(var l=1/0,c=1/0,h=-1/0,f=-1/0,p=0;p<n.length;p++){var g=n[p].getCenter();l=Math.min(l,g.x),c=Math.min(c,g.y),h=Math.max(h,g.x),f=Math.max(f,g.y)}var A=new t.Coordinate((l+h)/2,(c+f)/2),d=a.coordinateToVector3(A),y=a.altitudeToVector3(u.height,u.height).x,v=[];u._geometriesAttributes=[],u._colorMap={};for(var m=0;m<n.length;m++){var _=Te(d,n[m],a,y),I=_.attributes.position.array;u._geometriesAttributes[m]={position:{count:I.length/3}},v.push(_)}u._datas=n,u._uniforms={time:{type:"pv2",value:0},color:{type:"uvs",value:new e.Color("#0099FF")},fadeColor:{type:"uvs",value:new e.Color("#000")},opacity:{type:"pv2",value:u.opacity},num:{type:"pv2",value:5},hiz:{type:"pv2",value:.15}},new e.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:e.AdditiveBlending,transparent:!0,depthWrite:!1,depthTest:!0,side:e.DoubleSide});var E=new e.MeshBasicMaterial({side:e.DoubleSide,transparent:!0,opacity:.5,depthTest:!1,color:"blue"});u._createMesh(v[0],E);var C=a.coordinateToVector3(A,0);return u.getObject3d().position.copy(C),u._setPickObject3d(),u._init(),u}return ae(i,[{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(),n=this.getLayer().getPick(),r=this._geometriesAttributes.length,i=function(t){for(var e=t.length,n=0,r=0;r<e;r++)n+=t[r].position.count;return new Float32Array(3*n)}(this._geometriesAttributes),o=0,s=0;s<r;s++){var a=n.getColor(),u=a.getHex();this._colorMap[u]=s;var l=this._geometriesAttributes[s].position.count;this._datas[s].colorIndex=u;for(var c=0;c<l;c++)i[o]=a.r,i[o+1]=a.g,i[o+2]=a.b,o+=3}t.setAttribute("pickColor",new e.BufferAttribute(i,3,!0));var h=new e.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:e.DoubleSide,transparent:!0}),f=n.getColor().getHex(),p=new e.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}}]),i}(),qu=function(){function e(t,n,r,i,o){oe(this,e),this.map=r.map,this.threeLayer=r,this.groupId=i,this.layerClass=o;var s=[];t.features.forEach((function(t){var e=t.geometry;s.push(e)})),this.lineItems=s}var n;return ae(e,[{key:"addLine",value:(n=ie(ee().mark((function e(){var n,r;return ee().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=[],this.lineItems.forEach((function(e){"Polygon"===e.type?n.push(e):e.coordinates.forEach((function(e){var r=new t.Polygon(e);n.push(r)}))})),r=new Uu(n,{},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 n.apply(this,arguments)})}]),e}(),ju=new rt,zu=new y,Vu=function(t){le(n,Kt);var e=pe(n);function n(){var t;oe(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 qt([-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 qt([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),t}return ae(n,[{key:"applyMatrix4",value:function(t){var e=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),n.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 Jt(e,6,1);return this.setAttribute("instanceStart",new I(n,3,0)),this.setAttribute("instanceEnd",new I(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 Jt(e,6,1);return this.setAttribute("instanceColorStart",new I(n,3,0)),this.setAttribute("instanceColorEnd",new I(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 Wt(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 rt);var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),ju.setFromBufferAttribute(e),this.boundingBox.union(ju))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new it),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 r=0,i=0,o=t.count;i<o;i++)zu.fromBufferAttribute(t,i),r=Math.max(r,n.distanceToSquared(zu)),zu.fromBufferAttribute(e,i),r=Math.max(r,n.distanceToSquared(zu));this.boundingSphere.radius=Math.sqrt(r),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}(),Yu=new y,Hu=new y,Xu=new Dt,Ju=new Dt,Wu=new Dt,Ku=new y,Zu=new o,$u=new Zt,tl=new y,el=new rt,nl=new it,rl=new Dt;function il(t,e,n){return rl.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),rl.multiplyScalar(1/rl.w),rl.x=ku/n.width,rl.y=ku/n.height,rl.applyMatrix4(t.projectionMatrixInverse),rl.multiplyScalar(1/rl.w),Math.abs(Math.max(rl.x,rl.y))}var ol=function(t){le(n,T);var e=pe(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Vu,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ou({color:16777215*Math.random()});return oe(this,n),(t=e.call(this,r,i)).isLineSegments2=!0,t.type="LineSegments2",t}return ae(n,[{key:"computeLineDistances",value:function(){for(var t=this.geometry,e=t.attributes.instanceStart,n=t.attributes.instanceEnd,r=new Float32Array(2*e.count),i=0,o=0,s=e.count;i<s;i++,o+=2)Yu.fromBufferAttribute(e,i),Hu.fromBufferAttribute(n,i),r[o]=0===o?0:r[o-1],r[o+1]=r[o]+Yu.distanceTo(Hu);var a=new Jt(r,2,1);return t.setAttribute("instanceDistanceStart",new I(a,1,0)),t.setAttribute("instanceDistanceEnd",new I(a,1,1)),this}},{key:"raycast",value:function(t,e){var n=this.material.worldUnits,r=t.camera;null!==r||n||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');var i=void 0!==t.params.Line2&&t.params.Line2.threshold||0;Pu=t.ray;var o,s=this.matrixWorld,a=this.geometry,u=this.material;(ku=u.linewidth+i,null===a.boundingSphere&&a.computeBoundingSphere(),nl.copy(a.boundingSphere).applyMatrix4(s),n)?o=.5*ku:o=il(r,Math.max(r.near,nl.distanceToPoint(Pu.origin)),u.resolution);if(nl.radius+=o,!1!==Pu.intersectsSphere(nl)){var l;if(null===a.boundingBox&&a.computeBoundingBox(),el.copy(a.boundingBox).applyMatrix4(s),n)l=.5*ku;else l=il(r,Math.max(r.near,el.distanceToPoint(Pu.origin)),u.resolution);el.expandByScalar(l),!1!==Pu.intersectsBox(el)&&(n?function(t,e){for(var n=t.matrixWorld,r=t.geometry,i=r.attributes.instanceStart,o=r.attributes.instanceEnd,s=0,a=Math.min(r.instanceCount,i.count);s<a;s++){$u.start.fromBufferAttribute(i,s),$u.end.fromBufferAttribute(o,s),$u.applyMatrix4(n);var u=new y,l=new y;Pu.distanceSqToSegment($u.start,$u.end,l,u),l.distanceTo(u)<.5*ku&&e.push({point:l,pointOnLine:u,distance:Pu.origin.distanceTo(l),object:t,face:null,faceIndex:s,uv:null,uv2:null})}}(this,e):function(t,e,n){var r=e.projectionMatrix,i=t.material.resolution,o=t.matrixWorld,s=t.geometry,a=s.attributes.instanceStart,u=s.attributes.instanceEnd,l=Math.min(s.instanceCount,a.count),c=-e.near;Pu.at(1,Wu),Wu.w=1,Wu.applyMatrix4(e.matrixWorldInverse),Wu.applyMatrix4(r),Wu.multiplyScalar(1/Wu.w),Wu.x*=i.x/2,Wu.y*=i.y/2,Wu.z=0,Ku.copy(Wu),Zu.multiplyMatrices(e.matrixWorldInverse,o);for(var h=0,f=l;h<f;h++)if(Xu.fromBufferAttribute(a,h),Ju.fromBufferAttribute(u,h),Xu.w=1,Ju.w=1,Xu.applyMatrix4(Zu),Ju.applyMatrix4(Zu),!(Xu.z>c&&Ju.z>c)){if(Xu.z>c){var p=Xu.z-Ju.z,g=(Xu.z-c)/p;Xu.lerp(Ju,g)}else if(Ju.z>c){var A=Ju.z-Xu.z,d=(Ju.z-c)/A;Ju.lerp(Xu,d)}Xu.applyMatrix4(r),Ju.applyMatrix4(r),Xu.multiplyScalar(1/Xu.w),Ju.multiplyScalar(1/Ju.w),Xu.x*=i.x/2,Xu.y*=i.y/2,Ju.x*=i.x/2,Ju.y*=i.y/2,$u.start.copy(Xu),$u.start.z=0,$u.end.copy(Ju),$u.end.z=0;var v=$u.closestPointToPointParameter(Ku,!0);$u.at(v,tl);var m=F.lerp(Xu.z,Ju.z,v),_=m>=-1&&m<=1,I=Ku.distanceTo(tl)<.5*ku;if(_&&I){$u.start.fromBufferAttribute(a,h),$u.end.fromBufferAttribute(u,h),$u.start.applyMatrix4(o),$u.end.applyMatrix4(o);var E=new y,C=new y;Pu.distanceSqToSegment($u.start,$u.end,C,E),n.push({point:C,pointOnLine:E,distance:Pu.origin.distanceTo(C),object:t,face:null,faceIndex:h,uv:null,uv2:null})}}}(this,r,e))}}}]),n}(),sl=function(t){le(n,Vu);var e=pe(n);function n(){var t;return oe(this,n),(t=e.call(this)).isLineGeometry=!0,t.type="LineGeometry",t}return ae(n,[{key:"setPositions",value:function(t){for(var e=t.length-3,r=new Float32Array(2*e),i=0;i<e;i+=3)r[2*i]=t[i],r[2*i+1]=t[i+1],r[2*i+2]=t[i+2],r[2*i+3]=t[i+3],r[2*i+4]=t[i+4],r[2*i+5]=t[i+5];return Ae(ce(n.prototype),"setPositions",this).call(this,r),this}},{key:"setColors",value:function(t){for(var e=t.length-3,r=new Float32Array(2*e),i=0;i<e;i+=3)r[2*i]=t[i],r[2*i+1]=t[i+1],r[2*i+2]=t[i+2],r[2*i+3]=t[i+3],r[2*i+4]=t[i+4],r[2*i+5]=t[i+5];return Ae(ce(n.prototype),"setColors",this).call(this,r),this}},{key:"fromLine",value:function(t){var e=t.geometry;return this.setPositions(e.attributes.position.array),this}}]),n}(),al=function(t){le(n,ol);var e=pe(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new sl,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ou({color:16777215*Math.random()});return oe(this,n),(t=e.call(this,r,i)).isLine2=!0,t.type="Line2",t}return ae(n)}(),ul={altitude:0,height:10},ll=function(e){le(r,$t);var n=pe(r);function r(e,i,o,s){var a;oe(this,r),i=t.Util.extend({},ul,i,{layer:s,coordinate:e}),a=n.call(this);var u=i,l=u.altitude,c=u.height;a._initOptions(i),a.map=s.map;var h=s.altitudeToVector3(c,c).x;a.beginSizeZoom=i.beginSizeZoom||3,a.endSizeZoom=i.endSizeZoom||12,a.spanSizeZoom=a.endSizeZoom-a.beginSizeZoom,a.stepSize=1/(a.endSizeZoom-a.beginSizeZoom+1);var f=[];f.push(0,0,h),f.push(0,0,0);var p=new sl;p.setPositions(f),a.object3d=new al(p,o),a.object3d.computeLineDistances(),a.object3d.scale.set(1,1,1),a.object3d.__parent=fe(a);var g=s.distanceToVector3(l,l).x,A=s.coordinateToVector3(e,g);return a.getObject3d().position.copy(A),i.closeZoomChange||(a.zoomChange=function(){var t=a.getMap();if(t){var e=t.pixelToDistance(1,0);p.attributes.instanceStart.data.array[2]=h*e*a._getRate(),p.attributes.instanceStart.needsUpdate=!0}}),a}return ae(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}(),cl=function(){function e(t,n,r,i){var o=this;oe(this,e),0!=t.length?(this.map=r.map,this.threeLayer=r,this.groupId=i,this.height=n.height||50,this.renderOrder=n.renderOrder||0,this.isGradient=void 0===n.isGradient||n.isGradient,this.closeZoomChange=n.closeZoomChange||!1,this.dashed=void 0!==n.dashed&&n.dashed,this.dashScale=void 0!==n.dashScale?n.dashScale:2,this.dashSize=void 0!==n.dashSize?n.dashSize:1,this.gapSize=void 0!==n.gapSize?n.gapSize:1,this.meshs=[],t.forEach((function(t){var e;e=o.dashed?new Ou({color:t.color||"#35FFAC",transparent:!0,linewidth:n.linewidth||4,dashed:!0,defines:{USE_DASH:""},dashScale:o.dashScale,dashSize:o.dashSize,gapSize:o.gapSize}):new Ou({color:t.color||"#35FFAC",linewidth:n.lineWidth||4,dashed:!1,transparent:!0,opacity:n.opacity||1}),o._setMaterialRes(r,e);var i=new ll([t.longitude,t.latitude],{height:t.height||o.height,interactive:!1,beginSizeZoom:n.beginSizeZoom||9,endSizeZoom:n.endSizeZoom||16,closeZoomChange:o.closeZoomChange},e,r);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=t):console.error("需要绘制的点位数量为0")}return ae(e,[{key:"_setMaterialRes",value:function(t,e){var n=t.getMap().getSize(),r=n.width,i=n.height;e.resolution.set(r,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(e,n,r){for(var i=1/0,o=1/0,s=-1/0,a=-1/0,u=0;u<this.dataItems.length;u++){var l=this.dataItems[u];e.includes(l.code)?(i=Math.min(i,this.dataItems[u].longitude),o=Math.min(o,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(),n&&this.map.fitExtent(new t.Extent(i,o,s,a),r||0)}},{key:"updateByVisibility",value:function(){var t=this;this.meshs.forEach((function(e,n){.1===t.dataItems[n].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()}))}}]),e}(),hl={altitude:0,height:0},fl=function(n){le(i,$t);var r=pe(i);function i(n,o,s,a){var u;oe(this,i),s=t.Util.extend({},hl,s,{layer:a}),u=r.call(this);var l=s,c=l.width,h=l.height,f=l.altitude;u._initOptions(s);var p=new e.PlaneGeometry(c,h);u._createMesh(p,o);var g=a.distanceToVector3(f,f).x,A=a.coordinateToVector3(n,g);return u.getObject3d().position.copy(A),u}return ae(i)}(),pl=function(){function n(r,i,o,s,a,u,l){var c=this;oe(this,n),this.threelayer=a,this.map=a.map,this.layerClass=u,this.groupId=l,this.millsec=s.millsec||1e3,this.duration=s.duration||75;var h=r.split(","),f=i.split(","),p=parseFloat(h[0]),g=parseFloat(h[1]),A=parseFloat(f[0]),d=parseFloat(f[1]),y=new t.Extent(p,g,A,d),v=1/0,m=1/0,_=-1/0,I=-1/0;[[p,g],[p,d],[A,d],[A,g]].forEach((function(t){var e=c.threelayer.coordinateToVector3(t),n=e.x,r=e.y;v=Math.min(n,v),m=Math.min(r,m),_=Math.max(n,_),I=Math.max(r,I)}));var E=Math.abs(_-v),C=Math.abs(I-m);o.length>1&&jn.generateGifTexture(o,s.width,s.height).then((function(t){c.texture=t.texture,c.annie=new He(t.texture,t.colNum,t.rowNum,o.length,c.duration,t.colNum==t.rowNum);var n=new e.MeshBasicMaterial({map:t.texture,transparent:!0,opacity:void 0!==s.opacity?parseFloat(s.opacity):1}),r=new fl(y.getCenter(),n,{width:E,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 ae(n,[{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()}}]),n}(),gl={radius:50,altitude:0},Al=function(n){le(i,$t);var r=pe(i);function i(n,o,s,a){var u;oe(this,i),o=t.Util.extend({},gl,o,{layer:a}),u=r.call(this),o.altitude,u._initOptions(o);var l=Ne(n),c=a.coordinateToVector3(l),h=[];n.forEach((function(t){var e=a.coordinateToVector3(t);e.sub(c),h.push(e)}));var f=new e.CatmullRomCurve3(h),p=a.distanceToVector3(o.radius,o.radius).x,g=new e.TubeGeometry(f,2,p,20,!1);return u._createMesh(g,s),u.parent=null,u.getObject3d().position.set(c.x,c.y,p/2),u}return ae(i)}(),dl=function(){function t(n,r,i,o){oe(this,t),this.threelayer=i,this.map=i.map,this.groupId=o;var s=new e.MeshMatcapMaterial({color:r.color||"red",side:e.DoubleSide});this.m=s;var a=new Al(n,{radius:r.radius||2},s,i);a.parent=this,this.groupId?this.threelayer.addMesh1(a,this.groupId):this.threelayer.addMesh(a),this.mesh=a}return ae(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}(),yl={radius:100,altitude:0},vl=function(e){le(r,$t);var n=pe(r);function r(e,i,o,s,a){var u;oe(this,r),i=t.Util.extend({},yl,i,{layer:a,coordinate:e}),(u=n.call(this))._initOptions(i);var l=i.altitude;u.object3d=new al(o,s),u.object3d.computeLineDistances(),u.object3d.scale.set(1,1,1),u.object3d.__parent=fe(u);var c=a.distanceToVector3(l,l).x,h=a.coordinateToVector3(e,c);return u.getObject3d().position.copy(h),u}return ae(r)}(),ml={altitude:0,height:0},_l=function(n){le(i,$t);var r=pe(i);function i(n,o,s,a){var u;oe(this,i),s=t.Util.extend({},ml,s,{layer:a}),u=r.call(this);var l=s.altitude;u._initOptions(s);var c=s.scaleFactor||1,h=[],f=new e.ConeGeometry(1*c,2*c,10);f.translate(0,2.5*c,0),h.push(f);var p=new e.CylinderGeometry(.4*c,.6*c,3*c,10);h.push(p);var g=Ce(h);g.computeVertexNormals(),u._createMesh(g,o);var A=a.distanceToVector3(l,l).x,d=a.coordinateToVector3(n,A);return u.getObject3d().position.copy(d),u}return ae(i)}(),Il=function(){function n(r,i,o,s,a){oe(this,n),this.threelayer=o,this.map=o.map,this.layerClass=s,this.groupId=a;var u=void 0===i.lineFlag||!1!==i.lineFlag,l=i.heightDiv||4,c=i.pointsLen||20,h=i.arrowColor||"rgb(0,255,255)",f=i.arrowNum||5;this.speedFactor=i.speedFactor||2e-4,this.material=null,this.curve=null,this.meshs=[],this.arrows=[],this.up=new e.Vector3(0,1,0),this.axis=new e.Vector3,u&&(this.lineMaterial=new Ou({color:i.lineColor||"red",transparent:!0,linewidth:i.linewidth||4}),this._setMaterialRes(o,this.lineMaterial));var p=new e.MeshBasicMaterial({color:h,side:e.DoubleSide,transparent:!0});this.material=p;var g=new t.LineString(r),A=De(g)/l,d=o.distanceToVector3(A,A).x,y=r[0],v=r[1],m=[y[0]/2+v[0]/2,y[1]/2+v[1]/2],_=o.coordinateToVector3(g.getCenter()),I=o.coordinateToVector3(y).sub(_),E=o.coordinateToVector3(v).sub(_),C=o.coordinateToVector3(m,d).sub(_),x=new e.CatmullRomCurve3([I,C,E],!1,"catmullrom");this.curve=x,this.centerPt=_;var w=x.getPoints(c),b=[];w.forEach((function(t){b.push(t.x,t.y,t.z)}));var B=new sl;B.setPositions(b);var S=new vl(g.getCenter(),{interactive:!1},B,this.lineMaterial,o);this.meshs.push(S),this.ArrowNum=f;var M=1/this.ArrowNum;this.addSpan=Math.floor(100*M)/100;for(var L=0;L<this.ArrowNum;L++){var N=new _l(r[0],p,{scaleFactor:i.scaleFactor||1},o);N.object3d.renderOrder=i.arrowOrder||1,this.arrows.push(N)}this.groupId?(this.threelayer.addMesh1(S,this.groupId),this.threelayer.addMesh1(this.arrows,this.groupId)):(this.threelayer.addMesh(S),this.threelayer.addMesh(this.arrows)),this.layerClass.updatables.push(this)}var r;return ae(n,[{key:"tick",value:function(t){if(this.curve)for(var e=this.speedFactor*performance.now(),n=0;n<this.ArrowNum;n++){var r=(e+this.addSpan*n)%1,i=this.curve.getPointAt(r).add(this.centerPt);this.arrows[n].getObject3d().position.copy(i);var o=this.curve.getTangentAt(r);this.axis.crossVectors(this.up,o).normalize();var s=Math.acos(this.up.dot(o));this.arrows[n].getObject3d().quaternion.setFromAxisAngle(this.axis,s)}}},{key:"_setMaterialRes",value:function(t,e){var n=t.getMap().getSize(),r=n.width,i=n.height;e.resolution.set(r,i)}},{key:"loadTexture",value:(r=ie(ee().mark((function t(n){var r;return ee().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.promiseToDoSomething(n);case 2:return r=t.sent,this.texture=new e.CanvasTexture(r.canvas),this.material=new e.MeshBasicMaterial({map:this.texture,side:e.DoubleSide,transparent:!0}),t.abrupt("return",this.material);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)})},{key:"promiseToDoSomething",value:function(t){return new Promise((function(e){var n=document.createElement("canvas").getContext("2d");n.canvas.width=64,n.canvas.height=64,n.translate(35,32),n.rotate(.5*-Math.PI),n.fillStyle=t,n.textAlign="center",n.textBaseline="middle",n.font="48px sans-serif",n.fillText("➡︎",0,0),setTimeout((function(){return e(n)}),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}}]),n}(),El=function(){function n(r,i,o,s,a){var u=this;oe(this,n),this.threelayer=o,this.map=o.map,this.layerClass=s,this.groupId=a;var l=i.heightDiv||4,c=i.pointsLen||20;this.speedFactor=i.speedFactor||.01,this.sum=0,this.meshs=[];var h=new t.LineString(r),f=De(h)/l,p=o.distanceToVector3(f,f).x,g=r[0],A=r[1],d=[g[0]/2+A[0]/2,g[1]/2+A[1]/2],y=o.coordinateToVector3(h.getCenter()),v=o.coordinateToVector3(g).sub(y),m=o.coordinateToVector3(A).sub(y),_=o.coordinateToVector3(d,p).sub(y);this.lineMaterialDash=new Ou({color:i.lineDashColor||"red",transparent:!0,linewidth:i.lineDashWidth||4,dashed:!0,defines:{USE_DASH:""},dashScale:1,dashSize:i.dashSize||20,gapSize:1}),this.lineMaterial=new Ou({color:i.lineColor||"red",transparent:!0,linewidth:i.lineWidth||2,opacity:i.lineOpacity||.4}),this._setMaterialRes(o,this.lineMaterialDash),this._setMaterialRes(o,this.lineMaterial);var I=new e.CatmullRomCurve3([v,_,m],!1,"catmullrom").getPoints(c),E=[];I.forEach((function(t){E.push(t.x,t.y,t.z)}));var C=new sl;C.setPositions(E);var x=new vl(h.getCenter(),{interactive:!1},C,this.lineMaterialDash,o),w=new vl(h.getCenter(),{interactive:!1},C,this.lineMaterial,o),b=w.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(w,this.groupId),this.threelayer.addMesh1(x,this.groupId)):(this.threelayer.addMesh(w),this.threelayer.addMesh(x)),this.meshs.push(w),this.meshs.push(x),this.layerClass.updatables.push(this)}return ae(n,[{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,n,r,i){for(var o=t.geometry.attributes.position,s=new e.CatmullRomCurve3([n,i,r],!1,"catmullrom").getPoints(20),a=0;a<=19;a++){var u=s[a];o.setXYZ(a,u.x,u.y,u.z)}o.needsUpdate=!0,t.computeLineDistances(),t.geometry.attributes.lineDistance.needsUpdate=!0,t.material.dashSize=20}},{key:"_setMaterialRes",value:function(t,e){var n=t.getMap().getSize(),r=n.width,i=n.height;e.resolution.set(r,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()}}]),n}();te.prototype._recursionMesh=function(t){for(;t&&t.parent!==this.getScene()&&!t.parent.customType;)t=t.parent;return t},te.prototype.identify=function(n,r){var i=this;if(!n)return console.error("coordinate is null,it should be Coordinate"),[];if(Array.isArray(n)&&(n=new t.Coordinate(n)),!(n instanceof t.Coordinate))return console.error("coordinate type is error,it should be Coordinate"),[];var o=this.getMap().coordToContainerPoint(n);this._containerPoint=o;var s=o.x,a=o.y;this._initRaycaster(),this.fire("identify",{coordinate:n,options:r});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=s/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(n){var r=n.__parent;if(r&&r.getOptions){var i=r;i.getOptions().interactive&&i.isVisible()&&(i.identify&&t.Util.isFunction(i.identify)?d.push(i):A.push(n))}else(n instanceof e.Mesh||n instanceof e.Group)&&(n.customType?n.children.forEach((function(e){var n=e.__parent;if(n&&n.getOptions){var r=n;r.getOptions().interactive&&r.isVisible()&&(r.identify&&t.Util.isFunction(r.identify)?d.push(r):A.push(e))}})):A.push(n))}));var y=[],v=u.intersectObjects(A,!0);v&&Array.isArray(v)&&v.length&&(y=v.map((function(e){var n=e.object,r=e.instanceId,o=(n=i._recursionMesh(n)||{}).__parent||n;return o.faceIndex=e.faceIndex,o.index=e.index,o.intersect=e,t.Util.isNumber(r)&&(o.instanceId=r),o}))),this.renderPickScene(),d.length&&d.forEach((function(t){t.identify(n)&&y.push(t)}));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=(r=t.Util.extend({},r)).count;return t.Util.isNumber(E)&&E>0?y.slice(0,E):y},te.prototype._zoomend=function(){var e=this.getScene();if(e){var n=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&&t.Util.isFunction(i.zoomChange)&&i.zoomChange(n);var o=i.getMinZoom(),s=i.getMaxZoom();n<o||n>s?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):o<=n&&n<=s&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}));else{var r=e.__parent;if(r&&r.getOptions){var i=r;i.zoomChange&&t.Util.isFunction(i.zoomChange)&&i.zoomChange(n);var o=i.getMinZoom(),s=i.getMaxZoom();n<o||n>s?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):o<=n&&n<=s&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}}))}},te.prototype.addMesh1=function(t,e){var n=this,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)return this;Array.isArray(t)||(t=[t]);var i=this.getScene(),o=void 0;if(e&&(o=i.getObjectByProperty("customId",e)),t.forEach((function(t){if(t instanceof $t){var e;if(o)o.add(t.getObject3d());else console.log("组不存在,销毁创建的对象"),null===(e=t.parent)||void 0===e||e.dispose();t.isAdd||(t.isAdd=!0,t.options.layer=n,t._fire("add",{target:t}))}})),this._zoomend(),r){var s=this._getRenderer();s&&s.setToRedraw()}return this},te.prototype.removeMesh1=function(n,r){var i=this,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!n)return this;Array.isArray(n)||(n=[n]);var s=this.getScene(),a=s.getObjectByProperty("customId",r);if(n.forEach((function(n){if(n instanceof $t){a?a.remove(n.getObject3d()):s.remove(n.getObject3d()),n.isAdd&&(n.isAdd=!1,n._fire("remove",{target:n})),n._animation&&t.Util.isFunction(n._animation)&&delete i._animationBaseObjectMap[n.getObject3d().uuid];var r=i._delayMeshes;if(r.length)for(var o=0,u=r.length;o<u;o++)if(r[o]===n){r.splice(o,1);break}}else n instanceof e.Object3D&&s.remove(n)})),o){var u=this._getRenderer();u&&u.setToRedraw()}return this};var Cl=function(){function t(n,r){var i=this;oe(this,t),this.map=r,this.animationId=null,this.updatables=[];var o=Be();this.threeLayer=new te(o,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new e.Clock;var s=function t(){var e,n;(i.threeLayer._needsUpdate=!i.threeLayer._needsUpdate,i.threeLayer._needsUpdate)&&(null===(e=i.threeLayer)||void 0===e||null===(n=e.getRenderer())||void 0===n||n.clearCanvas(),i.threeLayer.renderScene());var r,o=i.clock.getDelta(),s=Ie(i.updatables);try{for(s.s();!(r=s.n()).done;){r.value.tick(o)}}catch(t){s.e(t)}finally{s.f()}i.animationId=requestAnimationFrame(t)};this.threeLayer.prepareToDraw=function(t,n,r){var i=new e.DirectionalLight(16777215);i.position.set(0,-10,10).normalize(),n.add(i),s()},this.threeLayer.addTo(r),this.layerId=o,this.layerName=n,this.dirty=!1,this.initFlag=!1}var n;return ae(t,[{key:"createGroup",value:(n=ie(ee().mark((function t(e){return ee().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,Se(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 n.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 n=t.getObjectByName(e);return n||(n=new Na(t,e)),n.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=Be();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,n=function e(){var n,r;(t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate)&&(null===(n=t.threeLayer)||void 0===n||null===(r=n.getRenderer())||void 0===r||r.clearCanvas(),t.threeLayer.renderScene());var i,o=t.clock.getDelta(),s=Ie(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,i,o){var s=new e.DirectionalLight(16777215);s.position.set(0,-10,10).normalize(),i.add(s),i.add(new e.AmbientLight(16777215)),n(),r()}}))}},{key:"drawRadar",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new Ue(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new Ue(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawSector",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new ze(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new ze(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawSectorImg",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new Xe(t,e,n||{},r.threeLayer,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new Xe(t,e,n||{},r.threeLayer,r);i(o)}))}))}},{key:"drawImage",value:function(t,e,n,r,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new Oe(t,e,n,r,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new Oe(t,e,n,r,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e){var n=this;return new Promise((function(r){if(n.threeLayer.getScene()){var i=new Ke(t,e||{},n.threeLayer,n);r(i)}else n.initFlag=!0,n.prepareToDraw().then((function(){var i=new Ke(t,e||{},n.threeLayer,n);r(i)}))}))}},{key:"drawPlaneMarker",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=null;t.length>0?(o=new sr(t,e,r.threeLayer,n)).addPoint().then((function(){i(o)})):i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=null;t.length>0?(o=new sr(t,e,r.threeLayer,n)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var n=this;return new Promise((function(r){if(n.threeLayer.getScene()){var i=new Ba(t,e,n.threeLayer,n);r(i)}else n.initFlag=!0,n.prepareToDraw().then((function(){var i=new Ba(t,e,n.threeLayer,n);r(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(n){if(e.threeLayer.getScene()){var r=new La(t,e.threeLayer);n(r)}else e.initFlag=!0,e.prepareToDraw().then((function(){var r=new La(t,e.threeLayer);n(r)}))}))}},{key:"drawFbxModel",value:function(t,e,n,r){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new Nu(t,e,n,i.threeLayer,r);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new Nu(t,e,n,i.threeLayer,r);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new Qu(t,e||{},r.threeLayer,n,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new Qu(t,e||{},r.threeLayer,n,r);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new Du(t,e||{},r.threeLayer,n,r);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new Du(t,e||{},r.threeLayer,n,r);i(o)}))}))}},{key:"drawPolyline",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new Fu(t,e,r.threeLayer,n);o.addLine().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new Fu(t,e,r.threeLayer,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new qu(t,e,r.threeLayer,n,r);o.addLine().then((function(){i(o)}))}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new qu(t,e,r.threeLayer,n,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new cl(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new cl(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"drawTube",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new dl(t,e||{},r.threeLayer,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new dl(t,e||{},r.threeLayer,n);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,n,r,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new pl(t,e,n,r||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new pl(t,e,n,r||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new Il(t,e||{},r.threeLayer,r,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new Il(t,e||{},r.threeLayer,r,n);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,n){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var o=new El(t,e||{},r.threeLayer,r,n);i(o)}else r.initFlag=!0,r.prepareToDraw().then((function(){var o=new El(t,e||{},r.threeLayer,r,n);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(),n=this.threeLayer.getScene(),r=this.threeLayer.getPick(),i=r.pickingTexture;r.pickingScene;var o=this.threeLayer.getRenderer();n.remove(e),e=null,n=null,i.dispose(),i=null,o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer)}}]),t}(),xl=function(){function e(n,r,i,o){oe(this,e),this.map=o,this.geometry=null,this.selectGeometry=null,this.isEndSelect=!1,this.drawTool=new t.DrawTool({mode:n,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=n,this.toolLayer=new t.VectorLayer(t.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 ae(e,[{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}}]),e}();function wl(){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 n=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,n+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3},this._transformlng=function(t,e){var n=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return n+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,n+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,n+=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,n){for(;t>n;)t-=n-e;for(;t<e;)t+=n-e;return t},this._getRange=function(t,e,n){return null!=e&&(t=Math.max(t,e)),null!=n&&(t=Math.min(t,n)),t}}function bl(t,e,n){if(null!==t)for(var r,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=!n||"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(r=0;r<u.length;r++){if(!1===e(u[r],f,y,m,_))return!1;f++,"MultiPoint"===I&&m++}"LineString"===I&&m++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(i=0;i<u[r].length-h;i++){if(!1===e(u[r][i],f,y,m,_))return!1;f++}"MultiLineString"===I&&m++,"Polygon"===I&&_++}"Polygon"===I&&m++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for(_=0,i=0;i<u[r].length;i++){for(o=0;o<u[r][i].length-h;o++){if(!1===e(u[r][i][o],f,y,m,_))return!1;f++}_++}m++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===bl(s.geometries[r],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Bl(t,e,n,r){var i=n;return bl(t,(function(t,r,o,s,a){i=0===r&&void 0===n?t:e(i,t,r,o,s,a)}),r),i}function Sl(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length&&!1!==e(t.features[n].properties,n);n++);break;case"Feature":e(t.properties,0)}}function Ml(t,e,n){var r=n;return Sl(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function Ll(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length&&!1!==e(t.features[n],n);n++);}function Nl(t,e,n){var r=n;return Ll(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function Tl(t){var e=[];return bl(t,(function(t){e.push(t)})),e}function Rl(t,e){var n,r,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(n=0;n<A;n++){for(a=p?t.features[n].geometry:g?t.geometry:t,l=p?t.features[n].properties:g?t.properties:{},c=p?t.features[n].bbox:g?t.bbox:void 0,h=p?t.features[n].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(r=0;r<o.geometries.length;r++)if(!1===e(o.geometries[r],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 Ql(t,e,n){var r=n;return Rl(t,(function(t,i,o,s,a){r=0===i&&void 0===n?t:e(r,t,i,o,s,a)})),r}function Dl(t,e){Rl(t,(function(t,n,r,i,o){var s,a=null===t?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==e(nn(t,r,{bbox:i,id:o}),n,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(nn({type:s,coordinates:l},r),n,u))return!1}}))}function Pl(t,e,n){var r=n;return Dl(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)})),r}function kl(t,e){Dl(t,(function(t,n,r){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!==bl(t,(function(o,c,h,f,p){if(void 0===s||n>a||f>u||p>l)return s=o,a=n,u=f,l=p,void(i=0);var g=ln([s,o],t.properties);if(!1===e(g,n,r,p,i))return!1;i++,s=o}))&&void 0}}}))}function Ol(t,e,n){var r=n,i=!1;return kl(t,(function(t,o,s,a,u){r=!1===i&&void 0===n?t:e(r,t,o,s,a,u),i=!0})),r}function Fl(t,e){if(!t)throw new Error("geojson is required");Dl(t,(function(t,n,r){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,n,r,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===e(ln(o[s],t.properties),n,r,s))return!1}}}))}function Gl(t,e,n){var r=n;return Fl(t,(function(t,i,o,s){r=0===i&&void 0===n?t:e(r,t,i,o,s)})),r}function Ul(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=u.length+s-1),ln([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),ln([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),ln([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),ln([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")}function ql(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":return on(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),on(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),on(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),on(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),on(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),on(u[i][o][s],a,e)}throw new Error("geojson is invalid")}wl.prototype.BD2GCJ=function(t,e){var n=t-.0065,r=e-.006,i=Math.sqrt(n*n+r*r)-2e-5*Math.sin(r*this.x_PI),o=Math.atan2(r,n)-3e-6*Math.cos(n*this.x_PI);return[i*Math.cos(o),i*Math.sin(o)]},wl.prototype.GCJ2BD=function(t,e){var n=Math.sqrt(t*t+e*e)+2e-5*Math.sin(e*this.x_PI),r=Math.atan2(e,t)+3e-6*Math.cos(t*this.x_PI);return[n*Math.cos(r)+.0065,n*Math.sin(r)+.006]},wl.prototype.WGS2GCJ=function(t,e){if(this._out_of_china(t,e))return[t,e];var n=this._transformlat(t-105,e-35),r=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 n=180*n/(this.a*(1-this.ee)/(o*s)*this.PI),[t+(r=180*r/(this.a/s*Math.cos(i)*this.PI)),e+n]},wl.prototype.GCJ2WGS=function(t,e){if(this._out_of_china(t,e))return[t,e];var n=this._transformlat(t-105,e-35),r=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 n=180*n/(this.a*(1-this.ee)/(o*s)*this.PI),[2*t-(t+(r=180*r/(this.a/s*Math.cos(i)*this.PI))),2*e-(e+n)]},wl.prototype.WGS2BD=function(t,e){var n=this.WGS2GCJ(t,e);return n=this.GCJ2BD(n[0],n[1])},wl.prototype.BD2WGS=function(t,e){var n=this.BD2GCJ(t,e);return n=this.GCJ2WGS(n[0],n[1])},wl.prototype.BD_MKT2WGS=function(t,e){var n=null;t=Math.abs(t),e=Math.abs(e);for(var r=0;r<this.MCBAND.length;r++)if(e>=this.MCBAND[r]){n=this.MC2LL[r];break}t=n[0]+n[1]*Math.abs(t);var i=Math.abs(e)/n[9];return e=n[2]+n[3]*i+n[4]*i*i+n[5]*i*i*i+n[6]*i*i*i*i+n[7]*i*i*i*i*i+n[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]},wl.prototype.BD_WGS2MKT=function(t,e){var n=null;t=this._getLoop(t,-180,180),e=this._getRange(e,-74,74);for(var r=0;r<this.LLBAND.length;r++)if(e>=this.LLBAND[r]){n=this.LL2MC[r];break}if(null!=n)for(r=this.LLBAND.length-1;r>=0;r--)if(e<=-this.LLBAND[r]){n=this.LL2MC[r];break}t=n[0]+n[1]*Math.abs(t);var i=Math.abs(e)/n[9];return e=n[2]+n[3]*i+n[4]*i*i+n[5]*i*i*i+n[6]*i*i*i*i+n[7]*i*i*i*i*i+n[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]};var jl=Object.freeze({__proto__:null,coordAll:Tl,coordEach:bl,coordReduce:Bl,featureEach:Ll,featureReduce:Nl,findPoint:ql,findSegment:Ul,flattenEach:Dl,flattenReduce:Pl,geomEach:Rl,geomReduce:Ql,lineEach:Fl,lineReduce:Gl,propEach:Sl,propReduce:Ml,segmentEach:kl,segmentReduce:Ol});function zl(t){var e=[1/0,1/0,-1/0,-1/0];return bl(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}zl.default=zl;
2
+ /*
3
+ object-assign
4
+ (c) Sindre Sorhus
5
+ @license MIT
6
+ */
7
+ var Vl=Object.getOwnPropertySymbols,Yl=Object.prototype.hasOwnProperty,Hl=Object.prototype.propertyIsEnumerable;var Xl=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={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(e).map((function(t){return e[t]}));if("0123456789"!==r.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 n,r,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 n=Object(arguments[o]))Yl.call(n,s)&&(i[s]=n[s]);if(Vl){r=Vl(n);for(var a=0;a<r.length;a++)Hl.call(n,r[a])&&(i[r[a]]=n[r[a]])}}return i},Jl={successCallback:null,verbose:!1},Wl={};
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 Kl(t,e,n){n=n||{};for(var r=Object.keys(Jl),i=0;i<r.length;i++){var o=r[i],s=n[o];s=null!=s?s:Jl[o],Wl[o]=s}Wl.verbose&&console.log("MarchingSquaresJS-isoContours: computing isocontour for "+e);var a=function(t){var e=[],n=0,r=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)&&!$l(i)){var a=function(t,e,n){var r,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][n],f=h.cval,p=l[f],g=ec(h,p);s.push([n+g[0],e+g[1]]),p=c[f],g=ec(h,p),s.push([n+g[0],e+g[1]]),tc(h);var A=n+a[f],d=e+u[f],y=f;for(;A>=0&&d>=0&&d<o&&(A!=n||d!=e)&&void 0!==(h=t[d][A]);){if(0===(f=h.cval)||15===f)return{path:s,info:"mergeable"};p=c[f],r=a[f],i=u[f],5!==f&&10!==f||(5===f?h.flipped?-1===u[y]?(p="left",r=-1,i=0):(p="right",r=1,i=0):-1===a[y]&&(p="bottom",r=0,i=-1):10===f&&(h.flipped?-1===a[y]?(p="top",r=0,i=1):(p="bottom",r=0,i=-1):1===u[y]&&(p="left",r=-1,i=0))),g=ec(h,p),s.push([A+g[0],d+g[1]]),tc(h),A+=r,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=n-1;h>=0;h--)if(Math.abs(e[h][0][0]-l)<=r&&Math.abs(e[h][0][1]-c)<=r){for(var f=a.path.length-2;f>=0;--f)e[h].unshift(a.path[f]);u=!0;break}u||(e[n++]=a.path)}var p}))})),e}(function(t,e){for(var n=t.length-1,r=t[0].length-1,i={rows:n,cols:r,cells:[]},o=0;o<n;++o){i.cells[o]=[];for(var s=0;s<r;++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-Zl(e,u,h),p=1-Zl(e,c,h)):2===a?(p=Zl(e,h,c),A=1-Zl(e,l,c)):3===a?(g=1-Zl(e,u,h),A=1-Zl(e,l,c)):4===a?(f=Zl(e,u,l),A=Zl(e,c,l)):5===a?(f=Zl(e,u,l),A=Zl(e,c,l),p=1-Zl(e,c,h),g=1-Zl(e,u,h)):6===a?(p=Zl(e,h,c),f=Zl(e,u,l)):7===a?(g=1-Zl(e,u,h),f=Zl(e,u,l)):8===a?(g=Zl(e,h,u),f=1-Zl(e,l,u)):9===a?(p=1-Zl(e,c,h),f=1-Zl(e,l,u)):10===a?(f=1-Zl(e,l,u),A=1-Zl(e,l,c),p=Zl(e,h,c),g=Zl(e,h,u)):11===a?(f=1-Zl(e,l,u),A=1-Zl(e,l,c)):12===a?(g=Zl(e,h,u),A=Zl(e,c,l)):13===a?(p=1-Zl(e,c,h),A=Zl(e,c,l)):14===a?(g=Zl(e,h,u),p=Zl(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 Wl.successCallback&&Wl.successCallback(a),a}function Zl(t,e,n){return(t-e)/(n-e)}function $l(t){return 0===t.cval||15===t.cval}function tc(t){$l(t)||5===t.cval||10===t.cval||(t.cval=15)}function ec(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 nc(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.zProperty||"elevation",r=e.flip,i=e.flags;Dn(t,"Point","input must contain Points");for(var o=function(t,e){var n={};Ll(t,(function(t){var e=Nn(t)[1];n[e]||(n[e]=[]),n[e].push(t)}));var r=Object.keys(n).map((function(t){return n[t].sort((function(t,e){return Nn(t)[0]-Nn(e)[0]}))})),i=r.sort((function(t,n){return e?Nn(t[0])[1]-Nn(n[0])[1]:Nn(n[0])[1]-Nn(t[0])[1]}));return i}(t,r),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[n]?l.push(h.properties[n]):l.push(0),!0===i&&(h.properties.matrixPosition=[a,c])}s.push(l)}return s}var rc={exports:{}};function ic(t,e,n,r,i){oc(t,e,n||0,r||t.length-1,i||ac)}function oc(t,e,n,r,i){for(;r>n;){if(r-n>600){var o=r-n+1,s=e-n+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);oc(t,e,Math.max(n,Math.floor(e-s*u/o+l)),Math.min(r,Math.floor(e+(o-s)*u/o+l)),i)}var c=t[e],h=n,f=r;for(sc(t,n,e),i(t[r],c)>0&&sc(t,n,r);h<f;){for(sc(t,h,f),h++,f--;i(t[h],c)<0;)h++;for(;i(t[f],c)>0;)f--}0===i(t[n],c)?sc(t,n,f):sc(t,++f,r),f<=e&&(n=f+1),e<=f&&(r=f-1)}}function sc(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function ac(t,e){return t<e?-1:t>e?1:0}function uc(t,e,n){if(!n)return e.indexOf(t);for(let r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function lc(t,e){cc(t,0,t.children.length,e,t)}function cc(t,e,n,r,i){i||(i=mc(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let o=e;o<n;o++){const e=t.children[o];hc(i,t.leaf?r(e):e)}return i}function hc(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 fc(t,e){return t.minX-e.minX}function pc(t,e){return t.minY-e.minY}function gc(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Ac(t){return t.maxX-t.minX+(t.maxY-t.minY)}function dc(t,e){const n=Math.max(t.minX,e.minX),r=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-n)*Math.max(0,o-r)}function yc(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function vc(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function mc(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function _c(t,e,n,r,i){const o=[e,n];for(;o.length;){if((n=o.pop())-(e=o.pop())<=r)continue;const s=e+Math.ceil((n-e)/r/2)*r;ic(t,s,e,n,i),o.push(e,s,s,n)}}var Ic=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 n=[];if(!vc(t,e))return n;const r=this.toBBox,i=[];for(;e;){for(let o=0;o<e.children.length;o++){const s=e.children[o],a=e.leaf?r(s):s;vc(t,a)&&(e.leaf?n.push(s):yc(t,a)?this._all(s,n):i.push(s))}e=i.pop()}return n}collides(t){let e=this.data;if(!vc(t,e))return!1;const n=[];for(;e;){for(let r=0;r<e.children.length;r++){const i=e.children[r],o=e.leaf?this.toBBox(i):i;if(vc(t,o)){if(e.leaf||yc(t,o))return!0;n.push(i)}}e=n.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=mc([]),this}remove(t,e){if(!t)return this;let n=this.data;const r=this.toBBox(t),i=[],o=[];let s,a,u;for(;n||i.length;){if(n||(n=i.pop(),a=i[i.length-1],s=o.pop(),u=!0),n.leaf){const r=uc(t,n.children,e);if(-1!==r)return n.children.splice(r,1),i.push(n),this._condense(i),this}u||n.leaf||!yc(n,r)?a?(s++,n=a.children[s],u=!1):n=null:(i.push(n),o.push(s),s=0,a=n,n=n.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 n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,r){const i=n-e+1;let o,s=this._maxEntries;if(i<=s)return o=mc(t.slice(e,n+1)),lc(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(s)),s=Math.ceil(i/Math.pow(s,r-1))),o=mc([]),o.leaf=!1,o.height=r;const a=Math.ceil(i/s),u=a*Math.ceil(Math.sqrt(s));_c(t,e,n,u,this.compareMinX);for(let i=e;i<=n;i+=u){const e=Math.min(i+u-1,n);_c(t,i,e,a,this.compareMinY);for(let n=i;n<=e;n+=a){const i=Math.min(n+a-1,e);o.children.push(this._build(t,n,i,r-1))}}return lc(o,this.toBBox),o}_chooseSubtree(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){let n,r=1/0,s=1/0;for(let a=0;a<e.children.length;a++){const u=e.children[a],l=gc(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,r=l<r?l:r,n=u):c===s&&l<r&&(r=l,n=u)}e=n||e.children[0]}var i,o;return e}_insert(t,e,n){const r=n?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,e,i);for(o.children.push(t),hc(o,r);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)}_split(t,e){const n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);const o=this._chooseSplitIndex(n,i,r),s=mc(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,lc(n,this.toBBox),lc(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)}_splitRoot(t,e){this.data=mc([t,e]),this.data.height=t.height+1,this.data.leaf=!1,lc(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let r,i=1/0,o=1/0;for(let s=e;s<=n-e;s++){const e=cc(t,0,s,this.toBBox),a=cc(t,s,n,this.toBBox),u=dc(e,a),l=gc(e)+gc(a);u<i?(i=u,r=s,o=l<o?l:o):u===i&&l<o&&(o=l,r=s)}return r||n-e}_chooseSplitAxis(t,e,n){const r=t.leaf?this.compareMinX:fc,i=t.leaf?this.compareMinY:pc;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)}_allDistMargin(t,e,n,r){t.children.sort(r);const i=this.toBBox,o=cc(t,0,e,i),s=cc(t,n-e,n,i);let a=Ac(o)+Ac(s);for(let r=e;r<n-e;r++){const e=t.children[r];hc(o,t.leaf?i(e):e),a+=Ac(o)}for(let r=n-e-1;r>=e;r--){const e=t.children[r];hc(s,t.leaf?i(e):e),a+=Ac(s)}return a}_adjustParentBBoxes(t,e,n){for(let r=n;r>=0;r--)hc(e[r],t)}_condense(t){for(let e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children,e.splice(e.indexOf(t[n]),1)):this.clear():lc(t[n],this.toBBox)}}}),Ec=Vn(Ic);function Cc(t,e){return t<e?-1:t>e?1:0}var xc=Object.freeze({__proto__:null,default:class{constructor(t=[],e=Cc){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:n}=this,r=e[t];for(;t>0;){const i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r}_down(t){const{data:e,compare:n}=this,r=this.length>>1,i=e[t];for(;t<r;){let r=1+(t<<1),o=e[r];const s=r+1;if(s<this.length&&n(e[s],o)<0&&(r=s,o=e[s]),n(o,i)>=0)break;e[t]=o,t=r}e[t]=i}}}),wc=Vn(xc),bc={exports:{}},Bc=function(t,e,n,r){var i=t[0],o=t[1],s=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);for(var a=(r-n)/2,u=0,l=a-1;u<a;l=u++){var c=e[n+2*u+0],h=e[n+2*u+1],f=e[n+2*l+0],p=e[n+2*l+1];h>o!=p>o&&i<(f-c)*(o-h)/(p-h)+c&&(s=!s)}return s},Sc=function(t,e,n,r){var i=t[0],o=t[1],s=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);for(var a=r-n,u=0,l=a-1;u<a;l=u++){var c=e[u+n][0],h=e[u+n][1],f=e[l+n][0],p=e[l+n][1];h>o!=p>o&&i<(f-c)*(o-h)/(p-h)+c&&(s=!s)}return s};bc.exports=function(t,e,n,r){return e.length>0&&Array.isArray(e[0])?Sc(t,e,n,r):Bc(t,e,n,r)},bc.exports.nested=Sc,bc.exports.flat=Bc;var Mc={exports:{}};!function(t){const e=134217729,n=33306690738754706e-32;function r(t,e,n,r,i){let o,s,a,u,l=e[0],c=r[0],h=0,f=0;c>l==c>-l?(o=l,l=e[++h]):(o=c,c=r[++f]);let p=0;if(h<t&&f<n)for(c>l==c>-l?(a=o-((s=l+o)-l),l=e[++h]):(a=o-((s=c+o)-c),c=r[++f]),o=s,0!==a&&(i[p++]=a);h<t&&f<n;)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=r[++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<n;)a=o-((s=o+c)-(u=s-o))+(c-u),c=r[++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,C,x,w,b,B,S,M,L,N,T,R,Q;const D=t-g,P=o-g,k=i-A,O=p-A;I=(N=(x=D-(C=(E=e*D)-(E-D)))*(b=O-(w=(E=e*O)-(E-O)))-((L=D*O)-C*w-x*w-C*b))-(B=N-(R=(x=k-(C=(E=e*k)-(E-k)))*(b=P-(w=(E=e*P)-(E-P)))-((T=k*P)-C*w-x*w-C*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=(Q=S+B)-S,u[2]=S-(Q-I)+(B-I),u[3]=Q;let F=function(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}(4,u),G=s*d;if(F>=G||-F>=G)return F;if(y=t-(D+(I=t-D))+(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+n*Math.abs(F),(F+=D*_+O*y-(k*m+P*v))>=G||-F>=G)return F;I=(N=(x=y-(C=(E=e*y)-(E-y)))*(b=O-(w=(E=e*O)-(E-O)))-((L=y*O)-C*w-x*w-C*b))-(B=N-(R=(x=v-(C=(E=e*v)-(E-v)))*(b=P-(w=(E=e*P)-(E-P)))-((T=v*P)-C*w-x*w-C*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=(Q=S+B)-S,f[2]=S-(Q-I)+(B-I),f[3]=Q;const U=r(4,u,4,f,l);I=(N=(x=D-(C=(E=e*D)-(E-D)))*(b=_-(w=(E=e*_)-(E-_)))-((L=D*_)-C*w-x*w-C*b))-(B=N-(R=(x=k-(C=(E=e*k)-(E-k)))*(b=m-(w=(E=e*m)-(E-m)))-((T=k*m)-C*w-x*w-C*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=(Q=S+B)-S,f[2]=S-(Q-I)+(B-I),f[3]=Q;const q=r(U,l,4,f,c);I=(N=(x=y-(C=(E=e*y)-(E-y)))*(b=_-(w=(E=e*_)-(E-_)))-((L=y*_)-C*w-x*w-C*b))-(B=N-(R=(x=v-(C=(E=e*v)-(E-v)))*(b=m-(w=(E=e*m)-(E-m)))-((T=v*m)-C*w-x*w-C*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=(Q=S+B)-S,f[2]=S-(Q-I)+(B-I),f[3]=Q;const j=r(q,c,4,f,h);return h[j-1]}(t,i,p,g,A,d,_)},t.orient2dfast=function(t,e,n,r,i,o){return(e-o)*(n-i)-(t-i)*(r-o)},Object.defineProperty(t,"__esModule",{value:!0})}(Mc.exports);var Lc=Ec,Nc=wc,Tc=bc.exports,Rc=Mc.exports.orient2d;function Qc(t,e,n){e=Math.max(0,void 0===e?2:e),n=n||0;var r=function(t){for(var e=t[0],n=t[0],r=t[0],i=t[0],o=0;o<t.length;o++){var s=t[o];s[0]<e[0]&&(e=s),s[0]>r[0]&&(r=s),s[1]<n[1]&&(n=s),s[1]>i[1]&&(i=s)}var a=[e,n,r,i],u=a.slice();for(o=0;o<t.length;o++)Tc(t[o],a)||u.push(t[o]);return function(t){t.sort(Yc);for(var e=[],n=0;n<t.length;n++){for(;e.length>=2&&Gc(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}for(var r=[],i=t.length-1;i>=0;i--){for(;r.length>=2&&Gc(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),e.pop(),e.concat(r)}(u)}(t),i=new Lc(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<r.length;a++){var u=r[a];i.remove(u),o=qc(u,o),s.push(o)}var l=new Lc(16);for(a=0;a<s.length;a++)l.insert(Uc(s[a]));for(var c=e*e,h=n*n;s.length;){var f=s.shift(),p=f.p,g=f.next.p,A=jc(p,g);if(!(A<h)){var d=A/c;(u=Dc(i,f.prev.p,p,g,f.next.next.p,d,l))&&Math.min(jc(u,p),jc(u,g))<=d&&(s.push(f),s.push(qc(u,f)),i.remove(u),l.remove(f),l.insert(Uc(f)),l.insert(Uc(f.next)))}}f=o;var y=[];do{y.push(f.p),f=f.next}while(f!==o);return y.push(f.p),y}function Dc(t,e,n,r,i,o,s){for(var a=new Nc([],Pc),u=t.data;u;){for(var l=0;l<u.children.length;l++){var c=u.children[l],h=u.leaf?zc(c,n,r):kc(n,r,c);h>o||a.push({node:c,dist:h})}for(;a.length&&!a.peek().node.children;){var f=a.pop(),p=f.node,g=zc(p,e,n),A=zc(p,r,i);if(f.dist<g&&f.dist<A&&Fc(n,p,s)&&Fc(r,p,s))return p}(u=a.pop())&&(u=u.node)}return null}function Pc(t,e){return t.dist-e.dist}function kc(t,e,n){if(Oc(t,n)||Oc(e,n))return 0;var r=Vc(t[0],t[1],e[0],e[1],n.minX,n.minY,n.maxX,n.minY);if(0===r)return 0;var i=Vc(t[0],t[1],e[0],e[1],n.minX,n.minY,n.minX,n.maxY);if(0===i)return 0;var o=Vc(t[0],t[1],e[0],e[1],n.maxX,n.minY,n.maxX,n.maxY);if(0===o)return 0;var s=Vc(t[0],t[1],e[0],e[1],n.minX,n.maxY,n.maxX,n.maxY);return 0===s?0:Math.min(r,i,o,s)}function Oc(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function Fc(t,e,n){for(var r,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=n.search({minX:a,minY:u,maxX:l,maxY:c}),f=0;f<h.length;f++)if(r=h[f].p,i=h[f].next.p,o=t,r!==(s=e)&&i!==o&&Gc(r,i,o)>0!=Gc(r,i,s)>0&&Gc(o,s,r)>0!=Gc(o,s,i)>0)return!1;return!0}function Gc(t,e,n){return Rc(t[0],t[1],e[0],e[1],n[0],n[1])}function Uc(t){var e=t.p,n=t.next.p;return t.minX=Math.min(e[0],n[0]),t.minY=Math.min(e[1],n[1]),t.maxX=Math.max(e[0],n[0]),t.maxY=Math.max(e[1],n[1]),t}function qc(t,e){var n={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(n.next=e.next,n.prev=e,e.next.prev=n,e.next=n):(n.prev=n,n.next=n),n}function jc(t,e){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function zc(t,e,n){var r=e[0],i=e[1],o=n[0]-r,s=n[1]-i;if(0!==o||0!==s){var a=((t[0]-r)*o+(t[1]-i)*s)/(o*o+s*s);a>1?(r=n[0],i=n[1]):a>0&&(r+=o*a,i+=s*a)}return(o=t[0]-r)*o+(s=t[1]-i)*s}function Vc(t,e,n,r,i,o,s,a){var u,l,c,h,f=n-t,p=r-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,C=v*_-m*m,x=C,w=C;0===C?(l=0,x=1,h=E,w=_):(h=v*E-m*I,(l=m*E-_*I)<0?(l=0,h=E,w=_):l>x&&(l=x,h=E+m,w=_)),h<0?(h=0,-I<0?l=0:-I>v?l=x:(l=-I,x=v)):h>w&&(h=w,-I+m<0?l=0:-I+m>v?l=x:(l=-I+m,x=v));var b=(1-(c=0===h?0:h/w))*i+c*s-((1-(u=0===l?0:l/x))*t+u*n),B=(1-c)*o+c*a-((1-u)*e+u*r);return b*b+B*B}function Yc(t,e){return t[0]===e[0]?t[1]-e[1]:t[0]-e[0]}Nc.default&&(Nc=Nc.default),rc.exports=Qc,rc.exports.default=Qc;var Hc=rc.exports;function Xc(t,e){void 0===e&&(e={}),e.concavity=e.concavity||1/0;var n=[];if(bl(t,(function(t){n.push([t[0],t[1]])})),!n.length)return null;var r=Hc(n,e.concavity);return r.length>3?an([r]):null}function Jc(t,e){var n=[];return Ll(t,(function(t){var r=!1;if("Point"===t.geometry.type)Rl(e,(function(e){Gn(t,e)&&(r=!0)})),r&&n.push(t);else{if("MultiPoint"!==t.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var i=[];Rl(e,(function(e){bl(t,(function(t){Gn(t,e)&&(r=!0,i.push(t))}))})),r&&n.push(pn(i))}})),hn(n)}function Wc(t,e){var n=!1;return hn(function(t){if(t.length<3)return[];t.sort(Zc);var e,n,r,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 Kc({__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($c(I),p=I.length;p;)n=I[--p],e=I[--p],r=t[a],i=n.x-e.x,o=n.y-e.y,s=2*(i*(r.y-n.y)-o*(r.x-n.x)),Math.abs(s)>f&&m.push(new Kc(e,n,r))}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 r={x:t.geometry.coordinates[0],y:t.geometry.coordinates[1]};return e?r.z=t.properties[e]:3===t.geometry.coordinates.length&&(n=!0,r.z=t.geometry.coordinates[2]),r}))).map((function(t){var e=[t.a.x,t.a.y],r=[t.b.x,t.b.y],i=[t.c.x,t.c.y],o={};return n?(e.push(t.a.z),r.push(t.b.z),i.push(t.c.z)):o={a:t.a.z,b:t.b.z,c:t.c.z},an([[e,r,i,e]],o)})))}var Kc=function(t,e,n){this.a=t,this.b=e,this.c=n;var r,i,o=e.x-t.x,s=e.y-t.y,a=n.x-t.x,u=n.y-t.y,l=o*(t.x+e.x)+s*(t.y+e.y),c=a*(t.x+n.x)+u*(t.y+n.y),h=2*(o*(n.y-e.y)-s*(n.x-e.x));this.x=(u*l-s*c)/h,this.y=(o*c-a*l)/h,r=this.x-t.x,i=this.y-t.y,this.r=r*r+i*i};function Zc(t,e){return e.x-t.x}function $c(t){var e,n,r,i,o,s=t.length;t:for(;s;)for(n=t[--s],e=t[--s],r=s;r;)if(o=t[--r],e===(i=t[--r])&&n===o||e===o&&n===i){t.splice(s,2),t.splice(r,2),s-=2;continue t}}function th(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return eh(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(n){switch(n){case"type":case"features":return;default:e[n]=t[n]}})),e.features=t.features.map((function(t){return eh(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return rh(t);default:throw new Error("unknown GeoJSON type")}}function eh(t){var e={type:"Feature"};return Object.keys(t).forEach((function(n){switch(n){case"type":case"properties":case"geometry":return;default:e[n]=t[n]}})),e.properties=nh(t.properties),e.geometry=rh(t.geometry),e}function nh(t){var e={};return t?(Object.keys(t).forEach((function(n){var r=t[n];"object"==typeof r?null===r?e[n]=null:Array.isArray(r)?e[n]=r.map((function(t){return t})):e[n]=nh(r):e[n]=r})),e):e}function rh(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return rh(t)})),e):(e.coordinates=ih(t.coordinates),e)}function ih(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return ih(t)}))}function oh(t,e){if(void 0===e&&(e={}),!bn(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if("FeatureCollection"!==kn(t))throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");!1!==n&&void 0!==n||(t=th(t));var r=[],i=Gl(t,(function(t,e){var n=function(t,e){var n,r=t.geometry.coordinates,i=e.geometry.coordinates,o=sh(r[0]),s=sh(r[r.length-1]),a=sh(i[0]),u=sh(i[i.length-1]);if(o===u)n=i.concat(r.slice(1));else if(a===s)n=r.concat(i.slice(1));else if(o===a)n=r.slice(1).reverse().concat(i);else{if(s!==u)return null;n=r.concat(i.reverse().slice(1))}return ln(n)}(t,e);return n||(r.push(t),e)}));return i&&r.push(i),r.length?1===r.length?r[0]:fn(r.map((function(t){return t.coordinates}))):null}function sh(t){return t[0].toString()+","+t[1].toString()}function ah(t){return t}function uh(t,e){var n=function(t){if(null==t)return ah;var e,n,r=t.scale[0],i=t.scale[1],o=t.translate[0],s=t.translate[1];return function(t,a){a||(e=n=0);var u=2,l=t.length,c=new Array(l);for(c[0]=(e+=t[0])*r+o,c[1]=(n+=t[1])*i+s;u<l;)c[u]=t[u],++u;return c}}(t.transform),r=t.arcs;function i(t,e){e.length&&e.pop();for(var i=r[t<0?~t:t],o=0,s=i.length;o<s;++o)e.push(n(i[o],o));t<0&&function(t,e){for(var n,r=t.length,i=r-e;i<--r;)n=t[i],t[i++]=t[r],t[r]=n}(e,s)}function o(t){return n(t)}function s(t){for(var e=[],n=0,r=t.length;n<r;++n)i(t[n],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 n,r=e.type;switch(r){case"GeometryCollection":return{type:r,geometries:e.geometries.map(t)};case"Point":n=o(e.coordinates);break;case"MultiPoint":n=e.coordinates.map(o);break;case"LineString":n=s(e.arcs);break;case"MultiLineString":n=e.arcs.map(s);break;case"Polygon":n=u(e.arcs);break;case"MultiPolygon":n=e.arcs.map(u);break;default:return null}return{type:r,coordinates:n}}(e)}function lh(t,e){var n={},r={},i={},o=[],s=-1;function a(t,e){for(var r in t){var i=t[r];delete e[i.start],delete i.start,delete i.end,i.forEach((function(t){n[t<0?~t:t]=1})),o.push(i)}}return e.forEach((function(n,r){var i,o=t.arcs[n<0?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(i=e[++s],e[s]=n,e[r]=i)})),e.forEach((function(e){var n,o,s=function(e){var n,r=t.arcs[e<0?~e:e],i=r[0];t.transform?(n=[0,0],r.forEach((function(t){n[0]+=t[0],n[1]+=t[1]}))):n=r[r.length-1];return e<0?[n,i]:[i,n]}(e),a=s[0],u=s[1];if(n=i[a])if(delete i[n.end],n.push(e),n.end=u,o=r[u]){delete r[o.start];var l=o===n?n:n.concat(o);r[l.start=n.start]=i[l.end=o.end]=l}else r[n.start]=i[n.end]=n;else if(n=r[u])if(delete r[n.start],n.unshift(e),n.start=a,o=i[a]){delete i[o.end];var c=o===n?n:o.concat(n);r[c.start=o.start]=i[c.end=n.end]=c}else r[n.start]=i[n.end]=n;else r[(n=[e]).start=a]=i[n.end=u]=n})),a(i,r),a(r,i),e.forEach((function(t){n[t<0?~t:t]||o.push([t])})),o}function ch(t){return uh(t,hh.apply(this,arguments))}function hh(t,e){var n={},r=[],i=[];function o(t){t.forEach((function(e){e.forEach((function(e){(n[e=e<0?~e:e]||(n[e]=[])).push(t)}))})),r.push(t)}function s(e){return function(t){for(var e,n=-1,r=t.length,i=t[r-1],o=0;++n<r;)e=i,i=t[n],o+=e[0]*i[1]-e[1]*i[0];return Math.abs(o)}(uh(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)}})),r.forEach((function(t){if(!t._){var e=[],r=[t];for(t._=1,i.push(e);t=r.pop();)e.push(t),t.forEach((function(t){t.forEach((function(t){n[t<0?~t:t].forEach((function(t){t._||(t._=1,r.push(t))}))}))}))}})),r.forEach((function(t){delete t._})),{type:"MultiPolygon",arcs:i.map((function(e){var r,i=[];if(e.forEach((function(t){t.forEach((function(t){t.forEach((function(t){n[t<0?~t:t].length<2&&i.push(t)}))}))})),(r=(i=lh(t,i)).length)>1)for(var o,a,u=1,l=s(i[0]);u<r;++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 fh=Object.prototype.hasOwnProperty;function ph(t,e,n,r,i,o){3===arguments.length&&(r=o=Array,i=null);for(var s=new r(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(r,o){for(var l=e(r)&u,c=s[l],h=0;c!=i;){if(n(c,r))return a[l]=o;if(++h>=t)throw new Error("full hashmap");c=s[l=l+1&u]}return s[l]=r,a[l]=o,o},maybeSet:function(r,o){for(var l=e(r)&u,c=s[l],h=0;c!=i;){if(n(c,r))return a[l];if(++h>=t)throw new Error("full hashmap");c=s[l=l+1&u]}return s[l]=r,a[l]=o,o},get:function(r,o){for(var l=e(r)&u,c=s[l],h=0;c!=i;){if(n(c,r))return a[l];if(++h>=t)break;c=s[l=l+1&u]}return o},keys:function(){for(var t=[],e=0,n=s.length;e<n;++e){var r=s[e];r!=i&&t.push(r)}return t}}}function gh(t,e){return t[0]===e[0]&&t[1]===e[1]}var Ah=new ArrayBuffer(16),dh=new Float64Array(Ah),yh=new Uint32Array(Ah);function vh(t){dh[0]=t[0],dh[1]=t[1];var e=yh[0]^yh[1];return 2147483647&(e=e<<5^e>>7^yh[2]^yh[3])}function mh(t){var e,n,r,i,o=t.coordinates,s=t.lines,a=t.rings,u=function(){for(var t=ph(1.4*o.length,I,E,Int32Array,-1,Int32Array),e=new Int32Array(o.length),n=0,r=o.length;n<r;++n)e[n]=t.maybeSet(n,n);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,n=o.length;e<n;++e)l[e]=c[e]=h[e]=-1;for(e=0,n=s.length;e<n;++e){var g=s[e],A=g[0],d=g[1];for(r=u[A],i=u[++A],++p,f[r]=1;++A<=d;)_(e,r,r=i,i=u[A]);++p,f[i]=1}for(e=0,n=o.length;e<n;++e)l[e]=-1;for(e=0,n=a.length;e<n;++e){var y=a[e],v=y[0]+1,m=y[1];for(_(e,u[m-1],r=u[v-1],i=u[v]);++v<=m;)_(e,r,r=i,i=u[v])}function _(t,e,n,r){if(l[n]!==t){l[n]=t;var i=c[n];if(i>=0){var o=h[n];i===e&&o===r||i===r&&o===e||(++p,f[n]=1)}else c[n]=e,h[n]=r}}function I(t){return vh(o[t])}function E(t,e){return gh(o[t],o[e])}l=c=h=null;var C,x=function(t,e,n,r,i){3===arguments.length&&(r=Array,i=null);for(var o=new r(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(r){for(var a=e(r)&s,u=o[a],l=0;u!=i;){if(n(u,r))return!0;if(++l>=t)throw new Error("full hashset");u=o[a=a+1&s]}return o[a]=r,!0},has:function(r){for(var a=e(r)&s,u=o[a],l=0;u!=i;){if(n(u,r))return!0;if(++l>=t)break;u=o[a=a+1&s]}return!1},values:function(){for(var t=[],e=0,n=o.length;e<n;++e){var r=o[e];r!=i&&t.push(r)}return t}}}(1.4*p,vh,gh);for(e=0,n=o.length;e<n;++e)f[C=u[e]]&&x.add(o[C]);return x}function _h(t,e,n,r){Ih(t,e,n),Ih(t,e,e+r),Ih(t,e+r,n)}function Ih(t,e,n){for(var r,i=e+(n---e>>1);e<i;++e,--n)r=t[e],t[e]=t[n],t[n]=r}function Eh(t){var e,n,r={};for(e in t)r[e]=null==(n=t[e])?{type:null}:("FeatureCollection"===n.type?Ch:"Feature"===n.type?xh:wh)(n);return r}function Ch(t){var e={type:"GeometryCollection",geometries:t.features.map(xh)};return null!=t.bbox&&(e.bbox=t.bbox),e}function xh(t){var e,n=wh(t.geometry);for(e in null!=t.id&&(n.id=t.id),null!=t.bbox&&(n.bbox=t.bbox),t.properties){n.properties=t.properties;break}return n}function wh(t){if(null==t)return{type:null};var e="GeometryCollection"===t.type?{type:"GeometryCollection",geometries:t.geometries.map(wh)}:"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 bh(t,e){var n=function(t){var e=1/0,n=1/0,r=-1/0,i=-1/0;function o(t){null!=t&&fh.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>r&&(r=o),s<n&&(n=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 r>=e&&i>=n?[e,n,r,i]:void 0}(t=Eh(t)),r=e>0&&n&&function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=o-r?(n-1)/(o-r):1,u=s-i?(n-1)/(s-i):1;function l(t){return[Math.round((t[0]-r)*a),Math.round((t[1]-i)*u)]}function c(t,e){for(var n,o,s,l,c,h=-1,f=0,p=t.length,g=new Array(p);++h<p;)n=t[h],l=Math.round((n[0]-r)*a),c=Math.round((n[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&&fh.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:[r,i]}}(t,n,e),i=function(t){var e,n,r,i,o=t.coordinates,s=t.lines,a=t.rings,u=s.length+a.length;for(delete t.lines,delete t.rings,r=0,i=s.length;r<i;++r)for(e=s[r];e=e.next;)++u;for(r=0,i=a.length;r<i;++r)for(n=a[r];n=n.next;)++u;var l=ph(2*u*1.4,vh,gh),c=t.arcs=[];for(r=0,i=s.length;r<i;++r){e=s[r];do{h(e)}while(e=e.next)}for(r=0,i=a.length;r<i;++r)if((n=a[r]).next)do{h(n)}while(n=n.next);else f(n);function h(t){var e,n,r,i,s,a,u,h;if(r=l.get(e=o[t[0]]))for(u=0,h=r.length;u<h;++u)if(p(i=r[u],t))return t[0]=i[0],void(t[1]=i[1]);if(s=l.get(n=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]);r?r.push(t):l.set(e,[t]),s?s.push(t):l.set(n,[t]),c.push(t)}function f(t){var e,n,r,i,s;if(n=l.get(o[t[0]]))for(i=0,s=n.length;i<s;++i){if(A(r=n[i],t))return t[0]=r[0],void(t[1]=r[1]);if(d(r,t))return t[0]=r[1],void(t[1]=r[0])}if(n=l.get(e=o[t[0]+y(t)]))for(i=0,s=n.length;i<s;++i){if(A(r=n[i],t))return t[0]=r[0],void(t[1]=r[1]);if(d(r,t))return t[0]=r[1],void(t[1]=r[0])}n?n.push(t):l.set(e,[t]),c.push(t)}function p(t,e){var n=t[0],r=e[0],i=t[1];if(n-i!=r-e[1])return!1;for(;n<=i;++n,++r)if(!gh(o[n],o[r]))return!1;return!0}function g(t,e){var n=t[0],r=e[0],i=t[1],s=e[1];if(n-i!=r-s)return!1;for(;n<=i;++n,--s)if(!gh(o[n],o[s]))return!1;return!0}function A(t,e){var n=t[0],r=e[0],i=t[1]-n;if(i!==e[1]-r)return!1;for(var s=y(t),a=y(e),u=0;u<i;++u)if(!gh(o[n+(u+s)%i],o[r+(u+a)%i]))return!1;return!0}function d(t,e){var n=t[0],r=e[0],i=t[1],s=e[1],a=i-n;if(a!==s-r)return!1;for(var u=y(t),l=a-y(e),c=0;c<a;++c)if(!gh(o[n+(c+u)%a],o[s-(c+l)%a]))return!1;return!0}function y(t){for(var e=t[0],n=t[1],r=e,i=r,s=o[r];++r<n;){var a=o[r];(a[0]<s[0]||a[0]===s[0]&&a[1]<s[1])&&(i=r,s=a)}return i-e}return t}(function(t){var e,n,r,i=mh(t),o=t.coordinates,s=t.lines,a=t.rings;for(n=0,r=s.length;n<r;++n)for(var u=s[n],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(n=0,r=a.length;n<r;++n)for(var h=a[n],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):(_h(o,f,g,g-p),o[g]=o[f],A=!0,p=f));return t}(function(t){var e=-1,n=[],r=[],i=[];function o(t){t&&fh.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 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 u(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 l(t){return t.map(u)}for(var c in t)o(t[c]);return{type:"Topology",coordinates:i,lines:n,rings:r,objects:t}}(t))),o=i.coordinates,s=ph(1.4*i.arcs.length,Bh,Sh);function a(t){t&&fh.call(u,t.type)&&u[t.type](t)}t=i.objects,i.bbox=n,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 n=s.get(t);e.push(t[0]<t[1]?n:~n)}while(t=t.next);return e}function c(t){return t.map(l)}for(var h in t)a(t[h]);return r&&(i.transform=r,i.arcs=function(t){for(var e=-1,n=t.length;++e<n;){for(var r,i,o=t[e],s=0,a=1,u=o.length,l=o[0],c=l[0],h=l[1];++s<u;)r=(l=o[s])[0],i=l[1],r===c&&i===h||(o[a++]=[r-c,i-h],c=r,h=i);1===a&&(o[a++]=[0,0]),o.length=a}return t}(i.arcs)),i}function Bh(t){var e,n=t[0],r=t[1];return r<n&&(e=n,n=r,r=e),n+31*r}function Sh(t,e){var n,r=t[0],i=t[1],o=e[0],s=e[1];return i<r&&(n=r,r=i,i=n),s<o&&(n=o,o=s,s=n),r===o&&i===s}function Mh(t,e){if(void 0===e&&(e={}),!bn(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if("FeatureCollection"!==kn(t))throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");!1!==n&&void 0!==n||(t=th(t));var r=function(t){var e={};Dl(t,(function(t){e[t.geometry.type]=!0}));var n=Object.keys(e);if(1===n.length)return n[0];return null}(t);if(!r)throw new Error("geojson must be homogenous");var i=t;switch(r){case"LineString":return oh(i,e);case"Polygon":return function(t,e){if(void 0===e&&(e={}),"FeatureCollection"!==kn(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=th(t));var n=[];Dl(t,(function(t){n.push(t.geometry)}));var r=bh({geoms:An(n).geometry});return ch(r,r.objects.geoms.geometries)}(i,e);default:throw new Error(r+" is not supported")}}var Lh={exports:{}},Nh={exports:{}};Nh.exports=function(){function t(t,n,i,o,s){e(t,n,i||0,o||t.length-1,s||r)}function e(t,r,i,o,s){for(;o>i;){if(o-i>600){var a=o-i+1,u=r-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,r,Math.max(i,Math.floor(r-u*c/a+h)),Math.min(o,Math.floor(r+(a-u)*c/a+h)),s)}var f=t[r],p=i,g=o;for(n(t,i,r),s(t[o],f)>0&&n(t,i,o);p<g;){for(n(t,p,g),p++,g--;s(t[p],f)<0;)p++;for(;s(t[g],f)>0;)g--}0===s(t[i],f)?n(t,i,g):n(t,++g,o),g<=r&&(i=g+1),r<=g&&(o=g-1)}}function n(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function r(t,e){return t<e?-1:t>e?1:0}return t}(),Lh.exports=Rh,Lh.exports.default=Rh;var Th=Nh.exports;function Rh(t,e){if(!(this instanceof Rh))return new Rh(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 Qh(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function Dh(t,e){Ph(t,0,t.children.length,e,t)}function Ph(t,e,n,r,i){i||(i=zh(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o,s=e;s<n;s++)o=t.children[s],kh(i,t.leaf?r(o):o);return i}function kh(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 Oh(t,e){return t.minX-e.minX}function Fh(t,e){return t.minY-e.minY}function Gh(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Uh(t){return t.maxX-t.minX+(t.maxY-t.minY)}function qh(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function jh(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function zh(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Vh(t,e,n,r,i){for(var o,s=[e,n];s.length;)(n=s.pop())-(e=s.pop())<=r||(o=e+Math.ceil((n-e)/r/2)*r,Th(t,o,e,n,i),s.push(e,o,o,n))}Rh.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,n=[],r=this.toBBox;if(!jh(t,e))return n;for(var i,o,s,a,u=[];e;){for(i=0,o=e.children.length;i<o;i++)s=e.children[i],jh(t,a=e.leaf?r(s):s)&&(e.leaf?n.push(s):qh(t,a)?this._all(s,n):u.push(s));e=u.pop()}return n},collides:function(t){var e=this.data,n=this.toBBox;if(!jh(t,e))return!1;for(var r,i,o,s,a=[];e;){for(r=0,i=e.children.length;r<i;r++)if(o=e.children[r],jh(t,s=e.leaf?n(o):o)){if(e.leaf||qh(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,n=t.length;e<n;e++)this.insert(t[e]);return this}var r=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===r.height)this._splitRoot(this.data,r);else{if(this.data.height<r.height){var i=this.data;this.data=r,r=i}this._insert(r,this.data.height-r.height-1,!0)}else this.data=r;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=zh([]),this},remove:function(t,e){if(!t)return this;for(var n,r,i,o,s=this.data,a=this.toBBox(t),u=[],l=[];s||u.length;){if(s||(s=u.pop(),r=u[u.length-1],n=l.pop(),o=!0),s.leaf&&-1!==(i=Qh(t,s.children,e)))return s.children.splice(i,1),u.push(s),this._condense(u),this;o||s.leaf||!qh(s,a)?r?(n++,s=r.children[n],o=!1):s=null:(u.push(s),l.push(n),n=0,r=s,s=s.children[0])}return this},toBBox:function(t){return t},compareMinX:Oh,compareMinY:Fh,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},_build:function(t,e,n,r){var i,o=n-e+1,s=this._maxEntries;if(o<=s)return Dh(i=zh(t.slice(e,n+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,r-1))),(i=zh([])).leaf=!1,i.height=r;var a,u,l,c,h=Math.ceil(o/s),f=h*Math.ceil(Math.sqrt(s));for(Vh(t,e,n,f,this.compareMinX),a=e;a<=n;a+=f)for(Vh(t,a,l=Math.min(a+f-1,n),h,this.compareMinY),u=a;u<=l;u+=h)c=Math.min(u+h-1,l),i.children.push(this._build(t,u,c,r-1));return Dh(i,this.toBBox),i},_chooseSubtree:function(t,e,n,r){for(var i,o,s,a,u,l,c,h,f,p;r.push(e),!e.leaf&&r.length-1!==n;){for(c=h=1/0,i=0,o=e.children.length;i<o;i++)u=Gh(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,n){var r=this.toBBox,i=n?t:r(t),o=[],s=this._chooseSubtree(i,this.data,e,o);for(s.children.push(t),kh(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 n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),s=zh(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,Dh(n,this.toBBox),Dh(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},_splitRoot:function(t,e){this.data=zh([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Dh(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){var r,i,o,s,a,u,l,c,h,f,p,g,A,d;for(u=l=1/0,r=e;r<=n-e;r++)i=Ph(t,0,r,this.toBBox),o=Ph(t,r,n,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=Gh(i)+Gh(o),s<u?(u=s,c=r,l=a<l?a:l):s===u&&a<l&&(l=a,c=r);return c},_chooseSplitAxis:function(t,e,n){var r=t.leaf?this.compareMinX:Oh,i=t.leaf?this.compareMinY:Fh;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)},_allDistMargin:function(t,e,n,r){t.children.sort(r);var i,o,s=this.toBBox,a=Ph(t,0,e,s),u=Ph(t,n-e,n,s),l=Uh(a)+Uh(u);for(i=e;i<n-e;i++)o=t.children[i],kh(a,t.leaf?s(o):o),l+=Uh(a);for(i=n-e-1;i>=e;i--)o=t.children[i],kh(u,t.leaf?s(o):o),l+=Uh(u);return l},_adjustParentBBoxes:function(t,e,n){for(var r=n;r>=0;r--)kh(e[r],t)},_condense:function(t){for(var e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children).splice(e.indexOf(t[n]),1):this.clear():Dh(t[n],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 Yh=Lh.exports;function Hh(t,e){void 0===e&&(e={});var n="object"==typeof e?e.mutate:e;if(!t)throw new Error("geojson is required");var r=kn(t),i=[];switch(r){case"LineString":i=Xh(t);break;case"MultiLineString":case"Polygon":Nn(t).forEach((function(t){i.push(Xh(t))}));break;case"MultiPolygon":Nn(t).forEach((function(t){var e=[];t.forEach((function(t){e.push(Xh(t))})),i.push(e)}));break;case"Point":return t;case"MultiPoint":var o={};Nn(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(r+" geometry not supported")}return t.coordinates?!0===n?(t.coordinates=i,t):{type:r,coordinates:i}:!0===n?(t.geometry.coordinates=i,t):nn({type:r,coordinates:i},t.properties,{bbox:t.bbox,id:t.id})}function Xh(t){var e=Nn(t);if(2===e.length&&!Jh(e[0],e[1]))return e;var n=[],r=e.length-1,i=n.length;n.push(e[0]);for(var o=1;o<r;o++){var s=n[n.length-1];e[o][0]===s[0]&&e[o][1]===s[1]||(n.push(e[o]),(i=n.length)>2&&Wh(n[i-3],n[i-1],n[i-2])&&n.splice(n.length-2,1))}if(n.push(e[e.length-1]),i=n.length,Jh(e[0],e[e.length-1])&&i<4)throw new Error("invalid polygon");return Wh(n[i-3],n[i-1],n[i-2])&&n.splice(n.length-2,1),n}function Jh(t,e){return t[0]===e[0]&&t[1]===e[1]}function Wh(t,e,n){var r=n[0],i=n[1],o=t[0],s=t[1],a=e[0],u=e[1],l=a-o,c=u-s;return 0===(r-o)*c-(i-s)*l&&(Math.abs(l)>=Math.abs(c)?l>0?o<=r&&r<=a:a<=r&&r<=o:c>0?s<=i&&i<=u:u<=i&&i<=s)}function Kh(t,e,n){var r=e.x,i=e.y,o=n.x-r,s=n.y-i;if(0!==o||0!==s){var a=((t.x-r)*o+(t.y-i)*s)/(o*o+s*s);a>1?(r=n.x,i=n.y):a>0&&(r+=o*a,i+=s*a)}return(o=t.x-r)*o+(s=t.y-i)*s}function Zh(t,e,n,r,i){for(var o,s=r,a=e+1;a<n;a++){var u=Kh(t[a],t[e],t[n]);u>s&&(o=a,s=u)}s>r&&(o-e>1&&Zh(t,e,o,r,i),i.push(t[o]),n-o>1&&Zh(t,o,n,r,i))}function $h(t,e){var n=t.length-1,r=[t[0]];return Zh(t,0,n,e,r),r.push(t[n]),r}function tf(t,e,n){if(t.length<=2)return t;var r=void 0!==e?e*e:1;return t=n?t:function(t,e){for(var n,r,i,o,s,a=t[0],u=[a],l=1,c=t.length;l<c;l++)n=t[l],i=a,o=void 0,s=void 0,o=(r=n).x-i.x,s=r.y-i.y,o*o+s*s>e&&(u.push(n),a=n);return a!==n&&u.push(n),u}(t,r),t=$h(t,r)}function ef(t,e,n){return tf(t.map((function(t){return{x:t[0],y:t[1],z:t[2]}})),e,n).map((function(t){return t.z?[t.x,t.y,t.z]:[t.x,t.y]}))}function nf(t,e,n){return t.map((function(t){var r=t.map((function(t){return{x:t[0],y:t[1]}}));if(r.length<4)throw new Error("invalid polygon");for(var i=tf(r,e,n).map((function(t){return[t.x,t.y]}));!rf(i);)i=tf(r,e-=.01*e,n).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 rf(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 of=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 n=this.points[e],r=this.points[e+1];this.centers.push({x:(n.x+r.x)/2,y:(n.y+r.y)/2,z:(n.z+r.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=[],n=this.pos(0);e.push(0);for(var r=0;r<this.duration;r+=10){var i=this.pos(r);Math.sqrt((i.x-n.x)*(i.x-n.x)+(i.y-n.y)*(i.y-n.y)+(i.z-n.z)*(i.z-n.z))>t&&(e.push(r),n=i)}return e},t.prototype.vector=function(t){var e=this.pos(t+10),n=this.pos(t-10);return{angle:180*Math.atan2(e.y-n.y,e.x-n.x)/3.14,speed:Math.sqrt((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)+(n.z-e.z)*(n.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 n=e/this.duration;if(n>=1)return this.points[this.length-1];var r=Math.floor((this.points.length-1)*n);return function(t,e,n,r,i){var o=function(t){var e=t*t,n=e*t;return[n,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}(t);return{x:i.x*o[0]+r.x*o[1]+n.x*o[2]+e.x*o[3],y:i.y*o[0]+r.y*o[1]+n.y*o[2]+e.y*o[3],z:i.z*o[0]+r.z*o[1]+n.z*o[2]+e.z*o[3]}}((this.length-1)*n-r,this.points[r],this.controls[r][1],this.controls[r+1][0],this.points[r+1])},t}();function sf(t,e){void 0===e&&(e={});for(var n=e.resolution||1e4,r=e.sharpness||.85,i=[],o=Pn(t).coordinates.map((function(t){return{x:t[0],y:t[1]}})),s=new of({duration:n,points:o,sharpness:r}),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),ln(i,e.properties)}function af(t,e){void 0===e&&(e={});var n=Number(t[0]),r=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=[n,r];return an([[s,[i,r],[i,o],[n,o],s]],e.properties,{bbox:t,id:e.id})}function uf(t){return af(zl(t))}function lf(t){var e=t[0],n=t[1],r=t[2],i=t[3];if(Fn(t.slice(0,2),[r,n])>=Fn(t.slice(0,2),[e,i])){var o=(n+i)/2;return[e,o-(r-e)/2,r,o+(r-e)/2]}var s=(e+r)/2;return[s-(i-n)/2,n,s+(i-n)/2,i]}function cf(t,e,n,r){void 0===r&&(r={});var i=Ln(t),o=En(i[0]),s=En(i[1]),a=En(n),u=vn(e,r.units),l=Math.asin(Math.sin(s)*Math.cos(u)+Math.cos(s)*Math.sin(u)*Math.cos(a));return on([In(o+Math.atan2(Math.sin(a)*Math.sin(u)*Math.cos(s),Math.cos(u)-Math.sin(s)*Math.sin(l))),In(l)],r.properties)}function hf(t,e,n){void 0===n&&(n={});for(var r=n.steps||64,i=n.properties?n.properties:!Array.isArray(t)&&"Feature"===t.type&&t.properties?t.properties:{},o=[],s=0;s<r;s++)o.push(cf(t,e,-360*s/r,n).geometry.coordinates);return o.push(o[0]),an([o],i)}function ff(t,e,n){if(void 0===n&&(n={}),!0===n.final)return function(t,e){var n=ff(e,t);return n=(n+180)%360}(t,e);var r=Ln(t),i=Ln(e),o=En(r[0]),s=En(i[0]),a=En(r[1]),u=En(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 In(Math.atan2(l,c))}function pf(t,e){void 0===e&&(e={});var n=zl(t);return on([(n[0]+n[2])/2,(n[1]+n[3])/2],e.properties,e)}function gf(t,e){void 0===e&&(e={});var n=0,r=0,i=0;return bl(t,(function(t){n+=t[0],r+=t[1],i++}),!0),on([n/i,r/i],e.properties)}function Af(t){var e=[];return"FeatureCollection"===t.type?Ll(t,(function(t){bl(t,(function(n){e.push(on(n,t.properties))}))})):bl(t,(function(n){e.push(on(n,t.properties))})),hn(e)}var df={exports:{}};function yf(t,e,n){n=n||2;var r,i,o,s,a,u,l,c=e&&e.length,h=c?e[0]*n:t.length,f=vf(t,0,h,n,!0),p=[];if(!f||f.next===f.prev)return p;if(c&&(f=function(t,e,n,r){var i,o,s,a=[];for(i=0,o=e.length;i<o;i++)(s=vf(t,e[i]*r,i<o-1?e[i+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),a.push(Mf(s));for(a.sort(wf),i=0;i<a.length;i++)n=bf(a[i],n);return n}(t,e,f,n)),t.length>80*n){r=o=t[0],i=s=t[1];for(var g=n;g<h;g+=n)(a=t[g])<r&&(r=a),(u=t[g+1])<i&&(i=u),a>o&&(o=a),u>s&&(s=u);l=0!==(l=Math.max(o-r,s-i))?32767/l:0}return _f(f,p,n,r,i,l,0),p}function vf(t,e,n,r,i){var o,s;if(i===qf(t,e,n,r)>0)for(o=e;o<n;o+=r)s=Ff(o,t[o],t[o+1],s);else for(o=n-r;o>=e;o-=r)s=Ff(o,t[o],t[o+1],s);return s&&Rf(s,s.next)&&(Gf(s),s=s.next),s}function mf(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!Rf(r,r.next)&&0!==Tf(r.prev,r,r.next))r=r.next;else{if(Gf(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function _f(t,e,n,r,i,o,s){if(t){!s&&o&&function(t,e,n,r){var i=t;do{0===i.z&&(i.z=Sf(i.x,i.y,e,n,r)),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,n,r,i,o,s,a,u,l=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,r=n,a=0,e=0;e<l&&(a++,r=r.nextZ);e++);for(u=l;a>0||u>0&&r;)0!==a&&(0===u||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,l*=2}while(s>1)}(i)}(t,r,i,o);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,o?Ef(t,r,i,o):If(t))e.push(a.i/n|0),e.push(t.i/n|0),e.push(u.i/n|0),Gf(t),t=u.next,l=u.next;else if((t=u)===l){s?1===s?_f(t=Cf(mf(t),e,n),e,n,r,i,o,2):2===s&&xf(t,e,n,r,i,o):_f(mf(t),e,n,r,i,o,1);break}}}function If(t){var e=t.prev,n=t,r=t.next;if(Tf(e,n,r)>=0)return!1;for(var i=e.x,o=n.x,s=r.x,a=e.y,u=n.y,l=r.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=r.next;g!==e;){if(g.x>=c&&g.x<=f&&g.y>=h&&g.y<=p&&Lf(i,a,o,u,s,l,g.x,g.y)&&Tf(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function Ef(t,e,n,r){var i=t.prev,o=t,s=t.next;if(Tf(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=Sf(p,g,e,n,r),v=Sf(A,d,e,n,r),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&&Lf(a,c,u,h,l,f,m.x,m.y)&&Tf(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,_.x>=p&&_.x<=A&&_.y>=g&&_.y<=d&&_!==i&&_!==s&&Lf(a,c,u,h,l,f,_.x,_.y)&&Tf(_.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&&Lf(a,c,u,h,l,f,m.x,m.y)&&Tf(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&&Lf(a,c,u,h,l,f,_.x,_.y)&&Tf(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function Cf(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!Rf(i,o)&&Qf(i,r,r.next,o)&&kf(i,o)&&kf(o,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(o.i/n|0),Gf(r),Gf(r.next),r=t=o),r=r.next}while(r!==t);return mf(r)}function xf(t,e,n,r,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&Nf(s,a)){var u=Of(s,a);return s=mf(s,s.next),u=mf(u,u.next),_f(s,e,n,r,i,o,0),void _f(u,e,n,r,i,o,0)}a=a.next}s=s.next}while(s!==t)}function wf(t,e){return t.x-e.x}function bf(t,e){var n=function(t,e){var n,r=e,i=t.x,o=t.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s&&(s=a,n=r.x<r.next.x?r:r.next,a===i))return n}r=r.next}while(r!==e);if(!n)return null;var u,l=n,c=n.x,h=n.y,f=1/0;r=n;do{i>=r.x&&r.x>=c&&i!==r.x&&Lf(o<h?i:s,o,c,h,o<h?s:i,o,r.x,r.y)&&(u=Math.abs(o-r.y)/(i-r.x),kf(r,t)&&(u<f||u===f&&(r.x>n.x||r.x===n.x&&Bf(n,r)))&&(n=r,f=u)),r=r.next}while(r!==l);return n}(t,e);if(!n)return e;var r=Of(n,t);return mf(r,r.next),mf(n,n.next)}function Bf(t,e){return Tf(t.prev,t,e.prev)<0&&Tf(e.next,t,t.next)<0}function Sf(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Mf(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function Lf(t,e,n,r,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function Nf(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Qf(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(kf(t,e)&&kf(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(Tf(t.prev,t,e.prev)||Tf(t,e.prev,e))||Rf(t,e)&&Tf(t.prev,t,t.next)>0&&Tf(e.prev,e,e.next)>0)}function Tf(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Rf(t,e){return t.x===e.x&&t.y===e.y}function Qf(t,e,n,r){var i=Pf(Tf(t,e,n)),o=Pf(Tf(t,e,r)),s=Pf(Tf(n,r,t)),a=Pf(Tf(n,r,e));return i!==o&&s!==a||(!(0!==i||!Df(t,n,e))||(!(0!==o||!Df(t,r,e))||(!(0!==s||!Df(n,t,r))||!(0!==a||!Df(n,e,r)))))}function Df(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Pf(t){return t>0?1:t<0?-1:0}function kf(t,e){return Tf(t.prev,t,t.next)<0?Tf(t,e,t.next)>=0&&Tf(t,t.prev,e)>=0:Tf(t,e,t.prev)<0||Tf(t,t.next,e)<0}function Of(t,e){var n=new Uf(t.i,t.x,t.y),r=new Uf(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Ff(t,e,n,r){var i=new Uf(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Gf(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 Uf(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function qf(t,e,n,r){for(var i=0,o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}df.exports=yf,df.exports.default=yf,yf.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(qf(t,0,o,n));if(i)for(var a=0,u=e.length;a<u;a++){var l=e[a]*n,c=a<u-1?e[a+1]*n:t.length;s-=Math.abs(qf(t,l,c,n))}var h=0;for(a=0;a<r.length;a+=3){var f=r[a]*n,p=r[a+1]*n,g=r[a+2]*n;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)},yf.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[i][o][s]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n};var jf=df.exports;function zf(t){var e=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[i][o][s]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n}(t),n=jf(e.vertices,e.holes,2),r=[],i=[];n.forEach((function(t,r){var o=n[r];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]),r.push(an([s]))}return r}function Vf(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var n,r=1/0,i=0;return Ll(e,(function(e,n){var o=Fn(t,e);o<r&&(i=n,r=o)})),(n=th(e.features[i])).properties.featureIndex=i,n.properties.distanceToPoint=r,n}function Yf(t){if(!t)throw new Error("geojson is required");var e=[];return Dl(t,(function(t){!function(t,e){var n=[],r=t.geometry;if(null!==r){switch(r.type){case"Polygon":n=Nn(r);break;case"LineString":n=[Nn(r)]}n.forEach((function(n){var r=function(t,e){var n=[];return t.reduce((function(t,r){var i=ln([t,r],e);return i.bbox=function(t,e){var n=t[0],r=t[1],i=e[0],o=e[1],s=n<i?n:i,a=r<o?r:o,u=n>i?n:i,l=r>o?r:o;return[s,a,u,l]}(t,r),n.push(i),r})),n}(n,t.properties);r.forEach((function(t){t.id=e.length,e.push(t)}))}))}}(t,e)})),hn(e)}var Hf={exports:{}};function Xf(t,e,n,r,i){Jf(t,e,n||0,r||t.length-1,i||Kf)}function Jf(t,e,n,r,i){for(;r>n;){if(r-n>600){var o=r-n+1,s=e-n+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);Jf(t,e,Math.max(n,Math.floor(e-s*u/o+l)),Math.min(r,Math.floor(e+(o-s)*u/o+l)),i)}var c=t[e],h=n,f=r;for(Wf(t,n,e),i(t[r],c)>0&&Wf(t,n,r);h<f;){for(Wf(t,h,f),h++,f--;i(t[h],c)<0;)h++;for(;i(t[f],c)>0;)f--}0===i(t[n],c)?Wf(t,n,f):Wf(t,++f,r),f<=e&&(n=f+1),e<=f&&(r=f-1)}}function Wf(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function Kf(t,e){return t<e?-1:t>e?1:0}function Zf(t,e,n){if(!n)return e.indexOf(t);for(let r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function $f(t,e){tp(t,0,t.children.length,e,t)}function tp(t,e,n,r,i){i||(i=lp(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let o=e;o<n;o++){const e=t.children[o];ep(i,t.leaf?r(e):e)}return i}function ep(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 np(t,e){return t.minX-e.minX}function rp(t,e){return t.minY-e.minY}function ip(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function op(t){return t.maxX-t.minX+(t.maxY-t.minY)}function sp(t,e){const n=Math.max(t.minX,e.minX),r=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-n)*Math.max(0,o-r)}function ap(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function up(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function lp(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function cp(t,e,n,r,i){const o=[e,n];for(;o.length;){if((n=o.pop())-(e=o.pop())<=r)continue;const s=e+Math.ceil((n-e)/r/2)*r;Xf(t,s,e,n,i),o.push(e,s,s,n)}}var hp=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 n=[];if(!up(t,e))return n;const r=this.toBBox,i=[];for(;e;){for(let o=0;o<e.children.length;o++){const s=e.children[o],a=e.leaf?r(s):s;up(t,a)&&(e.leaf?n.push(s):ap(t,a)?this._all(s,n):i.push(s))}e=i.pop()}return n}collides(t){let e=this.data;if(!up(t,e))return!1;const n=[];for(;e;){for(let r=0;r<e.children.length;r++){const i=e.children[r],o=e.leaf?this.toBBox(i):i;if(up(t,o)){if(e.leaf||ap(t,o))return!0;n.push(i)}}e=n.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=lp([]),this}remove(t,e){if(!t)return this;let n=this.data;const r=this.toBBox(t),i=[],o=[];let s,a,u;for(;n||i.length;){if(n||(n=i.pop(),a=i[i.length-1],s=o.pop(),u=!0),n.leaf){const r=Zf(t,n.children,e);if(-1!==r)return n.children.splice(r,1),i.push(n),this._condense(i),this}u||n.leaf||!ap(n,r)?a?(s++,n=a.children[s],u=!1):n=null:(i.push(n),o.push(s),s=0,a=n,n=n.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 n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,r){const i=n-e+1;let o,s=this._maxEntries;if(i<=s)return o=lp(t.slice(e,n+1)),$f(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(s)),s=Math.ceil(i/Math.pow(s,r-1))),o=lp([]),o.leaf=!1,o.height=r;const a=Math.ceil(i/s),u=a*Math.ceil(Math.sqrt(s));cp(t,e,n,u,this.compareMinX);for(let i=e;i<=n;i+=u){const e=Math.min(i+u-1,n);cp(t,i,e,a,this.compareMinY);for(let n=i;n<=e;n+=a){const i=Math.min(n+a-1,e);o.children.push(this._build(t,n,i,r-1))}}return $f(o,this.toBBox),o}_chooseSubtree(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){let n,r=1/0,s=1/0;for(let a=0;a<e.children.length;a++){const u=e.children[a],l=ip(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,r=l<r?l:r,n=u):c===s&&l<r&&(r=l,n=u)}e=n||e.children[0]}var i,o;return e}_insert(t,e,n){const r=n?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,e,i);for(o.children.push(t),ep(o,r);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)}_split(t,e){const n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);const o=this._chooseSplitIndex(n,i,r),s=lp(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,$f(n,this.toBBox),$f(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)}_splitRoot(t,e){this.data=lp([t,e]),this.data.height=t.height+1,this.data.leaf=!1,$f(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let r,i=1/0,o=1/0;for(let s=e;s<=n-e;s++){const e=tp(t,0,s,this.toBBox),a=tp(t,s,n,this.toBBox),u=sp(e,a),l=ip(e)+ip(a);u<i?(i=u,r=s,o=l<o?l:o):u===i&&l<o&&(o=l,r=s)}return r||n-e}_chooseSplitAxis(t,e,n){const r=t.leaf?this.compareMinX:np,i=t.leaf?this.compareMinY:rp;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)}_allDistMargin(t,e,n,r){t.children.sort(r);const i=this.toBBox,o=tp(t,0,e,i),s=tp(t,n-e,n,i);let a=op(o)+op(s);for(let r=e;r<n-e;r++){const e=t.children[r];ep(o,t.leaf?i(e):e),a+=op(o)}for(let r=n-e-1;r>=e;r--){const e=t.children[r];ep(s,t.leaf?i(e):e),a+=op(s)}return a}_adjustParentBBoxes(t,e,n){for(let r=n;r>=0;r--)ep(e[r],t)}_condense(t){for(let e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children,e.splice(e.indexOf(t[n]),1)):this.clear():$f(t[n],this.toBBox)}}}),fp=Vn(hp),pp={};!function(t){function e(t,e,n){void 0===n&&(n={});var r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function n(t,n,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(!f(t[0])||!f(t[1]))throw new Error("coordinates must contain numbers");return e({type:"Point",coordinates:t},n,r)}function r(t,n,r){void 0===r&&(r={});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},n,r)}function i(t,n,r){if(void 0===r&&(r={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return e({type:"LineString",coordinates:t},n,r)}function o(t,e){void 0===e&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function s(t,n,r){return void 0===r&&(r={}),e({type:"MultiLineString",coordinates:t},n,r)}function a(t,n,r){return void 0===r&&(r={}),e({type:"MultiPoint",coordinates:t},n,r)}function u(t,n,r){return void 0===r&&(r={}),e({type:"MultiPolygon",coordinates:t},n,r)}function l(e,n){void 0===n&&(n="kilometers");var r=t.factors[n];if(!r)throw new Error(n+" units is invalid");return e*r}function c(e,n){void 0===n&&(n="kilometers");var r=t.factors[n];if(!r)throw new Error(n+" units is invalid");return e/r}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 n(e).geometry;case"LineString":return i(e).geometry;case"Polygon":return r(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=n,t.points=function(t,e,r){return void 0===r&&(r={}),o(t.map((function(t){return n(t,e)})),r)},t.polygon=r,t.polygons=function(t,e,n){return void 0===n&&(n={}),o(t.map((function(t){return r(t,e)})),n)},t.lineString=i,t.lineStrings=function(t,e,n){return void 0===n&&(n={}),o(t.map((function(t){return i(t,e)})),n)},t.featureCollection=o,t.multiLineString=s,t.multiPoint=a,t.multiPolygon=u,t.geometryCollection=function(t,n,r){return void 0===r&&(r={}),e({type:"GeometryCollection",geometries:t},n,r)},t.round=function(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n},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,n){if(void 0===e&&(e="kilometers"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return l(c(t,e),n)},t.convertArea=function(e,n,r){if(void 0===n&&(n="meters"),void 0===r&&(r="kilometers"),!(e>=0))throw new Error("area must be a positive number");var i=t.areaFactors[n];if(!i)throw new Error("invalid original units");var o=t.areaFactors[r];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")}}(pp);var gp={};Object.defineProperty(gp,"__esModule",{value:!0});var Ap=pp;function dp(t,e,n){if(null!==t)for(var r,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=!n||"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(r=0;r<u.length;r++){if(!1===e(u[r],f,y,m,_))return!1;f++,"MultiPoint"===I&&m++}"LineString"===I&&m++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(i=0;i<u[r].length-h;i++){if(!1===e(u[r][i],f,y,m,_))return!1;f++}"MultiLineString"===I&&m++,"Polygon"===I&&_++}"Polygon"===I&&m++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for(_=0,i=0;i<u[r].length;i++){for(o=0;o<u[r][i].length-h;o++){if(!1===e(u[r][i][o],f,y,m,_))return!1;f++}_++}m++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===dp(s.geometries[r],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function yp(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length&&!1!==e(t.features[n].properties,n);n++);break;case"Feature":e(t.properties,0)}}function vp(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length&&!1!==e(t.features[n],n);n++);}function mp(t,e){var n,r,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(n=0;n<A;n++){for(a=p?t.features[n].geometry:g?t.geometry:t,l=p?t.features[n].properties:g?t.properties:{},c=p?t.features[n].bbox:g?t.bbox:void 0,h=p?t.features[n].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(r=0;r<o.geometries.length;r++)if(!1===e(o.geometries[r],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 _p(t,e){mp(t,(function(t,n,r,i,o){var s,a=null===t?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==e(Ap.feature(t,r,{bbox:i,id:o}),n,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(Ap.feature(l,r),n,u))return!1}}))}function Ip(t,e){_p(t,(function(t,n,r){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!==dp(t,(function(o,c,h,f,p){if(void 0===s||n>a||f>u||p>l)return s=o,a=n,u=f,l=p,void(i=0);var g=Ap.lineString([s,o],t.properties);if(!1===e(g,n,r,p,i))return!1;i++,s=o}))&&void 0}}}))}function Ep(t,e){if(!t)throw new Error("geojson is required");_p(t,(function(t,n,r){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,n,r,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===e(Ap.lineString(o[s],t.properties),n,r,s))return!1}}}))}gp.coordAll=function(t){var e=[];return dp(t,(function(t){e.push(t)})),e},gp.coordEach=dp,gp.coordReduce=function(t,e,n,r){var i=n;return dp(t,(function(t,r,o,s,a){i=0===r&&void 0===n?t:e(i,t,r,o,s,a)}),r),i},gp.featureEach=vp,gp.featureReduce=function(t,e,n){var r=n;return vp(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r},gp.findPoint=function(t,e){if(e=e||{},!Ap.isObject(e))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":return Ap.point(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),Ap.point(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),Ap.point(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),Ap.point(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),Ap.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),Ap.point(u[i][o][s],a,e)}throw new Error("geojson is invalid")},gp.findSegment=function(t,e){if(e=e||{},!Ap.isObject(e))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=u.length+s-1),Ap.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),Ap.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),Ap.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),Ap.lineString([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")},gp.flattenEach=_p,gp.flattenReduce=function(t,e,n){var r=n;return _p(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)})),r},gp.geomEach=mp,gp.geomReduce=function(t,e,n){var r=n;return mp(t,(function(t,i,o,s,a){r=0===i&&void 0===n?t:e(r,t,i,o,s,a)})),r},gp.lineEach=Ep,gp.lineReduce=function(t,e,n){var r=n;return Ep(t,(function(t,i,o,s){r=0===i&&void 0===n?t:e(r,t,i,o,s)})),r},gp.propEach=yp,gp.propReduce=function(t,e,n){var r=n;return yp(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r},gp.segmentEach=Ip,gp.segmentReduce=function(t,e,n){var r=n,i=!1;return Ip(t,(function(t,o,s,a,u){r=!1===i&&void 0===n?t:e(r,t,o,s,a,u),i=!0})),r};var Cp={};Object.defineProperty(Cp,"__esModule",{value:!0});var xp=gp;function wp(t){var e=[1/0,1/0,-1/0,-1/0];return xp.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}wp.default=wp,Cp.default=wp;var bp=fp,Bp=pp,Sp=gp,Mp=Cp.default,Lp=Sp.featureEach;Sp.coordEach;var Np=Bp.featureCollection;function Tp(t){var e=new bp(t);return e.insert=function(t){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Mp(t),bp.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:Mp(t),e.push(t)})):Lp(t,(function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox?t.bbox:Mp(t),e.push(t)})),bp.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:Mp(t),bp.prototype.remove.call(this,t,e)},e.clear=function(){return bp.prototype.clear.call(this)},e.search=function(t){var e=bp.prototype.search.call(this,this.toBBox(t));return Np(e)},e.collides=function(t){return bp.prototype.collides.call(this,this.toBBox(t))},e.all=function(){var t=bp.prototype.all.call(this);return Np(t)},e.toJSON=function(){return bp.prototype.toJSON.call(this)},e.fromJSON=function(t){return bp.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=Mp(t);else{if("FeatureCollection"!==t.type)throw new Error("invalid geojson");e=Mp(t)}return{minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}},e}Hf.exports=Tp,Hf.exports.default=Tp;var Rp=Hf.exports;function Qp(t,e){var n={},r=[];if("LineString"===t.type&&(t=nn(t)),"LineString"===e.type&&(e=nn(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=Dp(t,e);return i&&r.push(i),hn(r)}var o=Rp();return o.load(Yf(e)),Ll(Yf(t),(function(t){Ll(o.search(t),(function(e){var i=Dp(t,e);if(i){var o=Nn(i).join(",");n[o]||(n[o]=!0,r.push(i))}}))})),hn(r)}function Dp(t,e){var n=Nn(t),r=Nn(e);if(2!==n.length)throw new Error("<intersects> line1 must only contain 2 coordinates");if(2!==r.length)throw new Error("<intersects> line2 must only contain 2 coordinates");var i=n[0][0],o=n[0][1],s=n[1][0],a=n[1][1],u=r[0][0],l=r[0][1],c=r[1][0],h=r[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?on([i+A*(s-i),o+A*(a-o)]):null}function Pp(t,e,n){void 0===n&&(n={});var r=on([1/0,1/0],{dist:1/0}),i=0;return Dl(t,(function(t){for(var o=Nn(t),s=0;s<o.length-1;s++){var a=on(o[s]);a.properties.dist=Fn(e,a,n);var u=on(o[s+1]);u.properties.dist=Fn(e,u,n);var l=Fn(a,u,n),c=Math.max(a.properties.dist,u.properties.dist),h=ff(a,u),f=cf(e,c,h+90,n),p=cf(e,c,h-90,n),g=Qp(ln([f.geometry.coordinates,p.geometry.coordinates]),ln([a.geometry.coordinates,u.geometry.coordinates])),A=null;g.features.length>0&&((A=g.features[0]).properties.dist=Fn(e,A,n),A.properties.location=i+Fn(a,A,n)),a.properties.dist<r.properties.dist&&((r=a).properties.index=s,r.properties.location=i),u.properties.dist<r.properties.dist&&((r=u).properties.index=s+1,r.properties.location=i+l),A&&A.properties.dist<r.properties.dist&&((r=A).properties.index=s),i+=l}})),r}function kp(t,e,n){void 0===n&&(n={});var r=Ln(t),i=Ln(e);i[0]+=i[0]-r[0]>180?-360:r[0]-i[0]>180?360:0;var o=function(t,e,n){n=void 0===n?Ze:Number(n);var r=n,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*r;return h}(r,i);return Cn(o,"meters",n.units)}function Op(t,e,n){if(void 0===n&&(n={}),n.method||(n.method="geodesic"),n.units||(n.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=on(t):"Point"===t.type?t=nn(t):Qn(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=ln(e):"LineString"===e.type?e=nn(e):Qn(e,"LineString","line");var r=1/0,i=t.geometry.coordinates;return kl(e,(function(t){var e=t.geometry.coordinates[0],o=t.geometry.coordinates[1],s=function(t,e,n,r){var i=[n[0]-e[0],n[1]-e[1]],o=[t[0]-e[0],t[1]-e[1]],s=Fp(o,i);if(s<=0)return Gp(t,e,{method:r.method,units:"degrees"});var a=Fp(i,i);if(a<=s)return Gp(t,n,{method:r.method,units:"degrees"});var u=s/a,l=[e[0]+u*i[0],e[1]+u*i[1]];return Gp(t,l,{method:r.method,units:"degrees"})}(i,e,o,n);s<r&&(r=s)})),Cn(r,"degrees",n.units)}function Fp(t,e){return t[0]*e[0]+t[1]*e[1]}function Gp(t,e,n){return"planar"===n.method?kp(t,e,n):Fn(t,e,n)}function Up(t,e,n,r,i,o,s,a){var u,l,c,h,f={x:null,y:null,onLine1:!1,onLine2:!1};return 0===(u=(a-o)*(n-t)-(s-i)*(r-e))?null!==f.x&&null!==f.y&&f:(h=(n-t)*(l=e-o)-(r-e)*(c=t-i),l=((s-i)*l-(a-o)*c)/u,c=h/u,f.x=t+l*(n-t),f.y=e+l*(r-e),l>=0&&l<=1&&(f.onLine1=!0),c>=0&&c<=1&&(f.onLine2=!0),!(!f.onLine1||!f.onLine2)&&[f.x,f.y])}function qp(t){for(var e=function(t){if("FeatureCollection"!==t.type)return"Feature"!==t.type?hn([nn(t)]):hn([t]);return t}(t),n=pf(e),r=!1,i=0;!r&&i<e.features.length;){var o,s=e.features[i].geometry,a=!1;if("Point"===s.type)n.geometry.coordinates[0]===s.coordinates[0]&&n.geometry.coordinates[1]===s.coordinates[1]&&(r=!0);else if("MultiPoint"===s.type){var u=!1;for(o=0;!u&&o<s.coordinates.length;)n.geometry.coordinates[0]===s.coordinates[o][0]&&n.geometry.coordinates[1]===s.coordinates[o][1]&&(r=!0,u=!0),o++}else if("LineString"===s.type)for(o=0;!a&&o<s.coordinates.length-1;)jp(n.geometry.coordinates[0],n.geometry.coordinates[1],s.coordinates[o][0],s.coordinates[o][1],s.coordinates[o+1][0],s.coordinates[o+1][1])&&(a=!0,r=!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;)jp(n.geometry.coordinates[0],n.geometry.coordinates[1],c[o][0],c[o][1],c[o+1][0],c[o+1][1])&&(a=!0,r=!0),o++;l++}else"Polygon"!==s.type&&"MultiPolygon"!==s.type||Gn(n,s)&&(r=!0);i++}if(r)return n;var h=hn([]);for(i=0;i<e.features.length;i++)h.features=h.features.concat(Af(e.features[i]).features);return on(Vf(n,h).geometry.coordinates)}function jp(t,e,n,r,i,o){return Math.sqrt((i-n)*(i-n)+(o-r)*(o-r))===Math.sqrt((t-n)*(t-n)+(e-r)*(e-r))+Math.sqrt((i-t)*(i-t)+(o-e)*(o-e))}var zp=6378137;function Vp(t){return Ql(t,(function(t,e){return t+function(t){var e,n=0;switch(t.type){case"Polygon":return Yp(t.coordinates);case"MultiPolygon":for(e=0;e<t.coordinates.length;e++)n+=Yp(t.coordinates[e]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(e)}),0)}function Yp(t){var e=0;if(t&&t.length>0){e+=Math.abs(Hp(t[0]));for(var n=1;n<t.length;n++)e-=Math.abs(Hp(t[n]))}return e}function Hp(t){var e,n,r,i,o,s,a=0,u=t.length;if(u>2){for(s=0;s<u;s++)s===u-2?(r=u-2,i=u-1,o=0):s===u-1?(r=u-1,i=0,o=1):(r=s,i=s+1,o=s+2),e=t[r],n=t[i],a+=(Xp(t[o][0])-Xp(e[0]))*Math.sin(Xp(n[1]));a=a*zp*zp/2}return a}function Xp(t){return t*Math.PI/180}function Jp(t,e){return void 0===e&&(e={}),Ol(t,(function(t,n){var r=n.geometry.coordinates;return t+Fn(r[0],r[1],e)}),0)}function Wp(t,e,n,r){if(!bn(r=r||{}))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]),ln(o);a=ff(i[h],i[h-1])-180,u=cf(i[h],s,a,r),o.push(u.geometry.coordinates)}if(c>=n)return(s=n-c)?(a=ff(i[h],i[h-1])-180,u=cf(i[h],s,a,r),o.push(u.geometry.coordinates),ln(o)):(o.push(i[h]),ln(o));if(c>=e&&o.push(i[h]),h===i.length-1)return ln(o);c+=Fn(i[h],i[h+1],r)}if(c<e&&i.length===l)throw new Error("Start position is beyond line");var f=i[i.length-1];return ln([f,f])}function Kp(t,e,n){void 0===n&&(n={});for(var r=Ln(t),i=Nn(e),o=0;o<i.length-1;o++){var s=!1;if(n.ignoreEndVertices&&(0===o&&(s="start"),o===i.length-2&&(s="end"),0===o&&o+1===i.length-1&&(s="both")),Zp(i[o],i[o+1],r,s,void 0===n.epsilon?null:n.epsilon))return!0}return!1}function Zp(t,e,n,r,i){var o=n[0],s=n[1],a=t[0],u=t[1],l=e[0],c=e[1],h=l-a,f=c-u,p=(n[0]-a)*f-(n[1]-u)*h;if(null!==i){if(Math.abs(p)>i)return!1}else if(0!==p)return!1;return r?"start"===r?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"===r?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"===r&&(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 $p(t,e){var n=Pn(t),r=Pn(e),i=n.type,o=r.type;switch(i){case"Point":switch(o){case"MultiPoint":return function(t,e){var n,r=!1;for(n=0;n<e.coordinates.length;n++)if(eg(e.coordinates[n],t.coordinates)){r=!0;break}return r}(n,r);case"LineString":return Kp(n,r,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return Gn(n,r,{ignoreBoundary:!0});default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"MultiPoint":return function(t,e){for(var n=0;n<t.coordinates.length;n++){for(var r=!1,i=0;i<e.coordinates.length;i++)eg(t.coordinates[n],e.coordinates[i])&&(r=!0);if(!r)return!1}return!0}(n,r);case"LineString":return function(t,e){for(var n=!1,r=0;r<t.coordinates.length;r++){if(!Kp(t.coordinates[r],e))return!1;n||(n=Kp(t.coordinates[r],e,{ignoreEndVertices:!0}))}return n}(n,r);case"Polygon":case"MultiPolygon":return function(t,e){for(var n=!0,r=!1,i=0;i<t.coordinates.length;i++){if(!(r=Gn(t.coordinates[1],e))){n=!1;break}r=Gn(t.coordinates[1],e,{ignoreBoundary:!0})}return n&&r}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"LineString":return function(t,e){for(var n=0;n<t.coordinates.length;n++)if(!Kp(t.coordinates[n],e))return!1;return!0}(n,r);case"Polygon":case"MultiPolygon":return function(t,e){var n=zl(e),r=zl(t);if(!tg(n,r))return!1;for(var i=!1,o=0;o<t.coordinates.length-1;o++){if(!Gn(t.coordinates[o],e))return!1;if(i||(i=Gn(t.coordinates[o],e,{ignoreBoundary:!0})),!i)i=Gn(ng(t.coordinates[o],t.coordinates[o+1]),e,{ignoreBoundary:!0})}return i}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Polygon":case"MultiPolygon":return function(t,e){var n=zl(t);if(!tg(zl(e),n))return!1;for(var r=0;r<t.coordinates[0].length;r++)if(!Gn(t.coordinates[0][r],e))return!1;return!0}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function tg(t,e){return!(t[0]>e[0])&&(!(t[2]<e[2])&&(!(t[1]>e[1])&&!(t[3]<e[3])))}function eg(t,e){return t[0]===e[0]&&t[1]===e[1]}function ng(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}function rg(t,e,n){void 0===n&&(n={}),n.mask&&!n.units&&(n.units="kilometers");for(var r=[],i=t[0],o=t[1],s=t[2],a=t[3],u=e/Fn([i,o],[s,o],n)*(s-i),l=e/Fn([i,o],[i,a],n)*(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=on([g,A],n.properties);n.mask?$p(d,n.mask)&&r.push(d):r.push(d),A+=l}g+=u}return hn(r)}function ig(t,e){void 0===e&&(e={});var n=e.precision,r=e.coordinates,i=e.mutate;if(n=null==n||isNaN(n)?6:n,r=null==r||isNaN(r)?3:r,!t)throw new Error("<geojson> is required");if("number"!=typeof n)throw new Error("<precision> must be a number");if("number"!=typeof r)throw new Error("<coordinates> must be a number");!1!==i&&void 0!==i||(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,n);return bl(t,(function(t){!function(t,e,n){t.length>n&&t.splice(n,t.length);for(var r=0;r<t.length;r++)t[r]=Math.round(t[r]*e)/e}(t,o,r)})),t}function og(t){if(!t)throw new Error("geojson is required");var e=[];return Dl(t,(function(t){e.push(t)})),hn(e)}function sg(t,e,n){if("Polygon"!==t.geometry.type)throw new Error("The input feature must be a Polygon");void 0===n&&(n=1);var r=t.geometry.coordinates,i=[],o={};if(n){for(var s=[],a=0;a<r.length;a++)for(var u=0;u<r[a].length-1;u++)s.push(A(a,u));var l=Yh();l.load(s)}for(var c=0;c<r.length;c++)for(var h=0;h<r[c].length-1;h++){if(n)l.search(A(c,h)).forEach((function(t){var e=t.ring,n=t.edge;g(c,h,e,n)}));else for(var f=0;f<r.length;f++)for(var p=0;p<r[f].length-1;p++)g(c,h,f,p)}return e||(i={type:"Feature",geometry:{type:"MultiPoint",coordinates:i}}),i;function g(t,n,s,a){var u,l,c=r[t][n],h=r[t][n+1],f=r[s][a],p=r[s][a+1],g=function(t,e,n,r){if(ag(t,n)||ag(t,r)||ag(e,n)||ag(r,n))return null;var i=t[0],o=t[1],s=e[0],a=e[1],u=n[0],l=n[1],c=r[0],h=r[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,n,c,h,u,s,a,f,p,l,d)):i.push(g)}}function A(t,e){var n,i,o,s,a=r[t][e],u=r[t][e+1];return a[0]<u[0]?(n=a[0],i=u[0]):(n=u[0],i=a[0]),a[1]<u[1]?(o=a[1],s=u[1]):(o=u[1],s=a[1]),{minX:n,minY:o,maxX:i,maxY:s,ring:t,edge:e}}}function ag(t,e){if(!t||!e)return!1;if(t.length!==e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!ag(t[n],e[n]))return!1}else if(t[n]!==e[n])return!1;return!0}function ug(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,n=[],r=0;r<e;r++){var i=t.geometry.coordinates[r];pg(i[0],i[i.length-1])||i.push(i[0]),n.push.apply(n,i.slice(0,i.length-1))}if(!function(t){for(var e={},n=1,r=0,i=t.length;r<i;++r){if(Object.prototype.hasOwnProperty.call(e,t[r])){n=0;break}e[t[r]]=1}return n}(n))throw new Error("The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)");var o=n.length,s=sg(t,(function(t,e,n,r,i,o,s,a,u,l,c,h){return[t,e,n,r,i,o,s,a,u,l,c,h]})),a=s.length;if(0==a){var u=[];for(r=0;r<e;r++)u.push(an([t.geometry.coordinates[r]],{parent:-1,winding:fg(t.geometry.coordinates[r])}));var l=hn(u);return P(),k(),l}var c=[],h=[];for(r=0;r<e;r++){c.push([]);for(var f=0;f<t.geometry.coordinates[r].length-1;f++)c[r].push([new lg(t.geometry.coordinates[r][gg(f+1,t.geometry.coordinates[r].length-1)],1,[r,f],[r,gg(f+1,t.geometry.coordinates[r].length-1)],void 0)]),h.push(new cg(t.geometry.coordinates[r][f],[r,gg(f-1,t.geometry.coordinates[r].length-1)],[r,f],void 0,void 0,!1,!0))}for(r=0;r<a;r++)c[s[r][1]][s[r][2]].push(new lg(s[r][0],s[r][5],[s[r][1],s[r][2]],[s[r][6],s[r][7]],void 0)),s[r][11]&&h.push(new cg(s[r][0],[s[r][1],s[r][2]],[s[r][6],s[r][7]],void 0,void 0,!0,!0));var p=h.length;for(r=0;r<c.length;r++)for(f=0;f<c[r].length;f++)c[r][f].sort((function(t,e){return t.param<e.param?-1:1}));var g=[];for(r=0;r<p;r++)g.push({minX:h[r].coord[0],minY:h[r].coord[1],maxX:h[r].coord[0],maxY:h[r].coord[1],index:r});var A=Yh();A.load(g);for(r=0;r<c.length;r++)for(f=0;f<c[r].length;f++)for(var d=0;d<c[r][f].length;d++){v=d==c[r][f].length-1?c[r][gg(f+1,t.geometry.coordinates[r].length-1)][0].coord:c[r][f][d+1].coord;var y=A.search({minX:v[0],minY:v[1],maxX:v[0],maxY:v[1]})[0];c[r][f][d].nxtIsectAlongEdgeIn=y.index}for(r=0;r<c.length;r++)for(f=0;f<c[r].length;f++)for(d=0;d<c[r][f].length;d++){var v=c[r][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[r][f][d].nxtIsectAlongEdgeIn:pg(h[m].ringAndEdge1,c[r][f][d].ringAndEdgeIn)?h[m].nxtIsectAlongRingAndEdge1=c[r][f][d].nxtIsectAlongEdgeIn:h[m].nxtIsectAlongRingAndEdge2=c[r][f][d].nxtIsectAlongEdgeIn}var _=[];for(r=0,f=0;f<e;f++){var I=r;for(d=0;d<t.geometry.coordinates[f].length-1;d++)h[r].coord[0]<h[I].coord[0]&&(I=r),r++;var E=h[I].nxtIsectAlongRingAndEdge2;for(d=0;d<h.length;d++)if(h[d].nxtIsectAlongRingAndEdge1==I||h[d].nxtIsectAlongRingAndEdge2==I){var C=d;break}var x=hg([h[C].coord,h[I].coord,h[E].coord],!0)?1:-1;_.push({isect:I,parent:-1,winding:x})}_.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(;!pg(h[b].coord,h[R].coord);){L.push(h[R].coord);var Q=void 0;for(r=0;r<_.length;r++)if(_[r].isect==R){Q=r;break}if(null!=Q&&_.splice(Q,1),pg(T,h[R].ringAndEdge1)){if(T=h[R].ringAndEdge2,h[R].ringAndEdge2Walkable=!1,h[R].ringAndEdge1Walkable){var D={isect:R};hg([h[N].coord,h[R].coord,h[h[R].nxtIsectAlongRingAndEdge2].coord],1==S)?(D.parent=B,D.winding=-S):(D.parent=M,D.winding=S),_.push(D)}N=R,R=h[R].nxtIsectAlongRingAndEdge2}else{if(T=h[R].ringAndEdge1,h[R].ringAndEdge1Walkable=!1,h[R].ringAndEdge2Walkable){D={isect:R};hg([h[N].coord,h[R].coord,h[h[R].nxtIsectAlongRingAndEdge1].coord],1==S)?(D.parent=B,D.winding=-S):(D.parent=M,D.winding=S),_.push(D)}N=R,R=h[R].nxtIsectAlongRingAndEdge1}}L.push(h[R].coord),u.push(an([L],{index:M,parent:B,winding:S,netWinding:void 0}))}l=hn(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 n=-1,r=0;r<l.features.length;r++)t[e]!=r&&Gn(l.features[t[e]].geometry.coordinates[0][0],l.features[r],{ignoreBoundary:!0})&&Vp(l.features[r])<Infinity&&(n=r);l.features[t[e]].properties.parent=n}}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 n=0;n<l.features.length;n++)if(l.features[n].properties.parent==t){var r=e+l.features[n].properties.winding;l.features[n].properties.netWinding=r,O(n,r)}}return P(),k(),l}var lg=function(t,e,n,r,i){this.coord=t,this.param=e,this.ringAndEdgeIn=n,this.ringAndEdgeOut=r,this.nxtIsectAlongEdgeIn=i},cg=function(t,e,n,r,i,o,s){this.coord=t,this.ringAndEdge1=e,this.ringAndEdge2=n,this.nxtIsectAlongRingAndEdge1=r,this.nxtIsectAlongRingAndEdge2=i,this.ringAndEdge1Walkable=o,this.ringAndEdge2Walkable=s};function hg(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 fg(t){for(var e=0,n=0;n<t.length-1;n++)t[n][0]<t[e][0]&&(e=n);if(hg([t[gg(e-1,t.length-1)],t[e],t[gg(e+1,t.length-1)]],!0))var r=1;else r=-1;return r}function pg(t,e){if(!t||!e)return!1;if(t.length!=e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!pg(t[n],e[n]))return!1}else if(t[n]!=e[n])return!1;return!0}function gg(t,e){return(t%e+e)%e}var Ag=Math.PI/180,dg=180/Math.PI,yg=function(t,e){this.lon=t,this.lat=e,this.x=Ag*t,this.y=Ag*e};yg.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)},yg.prototype.antipode=function(){var t=-1*this.lat,e=this.lon<0?180+this.lon:-1*(180-this.lon);return new yg(e,t)};var vg=function(){this.coords=[],this.length=0};vg.prototype.move_to=function(t){this.length++,this.coords.push(t)};var mg=function(t){this.properties=t||{},this.geometries=[]};mg.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}},mg.prototype.wkt=function(){for(var t="",e="LINESTRING(",n=function(t){e+=t[0]+" "+t[1]+","},r=0;r<this.geometries.length;r++){if(0===this.geometries[r].coords.length)return"LINESTRING(empty)";this.geometries[r].coords.forEach(n),t+=e.substring(0,e.length-1)+")"}return t};var _g=function(t,e,n){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 yg(t.x,t.y),this.end=new yg(e.x,e.y),this.properties=n||{};var r=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(r/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 Ig(t,e){var n=[],r=Rp();return Dl(e,(function(e){if(n.forEach((function(t,e){t.id=e})),n.length){var i=r.search(e);if(i.features.length){var o=Cg(e,i);n=n.filter((function(t){return t.id!==o.id})),r.remove(o),Ll(Eg(o,e),(function(t){n.push(t),r.insert(t)}))}}else(n=Eg(t,e).features).forEach((function(t){t.bbox||(t.bbox=lf(zl(t)))})),r.load(hn(n))})),hn(n)}function Eg(t,e){var n=[],r=Nn(t)[0],i=Nn(t)[t.geometry.coordinates.length-1];if(xg(r,Ln(e))||xg(i,Ln(e)))return hn([t]);var o=Rp(),s=Yf(t);o.load(s);var a=o.search(e);if(!a.features.length)return hn([t]);var u=Cg(e,a),l=Nl(s,(function(t,r,i){var o=Nn(r)[1],s=Ln(e);return i===u.id?(t.push(s),n.push(ln(t)),xg(s,o)?[s]:[s,o]):(t.push(o),t)}),[r]);return l.length>1&&n.push(ln(l)),hn(n)}function Cg(t,e){if(!e.features.length)throw new Error("lines must contain features");if(1===e.features.length)return e.features[0];var n,r=1/0;return Ll(e,(function(e){var i=Pp(e,t).properties.dist;i<r&&(n=e,r=i)})),n}function xg(t,e){return t[0]===e[0]&&t[1]===e[1]}function wg(t,e,n,r,i){void 0===i&&(i={});var o=i.steps||64,s=bg(n),a=bg(r),u=Array.isArray(t)||"Feature"!==t.type?{}:t.properties;if(s===a)return ln(hf(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(cf(t,e,h,i).geometry.coordinates),h=l+360*++p/o;return h>c&&f.push(cf(t,e,c,i).geometry.coordinates),ln(f,u)}function bg(t){var e=t%360;return e<0&&(e+=360),e}function Bg(t,e){void 0===e&&(e={});var n=Pn(t);switch(e.properties||"Feature"!==t.type||(e.properties=t.properties),n.type){case"Polygon":return Sg(n,e);case"MultiPolygon":return function(t,e){void 0===e&&(e={});var n=Pn(t),r=n.coordinates,i=e.properties?e.properties:"Feature"===t.type?t.properties:{},o=[];return r.forEach((function(t){o.push(Mg(t,i))})),hn(o)}(n,e);default:throw new Error("invalid poly")}}function Sg(t,e){return void 0===e&&(e={}),Mg(Pn(t).coordinates,e.properties?e.properties:"Feature"===t.type?t.properties:{})}function Mg(t,e){return t.length>1?fn(t,e):ln(t[0],e)}function Lg(t,e){var n,r,i;void 0===e&&(e={});var o=e.properties,s=null===(n=e.autoComplete)||void 0===n||n,a=null===(r=e.orderCoords)||void 0===r||r;if(null!==(i=e.mutate)&&void 0!==i&&i||(t=th(t)),"FeatureCollection"===t.type){var u=[];return t.features.forEach((function(t){u.push(Nn(Ng(t,{},s,a)))})),gn(u,o)}return Ng(t,o,s,a)}function Ng(t,e,n,r){e=e||("Feature"===t.type?t.properties:{});var i=Pn(t),o=i.coordinates,s=i.type;if(!o.length)throw new Error("line must contain coordinates");switch(s){case"LineString":return n&&(o=Tg(o)),an([o],e);case"MultiLineString":var a=[],u=0;return o.forEach((function(t){if(n&&(t=Tg(t)),r){var e=function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.abs(e-r)*Math.abs(n-i)}(zl(ln(t)));e>u?(a.unshift(t),u=e):a.push(t)}else a.push(t)})),an(a,e);default:throw new Error("geometry type "+s+" is not supported")}}function Tg(t){var e=t[0],n=e[0],r=e[1],i=t[t.length-1],o=i[0],s=i[1];return n===o&&r===s||t.push(e),t}function Rg(t,e){var n,r,i,o,s,a,u;for(r=1;r<=8;r*=2){for(n=[],o=!(Dg(i=t[t.length-1],e)&r),s=0;s<t.length;s++)(u=!(Dg(a=t[s],e)&r))!==o&&n.push(Qg(i,a,r,e)),u&&n.push(a),i=a,o=u;if(!(t=n).length)break}return n}function Qg(t,e,n,r){return 8&n?[t[0]+(e[0]-t[0])*(r[3]-t[1])/(e[1]-t[1]),r[3]]:4&n?[t[0]+(e[0]-t[0])*(r[1]-t[1])/(e[1]-t[1]),r[1]]:2&n?[r[2],t[1]+(e[1]-t[1])*(r[2]-t[0])/(e[0]-t[0])]:1&n?[r[0],t[1]+(e[1]-t[1])*(r[0]-t[0])/(e[0]-t[0])]:null}function Dg(t,e){var n=0;return t[0]<e[0]?n|=1:t[0]>e[2]&&(n|=2),t[1]<e[1]?n|=4:t[1]>e[3]&&(n|=8),n}function Pg(t,e){for(var n=[],r=0,i=t;r<i.length;r++){var o=Rg(i[r],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&&n.push(o))}return n}_g.prototype.interpolate=function(t){var e=Math.sin((1-t)*this.g)/Math.sin(this.g),n=Math.sin(t*this.g)/Math.sin(this.g),r=e*Math.cos(this.start.y)*Math.cos(this.start.x)+n*Math.cos(this.end.y)*Math.cos(this.end.x),i=e*Math.cos(this.start.y)*Math.sin(this.start.x)+n*Math.cos(this.end.y)*Math.sin(this.end.x),o=e*Math.sin(this.start.y)+n*Math.sin(this.end.y),s=dg*Math.atan2(o,Math.sqrt(Math.pow(r,2)+Math.pow(i,2)));return[dg*Math.atan2(i,r),s]},_g.prototype.Arc=function(t,e){var n=[];if(!t||t<=2)n.push([this.start.lon,this.start.lat]),n.push([this.end.lon,this.end.lat]);else for(var r=1/(t-1),i=0;i<t;++i){var o=r*i,s=this.interpolate(o);n.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<n.length;++p){var g=n[p-1][0],A=n[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<n.length;++m){var _=parseFloat(n[m][0]);if(m>0&&Math.abs(_-n[m-1][0])>f){var I=parseFloat(n[m-1][0]),E=parseFloat(n[m-1][1]),C=parseFloat(n[m][0]),x=parseFloat(n[m][1]);if(I>-180&&I<h&&180===C&&m+1<n.length&&n[m-1][0]>-180&&n[m-1][0]<h){v.push([-180,n[m][1]]),m++,v.push([n[m][0],n[m][1]]);continue}if(I>c&&I<180&&-180===C&&m+1<n.length&&n[m-1][0]>c&&n[m-1][0]<180){v.push([180,n[m][1]]),m++,v.push([n[m][0],n[m][1]]);continue}if(I<h&&C>c){var w=I;I=C,C=w;var b=E;E=x,x=b}if(I>c&&C<h&&(C+=360),I<=180&&C>=180&&I<C){var B=(180-I)/(C-I),S=B*x+(1-B)*E;v.push([n[m-1][0]>c?180:-180,S]),(v=[]).push([n[m-1][0]>c?-180:180,S]),y.push(v)}else v=[],y.push(v);v.push([_,n[m][1]])}else v.push([n[m][0],n[m][1]])}}else{var M=[];y.push(M);for(var L=0;L<n.length;++L)M.push([n[L][0],n[L][1]])}for(var N=new mg(this.properties),T=0;T<y.length;++T){var R=new vg;N.geometries.push(R);for(var Q=y[T],D=0;D<Q.length;++D)R.move_to(Q[D])}return N};var kg,Og=Object.prototype.toString,Fg=function(t){var e=Og.call(t),n="[object Arguments]"===e;return n||(n="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===Og.call(t.callee)),n};if(!Object.keys){var Gg=Object.prototype.hasOwnProperty,Ug=Object.prototype.toString,qg=Fg,jg=Object.prototype.propertyIsEnumerable,zg=!jg.call({toString:null},"toString"),Vg=jg.call((function(){}),"prototype"),Yg=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Hg=function(t){var e=t.constructor;return e&&e.prototype===t},Xg={$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},Jg=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!Xg["$"+t]&&Gg.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{Hg(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();kg=function(t){var e=null!==t&&"object"==typeof t,n="[object Function]"===Ug.call(t),r=qg(t),i=e&&"[object String]"===Ug.call(t),o=[];if(!e&&!n&&!r)throw new TypeError("Object.keys called on a non-object");var s=Vg&&n;if(i&&t.length>0&&!Gg.call(t,0))for(var a=0;a<t.length;++a)o.push(String(a));if(r&&t.length>0)for(var u=0;u<t.length;++u)o.push(String(u));else for(var l in t)s&&"prototype"===l||!Gg.call(t,l)||o.push(String(l));if(zg)for(var c=function(t){if("undefined"==typeof window||!Jg)return Hg(t);try{return Hg(t)}catch(t){return!1}}(t),h=0;h<Yg.length;++h)c&&"constructor"===Yg[h]||!Gg.call(t,Yg[h])||o.push(Yg[h]);return o}}var Wg=kg,Kg=Array.prototype.slice,Zg=Fg,$g=Object.keys,tA=$g?function(t){return $g(t)}:Wg,eA=Object.keys;tA.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 Zg(t)?eA(Kg.call(t)):eA(t)})}else Object.keys=tA;return Object.keys||tA};var nA,rA=tA,iA=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),n=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(n))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 r=Object.getOwnPropertySymbols(t);if(1!==r.length||r[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},oA=iA,sA=function(){return oA()&&!!Symbol.toStringTag},aA="undefined"!=typeof Symbol&&Symbol,uA=iA,lA={foo:{}},cA=Object,hA=Array.prototype.slice,fA=Object.prototype.toString,pA=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==fA.call(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var n,r=hA.call(arguments,1),i=Math.max(0,e.length-r.length),o=[],s=0;s<i;s++)o.push("$"+s);if(n=Function("binder","return function ("+o.join(",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof n){var i=e.apply(this,r.concat(hA.call(arguments)));return Object(i)===i?i:this}return e.apply(t,r.concat(hA.call(arguments)))})),e.prototype){var a=function(){};a.prototype=e.prototype,n.prototype=new a,a.prototype=null}return n},gA=Function.prototype.bind||pA,AA=gA.call(Function.call,Object.prototype.hasOwnProperty),dA=SyntaxError,yA=Function,vA=TypeError,mA=function(t){try{return yA('"use strict"; return ('+t+").constructor;")()}catch(t){}},_A=Object.getOwnPropertyDescriptor;if(_A)try{_A({},"")}catch(t){_A=null}var IA=function(){throw new vA},EA=_A?function(){try{return IA}catch(t){try{return _A(arguments,"callee").get}catch(t){return IA}}}():IA,CA="function"==typeof aA&&"function"==typeof Symbol&&"symbol"==typeof aA("foo")&&"symbol"==typeof Symbol("bar")&&uA(),xA={__proto__:lA}.foo===lA.foo&&!({__proto__:null}instanceof cA),wA=Object.getPrototypeOf||(xA?function(t){return t.__proto__}:null),bA={},BA="undefined"!=typeof Uint8Array&&wA?wA(Uint8Array):nA,SA={"%AggregateError%":"undefined"==typeof AggregateError?nA:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?nA:ArrayBuffer,"%ArrayIteratorPrototype%":CA&&wA?wA([][Symbol.iterator]()):nA,"%AsyncFromSyncIteratorPrototype%":nA,"%AsyncFunction%":bA,"%AsyncGenerator%":bA,"%AsyncGeneratorFunction%":bA,"%AsyncIteratorPrototype%":bA,"%Atomics%":"undefined"==typeof Atomics?nA:Atomics,"%BigInt%":"undefined"==typeof BigInt?nA:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?nA:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?nA:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?nA:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?nA:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?nA:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?nA:FinalizationRegistry,"%Function%":yA,"%GeneratorFunction%":bA,"%Int8Array%":"undefined"==typeof Int8Array?nA:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?nA:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?nA:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":CA&&wA?wA(wA([][Symbol.iterator]())):nA,"%JSON%":"object"==typeof JSON?JSON:nA,"%Map%":"undefined"==typeof Map?nA:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&CA&&wA?wA((new Map)[Symbol.iterator]()):nA,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?nA:Promise,"%Proxy%":"undefined"==typeof Proxy?nA:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?nA:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?nA:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&CA&&wA?wA((new Set)[Symbol.iterator]()):nA,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?nA:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":CA&&wA?wA(""[Symbol.iterator]()):nA,"%Symbol%":CA?Symbol:nA,"%SyntaxError%":dA,"%ThrowTypeError%":EA,"%TypedArray%":BA,"%TypeError%":vA,"%Uint8Array%":"undefined"==typeof Uint8Array?nA:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?nA:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?nA:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?nA:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?nA:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?nA:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?nA:WeakSet};if(wA)try{null.error}catch(t){var MA=wA(wA(t));SA["%Error.prototype%"]=MA}var LA=function t(e){var n;if("%AsyncFunction%"===e)n=mA("async function () {}");else if("%GeneratorFunction%"===e)n=mA("function* () {}");else if("%AsyncGeneratorFunction%"===e)n=mA("async function* () {}");else if("%AsyncGenerator%"===e){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&wA&&(n=wA(i.prototype))}return SA[e]=n,n},NA={"%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"]},TA=gA,RA=AA,QA=TA.call(Function.call,Array.prototype.concat),DA=TA.call(Function.apply,Array.prototype.splice),PA=TA.call(Function.call,String.prototype.replace),kA=TA.call(Function.call,String.prototype.slice),OA=TA.call(Function.call,RegExp.prototype.exec),FA=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,GA=/\\(\\)?/g,UA=function(t,e){var n,r=t;if(RA(NA,r)&&(r="%"+(n=NA[r])[0]+"%"),RA(SA,r)){var i=SA[r];if(i===bA&&(i=LA(r)),void 0===i&&!e)throw new vA("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:r,value:i}}throw new dA("intrinsic "+t+" does not exist!")},qA=function(t,e){if("string"!=typeof t||0===t.length)throw new vA("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new vA('"allowMissing" argument must be a boolean');if(null===OA(/^%?[^%]*%?$/,t))throw new dA("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(t){var e=kA(t,0,1),n=kA(t,-1);if("%"===e&&"%"!==n)throw new dA("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==e)throw new dA("invalid intrinsic syntax, expected opening `%`");var r=[];return PA(t,FA,(function(t,e,n,i){r[r.length]=n?PA(i,GA,"$1"):e||t})),r}(t),r=n.length>0?n[0]:"",i=UA("%"+r+"%",e),o=i.name,s=i.value,a=!1,u=i.alias;u&&(r=u[0],DA(n,QA([0,1],u)));for(var l=1,c=!0;l<n.length;l+=1){var h=n[l],f=kA(h,0,1),p=kA(h,-1);if(('"'===f||"'"===f||"`"===f||'"'===p||"'"===p||"`"===p)&&f!==p)throw new dA("property names with quotes must have matching quotes");if("constructor"!==h&&c||(a=!0),RA(SA,o="%"+(r+="."+h)+"%"))s=SA[o];else if(null!=s){if(!(h in s)){if(!e)throw new vA("base intrinsic for "+t+" exists, but the property is not available.");return}if(_A&&l+1>=n.length){var g=_A(s,h);s=(c=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:s[h]}else c=RA(s,h),s=s[h];c&&!a&&(SA[o]=s)}}return s},jA={exports:{}};!function(t){var e=gA,n=qA,r=n("%Function.prototype.apply%"),i=n("%Function.prototype.call%"),o=n("%Reflect.apply%",!0)||e.call(i,r),s=n("%Object.getOwnPropertyDescriptor%",!0),a=n("%Object.defineProperty%",!0),u=n("%Math.max%");if(a)try{a({},"a",{value:1})}catch(t){a=null}t.exports=function(t){var n=o(e,i,arguments);s&&a&&(s(n,"length").configurable&&a(n,"length",{value:1+u(0,t.length-(arguments.length-1))}));return n};var l=function(){return o(e,r,arguments)};a?a(t.exports,"apply",{value:l}):t.exports.apply=l}(jA);var zA=qA,VA=jA.exports,YA=VA(zA("String.prototype.indexOf")),HA=function(t,e){var n=zA(t,!!e);return"function"==typeof n&&YA(t,".prototype.")>-1?VA(n):n},XA=sA(),JA=HA("Object.prototype.toString"),WA=function(t){return!(XA&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===JA(t)},KA=function(t){return!!WA(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==JA(t)&&"[object Function]"===JA(t.callee)},ZA=function(){return WA(arguments)}();WA.isLegacyArguments=KA;var $A=ZA?WA:KA,td=qA("%Object.defineProperty%",!0),ed=function(){if(td)try{return td({},"a",{value:1}),!0}catch(t){return!1}return!1};ed.hasArrayLengthDefineBug=function(){if(!ed())return null;try{return 1!==td([],"length",{value:1}).length}catch(t){return!0}};var nd=ed,rd=rA,id="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),od=Object.prototype.toString,sd=Array.prototype.concat,ad=Object.defineProperty,ud=nd(),ld=ad&&ud,cd=function(t,e,n,r){if(e in t)if(!0===r){if(t[e]===n)return}else if("function"!=typeof(i=r)||"[object Function]"!==od.call(i)||!r())return;var i;ld?ad(t,e,{configurable:!0,enumerable:!1,value:n,writable:!0}):t[e]=n},hd=function(t,e){var n=arguments.length>2?arguments[2]:{},r=rd(e);id&&(r=sd.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i<r.length;i+=1)cd(t,r[i],e[r[i]],n[r[i]])};hd.supportsDescriptors=!!ld;var fd=hd,pd=function(t){return t!=t},gd=function(t,e){return 0===t&&0===e?1/t==1/e:t===e||!(!pd(t)||!pd(e))},Ad=gd,dd=function(){return"function"==typeof Object.is?Object.is:Ad},yd=dd,vd=fd,md=fd,_d=gd,Id=dd,Ed=function(){var t=yd();return vd(Object,{is:t},{is:function(){return Object.is!==t}}),t},Cd=(0,jA.exports)(Id(),Object);md(Cd,{getPolyfill:Id,implementation:_d,shim:Ed});var xd,wd,bd,Bd,Sd=Cd,Md=HA,Ld=sA();if(Ld){xd=Md("Object.prototype.hasOwnProperty"),wd=Md("RegExp.prototype.exec"),bd={};var Nd=function(){throw bd};Bd={toString:Nd,valueOf:Nd},"symbol"==typeof Symbol.toPrimitive&&(Bd[Symbol.toPrimitive]=Nd)}var Td=Md("Object.prototype.toString"),Rd=Object.getOwnPropertyDescriptor,Qd=Ld?function(t){if(!t||"object"!=typeof t)return!1;var e=Rd(t,"lastIndex");if(!(e&&xd(e,"value")))return!1;try{wd(t,Bd)}catch(t){return t===bd}}:function(t){return!(!t||"object"!=typeof t&&"function"!=typeof t)&&"[object RegExp]"===Td(t)},Dd={exports:{}},Pd=function(){return"string"==typeof function(){}.name},kd=Object.getOwnPropertyDescriptor;if(kd)try{kd([],"length")}catch(t){kd=null}Pd.functionsHaveConfigurableNames=function(){if(!Pd()||!kd)return!1;var t=kd((function(){}),"name");return!!t&&!!t.configurable};var Od=Function.prototype.bind;Pd.boundFunctionsHaveNames=function(){return Pd()&&"function"==typeof Od&&""!==function(){}.bind().name};var Fd=Pd;!function(t){var e=Fd.functionsHaveConfigurableNames(),n=Object,r=TypeError;t.exports=function(){if(null!=this&&this!==n(this))throw new r("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"})}(Dd);var Gd=Dd.exports,Ud=fd.supportsDescriptors,qd=Object.getOwnPropertyDescriptor,jd=function(){if(Ud&&"gim"===/a/gim.flags){var t=qd(RegExp.prototype,"flags");if(t&&"function"==typeof t.get&&"boolean"==typeof RegExp.prototype.dotAll&&"boolean"==typeof RegExp.prototype.hasIndices){var e="",n={};if(Object.defineProperty(n,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(n,"sticky",{get:function(){e+="y"}}),"dy"===e)return t.get}}return Gd},zd=fd.supportsDescriptors,Vd=jd,Yd=Object.getOwnPropertyDescriptor,Hd=Object.defineProperty,Xd=TypeError,Jd=Object.getPrototypeOf,Wd=/a/,Kd=fd,Zd=Dd.exports,$d=jd,ty=function(){if(!zd||!Jd)throw new Xd("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=Vd(),e=Jd(Wd),n=Yd(e,"flags");return n&&n.get===t||Hd(e,"flags",{configurable:!0,enumerable:!1,get:t}),t},ey=(0,jA.exports)($d());Kd(ey,{getPolyfill:$d,implementation:Zd,shim:ty});var ny=ey,ry=Date.prototype.getDay,iy=Object.prototype.toString,oy=sA(),sy=rA,ay=$A,uy=Sd,ly=Qd,cy=ny,hy=function(t){return"object"==typeof t&&null!==t&&(oy?function(t){try{return ry.call(t),!0}catch(t){return!1}}(t):"[object Date]"===iy.call(t))},fy=Date.prototype.getTime;function py(t,e,n){var r=n||{};return!!(r.strict?uy(t,e):t===e)||(!t||!e||"object"!=typeof t&&"object"!=typeof e?r.strict?uy(t,e):t==e:function(t,e,n){var r,i;if(typeof t!=typeof e)return!1;if(gy(t)||gy(e))return!1;if(t.prototype!==e.prototype)return!1;if(ay(t)!==ay(e))return!1;var o=ly(t),s=ly(e);if(o!==s)return!1;if(o||s)return t.source===e.source&&cy(t)===cy(e);if(hy(t)&&hy(e))return fy.call(t)===fy.call(e);var a=Ay(t),u=Ay(e);if(a!==u)return!1;if(a||u){if(t.length!==e.length)return!1;for(r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}if(typeof t!=typeof e)return!1;try{var l=sy(t),c=sy(e)}catch(t){return!1}if(l.length!==c.length)return!1;for(l.sort(),c.sort(),r=l.length-1;r>=0;r--)if(l[r]!=c[r])return!1;for(r=l.length-1;r>=0;r--)if(!py(t[i=l[r]],e[i],n))return!1;return!0}(t,e,r))}function gy(t){return null==t}function Ay(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 dy=py;function yy(t,e,n){if(void 0===n&&(n={}),!bn(n=n||{}))throw new Error("options is invalid");var r,i=n.tolerance||0,o=[],s=Rp(),a=Yf(t);return s.load(a),kl(e,(function(t){var e=!1;t&&(Ll(s.search(t),(function(n){if(!1===e){var o=Nn(t).sort(),s=Nn(n).sort();dy(o,s)||(0===i?Kp(o[0],n)&&Kp(o[1],n):Pp(n,o[0]).properties.dist<=i&&Pp(n,o[1]).properties.dist<=i)?(e=!0,r=r?vy(r,t):t):(0===i?Kp(s[0],t)&&Kp(s[1],t):Pp(t,s[0]).properties.dist<=i&&Pp(t,s[1]).properties.dist<=i)&&(r=r?vy(r,n):n)}})),!1===e&&r&&(o.push(r),r=void 0))})),r&&o.push(r),hn(o)}function vy(t,e){var n=Nn(e),r=Nn(t),i=r[0],o=r[r.length-1],s=t.geometry.coordinates;return dy(n[0],i)?s.unshift(n[1]):dy(n[0],o)?s.push(n[1]):dy(n[1],i)?s.unshift(n[0]):dy(n[1],o)&&s.push(n[0]),t}function my(t){var e=t%360;return e<0&&(e+=360),e}function _y(t,e,n){var r;return void 0===n&&(n={}),(r=n.final?Iy(Ln(e),Ln(t)):Iy(Ln(t),Ln(e)))>180?-(360-r):r}function Iy(t,e){var n=En(t[1]),r=En(e[1]),i=En(e[0]-t[0]);i>Math.PI&&(i-=2*Math.PI),i<-Math.PI&&(i+=2*Math.PI);var o=Math.log(Math.tan(r/2+Math.PI/4)/Math.tan(n/2+Math.PI/4));return(In(Math.atan2(i,o))+360)%360}function Ey(t,e,n,r){void 0===r&&(r={});var i=e<0,o=Cn(Math.abs(e),r.units,"meters");i&&(o=-Math.abs(o));var s=Ln(t),a=function(t,e,n,r){r=void 0===r?Ze:Number(r);var i=e/r,o=t[0]*Math.PI/180,s=En(t[1]),a=En(n),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,n);return a[0]+=a[0]-s[0]>180?-360:s[0]-a[0]>180?360:0,on(a,r.properties)}function Cy(t,e,n,r,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]),r=wy(a,u,e),n<=0&&r>0?wy(e,a,i)<0||(i=a):n>0&&r<=0&&(xy(e,a,o)||(o=a)),n=r}return[i,o]}function xy(t,e,n){return wy(t,e,n)>0}function wy(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(e[1]-t[1])}function by(t){for(var e,n,r=Nn(t),i=0,o=1;o<r.length;)e=n||r[0],i+=((n=r[o])[0]-e[0])*(n[1]+e[1]),o++;return i>0}function By(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Rl(t,(function(t){By(t,e)})),t;case"LineString":return Sy(Nn(t),e),t;case"Polygon":return My(Nn(t),e),t;case"MultiLineString":return Nn(t).forEach((function(t){Sy(t,e)})),t;case"MultiPolygon":return Nn(t).forEach((function(t){My(t,e)})),t;case"Point":case"MultiPoint":return t}}function Sy(t,e){by(t)===e&&t.reverse()}function My(t,e){by(t[0])!==e&&t[0].reverse();for(var n=1;n<t.length;n++)by(t[n])===e&&t[n].reverse()}function Ly(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.zProperty||"elevation",r=e.flip,i=e.flags;Dn(t,"Point","input must contain Points");for(var o=function(t,e){var n={};Ll(t,(function(t){var e=Nn(t)[1];n[e]||(n[e]=[]),n[e].push(t)}));var r=Object.keys(n).map((function(t){return n[t].sort((function(t,e){return Nn(t)[0]-Nn(e)[0]}))})),i=r.sort((function(t,n){return e?Nn(t[0])[1]-Nn(n[0])[1]:Nn(n[0])[1]-Nn(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,r),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[n]?l.push(h.properties[n]):l.push(0),!0===i&&(h.properties.matrixPosition=[a,c])}s.push(l)}return s}var Ny={successCallback:null,verbose:!1,polygons:!1},Ty={};function Ry(t,e,n,r){r=r||{};for(var i=Object.keys(Ny),o=0;o<i.length;o++){var s=i[o],a=r[s];a=null!=a?a:Ny[s],Ty[s]=a}Ty.verbose&&console.log("MarchingSquaresJS-isoBands: computing isobands for ["+e+":"+(e+n)+"]");var u,l=function(t,e,n){for(var r=t.length-1,i=t[0].length-1,o={rows:r,cols:i,cells:[]},s=e+Math.abs(n),a=0;a<r;++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,C,x;y=v=m=_=I=E=C=x=.5;var w=[];1===l?(m=1-wv(e,f,p),x=1-wv(e,c,p),w.push(mv[l])):169===l?(m=wv(s,p,f),x=wv(s,p,c),w.push(mv[l])):4===l?(E=1-wv(e,h,f),_=wv(e,p,f),w.push(yv[l])):166===l?(E=wv(s,f,h),_=1-wv(s,f,p),w.push(yv[l])):16===l?(I=wv(e,f,h),v=wv(e,c,h),w.push(dv[l])):154===l?(I=1-wv(s,h,f),v=1-wv(s,h,c),w.push(dv[l])):64===l?(C=wv(e,p,c),y=1-wv(e,h,c),w.push(Iv[l])):106===l?(C=1-wv(s,c,p),y=wv(s,c,h),w.push(Iv[l])):168===l?(_=wv(s,p,f),m=wv(e,p,f),x=wv(e,p,c),C=wv(s,p,c),w.push(vv[l]),w.push(mv[l])):2===l?(_=1-wv(e,f,p),m=1-wv(s,f,p),x=1-wv(s,c,p),C=1-wv(e,c,p),w.push(vv[l]),w.push(mv[l])):162===l?(I=wv(s,f,h),E=wv(e,f,h),_=1-wv(e,f,p),m=1-wv(s,f,p),w.push(vv[l]),w.push(mv[l])):8===l?(I=1-wv(e,h,f),E=1-wv(s,h,f),_=wv(s,p,f),m=wv(e,p,f),w.push(dv[l]),w.push(yv[l])):138===l?(I=1-wv(e,h,f),E=1-wv(s,h,f),y=1-wv(s,h,c),v=1-wv(e,h,c),w.push(dv[l]),w.push(yv[l])):32===l?(I=wv(s,f,h),E=wv(e,f,h),y=wv(e,c,h),v=wv(s,c,h),w.push(dv[l]),w.push(yv[l])):42===l?(x=1-wv(s,c,p),C=1-wv(e,c,p),y=wv(e,c,h),v=wv(s,c,h),w.push(_v[l]),w.push(Iv[l])):128===l&&(x=wv(e,p,c),C=wv(s,p,c),y=1-wv(s,h,c),v=1-wv(e,h,c),w.push(_v[l]),w.push(Iv[l])),5===l?(E=1-wv(e,h,f),x=1-wv(e,c,p),w.push(yv[l])):165===l?(E=wv(s,f,h),x=wv(s,p,c),w.push(yv[l])):20===l?(_=wv(e,p,f),v=wv(e,c,h),w.push(vv[l])):150===l?(_=1-wv(s,f,p),v=1-wv(s,h,c),w.push(vv[l])):80===l?(I=wv(e,f,h),C=wv(e,p,c),w.push(dv[l])):90===l?(I=1-wv(s,h,f),C=1-wv(s,c,p),w.push(dv[l])):65===l?(m=1-wv(e,f,p),y=1-wv(e,h,c),w.push(mv[l])):105===l?(m=wv(s,p,f),y=wv(s,c,h),w.push(mv[l])):160===l?(I=wv(s,f,h),E=wv(e,f,h),x=wv(e,p,c),C=wv(s,p,c),w.push(dv[l]),w.push(yv[l])):10===l?(I=1-wv(e,h,f),E=1-wv(s,h,f),x=1-wv(s,c,p),C=1-wv(e,c,p),w.push(dv[l]),w.push(yv[l])):130===l?(_=1-wv(e,f,p),m=1-wv(s,f,p),y=1-wv(s,h,c),v=1-wv(e,h,c),w.push(vv[l]),w.push(mv[l])):40===l?(_=wv(s,p,f),m=wv(e,p,f),y=wv(e,c,h),v=wv(s,c,h),w.push(vv[l]),w.push(mv[l])):101===l?(E=wv(s,f,h),y=wv(s,c,h),w.push(yv[l])):69===l?(E=1-wv(e,h,f),y=1-wv(e,h,c),w.push(yv[l])):149===l?(x=wv(s,p,c),v=1-wv(s,h,c),w.push(_v[l])):21===l?(x=1-wv(e,c,p),v=wv(e,c,h),w.push(_v[l])):86===l?(_=1-wv(s,f,p),C=1-wv(s,c,p),w.push(vv[l])):84===l?(_=wv(e,p,f),C=wv(e,p,c),w.push(vv[l])):89===l?(I=1-wv(s,h,f),m=wv(s,p,f),w.push(mv[l])):81===l?(I=wv(e,f,h),m=1-wv(e,f,p),w.push(mv[l])):96===l?(I=wv(s,f,h),E=wv(e,f,h),C=wv(e,p,c),y=wv(s,c,h),w.push(dv[l]),w.push(yv[l])):74===l?(I=1-wv(e,h,f),E=1-wv(s,h,f),C=1-wv(s,c,p),y=1-wv(e,h,c),w.push(dv[l]),w.push(yv[l])):24===l?(I=1-wv(s,h,f),_=wv(s,p,f),m=wv(e,p,f),v=wv(e,c,h),w.push(dv[l]),w.push(mv[l])):146===l?(I=wv(e,f,h),_=1-wv(e,f,p),m=1-wv(s,f,p),v=1-wv(s,h,c),w.push(dv[l]),w.push(mv[l])):6===l?(E=1-wv(e,h,f),_=1-wv(s,f,p),x=1-wv(s,c,p),C=1-wv(e,c,p),w.push(yv[l]),w.push(vv[l])):164===l?(E=wv(s,f,h),_=wv(e,p,f),x=wv(e,p,c),C=wv(s,p,c),w.push(yv[l]),w.push(vv[l])):129===l?(m=1-wv(e,f,p),x=wv(s,p,c),y=1-wv(s,h,c),v=1-wv(e,h,c),w.push(mv[l]),w.push(_v[l])):41===l?(m=wv(s,p,f),x=1-wv(e,c,p),y=wv(e,c,h),v=wv(s,c,h),w.push(mv[l]),w.push(_v[l])):66===l?(_=1-wv(e,f,p),m=1-wv(s,f,p),C=1-wv(s,c,p),y=1-wv(e,h,c),w.push(vv[l]),w.push(mv[l])):104===l?(_=wv(s,p,f),m=wv(e,p,f),C=wv(e,p,c),y=wv(s,c,h),w.push(mv[l]),w.push(Ev[l])):144===l?(I=wv(e,f,h),x=wv(e,p,c),C=wv(s,p,c),v=1-wv(s,h,c),w.push(dv[l]),w.push(Iv[l])):26===l?(I=1-wv(s,h,f),x=1-wv(s,c,p),C=1-wv(e,c,p),v=wv(e,c,h),w.push(dv[l]),w.push(Iv[l])):36===l?(E=wv(s,f,h),_=wv(e,p,f),y=wv(e,c,h),v=wv(s,c,h),w.push(yv[l]),w.push(vv[l])):134===l?(E=1-wv(e,h,f),_=1-wv(s,f,p),y=1-wv(s,h,c),v=1-wv(e,h,c),w.push(yv[l]),w.push(vv[l])):9===l?(I=1-wv(e,h,f),E=1-wv(s,h,f),m=wv(s,p,f),x=1-wv(e,c,p),w.push(dv[l]),w.push(yv[l])):161===l?(I=wv(s,f,h),E=wv(e,f,h),m=1-wv(e,f,p),x=wv(s,p,c),w.push(dv[l]),w.push(yv[l])):37===l?(E=wv(s,f,h),x=1-wv(e,c,p),y=wv(e,c,h),v=wv(s,c,h),w.push(yv[l]),w.push(_v[l])):133===l?(E=1-wv(e,h,f),x=wv(s,p,c),y=1-wv(s,h,c),v=1-wv(e,h,c),w.push(yv[l]),w.push(_v[l])):148===l?(_=wv(e,p,f),x=wv(e,p,c),C=wv(s,p,c),v=1-wv(s,h,c),w.push(vv[l]),w.push(Iv[l])):22===l?(_=1-wv(s,f,p),x=1-wv(s,c,p),C=1-wv(e,c,p),v=wv(e,c,h),w.push(vv[l]),w.push(Iv[l])):82===l?(I=wv(e,f,h),_=1-wv(e,f,p),m=1-wv(s,f,p),C=1-wv(s,c,p),w.push(dv[l]),w.push(mv[l])):88===l?(I=1-wv(s,h,f),_=wv(s,p,f),m=wv(e,p,f),C=wv(e,p,c),w.push(dv[l]),w.push(mv[l])):73===l?(I=1-wv(e,h,f),E=1-wv(s,h,f),m=wv(s,p,f),y=1-wv(e,h,c),w.push(dv[l]),w.push(yv[l])):97===l?(I=wv(s,f,h),E=wv(e,f,h),m=1-wv(e,f,p),y=wv(s,c,h),w.push(dv[l]),w.push(yv[l])):145===l?(I=wv(e,f,h),m=1-wv(e,f,p),x=wv(s,p,c),v=1-wv(s,h,c),w.push(dv[l]),w.push(_v[l])):25===l?(I=1-wv(s,h,f),m=wv(s,p,f),x=1-wv(e,c,p),v=wv(e,c,h),w.push(dv[l]),w.push(_v[l])):70===l?(E=1-wv(e,h,f),_=1-wv(s,f,p),C=1-wv(s,c,p),y=1-wv(e,h,c),w.push(yv[l]),w.push(vv[l])):100===l?(E=wv(s,f,h),_=wv(e,p,f),C=wv(e,p,c),y=wv(s,c,h),w.push(yv[l]),w.push(vv[l])):34===l?(0===A?(I=1-wv(e,h,f),E=1-wv(s,h,f),_=wv(s,p,f),m=wv(e,p,f),x=wv(e,p,c),C=wv(s,p,c),y=1-wv(s,h,c),v=1-wv(e,h,c)):(I=wv(s,f,h),E=wv(e,f,h),_=1-wv(e,f,p),m=1-wv(s,f,p),x=1-wv(s,c,p),C=1-wv(e,c,p),y=wv(e,c,h),v=wv(s,c,h)),w.push(dv[l]),w.push(yv[l]),w.push(_v[l]),w.push(Iv[l])):35===l?(4===A?(I=1-wv(e,h,f),E=1-wv(s,h,f),_=wv(s,p,f),m=wv(e,p,f),x=wv(e,p,c),C=wv(s,p,c),y=1-wv(s,h,c),v=1-wv(e,h,c)):(I=wv(s,f,h),E=wv(e,f,h),_=1-wv(e,f,p),m=1-wv(s,f,p),x=1-wv(s,c,p),C=1-wv(e,c,p),y=wv(e,c,h),v=wv(s,c,h)),w.push(dv[l]),w.push(yv[l]),w.push(mv[l]),w.push(Iv[l])):136===l?(0===A?(I=wv(s,f,h),E=wv(e,f,h),_=1-wv(e,f,p),m=1-wv(s,f,p),x=1-wv(s,c,p),C=1-wv(e,c,p),y=wv(e,c,h),v=wv(s,c,h)):(I=1-wv(e,h,f),E=1-wv(s,h,f),_=wv(s,p,f),m=wv(e,p,f),x=wv(e,p,c),C=wv(s,p,c),y=1-wv(s,h,c),v=1-wv(e,h,c)),w.push(dv[l]),w.push(yv[l]),w.push(_v[l]),w.push(Iv[l])):153===l?(0===A?(I=wv(e,f,h),m=1-wv(e,f,p),x=1-wv(e,c,p),v=wv(e,c,h)):(I=1-wv(s,h,f),m=wv(s,p,f),x=wv(s,p,c),v=1-wv(s,h,c)),w.push(dv[l]),w.push(mv[l])):102===l?(0===A?(E=1-wv(e,h,f),_=wv(e,p,f),C=wv(e,p,c),y=1-wv(e,h,c)):(E=wv(s,f,h),_=1-wv(s,f,p),C=1-wv(s,c,p),y=wv(s,c,h)),w.push(yv[l]),w.push(Iv[l])):155===l?(4===A?(I=wv(e,f,h),m=1-wv(e,f,p),x=1-wv(e,c,p),v=wv(e,c,h)):(I=1-wv(s,h,f),m=wv(s,p,f),x=wv(s,p,c),v=1-wv(s,h,c)),w.push(dv[l]),w.push(_v[l])):103===l?(4===A?(E=1-wv(e,h,f),_=wv(e,p,f),C=wv(e,p,c),y=1-wv(e,h,c)):(E=wv(s,f,h),_=1-wv(s,f,p),C=1-wv(s,c,p),y=wv(s,c,h)),w.push(yv[l]),w.push(vv[l])):152===l?(0===A?(I=wv(e,f,h),_=1-wv(e,f,p),m=1-wv(s,f,p),x=1-wv(s,c,p),C=1-wv(e,c,p),v=wv(e,c,h)):(I=1-wv(s,h,f),_=wv(s,p,f),m=wv(e,p,f),x=wv(e,p,c),C=wv(s,p,c),v=1-wv(s,h,c)),w.push(dv[l]),w.push(vv[l]),w.push(mv[l])):156===l?(4===A?(I=wv(e,f,h),_=1-wv(e,f,p),m=1-wv(s,f,p),x=1-wv(s,c,p),C=1-wv(e,c,p),v=wv(e,c,h)):(I=1-wv(s,h,f),_=wv(s,p,f),m=wv(e,p,f),x=wv(e,p,c),C=wv(s,p,c),v=1-wv(s,h,c)),w.push(dv[l]),w.push(mv[l]),w.push(Iv[l])):137===l?(0===A?(I=wv(s,f,h),E=wv(e,f,h),m=1-wv(e,f,p),x=1-wv(e,c,p),y=wv(e,c,h),v=wv(s,c,h)):(I=1-wv(e,h,f),E=1-wv(s,h,f),m=wv(s,p,f),x=wv(s,p,c),y=1-wv(s,h,c),v=1-wv(e,h,c)),w.push(dv[l]),w.push(yv[l]),w.push(mv[l])):139===l?(4===A?(I=wv(s,f,h),E=wv(e,f,h),m=1-wv(e,f,p),x=1-wv(e,c,p),y=wv(e,c,h),v=wv(s,c,h)):(I=1-wv(e,h,f),E=1-wv(s,h,f),m=wv(s,p,f),x=wv(s,p,c),y=1-wv(s,h,c),v=1-wv(e,h,c)),w.push(dv[l]),w.push(yv[l]),w.push(_v[l])):98===l?(0===A?(I=1-wv(e,h,f),E=1-wv(s,h,f),_=wv(s,p,f),m=wv(e,p,f),C=wv(e,p,c),y=1-wv(e,h,c)):(I=wv(s,f,h),E=wv(e,f,h),_=1-wv(e,f,p),m=1-wv(s,f,p),C=1-wv(s,c,p),y=wv(s,c,h)),w.push(dv[l]),w.push(yv[l]),w.push(Iv[l])):99===l?(4===A?(I=1-wv(e,h,f),E=1-wv(s,h,f),_=wv(s,p,f),m=wv(e,p,f),C=wv(e,p,c),y=1-wv(e,h,c)):(I=wv(s,f,h),E=wv(e,f,h),_=1-wv(e,f,p),m=1-wv(s,f,p),C=1-wv(s,c,p),y=wv(s,c,h)),w.push(dv[l]),w.push(yv[l]),w.push(mv[l])):38===l?(0===A?(E=1-wv(e,h,f),_=wv(e,p,f),x=wv(e,p,c),C=wv(s,p,c),y=1-wv(s,h,c),v=1-wv(e,h,c)):(E=wv(s,f,h),_=1-wv(s,f,p),x=1-wv(s,c,p),C=1-wv(e,c,p),y=wv(e,c,h),v=wv(s,c,h)),w.push(yv[l]),w.push(_v[l]),w.push(Iv[l])):39===l?(4===A?(E=1-wv(e,h,f),_=wv(e,p,f),x=wv(e,p,c),C=wv(s,p,c),y=1-wv(s,h,c),v=1-wv(e,h,c)):(E=wv(s,f,h),_=1-wv(s,f,p),x=1-wv(s,c,p),C=1-wv(e,c,p),y=wv(e,c,h),v=wv(s,c,h)),w.push(yv[l]),w.push(vv[l]),w.push(Iv[l])):85===l&&(I=1,E=0,_=1,m=0,x=0,C=1,y=0,v=1),(y<0||y>1||v<0||v>1||I<0||I>1||_<0||_>1||x<0||x>1||C<0||C>1)&&console.log("MarchingSquaresJS-isoBands: "+l+" "+g+" "+c+","+h+","+f+","+p+" "+A+" "+y+" "+v+" "+I+" "+E+" "+_+" "+m+" "+x+" "+C),o.cells[a][u]={cval:l,cval_real:g,flipped:A,topleft:y,topright:v,righttop:I,rightbottom:E,bottomright:_,bottomleft:m,leftbottom:x,lefttop:C,edges:w}}}}}return o}(t,e,n);return Ty.polygons?(Ty.verbose&&console.log("MarchingSquaresJS-isoBands: returning single polygons for each grid cell"),u=function(t){var e=[],n=0;return t.cells.forEach((function(t,r){t.forEach((function(t,i){if(void 0!==t){var o=xv[t.cval](t);"object"==typeof o&&bv(o)?"object"==typeof o[0]&&bv(o[0])?"object"==typeof o[0][0]&&bv(o[0][0])?o.forEach((function(t){t.forEach((function(t){t[0]+=i,t[1]+=r})),e[n++]=t})):(o.forEach((function(t){t[0]+=i,t[1]+=r})),e[n++]=o):console.log("MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates"):console.log("MarchingSquaresJS-isoBands: bandcell polygon with null coordinates")}}))})),e}(l)):(Ty.verbose&&console.log("MarchingSquaresJS-isoBands: returning polygon paths for entire data grid"),u=function(t){for(var e=[],n=t.rows,r=t.cols,i=[],o=0;o<n;o++)for(var s=0;s<r;s++)if(void 0!==t.cells[o][s]&&t.cells[o][s].edges.length>0){var a=Sv(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=Mv(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>=n||l<0||l>=r||void 0===t.cells[c][l]){var h=Bv(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 Ty.successCallback&&Ty.successCallback(u),u}var Qy=64,Dy=16,Py=4,ky=1,Oy=[],Fy=[],Gy=[],Uy=[],qy=[],jy=[],zy=[],Vy=[],Yy=[],Hy=[],Xy=[],Jy=[],Wy=[],Ky=[],Zy=[],$y=[],tv=[],ev=[],nv=[],rv=[],iv=[],ov=[],sv=[],av=[];zy[85]=Hy[85]=-1,Vy[85]=Xy[85]=0,Yy[85]=Jy[85]=1,nv[85]=ov[85]=1,rv[85]=sv[85]=0,iv[85]=av[85]=1,Oy[85]=Uy[85]=0,Fy[85]=qy[85]=-1,Gy[85]=Zy[85]=0,$y[85]=Wy[85]=0,tv[85]=Ky[85]=1,jy[85]=ev[85]=1,ov[1]=ov[169]=0,sv[1]=sv[169]=-1,av[1]=av[169]=0,Wy[1]=Wy[169]=-1,Ky[1]=Ky[169]=0,Zy[1]=Zy[169]=0,Hy[4]=Hy[166]=0,Xy[4]=Xy[166]=-1,Jy[4]=Jy[166]=1,$y[4]=$y[166]=1,tv[4]=tv[166]=0,ev[4]=ev[166]=0,zy[16]=zy[154]=0,Vy[16]=Vy[154]=1,Yy[16]=Yy[154]=1,Uy[16]=Uy[154]=1,qy[16]=qy[154]=0,jy[16]=jy[154]=1,nv[64]=nv[106]=0,rv[64]=rv[106]=1,iv[64]=iv[106]=0,Oy[64]=Oy[106]=-1,Fy[64]=Fy[106]=0,Gy[64]=Gy[106]=1,nv[2]=nv[168]=0,rv[2]=rv[168]=-1,iv[2]=iv[168]=1,ov[2]=ov[168]=0,sv[2]=sv[168]=-1,av[2]=av[168]=0,Wy[2]=Wy[168]=-1,Ky[2]=Ky[168]=0,Zy[2]=Zy[168]=0,$y[2]=$y[168]=-1,tv[2]=tv[168]=0,ev[2]=ev[168]=1,zy[8]=zy[162]=0,Vy[8]=Vy[162]=-1,Yy[8]=Yy[162]=0,Hy[8]=Hy[162]=0,Xy[8]=Xy[162]=-1,Jy[8]=Jy[162]=1,Wy[8]=Wy[162]=1,Ky[8]=Ky[162]=0,Zy[8]=Zy[162]=1,$y[8]=$y[162]=1,tv[8]=tv[162]=0,ev[8]=ev[162]=0,zy[32]=zy[138]=0,Vy[32]=Vy[138]=1,Yy[32]=Yy[138]=1,Hy[32]=Hy[138]=0,Xy[32]=Xy[138]=1,Jy[32]=Jy[138]=0,Oy[32]=Oy[138]=1,Fy[32]=Fy[138]=0,Gy[32]=Gy[138]=0,Uy[32]=Uy[138]=1,qy[32]=qy[138]=0,jy[32]=jy[138]=1,ov[128]=ov[42]=0,sv[128]=sv[42]=1,av[128]=av[42]=1,nv[128]=nv[42]=0,rv[128]=rv[42]=1,iv[128]=iv[42]=0,Oy[128]=Oy[42]=-1,Fy[128]=Fy[42]=0,Gy[128]=Gy[42]=1,Uy[128]=Uy[42]=-1,qy[128]=qy[42]=0,jy[128]=jy[42]=0,Hy[5]=Hy[165]=-1,Xy[5]=Xy[165]=0,Jy[5]=Jy[165]=0,ov[5]=ov[165]=1,sv[5]=sv[165]=0,av[5]=av[165]=0,$y[20]=$y[150]=0,tv[20]=tv[150]=1,ev[20]=ev[150]=1,Uy[20]=Uy[150]=0,qy[20]=qy[150]=-1,jy[20]=jy[150]=1,zy[80]=zy[90]=-1,Vy[80]=Vy[90]=0,Yy[80]=Yy[90]=1,nv[80]=nv[90]=1,rv[80]=rv[90]=0,iv[80]=iv[90]=1,Wy[65]=Wy[105]=0,Ky[65]=Ky[105]=1,Zy[65]=Zy[105]=0,Oy[65]=Oy[105]=0,Fy[65]=Fy[105]=-1,Gy[65]=Gy[105]=0,zy[160]=zy[10]=-1,Vy[160]=Vy[10]=0,Yy[160]=Yy[10]=1,Hy[160]=Hy[10]=-1,Xy[160]=Xy[10]=0,Jy[160]=Jy[10]=0,ov[160]=ov[10]=1,sv[160]=sv[10]=0,av[160]=av[10]=0,nv[160]=nv[10]=1,rv[160]=rv[10]=0,iv[160]=iv[10]=1,$y[130]=$y[40]=0,tv[130]=tv[40]=1,ev[130]=ev[40]=1,Wy[130]=Wy[40]=0,Ky[130]=Ky[40]=1,Zy[130]=Zy[40]=0,Oy[130]=Oy[40]=0,Fy[130]=Fy[40]=-1,Gy[130]=Gy[40]=0,Uy[130]=Uy[40]=0,qy[130]=qy[40]=-1,jy[130]=jy[40]=1,Hy[37]=Hy[133]=0,Xy[37]=Xy[133]=1,Jy[37]=Jy[133]=1,ov[37]=ov[133]=0,sv[37]=sv[133]=1,av[37]=av[133]=0,Oy[37]=Oy[133]=-1,Fy[37]=Fy[133]=0,Gy[37]=Gy[133]=0,Uy[37]=Uy[133]=1,qy[37]=qy[133]=0,jy[37]=jy[133]=0,$y[148]=$y[22]=-1,tv[148]=tv[22]=0,ev[148]=ev[22]=0,ov[148]=ov[22]=0,sv[148]=sv[22]=-1,av[148]=av[22]=1,nv[148]=nv[22]=0,rv[148]=rv[22]=1,iv[148]=iv[22]=1,Uy[148]=Uy[22]=-1,qy[148]=qy[22]=0,jy[148]=jy[22]=1,zy[82]=zy[88]=0,Vy[82]=Vy[88]=-1,Yy[82]=Yy[88]=1,$y[82]=$y[88]=1,tv[82]=tv[88]=0,ev[82]=ev[88]=1,Wy[82]=Wy[88]=-1,Ky[82]=Ky[88]=0,Zy[82]=Zy[88]=1,nv[82]=nv[88]=0,rv[82]=rv[88]=-1,iv[82]=iv[88]=0,zy[73]=zy[97]=0,Vy[73]=Vy[97]=1,Yy[73]=Yy[97]=0,Hy[73]=Hy[97]=0,Xy[73]=Xy[97]=-1,Jy[73]=Jy[97]=0,Wy[73]=Wy[97]=1,Ky[73]=Ky[97]=0,Zy[73]=Zy[97]=0,Oy[73]=Oy[97]=1,Fy[73]=Fy[97]=0,Gy[73]=Gy[97]=1,zy[145]=zy[25]=0,Vy[145]=Vy[25]=-1,Yy[145]=Yy[25]=0,Wy[145]=Wy[25]=1,Ky[145]=Ky[25]=0,Zy[145]=Zy[25]=1,ov[145]=ov[25]=0,sv[145]=sv[25]=1,av[145]=av[25]=1,Uy[145]=Uy[25]=-1,qy[145]=qy[25]=0,jy[145]=jy[25]=0,Hy[70]=Hy[100]=0,Xy[70]=Xy[100]=1,Jy[70]=Jy[100]=0,$y[70]=$y[100]=-1,tv[70]=tv[100]=0,ev[70]=ev[100]=1,nv[70]=nv[100]=0,rv[70]=rv[100]=-1,iv[70]=iv[100]=1,Oy[70]=Oy[100]=1,Fy[70]=Fy[100]=0,Gy[70]=Gy[100]=0,Hy[101]=Hy[69]=0,Xy[101]=Xy[69]=1,Jy[101]=Jy[69]=0,Oy[101]=Oy[69]=1,Fy[101]=Fy[69]=0,Gy[101]=Gy[69]=0,ov[149]=ov[21]=0,sv[149]=sv[21]=1,av[149]=av[21]=1,Uy[149]=Uy[21]=-1,qy[149]=qy[21]=0,jy[149]=jy[21]=0,$y[86]=$y[84]=-1,tv[86]=tv[84]=0,ev[86]=ev[84]=1,nv[86]=nv[84]=0,rv[86]=rv[84]=-1,iv[86]=iv[84]=1,zy[89]=zy[81]=0,Vy[89]=Vy[81]=-1,Yy[89]=Yy[81]=0,Wy[89]=Wy[81]=1,Ky[89]=Ky[81]=0,Zy[89]=Zy[81]=1,zy[96]=zy[74]=0,Vy[96]=Vy[74]=1,Yy[96]=Yy[74]=0,Hy[96]=Hy[74]=-1,Xy[96]=Xy[74]=0,Jy[96]=Jy[74]=1,nv[96]=nv[74]=1,rv[96]=rv[74]=0,iv[96]=iv[74]=0,Oy[96]=Oy[74]=1,Fy[96]=Fy[74]=0,Gy[96]=Gy[74]=1,zy[24]=zy[146]=0,Vy[24]=Vy[146]=-1,Yy[24]=Yy[146]=1,$y[24]=$y[146]=1,tv[24]=tv[146]=0,ev[24]=ev[146]=1,Wy[24]=Wy[146]=0,Ky[24]=Ky[146]=1,Zy[24]=Zy[146]=1,Uy[24]=Uy[146]=0,qy[24]=qy[146]=-1,jy[24]=jy[146]=0,Hy[6]=Hy[164]=-1,Xy[6]=Xy[164]=0,Jy[6]=Jy[164]=1,$y[6]=$y[164]=-1,tv[6]=tv[164]=0,ev[6]=ev[164]=0,ov[6]=ov[164]=0,sv[6]=sv[164]=-1,av[6]=av[164]=1,nv[6]=nv[164]=1,rv[6]=rv[164]=0,iv[6]=iv[164]=0,Wy[129]=Wy[41]=0,Ky[129]=Ky[41]=1,Zy[129]=Zy[41]=1,ov[129]=ov[41]=0,sv[129]=sv[41]=1,av[129]=av[41]=0,Oy[129]=Oy[41]=-1,Fy[129]=Fy[41]=0,Gy[129]=Gy[41]=0,Uy[129]=Uy[41]=0,qy[129]=qy[41]=-1,jy[129]=jy[41]=0,$y[66]=$y[104]=0,tv[66]=tv[104]=1,ev[66]=ev[104]=0,Wy[66]=Wy[104]=-1,Ky[66]=Ky[104]=0,Zy[66]=Zy[104]=1,nv[66]=nv[104]=0,rv[66]=rv[104]=-1,iv[66]=iv[104]=0,Oy[66]=Oy[104]=0,Fy[66]=Fy[104]=-1,Gy[66]=Gy[104]=1,zy[144]=zy[26]=-1,Vy[144]=Vy[26]=0,Yy[144]=Yy[26]=0,ov[144]=ov[26]=1,sv[144]=sv[26]=0,av[144]=av[26]=1,nv[144]=nv[26]=0,rv[144]=rv[26]=1,iv[144]=iv[26]=1,Uy[144]=Uy[26]=-1,qy[144]=qy[26]=0,jy[144]=jy[26]=1,Hy[36]=Hy[134]=0,Xy[36]=Xy[134]=1,Jy[36]=Jy[134]=1,$y[36]=$y[134]=0,tv[36]=tv[134]=1,ev[36]=ev[134]=0,Oy[36]=Oy[134]=0,Fy[36]=Fy[134]=-1,Gy[36]=Gy[134]=1,Uy[36]=Uy[134]=1,qy[36]=qy[134]=0,jy[36]=jy[134]=0,zy[9]=zy[161]=-1,Vy[9]=Vy[161]=0,Yy[9]=Yy[161]=0,Hy[9]=Hy[161]=0,Xy[9]=Xy[161]=-1,Jy[9]=Jy[161]=0,Wy[9]=Wy[161]=1,Ky[9]=Ky[161]=0,Zy[9]=Zy[161]=0,ov[9]=ov[161]=1,sv[9]=sv[161]=0,av[9]=av[161]=1,zy[136]=0,Vy[136]=1,Yy[136]=1,Hy[136]=0,Xy[136]=1,Jy[136]=0,$y[136]=-1,tv[136]=0,ev[136]=1,Wy[136]=-1,Ky[136]=0,Zy[136]=0,ov[136]=0,sv[136]=-1,av[136]=0,nv[136]=0,rv[136]=-1,iv[136]=1,Oy[136]=1,Fy[136]=0,Gy[136]=0,Uy[136]=1,qy[136]=0,jy[136]=1,zy[34]=0,Vy[34]=-1,Yy[34]=0,Hy[34]=0,Xy[34]=-1,Jy[34]=1,$y[34]=1,tv[34]=0,ev[34]=0,Wy[34]=1,Ky[34]=0,Zy[34]=1,ov[34]=0,sv[34]=1,av[34]=1,nv[34]=0,rv[34]=1,iv[34]=0,Oy[34]=-1,Fy[34]=0,Gy[34]=1,Uy[34]=-1,qy[34]=0,jy[34]=0,zy[35]=0,Vy[35]=1,Yy[35]=1,Hy[35]=0,Xy[35]=-1,Jy[35]=1,$y[35]=1,tv[35]=0,ev[35]=0,Wy[35]=-1,Ky[35]=0,Zy[35]=0,ov[35]=0,sv[35]=-1,av[35]=0,nv[35]=0,rv[35]=1,iv[35]=0,Oy[35]=-1,Fy[35]=0,Gy[35]=1,Uy[35]=1,qy[35]=0,jy[35]=1,zy[153]=0,Vy[153]=1,Yy[153]=1,Wy[153]=-1,Ky[153]=0,Zy[153]=0,ov[153]=0,sv[153]=-1,av[153]=0,Uy[153]=1,qy[153]=0,jy[153]=1,Hy[102]=0,Xy[102]=-1,Jy[102]=1,$y[102]=1,tv[102]=0,ev[102]=0,nv[102]=0,rv[102]=1,iv[102]=0,Oy[102]=-1,Fy[102]=0,Gy[102]=1,zy[155]=0,Vy[155]=-1,Yy[155]=0,Wy[155]=1,Ky[155]=0,Zy[155]=1,ov[155]=0,sv[155]=1,av[155]=1,Uy[155]=-1,qy[155]=0,jy[155]=0,Hy[103]=0,Xy[103]=1,Jy[103]=0,$y[103]=-1,tv[103]=0,ev[103]=1,nv[103]=0,rv[103]=-1,iv[103]=1,Oy[103]=1,Fy[103]=0,Gy[103]=0,zy[152]=0,Vy[152]=1,Yy[152]=1,$y[152]=-1,tv[152]=0,ev[152]=1,Wy[152]=-1,Ky[152]=0,Zy[152]=0,ov[152]=0,sv[152]=-1,av[152]=0,nv[152]=0,rv[152]=-1,iv[152]=1,Uy[152]=1,qy[152]=0,jy[152]=1,zy[156]=0,Vy[156]=-1,Yy[156]=1,$y[156]=1,tv[156]=0,ev[156]=1,Wy[156]=-1,Ky[156]=0,Zy[156]=0,ov[156]=0,sv[156]=-1,av[156]=0,nv[156]=0,rv[156]=1,iv[156]=1,Uy[156]=-1,qy[156]=0,jy[156]=1,zy[137]=0,Vy[137]=1,Yy[137]=1,Hy[137]=0,Xy[137]=1,Jy[137]=0,Wy[137]=-1,Ky[137]=0,Zy[137]=0,ov[137]=0,sv[137]=-1,av[137]=0,Oy[137]=1,Fy[137]=0,Gy[137]=0,Uy[137]=1,qy[137]=0,jy[137]=1,zy[139]=0,Vy[139]=1,Yy[139]=1,Hy[139]=0,Xy[139]=-1,Jy[139]=0,Wy[139]=1,Ky[139]=0,Zy[139]=0,ov[139]=0,sv[139]=1,av[139]=0,Oy[139]=-1,Fy[139]=0,Gy[139]=0,Uy[139]=1,qy[139]=0,jy[139]=1,zy[98]=0,Vy[98]=-1,Yy[98]=0,Hy[98]=0,Xy[98]=-1,Jy[98]=1,$y[98]=1,tv[98]=0,ev[98]=0,Wy[98]=1,Ky[98]=0,Zy[98]=1,nv[98]=0,rv[98]=1,iv[98]=0,Oy[98]=-1,Fy[98]=0,Gy[98]=1,zy[99]=0,Vy[99]=1,Yy[99]=0,Hy[99]=0,Xy[99]=-1,Jy[99]=1,$y[99]=1,tv[99]=0,ev[99]=0,Wy[99]=-1,Ky[99]=0,Zy[99]=1,nv[99]=0,rv[99]=-1,iv[99]=0,Oy[99]=1,Fy[99]=0,Gy[99]=1,Hy[38]=0,Xy[38]=-1,Jy[38]=1,$y[38]=1,tv[38]=0,ev[38]=0,ov[38]=0,sv[38]=1,av[38]=1,nv[38]=0,rv[38]=1,iv[38]=0,Oy[38]=-1,Fy[38]=0,Gy[38]=1,Uy[38]=-1,qy[38]=0,jy[38]=0,Hy[39]=0,Xy[39]=1,Jy[39]=1,$y[39]=-1,tv[39]=0,ev[39]=0,ov[39]=0,sv[39]=-1,av[39]=1,nv[39]=0,rv[39]=1,iv[39]=0,Oy[39]=-1,Fy[39]=0,Gy[39]=1,Uy[39]=1,qy[39]=0,jy[39]=0;var uv=function(t){return[[t.bottomleft,0],[0,0],[0,t.leftbottom]]},lv=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0]]},cv=function(t){return[[t.topright,1],[1,1],[1,t.righttop]]},hv=function(t){return[[0,t.lefttop],[0,1],[t.topleft,1]]},fv=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop]]},pv=function(t){return[[t.bottomright,0],[t.bottomleft,0],[1,t.righttop],[1,t.rightbottom]]},gv=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.topleft,1],[t.topright,1]]},Av=function(t){return[[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},dv=[],yv=[],vv=[],mv=[],_v=[],Iv=[],Ev=[],Cv=[];mv[1]=_v[1]=18,mv[169]=_v[169]=18,vv[4]=yv[4]=12,vv[166]=yv[166]=12,dv[16]=Cv[16]=4,dv[154]=Cv[154]=4,Iv[64]=Ev[64]=22,Iv[106]=Ev[106]=22,vv[2]=Iv[2]=17,mv[2]=_v[2]=18,vv[168]=Iv[168]=17,mv[168]=_v[168]=18,dv[8]=mv[8]=9,yv[8]=vv[8]=12,dv[162]=mv[162]=9,yv[162]=vv[162]=12,dv[32]=Cv[32]=4,yv[32]=Ev[32]=1,dv[138]=Cv[138]=4,yv[138]=Ev[138]=1,_v[128]=Cv[128]=21,Iv[128]=Ev[128]=22,_v[42]=Cv[42]=21,Iv[42]=Ev[42]=22,yv[5]=_v[5]=14,yv[165]=_v[165]=14,vv[20]=Cv[20]=6,vv[150]=Cv[150]=6,dv[80]=Iv[80]=11,dv[90]=Iv[90]=11,mv[65]=Ev[65]=3,mv[105]=Ev[105]=3,dv[160]=Iv[160]=11,yv[160]=_v[160]=14,dv[10]=Iv[10]=11,yv[10]=_v[10]=14,vv[130]=Cv[130]=6,mv[130]=Ev[130]=3,vv[40]=Cv[40]=6,mv[40]=Ev[40]=3,yv[101]=Ev[101]=1,yv[69]=Ev[69]=1,_v[149]=Cv[149]=21,_v[21]=Cv[21]=21,vv[86]=Iv[86]=17,vv[84]=Iv[84]=17,dv[89]=mv[89]=9,dv[81]=mv[81]=9,dv[96]=Ev[96]=0,yv[96]=Iv[96]=15,dv[74]=Ev[74]=0,yv[74]=Iv[74]=15,dv[24]=vv[24]=8,mv[24]=Cv[24]=7,dv[146]=vv[146]=8,mv[146]=Cv[146]=7,yv[6]=Iv[6]=15,vv[6]=_v[6]=16,yv[164]=Iv[164]=15,vv[164]=_v[164]=16,mv[129]=Cv[129]=7,_v[129]=Ev[129]=20,mv[41]=Cv[41]=7,_v[41]=Ev[41]=20,vv[66]=Ev[66]=2,mv[66]=Iv[66]=19,vv[104]=Ev[104]=2,mv[104]=Iv[104]=19,dv[144]=_v[144]=10,Iv[144]=Cv[144]=23,dv[26]=_v[26]=10,Iv[26]=Cv[26]=23,yv[36]=Cv[36]=5,vv[36]=Ev[36]=2,yv[134]=Cv[134]=5,vv[134]=Ev[134]=2,dv[9]=_v[9]=10,yv[9]=mv[9]=13,dv[161]=_v[161]=10,yv[161]=mv[161]=13,yv[37]=Cv[37]=5,_v[37]=Ev[37]=20,yv[133]=Cv[133]=5,_v[133]=Ev[133]=20,vv[148]=_v[148]=16,Iv[148]=Cv[148]=23,vv[22]=_v[22]=16,Iv[22]=Cv[22]=23,dv[82]=vv[82]=8,mv[82]=Iv[82]=19,dv[88]=vv[88]=8,mv[88]=Iv[88]=19,dv[73]=Ev[73]=0,yv[73]=mv[73]=13,dv[97]=Ev[97]=0,yv[97]=mv[97]=13,dv[145]=mv[145]=9,_v[145]=Cv[145]=21,dv[25]=mv[25]=9,_v[25]=Cv[25]=21,yv[70]=Ev[70]=1,vv[70]=Iv[70]=17,yv[100]=Ev[100]=1,vv[100]=Iv[100]=17,dv[34]=mv[34]=9,yv[34]=vv[34]=12,_v[34]=Cv[34]=21,Iv[34]=Ev[34]=22,dv[136]=Cv[136]=4,yv[136]=Ev[136]=1,vv[136]=Iv[136]=17,mv[136]=_v[136]=18,dv[35]=Cv[35]=4,yv[35]=vv[35]=12,mv[35]=_v[35]=18,Iv[35]=Ev[35]=22,dv[153]=Cv[153]=4,mv[153]=_v[153]=18,yv[102]=vv[102]=12,Iv[102]=Ev[102]=22,dv[155]=mv[155]=9,_v[155]=Cv[155]=23,yv[103]=Ev[103]=1,vv[103]=Iv[103]=17,dv[152]=Cv[152]=4,vv[152]=Iv[152]=17,mv[152]=_v[152]=18,dv[156]=vv[156]=8,mv[156]=_v[156]=18,Iv[156]=Cv[156]=23,dv[137]=Cv[137]=4,yv[137]=Ev[137]=1,mv[137]=_v[137]=18,dv[139]=Cv[139]=4,yv[139]=mv[139]=13,_v[139]=Ev[139]=20,dv[98]=mv[98]=9,yv[98]=vv[98]=12,Iv[98]=Ev[98]=22,dv[99]=Ev[99]=0,yv[99]=vv[99]=12,mv[99]=Iv[99]=19,yv[38]=vv[38]=12,_v[38]=Cv[38]=21,Iv[38]=Ev[38]=22,yv[39]=Cv[39]=5,vv[39]=_v[39]=16,Iv[39]=Ev[39]=22;var xv=[];function wv(t,e,n){return(t-e)/(n-e)}function bv(t){return t.constructor.toString().indexOf("Array")>-1}function Bv(t,e,n,r,i,o){for(var s=t.cells[n][e],a=s.cval_real,u=e+r,l=n+i,c=[],h=!1;!h;){if(void 0===t.cells[l]||void 0===t.cells[l][u])if(l-=i,u-=r,a=(s=t.cells[l][u]).cval_real,-1===i)if(0===o)if(a&ky)c.push([u,l]),r=-1,i=0,o=0;else{if(!(a&Py)){c.push([u+s.bottomright,l]),r=0,i=1,o=1,h=!0;break}c.push([u+1,l]),r=1,i=0,o=0}else{if(!(a&ky)){if(a&Py){c.push([u+s.bottomright,l]),r=0,i=1,o=1,h=!0;break}c.push([u+s.bottomleft,l]),r=0,i=1,o=0,h=!0;break}c.push([u,l]),r=-1,i=0,o=0}else if(1===i)if(0===o){if(!(a&Dy)){if(a&Qy){c.push([u+s.topleft,l+1]),r=0,i=-1,o=0,h=!0;break}c.push([u+s.topright,l+1]),r=0,i=-1,o=1,h=!0;break}c.push([u+1,l+1]),r=1,i=0,o=1}else c.push([u+1,l+1]),r=1,i=0,o=1;else if(-1===r)if(0===o){if(!(a&Qy)){if(a&ky){c.push([u,l+s.leftbottom]),r=1,i=0,o=0,h=!0;break}c.push([u,l+s.lefttop]),r=1,i=0,o=1,h=!0;break}c.push([u,l+1]),r=0,i=1,o=0}else{if(!(a&Qy)){console.log("MarchingSquaresJS-isoBands: wtf");break}c.push([u,l+1]),r=0,i=1,o=0}else{if(1!==r){console.log("MarchingSquaresJS-isoBands: we came from nowhere!");break}if(0===o){if(!(a&Py)){c.push([u+1,l+s.rightbottom]),r=-1,i=0,o=0,h=!0;break}c.push([u+1,l]),r=0,i=-1,o=1}else{if(!(a&Py)){if(a&Dy){c.push([u+1,l+s.righttop]),r=-1,i=0,o=1;break}c.push([u+1,l+s.rightbottom]),r=-1,i=0,o=0,h=!0;break}c.push([u+1,l]),r=0,i=-1,o=1}}else if(a=(s=t.cells[l][u]).cval_real,-1===r)if(0===o)if(void 0!==t.cells[l-1]&&void 0!==t.cells[l-1][u])r=0,i=-1,o=1;else{if(!(a&ky)){c.push([u+s.bottomright,l]),r=0,i=1,o=1,h=!0;break}c.push([u,l])}else{if(!(a&Qy)){console.log("MarchingSquaresJS-isoBands: found entry from top at "+u+","+l);break}console.log("MarchingSquaresJS-isoBands: proceeding in x-direction!")}else if(1===r){if(0===o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[l+1]&&void 0!==t.cells[l+1][u])r=0,i=1,o=0;else{if(!(a&Dy)){c.push([u+s.topleft,l+1]),r=0,i=-1,o=0,h=!0;break}c.push([u+1,l+1]),r=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])r=1,i=0,o=1;else{if(!(a&Py)){c.push([u+1,l+s.righttop]),r=-1,i=0,o=1,h=!0;break}c.push([u+1,l]),r=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])r=-1,i=0,o=0;else{if(!(a&Qy)){c.push([u,l+s.leftbottom]),r=1,i=0,o=0,h=!0;break}c.push([u,l+1]),r=0,i=1,o=0}}if(l+=i,(u+=r)===e&&l===n)break}return{path:c,i:u,j:l,x:r,y:i,o:o}}function Sv(t){if(t.edges.length>0){var e=t.edges[t.edges.length-1],n=t.cval_real;switch(e){case 0:return n&Dy?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 1:return n&Py?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 2:return n&Py?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 3:return n&ky?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 4:return n&Dy?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 5:return n&Py?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 6:return n&Py?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 7:return n&ky?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 8:return n&Py?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.righttop],x:-1,y:0,o:1};case 9:return n&ky?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 10:return n&ky?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.righttop],x:-1,y:0,o:1};case 11:return n&Qy?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 12:return n&Py?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 13:return n&ky?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 14:return n&ky?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 15:return n&Qy?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 16:return n&Py?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 17:return n&Qy?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 18:return n&ky?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 19:return n&Qy?{p:[t.bottomleft,0],x:0,y:1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 20:return n&Qy?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 21:return n&Dy?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.topright,1],x:0,y:-1,o:1};case 22:return n&Qy?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 23:return n&Dy?{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 Mv(t,e,n,r){var i,o,s,a,u,l=t.cval;switch(e){case-1:if(0===r)i=yv[l],s=Hy[l],a=Xy[l],u=Jy[l];else i=dv[l],s=zy[l],a=Vy[l],u=Yy[l];break;case 1:if(0===r)i=_v[l],s=ov[l],a=sv[l],u=av[l];else i=Iv[l],s=nv[l],a=rv[l],u=iv[l];break;default:switch(n){case-1:if(0===r)i=Ev[l],s=Oy[l],a=Fy[l],u=Gy[l];else i=Cv[l],s=Uy[l],a=qy[l],u=jy[l];break;case 1:if(0===r)i=mv[l],s=Wy[l],a=Ky[l],u=Zy[l];else i=vv[l],s=$y[l],a=tv[l],u=ev[l]}}if(o=t.edges.indexOf(i),void 0===t.edges[o])return null;switch(function(t,e){delete t.edges[e];for(var n=e+1;n<t.edges.length;n++)t.edges[n-1]=t.edges[n];t.edges.pop()}(t,o),l=t.cval_real,i){case 0:l&Dy?(e=t.topleft,n=1):(e=1,n=t.righttop);break;case 1:l&Py?(e=1,n=t.rightbottom):(e=t.topleft,n=1);break;case 2:l&Py?(e=t.topleft,n=1):(e=t.bottomright,n=0);break;case 3:l&ky?(e=t.bottomleft,n=0):(e=t.topleft,n=1);break;case 4:l&Dy?(e=t.topright,n=1):(e=1,n=t.righttop);break;case 5:l&Py?(e=1,n=t.rightbottom):(e=t.topright,n=1);break;case 6:l&Py?(e=t.topright,n=1):(e=t.bottomright,n=0);break;case 7:l&ky?(e=t.bottomleft,n=0):(e=t.topright,n=1);break;case 8:l&Py?(e=1,n=t.righttop):(e=t.bottomright,n=0);break;case 9:l&ky?(e=t.bottomleft,n=0):(e=1,n=t.righttop);break;case 10:l&ky?(e=1,n=t.righttop):(e=0,n=t.leftbottom);break;case 11:l&Qy?(e=0,n=t.lefttop):(e=1,n=t.righttop);break;case 12:l&Py?(e=1,n=t.rightbottom):(e=t.bottomright,n=0);break;case 13:l&ky?(e=t.bottomleft,n=0):(e=1,n=t.rightbottom);break;case 14:l&ky?(e=1,n=t.rightbottom):(e=0,n=t.leftbottom);break;case 15:l&Qy?(e=0,n=t.lefttop):(e=1,n=t.rightbottom);break;case 16:l&Py?(e=0,n=t.leftbottom):(e=t.bottomright,n=0);break;case 17:l&Qy?(e=0,n=t.lefttop):(e=t.bottomright,n=0);break;case 18:l&ky?(e=t.bottomleft,n=0):(e=0,n=t.leftbottom);break;case 19:l&Qy?(e=0,n=t.lefttop):(e=t.bottomleft,n=0);break;case 20:l&Qy?(e=0,n=t.leftbottom):(e=t.topleft,n=1);break;case 21:l&Dy?(e=t.topright,n=1):(e=0,n=t.leftbottom);break;case 22:l&Qy?(e=0,n=t.lefttop):(e=t.topleft,n=1);break;case 23:l&Dy?(e=t.topright,n=1):(e=0,n=t.lefttop);break;default:return console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t),null}return void 0!==e&&void 0!==n&&void 0!==s&&void 0!==a&&void 0!==u||(console.log("MarchingSquaresJS-isoBands: undefined value!"),console.log(t),console.log(e+" "+n+" "+s+" "+a+" "+u)),{p:[e,n],x:s,y:a,o:u}}function Lv(t){var e=[],n=[];t.forEach((function(t){var r=Vp(an([t]));n.push(r),e.push({ring:t,area:r})})),n.sort((function(t,e){return e-t}));var r=[];return n.forEach((function(t){for(var n=0;n<e.length;n++)if(e[n].area===t){r.push(e[n].ring),e.splice(n,1);break}})),r}function Nv(t){for(var e=t.map((function(t){return{lrCoordinates:t,grouped:!1}})),n=[];!Rv(e);)for(var r=0;r<e.length;r++)if(!e[r].grouped){var i=[];i.push(e[r].lrCoordinates),e[r].grouped=!0;for(var o=an([e[r].lrCoordinates]),s=r+1;s<e.length;s++){if(!e[s].grouped)Tv(an([e[s].lrCoordinates]),o)&&(i.push(e[s].lrCoordinates),e[s].grouped=!0)}n.push(i)}return n}function Tv(t,e){for(var n=Af(t),r=0;r<n.features.length;r++)if(!Gn(n.features[r],e))return!1;return!0}function Rv(t){for(var e=0;e<t.length;e++)if(!1===t[e].grouped)return!1;return!0}function Qv(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.pivot,i=n.mutate;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("angle is required");return 0===e||(r||(r=gf(t)),!1!==i&&void 0!==i||(t=th(t)),bl(t,(function(t){var n=_y(r,t)+e,i=kp(r,t),o=Nn(Ey(r,i,n));t[0]=o[0],t[1]=o[1]}))),t}function Dv(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.origin,i=n.mutate;if(!t)throw new Error("geojson required");if("number"!=typeof e||0===e)throw new Error("invalid factor");var o=Array.isArray(r)||"object"==typeof r;return!0!==i&&(t=th(t)),"FeatureCollection"!==t.type||o?Pv(t,e,r):(Ll(t,(function(n,i){t.features[i]=Pv(n,e,r)})),t)}function Pv(t,e,n){var r="Point"===kn(t);return n=function(t,e){null==e&&(e="centroid");if(Array.isArray(e)||"object"==typeof e)return Ln(e);var n=t.bbox?t.bbox:zl(t),r=n[0],i=n[1],o=n[2],s=n[3];switch(e){case"sw":case"southwest":case"westsouth":case"bottomleft":return on([r,i]);case"se":case"southeast":case"eastsouth":case"bottomright":return on([o,i]);case"nw":case"northwest":case"westnorth":case"topleft":return on([r,s]);case"ne":case"northeast":case"eastnorth":case"topright":return on([o,s]);case"center":return pf(t);case void 0:case null:case"centroid":return gf(t);default:throw new Error("invalid origin")}}(t,n),1===e||r||bl(t,(function(t){var r=kp(n,t),i=_y(n,t),o=Nn(Ey(n,r*e,i));t[0]=o[0],t[1]=o[1],3===t.length&&(t[2]*=e)})),t}function kv(t){var e=t[0],n=t[1];return[n[0]-e[0],n[1]-e[1]]}function Ov(t,e){return t[0]*e[1]-e[0]*t[1]}function Fv(t,e){return!function(t,e){return 0===Ov(kv(t),kv(e))}(t,e)&&function(t,e){var n,r,i=t[0],o=kv(t),s=e[0],a=kv(e),u=Ov(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]]}(Ov((r=i,[(n=s)[0]-r[0],n[1]-r[1]]),a)/u,o));return l}(t,e)}function Gv(t,e,n){var r=[],i=mn(e,n),o=Nn(t),s=[];return o.forEach((function(t,e){if(e!==o.length-1){var n=(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(r.push(n),e>0){var a=r[e-1],u=Fv(n,a);!1!==u&&(a[1]=u,n[0]=u),s.push(a[0]),e===o.length-2&&(s.push(n[0]),s.push(n[1]))}2===o.length&&(s.push(n[0]),s.push(n[1]))}var l,c,h,f,p,g,A,d})),ln(s,t.properties)}function Uv(t,e,n){var r=e[0]-t[0],i=e[1]-t[1],o=n[0]-e[0];return function(t){return(t>0)-(t<0)||+t}(r*(n[1]-e[1])-o*i)}function qv(t,e){return e.geometry.coordinates[0].every((function(e){return Gn(on(e),t)}))}xv[1]=xv[169]=uv,xv[4]=xv[166]=lv,xv[16]=xv[154]=cv,xv[64]=xv[106]=hv,xv[168]=xv[2]=fv,xv[162]=xv[8]=pv,xv[138]=xv[32]=gv,xv[42]=xv[128]=Av,xv[5]=xv[165]=function(t){return[[0,0],[0,t.leftbottom],[1,t.rightbottom],[1,0]]},xv[20]=xv[150]=function(t){return[[1,0],[t.bottomright,0],[t.topright,1],[1,1]]},xv[80]=xv[90]=function(t){return[[1,1],[1,t.righttop],[0,t.lefttop],[0,1]]},xv[65]=xv[105]=function(t){return[[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},xv[160]=xv[10]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.leftbottom],[0,t.lefttop]]},xv[130]=xv[40]=function(t){return[[t.topleft,1],[t.topright,1],[t.bottomright,0],[t.bottomleft,0]]},xv[85]=function(){return[[0,0],[0,1],[1,1],[1,0]]},xv[101]=xv[69]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,1],[t.topleft,1]]},xv[149]=xv[21]=function(t){return[[t.topright,1],[1,1],[1,0],[0,0],[0,t.leftbottom]]},xv[86]=xv[84]=function(t){return[[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[1,1]]},xv[89]=xv[81]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,1]]},xv[96]=xv[74]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.lefttop],[0,1],[t.topleft,1]]},xv[24]=xv[146]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[t.topright,1]]},xv[6]=xv[164]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop]]},xv[129]=xv[41]=function(t){return[[t.topright,1],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1]]},xv[66]=xv[104]=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},xv[144]=xv[26]=function(t){return[[1,1],[1,t.righttop],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},xv[36]=xv[134]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[t.topleft,1],[t.topright,1]]},xv[9]=xv[161]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom]]},xv[37]=xv[133]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},xv[148]=xv[22]=function(t){return[[1,1],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},xv[82]=xv[88]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1]]},xv[73]=xv[97]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},xv[145]=xv[25]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},xv[70]=xv[100]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},xv[34]=function(t){return[Av(t),pv(t)]},xv[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]]},xv[136]=function(t){return[gv(t),fv(t)]},xv[153]=function(t){return[cv(t),uv(t)]},xv[102]=function(t){return[lv(t),hv(t)]},xv[155]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},xv[103]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},xv[152]=function(t){return[cv(t),fv(t)]},xv[156]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},xv[137]=function(t){return[gv(t),uv(t)]},xv[139]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},xv[98]=function(t){return[pv(t),hv(t)]},xv[99]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},xv[38]=function(t){return[lv(t),Av(t)]},xv[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 jv=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,n){var r=e.to,i=n.to;if(r.coordinates[0]-t.coordinates[0]>=0&&i.coordinates[0]-t.coordinates[0]<0)return 1;if(r.coordinates[0]-t.coordinates[0]<0&&i.coordinates[0]-t.coordinates[0]>=0)return-1;if(r.coordinates[0]-t.coordinates[0]==0&&i.coordinates[0]-t.coordinates[0]==0)return r.coordinates[1]-t.coordinates[1]>=0||i.coordinates[1]-t.coordinates[1]>=0?r.coordinates[1]-i.coordinates[1]:i.coordinates[1]-r.coordinates[1];var o=Uv(t.coordinates,r.coordinates,i.coordinates);return o<0?1:o>0?-1:Math.pow(r.coordinates[0]-t.coordinates[0],2)+Math.pow(r.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}(),zv=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 ln([this.from.coordinates,this.to.coordinates])},t.prototype.compareTo=function(t){return Uv(t.from.coordinates,t.to.coordinates,this.to.coordinates)},t}(),Vv=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,n,r){return n.from.coordinates[1]>t.edges[e].from.coordinates[1]&&(e=r),e}),0),n=(0===e?this.length:e)-1,r=(e+1)%this.length,i=Uv(this.edges[n].from.coordinates,this.edges[e].from.coordinates,this.edges[r].from.coordinates);return 0===i?this.edges[n].from.coordinates[0]>this.edges[r].from.coordinates[0]:i>0},t.prototype.toMultiPoint=function(){return pn(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=an([t])},t.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=uf(this.toPolygon())},t.findEdgeRingContaining=function(t,e){var n,r,i=t.getEnvelope();return e.forEach((function(e){var o,s,a,u,l,c,h=e.getEnvelope();if((r&&(n=r.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))&&qv(h,i)){for(var f=t.map((function(t){return t.from.coordinates})),p=void 0,g=function(t){e.some((function(e){return n=t,r=e.from.coordinates,n[0]===r[0]&&n[1]===r[1];var n,r}))||(p=t)},A=0,d=f;A<d.length;A++){g(d[A])}p&&e.inside(on(p))&&(r&&!qv(n,h)||(r=e))}})),r},t.prototype.inside=function(t){return Gn(t,this.toPolygon())},t}(),Yv=Vv;var Hv=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 n=new t;return Dl(e,(function(t){Qn(t,"LineString","Graph::fromGeoJson"),Bl(t,(function(t,e){if(t){var r=n.getNode(t),i=n.getNode(e);n.addEdge(r,i)}return e}))})),n},t.prototype.getNode=function(t){var e=jv.buildId(t),n=this.nodes[e];return n||(n=this.nodes[e]=new jv(t)),n},t.prototype.addEdge=function(t,e){var n=new zv(t,e),r=n.getSymetric();this.edges.push(n),this.edges.push(r)},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 n=t.getOuterEdges().map((function(t){return t.to}));this.removeNode(t),n.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,n){t.getOuterEdge((0===n?t.getOuterEdges().length:n)-1).symetric.next=e}))},t.prototype._computeNextCCWEdges=function(t,e){for(var n,r,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&&(r=l),u&&(r&&(r.next=u,r=void 0),n||(n=u)))}r&&(r.next=n)},t.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach((function(n){if(!(n.label>=0)){t.push(n);var r=n;do{r.label=e,r=r.next}while(!n.isEqual(r));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(n){t._computeNextCCWEdges(n,e.label)}))}));var e=[];return this.edges.forEach((function(n){n.ring||e.push(t._findEdgeRing(n))})),e},t.prototype._findIntersectionNodes=function(t){var e=[],n=t,r=function(){var r=0;n.from.getOuterEdges().forEach((function(e){e.label===t.label&&++r})),r>1&&e.push(n.from),n=n.next};do{r()}while(!t.isEqual(n));return e},t.prototype._findEdgeRing=function(t){var e=t,n=new Yv;do{n.push(e),e.ring=n,e=e.next}while(!t.isEqual(e));return n},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}(),Xv=Hv;function Jv(t,e){var n=!0;return Dl(t,(function(t){Dl(e,(function(e){if(!1===n)return!1;n=function(t,e){switch(t.type){case"Point":switch(e.type){case"Point":return n=t.coordinates,r=e.coordinates,!(n[0]===r[0]&&n[1]===r[1]);case"LineString":return!Wv(e,t);case"Polygon":return!Gn(t,e)}break;case"LineString":switch(e.type){case"Point":return!Wv(t,e);case"LineString":return!function(t,e){if(Qp(t,e).features.length>0)return!0;return!1}(t,e);case"Polygon":return!Kv(e,t)}break;case"Polygon":switch(e.type){case"Point":return!Gn(e,t);case"LineString":return!Kv(t,e);case"Polygon":return!function(t,e){for(var n=0,r=t.coordinates[0];n<r.length;n++){if(Gn(r[n],e))return!0}for(var i=0,o=e.coordinates[0];i<o.length;i++){if(Gn(o[i],t))return!0}var s=Qp(Bg(t),Bg(e));if(s.features.length>0)return!0;return!1}(e,t)}}var n,r;return!1}(t.geometry,e.geometry)}))})),n}function Wv(t,e){for(var n=0;n<t.coordinates.length-1;n++)if(Zv(t.coordinates[n],t.coordinates[n+1],e.coordinates))return!0;return!1}function Kv(t,e){for(var n=0,r=e.coordinates;n<r.length;n++){if(Gn(r[n],t))return!0}return Qp(e,Bg(t)).features.length>0}function Zv(t,e,n){var r=n[0]-t[0],i=n[1]-t[1],o=e[0]-t[0],s=e[1]-t[1];return 0==r*s-i*o&&(Math.abs(o)>=Math.abs(s)?o>0?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:s>0?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1])}function $v(t,e){return!(t[0]>e[0])&&(!(t[2]<e[2])&&(!(t[1]>e[1])&&!(t[3]<e[3])))}function tm(t,e){return t[0]===e[0]&&t[1]===e[1]}function em(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}function nm(t,e){for(var n=!1,r=!1,i=t.coordinates.length,o=0;o<i&&!n&&!r;){for(var s=0;s<e.coordinates.length-1;s++){var a=!0;0!==s&&s!==e.coordinates.length-2||(a=!1),om(e.coordinates[s],e.coordinates[s+1],t.coordinates[o],a)?n=!0:r=!0}o++}return n&&r}function rm(t,e){return Qp(t,Sg(e)).features.length>0}function im(t,e){for(var n=!1,r=!1,i=t.coordinates.length,o=0;o<i&&(!n||!r);o++)Gn(on(t.coordinates[o]),e)?n=!0:r=!0;return r&&n}function om(t,e,n,r){var i=n[0]-t[0],o=n[1]-t[1],s=e[0]-t[0],a=e[1]-t[1];return 0==i*a-o*s&&(r?Math.abs(s)>=Math.abs(a)?s>0?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:a>0?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1]:Math.abs(s)>=Math.abs(a)?s>0?t[0]<n[0]&&n[0]<e[0]:e[0]<n[0]&&n[0]<t[0]:a>0?t[1]<n[1]&&n[1]<e[1]:e[1]<n[1]&&n[1]<t[1])}var sm=dy,am=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:cm};function um(t){return t.coordinates.map((function(e){return{type:t.type.replace("Multi",""),coordinates:e}}))}function lm(t,e){return t.hasOwnProperty("coordinates")?t.coordinates.length===e.coordinates.length:t.length===e.length}function cm(t,e){return sm(t,e,{strict:!0})}am.prototype.compare=function(t,e){if(t.type!==e.type||!lm(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 n=this,r=um(t),i=um(e);return r.every((function(t){return this.some((function(e){return n.compare(t,e)}))}),i)}}return!1},am.prototype.compareCoord=function(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n].toFixed(this.precision)!==e[n].toFixed(this.precision))return!1;return!0},am.prototype.compareLine=function(t,e,n,r){if(!lm(t,e))return!1;var i=this.pseudoNode?t:this.removePseudo(t),o=this.pseudoNode?e:this.removePseudo(e);if(!r||this.compareCoord(i[0],o[0])||(o=this.fixStartIndex(o,i))){var s=this.compareCoord(i[n],o[n]);return this.direction||s?this.comparePath(i,o):!!this.compareCoord(i[n],o[o.length-(1+n)])&&this.comparePath(i.slice().reverse(),o)}},am.prototype.fixStartIndex=function(t,e){for(var n,r=-1,i=0;i<t.length;i++)if(this.compareCoord(t[i],e[0])){r=i;break}return r>=0&&(n=[].concat(t.slice(r,t.length),t.slice(1,r+1))),n},am.prototype.comparePath=function(t,e){var n=this;return t.every((function(t,e){return n.compareCoord(t,this[e])}),e)},am.prototype.comparePolygon=function(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){var n=t.coordinates.slice(1,t.coordinates.length),r=e.coordinates.slice(1,e.coordinates.length),i=this;return n.every((function(t){return this.some((function(e){return i.compareLine(t,e,1,!0)}))}),r)}return!1},am.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)},am.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},am.prototype.removePseudo=function(t){return t};var hm=am;function fm(t,e){var n=!1;return Dl(t,(function(t){Dl(e,(function(e){if(!0===n)return!0;n=!Jv(t.geometry,e.geometry)}))})),n}var pm={exports:{}},gm={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,n,r){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,n,r)}e.prototype.run=function(t,e,n,r){this._init(t,e,n,r);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,n,r){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),n&&(this.minPts=n),r&&(this.distance=r)},e.prototype._expandCluster=function(t,e){for(var n=0;n<e.length;n++){var r=e[n];if(1!==this._visited[r]){this._visited[r]=1;var i=this._regionQuery(r);i.length>=this.minPts&&(e=this._mergeArrays(e,i))}1!==this._assigned[r]&&this._addToCluster(r,t)}},e.prototype._addToCluster=function(t,e){this.clusters[e].push(t),this._assigned[t]=1},e.prototype._regionQuery=function(t){for(var e=[],n=0;n<this._datasetLength;n++){this.distance(this.dataset[t],this.dataset[n])<this.epsilon&&e.push(n)}return e},e.prototype._mergeArrays=function(t,e){for(var n=e.length,r=0;r<n;r++){var i=e[r];t.indexOf(i)<0&&t.push(i)}return t},e.prototype._euclideanDistance=function(t,e){for(var n=0,r=Math.min(t.length,e.length);r--;)n+=(t[r]-e[r])*(t[r]-e[r]);return Math.sqrt(n)},t.exports&&(t.exports=e)}(gm);var Am={exports:{}};!function(t){
115
+ /**
116
+ * KMEANS clustering
117
+ *
118
+ * @author Lukasz Krawczyk <contact@lukaszkrawczyk.eu>
119
+ * @copyright MIT
120
+ */
121
+ function e(t,e,n){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(t,e,n)}e.prototype.init=function(t,e,n){this.assignments=[],this.centroids=[],void 0!==t&&(this.dataset=t),void 0!==e&&(this.k=e),void 0!==n&&(this.distance=n)},e.prototype.run=function(t,e){this.init(t,e);for(var n=this.dataset.length,r=0;r<this.k;r++)this.centroids[r]=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<n;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,n=this.dataset.length-1;do{e=Math.round(Math.random()*n),t=this.dataset[e]}while(this.centroids.indexOf(t)>=0);return t},e.prototype.assign=function(){for(var t,e=!1,n=this.dataset.length,r=0;r<n;r++)(t=this.argmin(this.dataset[r],this.centroids,this.distance))!=this.assignments[r]&&(this.assignments[r]=t,e=!0);return e},e.prototype.getClusters=function(){for(var t,e=new Array(this.k),n=0;n<this.assignments.length;n++)void 0===e[t=this.assignments[n]]&&(e[t]=[]),e[t].push(n);return e},e.prototype.argmin=function(t,e,n){for(var r,i=Number.MAX_VALUE,o=0,s=e.length,a=0;a<s;a++)(r=n(t,e[a]))<i&&(i=r,o=a);return o},e.prototype.distance=function(t,e){for(var n=0,r=Math.min(t.length,e.length);r--;){var i=t[r]-e[r];n+=i*i}return Math.sqrt(n)},t.exports&&(t.exports=e)}(Am);var dm,ym={exports:{}},vm={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,n){this._queue=[],this._priorities=[],this._sorting="desc",this._init(t,e,n)}e.prototype.insert=function(t,e){for(var n=this._queue.length,r=n;r--;){var i=this._priorities[r];"desc"===this._sorting?e>i&&(n=r):e<i&&(n=r)}this._insertAt(t,e,n)},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,n=this._queue.length;e<n;e++)t.push([this._queue[e],this._priorities[e]]);return t},e.prototype._init=function(t,e,n){if(t&&e){if(this._queue=[],this._priorities=[],t.length!==e.length)throw new Error("Arrays must have the same length");for(var r=0;r<t.length;r++)this.insert(t[r],e[r])}n&&(this._sorting=n)},e.prototype._insertAt=function(t,e,n){this._queue.length===n?(this._queue.push(t),this._priorities.push(e)):(this._queue.splice(n,0,t),this._priorities.splice(n,0,e))},t.exports&&(t.exports=e)}(vm),function(t){if(t.exports)var e=vm.exports;
130
+ /**
131
+ * OPTICS - Ordering points to identify the clustering structure
132
+ *
133
+ * @author Lukasz Krawczyk <contact@lukaszkrawczyk.eu>
134
+ * @copyright MIT
135
+ */function n(t,e,n,r){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(t,e,n,r)}n.prototype.run=function(t,n,r,i){this._init(t,n,r,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},n.prototype.getReachabilityPlot=function(){for(var t=[],e=0,n=this._orderedList.length;e<n;e++){var r=this._orderedList[e],i=this._reachability[r];t.push([r,i])}return t},n.prototype._init=function(t,e,n,r){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),n&&(this.minPts=n),r&&(this.distance=r)},n.prototype._updateQueue=function(t,e,n){var r=this;this._coreDistance=this._distanceToCore(t),e.forEach((function(e){if(void 0===r._processed[e]){var i=r.distance(r.dataset[t],r.dataset[e]),o=Math.max(r._coreDistance,i);void 0===r._reachability[e]?(r._reachability[e]=o,n.insert(e,o)):o<r._reachability[e]&&(r._reachability[e]=o,n.remove(e),n.insert(e,o))}}))},n.prototype._expandCluster=function(t,e){for(var n=e.getElements(),r=0,i=n.length;r<i;r++){var o=n[r];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))}}},n.prototype._distanceToCore=function(t){for(var e=this.epsilon,n=0;n<e;n++){if(this._regionQuery(t,n).length>=this.minPts)return n}},n.prototype._regionQuery=function(t,e){e=e||this.epsilon;for(var n=[],r=0,i=this.dataset.length;r<i;r++)this.distance(this.dataset[t],this.dataset[r])<e&&n.push(r);return n},n.prototype._euclideanDistance=function(t,e){for(var n=0,r=Math.min(t.length,e.length);r--;)n+=(t[r]-e[r])*(t[r]-e[r]);return Math.sqrt(n)},t.exports&&(t.exports=n)}(ym),(dm=pm).exports&&(dm.exports={DBSCAN:gm.exports,KMEANS:Am.exports,OPTICS:ym.exports,PriorityQueue:vm.exports});var mm=pm.exports;var _m={eudist:function(t,e,n){for(var r=t.length,i=0,o=0;o<r;o++){var s=(t[o]||0)-(e[o]||0);i+=s*s}return n?Math.sqrt(i):i},mandist:function(t,e,n){for(var r=t.length,i=0,o=0;o<r;o++)i+=Math.abs((t[o]||0)-(e[o]||0));return n?Math.sqrt(i):i},dist:function(t,e,n){var r=Math.abs(t-e);return n?r:r*r}},Im=_m.eudist,Em=_m.dist,Cm={kmrand:function(t,e){for(var n={},r=[],i=e<<2,o=t.length,s=t[0].length>0;r.length<e&&i-- >0;){var a=t[Math.floor(Math.random()*o)],u=s?a.join("_"):""+a;n[u]||(n[u]=!0,r.push(a))}if(r.length<e)throw new Error("Error initializating clusters");return r},kmpp:function(t,e){var n=t[0].length?Im:Em,r=[],i=t.length,o=t[0].length>0,s=t[Math.floor(Math.random()*i)];for(o&&s.join("_"),r.push(s);r.length<e;){for(var a=[],u=r.length,l=0,c=[],h=0;h<i;h++){for(var f=1/0,p=0;p<u;p++){var g=n(t[h],r[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;);r.push(c[m-1].v)}return r}},xm=_m.eudist,wm=Cm.kmrand,bm=Cm.kmpp;function Bm(t,e,n){n=n||[];for(var r=0;r<t;r++)n[r]=e;return n}var Sm=function(t,e,n,r){var i=[],o=[],s=[],a=[],u=!1,l=r||1e4,c=t.length,h=t[0].length,f=h>0,p=[];if(n)i="kmrand"==n?wm(t,e):"kmpp"==n?bm(t,e):n;else for(var g={};i.length<e;){var A=Math.floor(Math.random()*c);g[A]||(g[A]=!0,i.push(t[A]))}do{Bm(e,0,p);for(var d=0;d<c;d++){for(var y=1/0,v=0,m=0;m<e;m++){(a=f?xm(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?Bm(h,0,_[I]):0,o[I]=i[I];if(f){for(var E=0;E<e;E++)i[E]=[];for(var C=0;C<c;C++)for(var x=_[s[C]],w=t[C],b=0;b<h;b++)x[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 Q=0;Q<c;Q++){_[s[Q]]+=t[Q]}for(var D=0;D<e;D++)i[D]=_[D]/p[D]||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 Mm(t,e){return _n(_y(t[0],t[1]))===_n(_y(e[0],e[1]))}function Lm(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 Nm(t){for(var e=t,n=[];e.parent;)n.unshift(e),e=e.parent;return n}var Tm={search:function(t,e,n,r){t.cleanDirty();var i=(r=r||{}).heuristic||Tm.heuristics.manhattan,o=r.closest||!1,s=new Dm((function(t){return t.f})),a=e;for(e.h=i(e,n),s.push(e);s.size()>0;){var u=s.pop();if(u===n)return Nm(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,n),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?Nm(a):[]},heuristics:{manhattan:function(t,e){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},diagonal:function(t,e){var n=Math.sqrt(2),r=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y);return 1*(r+i)+(n-2)*Math.min(r,i)}},cleanNode:function(t){t.f=0,t.g=0,t.h=0,t.visited=!1,t.closed=!1,t.parent=null}};function Rm(t,e){e=e||{},this.nodes=[],this.diagonal=!!e.diagonal,this.grid=[];for(var n=0;n<t.length;n++){this.grid[n]=[];for(var r=0,i=t[n];r<i.length;r++){var o=new Qm(n,r,i[r]);this.grid[n][r]=o,this.nodes.push(o)}}this.init()}function Qm(t,e,n){this.x=t,this.y=e,this.weight=n}function Dm(t){this.content=[],this.scoreFunction=t}function Pm(t,e){for(var n=0;n<e.features.length;n++)if(Gn(t,e.features[n]))return!0;return!1}function km(t){return function(){return t}}function Om(t){return t[0]}function Fm(t){return t[1]}function Gm(){this._=null}function Um(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function qm(t,e){var n=e,r=e.R,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.R=r.L,n.R&&(n.R.U=n),r.L=n}function jm(t,e){var n=e,r=e.L,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.L=r.R,n.L&&(n.L.U=n),r.R=n}function zm(t){for(;t.L;)t=t.L;return t}function Vm(t,e,n,r){var i=[null,null],o=A_.push(i)-1;return i.left=t,i.right=e,n&&Hm(i,t,e,n),r&&Hm(i,e,t,r),p_[t.index].halfedges.push(o),p_[e.index].halfedges.push(o),i}function Ym(t,e,n){var r=[e,n];return r.left=t,r}function Hm(t,e,n,r){t[0]||t[1]?t.left===n?t[1]=r:t[0]=r:(t[0]=r,t.left=e,t.right=n)}function Xm(t,e,n,r,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=r-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=n-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 Jm(t,e,n,r,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>=r)return;if(h>p){if(u){if(u[1]>=i)return}else u=[A,n];o=[A,i]}else{if(u){if(u[1]<n)return}else u=[A,i];o=[A,n]}}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=[(n-a)/s,n];o=[(i-a)/s,i]}else{if(u){if(u[1]<n)return}else u=[(i-a)/s,i];o=[(n-a)/s,n]}else if(f<g){if(u){if(u[0]>=r)return}else u=[e,s*e+a];o=[r,s*r+a]}else{if(u){if(u[0]<e)return}else u=[r,s*r+a];o=[e,s*e+a]}return t[0]=u,t[1]=o,!0}function Wm(t,e){var n=t.site,r=e.left,i=e.right;return n===i&&(i=r,r=n),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(n===r?(r=e[1],i=e[0]):(r=e[0],i=e[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function Km(t,e){return e[+(e.left!==t.site)]}function Zm(t,e){return e[+(e.left===t.site)]}Rm.prototype.init=function(){this.dirtyNodes=[];for(var t=0;t<this.nodes.length;t++)Tm.cleanNode(this.nodes[t])},Rm.prototype.cleanDirty=function(){for(var t=0;t<this.dirtyNodes.length;t++)Tm.cleanNode(this.dirtyNodes[t]);this.dirtyNodes=[]},Rm.prototype.markDirty=function(t){this.dirtyNodes.push(t)},Rm.prototype.neighbors=function(t){var e=[],n=t.x,r=t.y,i=this.grid;return i[n-1]&&i[n-1][r]&&e.push(i[n-1][r]),i[n+1]&&i[n+1][r]&&e.push(i[n+1][r]),i[n]&&i[n][r-1]&&e.push(i[n][r-1]),i[n]&&i[n][r+1]&&e.push(i[n][r+1]),this.diagonal&&(i[n-1]&&i[n-1][r-1]&&e.push(i[n-1][r-1]),i[n+1]&&i[n+1][r-1]&&e.push(i[n+1][r-1]),i[n-1]&&i[n-1][r+1]&&e.push(i[n-1][r+1]),i[n+1]&&i[n+1][r+1]&&e.push(i[n+1][r+1])),e},Rm.prototype.toString=function(){for(var t,e,n,r,i=[],o=this.grid,s=0,a=o.length;s<a;s++){for(t=[],n=0,r=(e=o[s]).length;n<r;n++)t.push(e[n].weight);i.push(t.join(" "))}return i.join("\n")},Qm.prototype.toString=function(){return"["+this.x+" "+this.y+"]"},Qm.prototype.getCost=function(t){return t&&t.x!==this.x&&t.y!==this.y?1.41421*this.weight:this.weight},Qm.prototype.isWall=function(){return 0===this.weight},Dm.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),n=this.content.pop();e!==this.content.length-1&&(this.content[e]=n,this.scoreFunction(n)<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 n=(t+1>>1)-1,r=this.content[n];if(!(this.scoreFunction(e)<this.scoreFunction(r)))break;this.content[n]=e,this.content[t]=r,t=n}},bubbleUp:function(t){for(var e=this.content.length,n=this.content[t],r=this.scoreFunction(n);;){var i,o=t+1<<1,s=o-1,a=null;if(s<e){var u=this.content[s];(i=this.scoreFunction(u))<r&&(a=s)}if(o<e){var l=this.content[o];this.scoreFunction(l)<(null===a?r:i)&&(a=o)}if(null===a)break;this.content[t]=this.content[a],this.content[a]=n,t=a}}},Gm.prototype={constructor:Gm,insert:function(t,e){var n,r,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;n=t}else this._?(t=zm(this._),e.P=null,e.N=t,t.P=t.L=e,n=t):(e.P=e.N=null,this._=e,n=null);for(e.L=e.R=null,e.U=n,e.C=!0,t=e;n&&n.C;)n===(r=n.U).L?(i=r.R)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.R&&(qm(this,n),n=(t=n).U),n.C=!1,r.C=!0,jm(this,r)):(i=r.L)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.L&&(jm(this,n),n=(t=n).U),n.C=!1,r.C=!0,qm(this,r)),n=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,n,r,i=t.U,o=t.L,s=t.R;if(n=o?s?zm(s):o:s,i?i.L===t?i.L=n:i.R=n:this._=n,o&&s?(r=n.C,n.C=t.C,n.L=o,o.U=n,n!==s?(i=n.U,n.U=t.U,t=n.R,i.L=t,n.R=s,s.U=n):(n.U=i,i=n,t=n.R)):(r=t.C,t=n),t&&(t.U=i),!r)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,qm(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,jm(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,qm(this,i),t=this._;break}}else if((e=i.L).C&&(e.C=!1,i.C=!0,jm(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,qm(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,jm(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}};var $m,t_=[];function e_(){Um(this),this.x=this.y=this.arc=this.site=this.cy=null}function n_(t){var e=t.P,n=t.N;if(e&&n){var r=e.site,i=t.site,o=n.site;if(r!==o){var s=i[0],a=i[1],u=r[0]-s,l=r[1]-a,c=o[0]-s,h=o[1]-a,f=2*(u*h-l*c);if(!(f>=-y_)){var p=u*u+l*l,g=c*c+h*h,A=(h*p-l*g)/f,d=(u*g-c*p)/f,y=t_.pop()||new e_;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=g_._;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}g_.insert(v,y),v||($m=y)}}}}function r_(t){var e=t.circle;e&&(e.P||($m=e.N),g_.remove(e),t_.push(e),Um(e),t.circle=null)}var i_=[];function o_(){Um(this),this.edge=this.site=this.circle=null}function s_(t){var e=i_.pop()||new o_;return e.site=t,e}function a_(t){r_(t),f_.remove(t),i_.push(t),Um(t)}function u_(t){var e=t.circle,n=e.x,r=e.cy,i=[n,r],o=t.P,s=t.N,a=[t];a_(t);for(var u=o;u.circle&&Math.abs(n-u.circle.x)<d_&&Math.abs(r-u.circle.cy)<d_;)o=u.P,a.unshift(u),a_(u),u=o;a.unshift(u),r_(u);for(var l=s;l.circle&&Math.abs(n-l.circle.x)<d_&&Math.abs(r-l.circle.cy)<d_;)s=l.N,a.push(l),a_(l),l=s;a.push(l),r_(l);var c,h=a.length;for(c=1;c<h;++c)l=a[c],u=a[c-1],Hm(l.edge,u.site,l.site,i);u=a[0],(l=a[h-1]).edge=Vm(u.site,l.site,null,i),n_(u),n_(l)}function l_(t){for(var e,n,r,i,o=t[0],s=t[1],a=f_._;a;)if((r=c_(a,s)-o)>d_)a=a.L;else{if(!((i=o-h_(a,s))>d_)){r>-d_?(e=a.P,n=a):i>-d_?(e=a,n=a.N):e=n=a;break}if(!a.R){e=a;break}a=a.R}!function(t){p_[t.index]={site:t,halfedges:[]}}(t);var u=s_(t);if(f_.insert(e,u),e||n){if(e===n)return r_(e),n=s_(e.site),f_.insert(u,n),u.edge=n.edge=Vm(e.site,u.site),n_(e),void n_(n);if(n){r_(e),r_(n);var l=e.site,c=l[0],h=l[1],f=t[0]-c,p=t[1]-h,g=n.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];Hm(n.edge,l,g,_),u.edge=Vm(l,t,null,_),n.edge=Vm(t,g,null,_),n_(e),n_(n)}else u.edge=Vm(e.site,u.site)}}function c_(t,e){var n=t.site,r=n[0],i=n[1],o=i-e;if(!o)return r;var s=t.P;if(!s)return-1/0;var a=(n=s.site)[0],u=n[1],l=u-e;if(!l)return a;var c=a-r,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+r:(r+a)/2}function h_(t,e){var n=t.N;if(n)return c_(n,e);var r=t.site;return r[1]===e?r[0]:1/0}var f_,p_,g_,A_,d_=1e-6,y_=1e-12;function v_(t,e){return e[1]-t[1]||e[0]-t[0]}function m_(t,e){var n,r,i,o=t.sort(v_).pop();for(A_=[],p_=new Array(t.length),f_=new Gm,g_=new Gm;;)if(i=$m,o&&(!i||o[1]<i.y||o[1]===i.y&&o[0]<i.x))o[0]===n&&o[1]===r||(l_(o),n=o[0],r=o[1]),o=t.pop();else{if(!i)break;u_(i.arc)}if(function(){for(var t,e,n,r,i=0,o=p_.length;i<o;++i)if((t=p_[i])&&(r=(e=t.halfedges).length)){var s=new Array(r),a=new Array(r);for(n=0;n<r;++n)s[n]=n,a[n]=Wm(t,A_[e[n]]);for(s.sort((function(t,e){return a[e]-a[t]})),n=0;n<r;++n)a[n]=e[s[n]];for(n=0;n<r;++n)e[n]=a[n]}}(),e){var s=+e[0][0],a=+e[0][1],u=+e[1][0],l=+e[1][1];!function(t,e,n,r){for(var i,o=A_.length;o--;)Jm(i=A_[o],t,e,n,r)&&Xm(i,t,e,n,r)&&(Math.abs(i[0][0]-i[1][0])>d_||Math.abs(i[0][1]-i[1][1])>d_)||delete A_[o]}(s,a,u,l),function(t,e,n,r){var i,o,s,a,u,l,c,h,f,p,g,A,d=p_.length,y=!0;for(i=0;i<d;++i)if(o=p_[i]){for(s=o.site,a=(u=o.halfedges).length;a--;)A_[u[a]]||u.splice(a,1);for(a=0,l=u.length;a<l;)g=(p=Zm(o,A_[u[a]]))[0],A=p[1],h=(c=Km(o,A_[u[++a%l]]))[0],f=c[1],(Math.abs(g-h)>d_||Math.abs(A-f)>d_)&&(u.splice(a,0,A_.push(Ym(s,p,Math.abs(g-t)<d_&&r-A>d_?[t,Math.abs(h-t)<d_?f:r]:Math.abs(A-r)<d_&&n-g>d_?[Math.abs(f-r)<d_?h:n,r]:Math.abs(g-n)<d_&&A-e>d_?[n,Math.abs(h-n)<d_?f:e]:Math.abs(A-e)<d_&&g-t>d_?[Math.abs(f-e)<d_?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=p_[i])&&(_=(v=(s=o.site)[0]-t)*v+(m=s[1]-e)*m)<I&&(I=_,y=o);if(y){var E=[t,e],C=[t,r],x=[n,r],w=[n,e];y.halfedges.push(A_.push(Ym(s=y.site,E,C))-1,A_.push(Ym(s,C,x))-1,A_.push(Ym(s,x,w))-1,A_.push(Ym(s,w,E))-1)}}for(i=0;i<d;++i)(o=p_[i])&&(o.halfedges.length||delete p_[i])}(s,a,u,l)}this.edges=A_,this.cells=p_,f_=g_=A_=p_=null}function __(t){return(t=t.slice()).push(t[0]),an([t])}function I_(t,e,n,r){var i=(r=r||{}).steps||64,o=r.units||"kilometers",s=r.angle||0,a=r.pivot||t,u=r.properties||t.properties||{};if(!t)throw new Error("center is required");if(!e)throw new Error("xSemiAxis is required");if(!n)throw new Error("ySemiAxis is required");if(!bn(r))throw new Error("options must be an object");if(!wn(i))throw new Error("steps must be a number");if(!wn(s))throw new Error("angle must be a number");var l=Ln(t);if("degrees"===o)var c=En(s);else e=Ey(t,e,90,{units:o}),n=Ey(t,n,0,{units:o}),e=Ln(e)[0]-l[0],n=Ln(n)[1]-l[1];for(var h=[],f=0;f<i;f+=1){var p=-360*f/i,g=e*n/Math.sqrt(Math.pow(n,2)+Math.pow(e,2)*Math.pow(E_(p),2)),A=e*n/Math.sqrt(Math.pow(e,2)+Math.pow(n,2)/Math.pow(E_(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?an([h],u):Qv(an([h],u),s,{pivot:a})}function E_(t){var e=t*Math.PI/180;return Math.tan(e)}function C_(t,e){void 0===e&&(e={});var n=0,r=0,i=0;return Rl(t,(function(t,o,s){var a=e.weight?null==s?void 0:s[e.weight]:void 0;if(!wn(a=null==a?1:a))throw new Error("weight value must be a number for feature index "+o);(a=Number(a))>0&&bl(t,(function(t){n+=t[0]*a,r+=t[1]*a,i+=a}))})),on([n/i,r/i],e.properties,e)}function x_(t,e,n,r,i){var o=r.tolerance||.001,s=0,a=0,u=0,l=0;if(Ll(n,(function(e){var n,r=null===(n=e.properties)||void 0===n?void 0:n.weight,i=null==r?1:r;if(!wn(i=Number(i)))throw new Error("weight value must be a number");if(i>0){l+=1;var o=i*Fn(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?on([c,h],{medianCandidates:r.medianCandidates}):(r.medianCandidates.push([c,h]),x_([c,h],t,n,r,i-1))}function w_(t,e){return{x:t[0]-e[0],y:t[1]-e[1]}}function b_(t,e){var n=0,r=0;bl(t,(function(i,o,s,a,u){u>n&&(n=u,r=o,e.push([]));var l=o-r,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 B_(t,e){var n=0,r=0,i=0;bl(t,(function(o,s,a,u,l){u>i&&(i=u,r=s,e.push([[]])),l>n&&(n=l,r=s,e[u].push([]));var c=s-r,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 S_(t,e,n){void 0===n&&(n=2);var r=Ln(t),i=Ln(e),o=r[0]-i[0],s=r[1]-i[1];return 1===n?Math.abs(o)+Math.abs(s):Math.pow(Math.pow(o,n)+Math.pow(s,n),1/n)}function M_(t,e){var n=(e=e||{}).threshold||1e4,r=e.p||2,i=e.binary||!1,o=e.alpha||-1,s=e.standardization||!1,a=[];Ll(t,(function(t){a.push(gf(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=S_(a[l],a[c],r);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<=n?1:0:h<=n?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 L_(t){for(var e=0,n=0,r=t;n<r.length;n++){e+=r[n]}return e/t.length}function N_(t,e){return void 0===e&&(e={}),R_(t,"mercator",e)}function T_(t,e){return void 0===e&&(e={}),R_(t,"wgs84",e)}function R_(t,e,n){void 0===n&&(n={});var r=(n=n||{}).mutate;if(!t)throw new Error("geojson is required");return Array.isArray(t)&&wn(t[0])?t="mercator"===e?Q_(t):D_(t):(!0!==r&&(t=th(t)),bl(t,(function(t){var n="mercator"===e?Q_(t):D_(t);t[0]=n[0],t[1]=n[1]}))),t}function Q_(t){var e=Math.PI/180,n=6378137,r=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=[n*i*e,n*Math.log(Math.tan(.25*Math.PI+.5*t[1]*e))];return o[0]>r&&(o[0]=r),o[0]<-r&&(o[0]=-r),o[1]>r&&(o[1]=r),o[1]<-r&&(o[1]=-r),o}function D_(t){var e=180/Math.PI,n=6378137;return[t[0]*e/n,(.5*Math.PI-2*Math.atan(Math.exp(-t[1]/n)))*e]}m_.prototype={constructor:m_,polygons:function(){var t=this.edges;return this.cells.map((function(e){var n=e.halfedges.map((function(n){return Km(e,t[n])}));return n.data=e.site.data,n}))},triangles:function(){var t=[],e=this.edges;return this.cells.forEach((function(n,r){if(o=(i=n.halfedges).length)for(var i,o,s,a,u,l,c=n.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&&r<s.index&&r<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,n){for(var r,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[r=s],s=null,i.halfedges.forEach((function(n){var r=o.edges[n],a=r.left;if(a!==i.site&&a||(a=r.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=r,null==n||c<=n*n?i.site:null}};var P_=Object.freeze({__proto__:null,toMercator:N_,toWgs84:T_}),k_=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r};function O_(t){return Array.isArray(t)?j_(t):t&&t.bbox?j_(t.bbox):[360*q_(),180*q_()]}function F_(t,e){void 0===e&&(e={}),null==t&&(t=1);for(var n=[],r=0;r<t;r++)n.push(on(O_(e.bbox)));return hn(n)}function G_(t,e){void 0===e&&(e={}),null==t&&(t=1),wn(e.num_vertices)&&void 0!==e.num_vertices||(e.num_vertices=10),wn(e.max_radial_length)&&void 0!==e.max_radial_length||(e.max_radial_length=10);for(var n=[],r=function(t){var r,i=[],o=k_(Array(e.num_vertices+1)).map(Math.random);o.forEach((function(t,e,n){n[e]=e>0?t+n[e-1]:t})),o.forEach((function(t){t=2*t*Math.PI/o[o.length-1];var n=Math.random();i.push([n*(e.max_radial_length||10)*Math.sin(t),n*(e.max_radial_length||10)*Math.cos(t)])})),i[i.length-1]=i[0],i=i.map((r=O_(e.bbox),function(t){return[t[0]+r[0],t[1]+r[1]]})),n.push(an([i]))},i=0;i<t;i++)r();return hn(n)}function U_(t,e){if(void 0===e&&(e={}),!bn(e=e||{}))throw new Error("options is invalid");var n=e.bbox,r=e.num_vertices,i=e.max_length,o=e.max_rotation;null==t&&(t=1),(!wn(r)||void 0===r||r<2)&&(r=10),wn(i)&&void 0!==i||(i=1e-4),wn(o)&&void 0!==o||(o=Math.PI/8);for(var s=[],a=0;a<t;a++){for(var u=[O_(n)],l=0;l<r-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(ln(u))}return hn(s)}function q_(){return Math.random()-.5}function j_(t){return[Math.random()*(t[2]-t[0])+t[0],Math.random()*(t[3]-t[1])+t[1]]}var z_=Object.freeze({__proto__:null,randomPosition:O_,randomPoint:F_,randomPolygon:G_,randomLineString:U_});function V_(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 n=[];return Ll(t,(function(t){J_(t.properties,e)&&n.push(t)})),hn(n)}function Y_(t,e,n){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 r=X_(t,e),i=Object.keys(r),o=0;o<i.length;o++){for(var s=i[o],a=r[s],u=[],l=0;l<a.length;l++)u.push(t.features[a[l]]);n(hn(u),s,o)}}function H_(t,e,n,r){var i=r;return Y_(t,e,(function(t,e,o){i=0===o&&void 0===r?t:n(i,t,e,o)})),i}function X_(t,e){var n={};return Ll(t,(function(t,r){var i=t.properties||{};if(Object.prototype.hasOwnProperty.call(i,String(e))){var o=i[e];Object.prototype.hasOwnProperty.call(n,o)?n[o].push(r):n[o]=[r]}})),n}function J_(t,e){if(void 0===t)return!1;var n=typeof e;if("number"===n||"string"===n)return Object.prototype.hasOwnProperty.call(t,e);if(Array.isArray(e)){for(var r=0;r<e.length;r++)if(!J_(t,e[r]))return!1;return!0}return W_(t,e)}function W_(t,e){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r];if(t[i]!==e[i])return!1}return!0}function K_(t,e){if(!e)return{};if(!e.length)return{};for(var n={},r=0;r<e.length;r++){var i=e[r];Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n}var Z_=Object.freeze({__proto__:null,getCluster:V_,clusterEach:Y_,clusterReduce:H_,createBins:X_,applyFilter:J_,propertiesContainsFilter:W_,filterProperties:K_});
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 $_(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=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++,r=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],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var tI=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function eI(t,e){return t>e?1:t<e?-1:0}function nI(t,e,n){for(var r=new tI(null,null),i=r,o=r;;){var s=n(t,e.key);if(s<0){if(null===e.left)break;if(n(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(n(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=r.right,e.right=r.left,e}function rI(t,e,n,r){var i=new tI(t,e);if(null===n)return i.left=i.right=null,i;var o=r(t,(n=nI(t,n,r)).key);return o<0?(i.left=n.left,i.right=n,n.left=null):o>=0&&(i.right=n.right,i.left=n,n.right=null),i}function iI(t,e,n){var r=null,i=null;if(e){var o=n((e=nI(t,e,n)).key,t);0===o?(r=e.left,i=e.right):o<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function oI(t,e,n,r,i){if(t){r(e+(n?"└── ":"├── ")+i(t)+"\n");var o=e+(n?" ":"│ ");t.left&&oI(t.left,o,!1,r,i),t.right&&oI(t.right,o,!0,r,i)}}var sI=function(){function t(t){void 0===t&&(t=eI),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=rI(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var n=new tI(t,e);null===this._root&&(n.left=n.right=null,this._size++,this._root=n);var r=this._comparator,i=nI(t,this._root,r),o=r(t,i.key);return 0===o?this._root=i:(o<0?(n.left=i.left,n.right=i,i.left=null):o>0&&(n.right=i.right,n.left=i,i.right=null),this._size++,this._root=n),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,n){var r;return null===e?null:0===n(t,(e=nI(t,e,n)).key)?(null===e.left?r=e.right:(r=nI(t,e.left,n)).right=e.right,this._size--,r):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=nI(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,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=nI(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,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var n=this._root,r=[],i=!1;!i;)null!==n?(r.push(n),n=n.left):0!==r.length?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this},t.prototype.range=function(t,e,n,r){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&&n.call(r,s))return this;s=s.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var n=e.key;return t.push(n)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var n=e.data;return t.push(n)})),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,n=!1,r=0,i=[];!n;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},t.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?(n=e,e=e.left):e=e.right}return n},t.prototype.prev=function(t){var e=this._root,n=null;if(null!==t.left){for(n=t.left;n.right;)n=n.right;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?e=e.left:(n=e,e=e.right)}return n},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){var e=t,n=[],r=!1,i=new tI(null,null),o=i;for(;!r;)e?(n.push(e),e=e.left):n.length>0?e=(e=o=o.next=n.pop()).right:r=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=!1);var r=t.length,i=this._comparator;if(n&&lI(t,e,0,r-1,i),null===this._root)this._root=aI(t,e,0,r),this._size=r;else{var o=function(t,e,n){var r=new tI(null,null),i=r,o=t,s=e;for(;null!==o&&null!==s;)n(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 r.next}(this.toList(),function(t,e){for(var n=new tI(null,null),r=n,i=0;i<t.length;i++)r=r.next=new tI(t[i],e[i]);return r.next=null,n.next}(t,e),i);r=this._size+r,this._root=uI({head:o},0,r)}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 oI(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,n){var r=this._comparator,i=iI(t,this._root,r),o=i.left,s=i.right;r(t,e)<0?s=rI(e,n,s,r):o=rI(e,n,o,r),this._root=function(t,e,n){return null===e?t:(null===t||((e=nI(t.key,e,n)).left=t),e)}(o,s,r)},t.prototype.split=function(t){return iI(t,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var t,e,n;return $_(this,(function(r){switch(r.label){case 0:t=this._root,e=[],n=!1,r.label=1;case 1:return n?[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 r.sent(),t=t.right,[3,5];case 4:n=!0,r.label=5;case 5:return[3,1];case 6:return[2]}}))},t}();function aI(t,e,n,r){var i=r-n;if(i>0){var o=n+Math.floor(i/2),s=t[o],a=e[o],u=new tI(s,a);return u.left=aI(t,e,n,o),u.right=aI(t,e,o+1,r),u}return null}function uI(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=uI(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=uI(t,i+1,n),s}return null}function lI(t,e,n,r,i){if(!(n>=r)){for(var o=t[n+r>>1],s=n-1,a=r+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}lI(t,e,n,a,i),lI(t,e,a+1,r,i)}}function cI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function hI(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function fI(t,e,n){return e&&hI(t.prototype,e),n&&hI(t,n),t}var pI=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},gI=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 n=t.ll.x<e.ll.x?e.ll.x:t.ll.x,r=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:n,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:r,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},AI=Number.EPSILON;void 0===AI&&(AI=Math.pow(2,-52));var dI=AI*AI,yI=function(t,e){if(-AI<t&&t<AI&&-AI<e&&e<AI)return 0;var n=t-e;return n*n<dI*t*e?0:t<e?-1:1},vI=function(){function t(){cI(this,t),this.reset()}return fI(t,[{key:"reset",value:function(){this.xRounder=new mI,this.yRounder=new mI}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),t}(),mI=function(){function t(){cI(this,t),this.tree=new sI,this.round(0)}return fI(t,[{key:"round",value:function(t){var e=this.tree.add(t),n=this.tree.prev(e);if(null!==n&&0===yI(e.key,n.key))return this.tree.remove(t),n.key;var r=this.tree.next(e);return null!==r&&0===yI(e.key,r.key)?(this.tree.remove(t),r.key):t}}]),t}(),_I=new vI,II=function(t,e){return t.x*e.y-t.y*e.x},EI=function(t,e){return t.x*e.x+t.y*e.y},CI=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y},o=II(r,i);return yI(o,0)},xI=function(t){return Math.sqrt(EI(t,t))},wI=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return EI(i,r)/xI(i)/xI(r)},bI=function(t,e,n){return 0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n}},BI=function(t,e,n){return 0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)}},SI=function(){function t(e,n){cI(this,t),void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return fI(t,null,[{key:"compare",value:function(e,n){var r=t.comparePoints(e.point,n.point);return 0!==r?r:(e.point!==n.point&&e.link(n),e.isLeft!==n.isLeft?e.isLeft?1:-1:LI.compare(e.segment,n.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}}]),fI(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,n=0,r=e.length;n<r;n++){var i=e[n];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 n=this.point.events[e];if(void 0===n.segment.consumedBy)for(var r=e+1;r<t;r++){var i=this.point.events[r];void 0===i.consumedBy&&(n.otherSE.point.events===i.otherSE.point.events&&n.segment.consume(i.segment))}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,n=this.point.events.length;e<n;e++){var r=this.point.events[e];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&t.push(r)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,n=new Map,r=function(r){var i,o,s,a,u,l=r.otherSE;n.set(r,{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},II(u,a)/xI(u)/xI(a)),cosine:wI(e.point,t.point,l.point)})};return function(t,e){n.has(t)||r(t),n.has(e)||r(e);var i=n.get(t),o=i.sine,s=i.cosine,a=n.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}(),MI=0,LI=function(){function t(e,n,r,i){cI(this,t),this.id=++MI,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=r,this.windings=i}return fI(t,null,[{key:"compare",value:function(t,e){var n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<n)return 1;if(i<r)return-1;var s=t.leftSE.point.y,a=e.leftSE.point.y,u=t.rightSE.point.y,l=e.rightSE.point.y;if(n<r){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(n>r){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-n,v=l-a,m=o-r;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}}]),fI(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,n=this.rightSE.point,r=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/r.y,o=e.x+i*r.x;if(t.x===o)return 0;var s=(t.x-e.x)/r.x,a=e.y+s*r.y;return t.y===a?0:t.y<a?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),n=t.bbox(),r=gI(e,n);if(null===r)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,u=pI(e,s)&&0===this.comparePoint(s),l=pI(n,i)&&0===t.comparePoint(i),c=pI(e,a)&&0===this.comparePoint(a),h=pI(n,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,n,r){if(0===e.x)return BI(n,r,t.x);if(0===r.x)return BI(t,e,n.x);if(0===e.y)return bI(n,r,t.y);if(0===r.y)return bI(t,e,n.y);var i=II(e,r);if(0==i)return null;var o={x:n.x-t.x,y:n.y-t.y},s=II(o,e)/i,a=II(o,r)/i;return{x:(t.x+a*e.x+(n.x+s*r.x))/2,y:(t.y+a*e.y+(n.y+s*r.y))/2}}(i,this.vector(),s,t.vector());return null===f?null:pI(r,f)?_I.round(f.x,f.y):null}},{key:"split",value:function(e){var n=[],r=void 0!==e.events,i=new SI(e,!0),o=new SI(e,!1),s=this.rightSE;this.replaceRightSE(o),n.push(o),n.push(i);var a=new t(i,s,this.rings.slice(),this.windings.slice());return SI.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),SI.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}},{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,n=this.windings.length;e<n;e++)this.windings[e]*=-1}},{key:"consume",value:function(e){for(var n=this,r=e;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;var i=t.compare(n,r);if(0!==i){if(i>0){var o=n;n=r,r=o}if(n.prev===r){var s=n;n=r,r=s}for(var a=0,u=r.rings.length;a<u;a++){var l=r.rings[a],c=r.windings[a],h=n.rings.indexOf(l);-1===h?(n.rings.push(l),n.windings.push(c)):n.windings[h]+=c}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.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,n=this._afterState.windings,r=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),n.push(a)):n[u]+=a}for(var l=[],c=[],h=0,f=e.length;h<f;h++)if(0!==n[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===r.indexOf(v)&&r.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(UI.type){case"union":var n=0===t.length,r=0===e.length;this._isInResult=n!==r;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===UI.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(UI.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,n,r){var i,o,s,a=SI.comparePoints(e,n);if(a<0)i=e,o=n,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=n,o=e,s=-1}return new t(new SI(i,!0),new SI(o,!1),[r],[s])}}]),t}(),NI=function(){function t(e,n,r){if(cI(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,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=_I.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=_I.round(e[s][0],e[s][1]);u.x===o.x&&u.y===o.y||(this.segments.push(LI.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(LI.fromRing(o,i,this))}return fI(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.segments.length;e<n;e++){var r=this.segments[e];t.push(r.leftSE),t.push(r.rightSE)}return t}}]),t}(),TI=function(){function t(e,n){if(cI(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new NI(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 r=1,i=e.length;r<i;r++){var o=new NI(e[r],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=n}return fI(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,n=this.interiorRings.length;e<n;e++)for(var r=this.interiorRings[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),t}(),RI=function(){function t(e,n){if(cI(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 r=0,i=e.length;r<i;r++){var o=new TI(e[r],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=n}return fI(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++)for(var r=this.polys[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),t}(),QI=function(){function t(e){cI(this,t),this.events=e;for(var n=0,r=e.length;n<r;n++)e[n].segment.ringOut=this;this.poly=null}return fI(t,null,[{key:"factory",value:function(e){for(var n=[],r=0,i=e.length;r<i;r++){var o=e[r];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),n.push(new t(_.reverse()))}n.push(new t(l))}}return n}}]),fI(t,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],n=1,r=this.events.length-1;n<r;n++){var i=this.events[n].point,o=this.events[n+1].point;0!==CI(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],a=e[1];0===CI(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,n=this.events.length;e<n;e++){var r=this.events[e];SI.compare(t,r)>0&&(t=r)}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}(),DI=function(){function t(e){cI(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return fI(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,n=this.interiorRings.length;e<n;e++){var r=this.interiorRings[e].getGeom();null!==r&&t.push(r)}return t}}]),t}(),PI=function(){function t(e){cI(this,t),this.rings=e,this.polys=this._composePolys(e)}return fI(t,[{key:"getGeom",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++){var r=this.polys[e].getGeom();null!==r&&t.push(r)}return t}},{key:"_composePolys",value:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];if(!i.poly)if(i.isExteriorRing())e.push(new DI(i));else{var o=i.enclosingRing();o.poly||e.push(new DI(o)),o.poly.addInterior(i)}}return e}}]),t}(),kI=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:LI.compare;cI(this,t),this.queue=e,this.tree=new sI(n),this.segments=[]}return fI(t,[{key:"process",value:function(t){var e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;var r=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!r)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=r,o=r,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++)n.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++)n.push(A[d])}if(null!==u||null!==p){var v=null;if(null===u)v=p;else if(null===p)v=u;else{v=SI.comparePoints(u,p)<=0?u:p}this.queue.remove(e.rightSE),n.push(e.rightSE);for(var m=e.split(v),_=0,I=m.length;_<I;_++)n.push(m[_])}n.length>0?(this.tree.remove(e),n.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 C=this._splitSafely(s,E),x=0,w=C.length;x<w;x++)n.push(C[x]);if(!a.isAnEndpoint(E))for(var b=this._splitSafely(a,E),B=0,S=b.length;B<S;B++)n.push(b[B])}}this.tree.remove(e)}return n}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var n=t.rightSE;this.queue.remove(n);var r=t.split(e);return r.push(n),void 0===t.consumedBy&&this.tree.insert(t),r}}]),t}(),OI="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,FI="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,GI=function(){function t(){cI(this,t)}return fI(t,[{key:"run",value:function(t,e,n){UI.type=t,_I.reset();for(var r=[new RI(e,!0)],i=0,o=n.length;i<o;i++)r.push(new RI(n[i],!1));if(UI.numMultiPolys=r.length,"difference"===UI.type)for(var s=r[0],a=1;a<r.length;)null!==gI(r[a].bbox,s.bbox)?a++:r.splice(a,1);if("intersection"===UI.type)for(var u=0,l=r.length;u<l;u++)for(var c=r[u],h=u+1,f=r.length;h<f;h++)if(null===gI(c.bbox,r[h].bbox))return[];for(var p=new sI(SI.compare),g=0,A=r.length;g<A;g++)for(var d=r[g].getSweepEvents(),y=0,v=d.length;y<v;y++)if(p.insert(d[y]),p.size>OI)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 kI(p),_=p.size,I=p.pop();I;){var E=I.key;if(p.size===_){var C=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(C.id," ")+"[".concat(C.leftSE.point.x,", ").concat(C.leftSE.point.y,"] -> ")+"[".concat(C.rightSE.point.x,", ").concat(C.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(p.size>OI)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(m.segments.length>FI)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var x=m.process(E),w=0,b=x.length;w<b;w++){var B=x[w];void 0===B.consumedBy&&p.insert(B)}_=p.size,I=p.pop()}_I.reset();var S=QI.factory(m.segments);return new PI(S).getGeom()}}]),t}(),UI=new GI,qI={union:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return UI.run("union",t,n)},intersection:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return UI.run("intersection",t,n)},xor:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return UI.run("xor",t,n)},difference:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return UI.run("difference",t,n)}};"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),n=Math.max(Math.min(e.length,9007199254740991),0)||0,r=1 in arguments&&parseInt(Number(arguments[1]),10)||0;r=r<0?Math.max(n+r,0):Math.min(r,n);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:n;for(i=i<0?Math.max(n+arguments[2],0):Math.min(i,n);r<i;)e[r]=t,++r;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 jI=function(){};jI.prototype.interfaces_=function(){return[]},jI.prototype.getClass=function(){return jI},jI.prototype.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n};var zI=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),VI=function(){},YI={MAX_VALUE:{configurable:!0}};VI.isNaN=function(t){return Number.isNaN(t)},VI.doubleToLongBits=function(t){return t},VI.longBitsToDouble=function(t){return t},VI.isInfinite=function(t){return!Number.isFinite(t)},YI.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(VI,YI);var HI=function(){},XI=function(){},JI=function(){};function WI(){}var KI=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])},ZI={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};KI.prototype.setOrdinate=function(t,e){switch(t){case KI.X:this.x=e;break;case KI.Y:this.y=e;break;case KI.Z:this.z=e;break;default:throw new zI("Invalid ordinate index: "+t)}},KI.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],n=arguments[1];return!!jI.equalsWithTolerance(this.x,e.x,n)&&!!jI.equalsWithTolerance(this.y,e.y,n)}},KI.prototype.getOrdinate=function(t){switch(t){case KI.X:return this.x;case KI.Y:return this.y;case KI.Z:return this.z}throw new zI("Invalid ordinate index: "+t)},KI.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||VI.isNaN(this.z))&&VI.isNaN(t.z)},KI.prototype.equals=function(t){return t instanceof KI&&this.equals2D(t)},KI.prototype.equalInZ=function(t,e){return jI.equalsWithTolerance(this.z,t.z,e)},KI.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},KI.prototype.clone=function(){},KI.prototype.copy=function(){return new KI(this)},KI.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},KI.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return Math.sqrt(e*e+n*n+r*r)},KI.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},KI.prototype.hashCode=function(){var t=17;return t=37*(t=37*t+KI.hashCode(this.x))+KI.hashCode(this.y)},KI.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},KI.prototype.interfaces_=function(){return[HI,XI,WI]},KI.prototype.getClass=function(){return KI},KI.hashCode=function(){if(1===arguments.length){var t=VI.doubleToLongBits(arguments[0]);return Math.trunc((t^t)>>>32)}},ZI.DimensionalComparator.get=function(){return $I},ZI.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},ZI.NULL_ORDINATE.get=function(){return VI.NaN},ZI.X.get=function(){return 0},ZI.Y.get=function(){return 1},ZI.Z.get=function(){return 2},Object.defineProperties(KI,ZI);var $I=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 zI("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};$I.prototype.compare=function(t,e){var n=t,r=e,i=$I.compare(n.x,r.x);if(0!==i)return i;var o=$I.compare(n.y,r.y);return 0!==o?o:this._dimensionsToTest<=2?0:$I.compare(n.z,r.z)},$I.prototype.interfaces_=function(){return[JI]},$I.prototype.getClass=function(){return $I},$I.compare=function(t,e){return t<e?-1:t>e?1:VI.isNaN(t)?VI.isNaN(e)?0:-1:VI.isNaN(e)?1:0};var tE=function(){};tE.prototype.create=function(){},tE.prototype.interfaces_=function(){return[]},tE.prototype.getClass=function(){return tE};var eE=function(){},nE={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};eE.prototype.interfaces_=function(){return[]},eE.prototype.getClass=function(){return eE},eE.toLocationSymbol=function(t){switch(t){case eE.EXTERIOR:return"e";case eE.BOUNDARY:return"b";case eE.INTERIOR:return"i";case eE.NONE:return"-"}throw new zI("Unknown location value: "+t)},nE.INTERIOR.get=function(){return 0},nE.BOUNDARY.get=function(){return 1},nE.EXTERIOR.get=function(){return 2},nE.NONE.get=function(){return-1},Object.defineProperties(eE,nE);var rE=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},iE=function(){},oE={LOG_10:{configurable:!0}};iE.prototype.interfaces_=function(){return[]},iE.prototype.getClass=function(){return iE},iE.log10=function(t){var e=Math.log(t);return VI.isInfinite(e)||VI.isNaN(e)?e:e/iE.LOG_10},iE.min=function(t,e,n,r){var i=t;return e<i&&(i=e),n<i&&(i=n),r<i&&(i=r),i},iE.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],n=arguments[2];return t<e?e:t>n?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],o=arguments[2];return r<i?i:r>o?o:r}},iE.wrap=function(t,e){return t<0?e- -t%e:t%e},iE.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],n=arguments[0];return t>n&&(n=t),e>n&&(n=e),n}if(4===arguments.length){var r=arguments[1],i=arguments[2],o=arguments[3],s=arguments[0];return r>s&&(s=r),i>s&&(s=i),o>s&&(s=o),s}},iE.average=function(t,e){return(t+e)/2},oE.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(iE,oE);var sE=function(t){this.str=t};sE.prototype.append=function(t){this.str+=t},sE.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},sE.prototype.toString=function(t){return this.str};var aE=function(t){this.value=t};aE.prototype.intValue=function(){return this.value},aE.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},aE.isNaN=function(t){return Number.isNaN(t)};var uE=function(){};uE.isWhitespace=function(t){return t<=32&&t>=0||127===t},uE.toUpperCase=function(t){return t.toUpperCase()};var lE=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 n=arguments[0];this.init(n)}else if("string"==typeof arguments[0]){t.call(this,t.parse(arguments[0]))}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.init(r,i)}},cE={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}};lE.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},lE.prototype.extractSignificantDigits=function(t,e){var n=this.abs(),r=lE.magnitude(n._hi),i=lE.TEN.pow(r);(n=n.divide(i)).gt(lE.TEN)?(n=n.divide(lE.TEN),r+=1):n.lt(lE.ONE)&&(n=n.multiply(lE.TEN),r-=1);for(var o=r+1,s=new sE,a=lE.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===o&&s.append(".");var l=Math.trunc(n._hi);if(l<0)break;var c=!1,h=0;l>9?(c=!0,h="9"):h="0"+l,s.append(h),n=n.subtract(lE.valueOf(l)).multiply(lE.TEN),c&&n.selfAdd(lE.TEN);var f=!0,p=lE.magnitude(n._hi);if(p<0&&Math.abs(p)>=a-u&&(f=!1),!f)break}return e[0]=r,s.toString()},lE.prototype.sqr=function(){return this.multiply(this)},lE.prototype.doubleValue=function(){return this._hi+this._lo},lE.prototype.subtract=function(){if(arguments[0]instanceof lE){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},lE.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},lE.prototype.isZero=function(){return 0===this._hi&&0===this._lo},lE.prototype.selfSubtract=function(){if(arguments[0]instanceof lE){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)}},lE.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},lE.prototype.min=function(t){return this.le(t)?this:t},lE.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof lE){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 n,r,i,o,s=arguments[0],a=arguments[1],u=null,l=null,c=null,h=null;return i=this._hi/s,h=(u=(c=lE.SPLIT*i)-(u=c-i))*(l=(h=lE.SPLIT*s)-(l=h-s))-(o=i*s)+u*(r=s-l)+(n=i-u)*l+n*r,h=i+(c=(this._hi-o-h+this._lo-i*a)/s),this._hi=h,this._lo=i-h+c,this}},lE.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},lE.prototype.divide=function(){if(arguments[0]instanceof lE){var t,e,n,r,i=arguments[0],o=null,s=null,a=null,u=null;return t=(n=this._hi/i._hi)-(o=(a=lE.SPLIT*n)-(o=a-n)),u=o*(s=(u=lE.SPLIT*i._hi)-(s=u-i._hi))-(r=n*i._hi)+o*(e=i._hi-s)+t*s+t*e,a=(this._hi-r-u+this._lo-n*i._lo)/i._hi,new lE(u=n+a,n-u+a)}if("number"==typeof arguments[0]){var l=arguments[0];return VI.isNaN(l)?lE.createNaN():lE.copy(this).selfDivide(l,0)}},lE.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},lE.prototype.pow=function(t){if(0===t)return lE.valueOf(1);var e=new lE(this),n=lE.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2==1&&n.selfMultiply(e),(r/=2)>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n},lE.prototype.ceil=function(){if(this.isNaN())return lE.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new lE(t,e)},lE.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},lE.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},lE.prototype.setValue=function(){if(arguments[0]instanceof lE){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},lE.prototype.max=function(t){return this.ge(t)?this:t},lE.prototype.sqrt=function(){if(this.isZero())return lE.valueOf(0);if(this.isNegative())return lE.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=lE.valueOf(e),r=this.subtract(n.sqr())._hi*(.5*t);return n.add(r)},lE.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof lE){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,n,r,i,o,s=arguments[0],a=null;return a=(r=this._hi+s)-(i=r-this._hi),n=(o=(a=s-i+(this._hi-a))+this._lo)+(r-(e=r+o)),this._hi=e+n,this._lo=n+(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}},lE.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof lE){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 n,r,i=arguments[0],o=arguments[1],s=null,a=null,u=null,l=null;s=(u=lE.SPLIT*this._hi)-this._hi,l=lE.SPLIT*i,s=u-s,n=this._hi-s,a=l-i;var c=(u=this._hi*i)+(l=s*(a=l-a)-u+s*(r=i-a)+n*a+n*r+(this._hi*o+this._lo*i)),h=l+(s=u-c);return this._hi=c,this._lo=h,this}},lE.prototype.selfSqr=function(){return this.selfMultiply(this)},lE.prototype.floor=function(){if(this.isNaN())return lE.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new lE(t,e)},lE.prototype.negate=function(){return this.isNaN()?this:new lE(-this._hi,-this._lo)},lE.prototype.clone=function(){},lE.prototype.multiply=function(){if(arguments[0]instanceof lE){var t=arguments[0];return t.isNaN()?lE.createNaN():lE.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return VI.isNaN(e)?lE.createNaN():lE.copy(this).selfMultiply(e,0)}},lE.prototype.isNaN=function(){return VI.isNaN(this._hi)},lE.prototype.intValue=function(){return Math.trunc(this._hi)},lE.prototype.toString=function(){var t=lE.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},lE.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,i=n;if("."===n.charAt(0))i="0"+n;else if(r<0)i="0."+lE.stringOfChar("0",-r)+n;else if(-1===n.indexOf(".")){var o=r-n.length;i=n+lE.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},lE.prototype.reciprocal=function(){var t,e,n,r,i=null,o=null,s=null,a=null;t=(n=1/this._hi)-(i=(s=lE.SPLIT*n)-(i=s-n)),o=(a=lE.SPLIT*this._hi)-this._hi;var u=n+(s=(1-(r=n*this._hi)-(a=i*(o=a-o)-r+i*(e=this._hi-o)+t*o+t*e)-n*this._lo)/this._hi);return new lE(u,n-u+s)},lE.prototype.toSciNotation=function(){if(this.isZero())return lE.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=lE.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===n.charAt(0))throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var o=n.charAt(0)+"."+i;return this.isNegative()?"-"+o+r:o+r},lE.prototype.abs=function(){return this.isNaN()?lE.NaN:this.isNegative()?this.negate():new lE(this)},lE.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},lE.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},lE.prototype.add=function(){if(arguments[0]instanceof lE){var t=arguments[0];return lE.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return lE.copy(this).selfAdd(e)}},lE.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 lE){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this._hi=n,this._lo=r}},lE.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},lE.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},lE.prototype.trunc=function(){return this.isNaN()?lE.NaN:this.isPositive()?this.floor():this.ceil()},lE.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},lE.prototype.interfaces_=function(){return[WI,HI,XI]},lE.prototype.getClass=function(){return lE},lE.sqr=function(t){return lE.valueOf(t).selfMultiply(t)},lE.valueOf=function(){return"string"==typeof arguments[0]?lE.parse(arguments[0]):"number"==typeof arguments[0]?new lE(arguments[0]):void 0},lE.sqrt=function(t){return lE.valueOf(t).sqrt()},lE.parse=function(t){for(var e=0,n=t.length;uE.isWhitespace(t.charAt(e));)e++;var r=!1;if(e<n){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(r=!0))}for(var o=new lE,s=0,a=0,u=0;!(e>=n);){var l=t.charAt(e);if(e++,uE.isDigit(l)){var c=l-"0";o.selfMultiply(lE.TEN),o.selfAdd(c),s++}else{if("."!==l){if("e"===l||"E"===l){var h=t.substring(e);try{u=aE.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=lE.TEN.pow(p);f=o.divide(g)}else if(p<0){var A=lE.TEN.pow(-p);f=o.multiply(A)}return r?f.negate():f},lE.createNaN=function(){return new lE(VI.NaN,VI.NaN)},lE.copy=function(t){return new lE(t)},lE.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n));return 10*Math.pow(10,r)<=e&&(r+=1),r},lE.stringOfChar=function(t,e){for(var n=new sE,r=0;r<e;r++)n.append(t);return n.toString()},cE.PI.get=function(){return new lE(3.141592653589793,12246467991473532e-32)},cE.TWO_PI.get=function(){return new lE(6.283185307179586,24492935982947064e-32)},cE.PI_2.get=function(){return new lE(1.5707963267948966,6123233995736766e-32)},cE.E.get=function(){return new lE(2.718281828459045,14456468917292502e-32)},cE.NaN.get=function(){return new lE(VI.NaN,VI.NaN)},cE.EPS.get=function(){return 123259516440783e-46},cE.SPLIT.get=function(){return 134217729},cE.MAX_PRINT_DIGITS.get=function(){return 32},cE.TEN.get=function(){return lE.valueOf(10)},cE.ONE.get=function(){return lE.valueOf(1)},cE.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},cE.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(lE,cE);var hE=function(){},fE={DP_SAFE_EPSILON:{configurable:!0}};hE.prototype.interfaces_=function(){return[]},hE.prototype.getClass=function(){return hE},hE.orientationIndex=function(t,e,n){var r=hE.orientationIndexFilter(t,e,n);if(r<=1)return r;var i=lE.valueOf(e.x).selfAdd(-t.x),o=lE.valueOf(e.y).selfAdd(-t.y),s=lE.valueOf(n.x).selfAdd(-e.x),a=lE.valueOf(n.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},hE.signOfDet2x2=function(t,e,n,r){return t.multiply(r).selfSubtract(e.multiply(n)).signum()},hE.intersection=function(t,e,n,r){var i=lE.valueOf(r.y).selfSubtract(n.y).selfMultiply(lE.valueOf(e.x).selfSubtract(t.x)),o=lE.valueOf(r.x).selfSubtract(n.x).selfMultiply(lE.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=lE.valueOf(r.x).selfSubtract(n.x).selfMultiply(lE.valueOf(t.y).selfSubtract(n.y)),u=lE.valueOf(r.y).selfSubtract(n.y).selfMultiply(lE.valueOf(t.x).selfSubtract(n.x)),l=a.subtract(u).selfDivide(s).doubleValue(),c=lE.valueOf(t.x).selfAdd(lE.valueOf(e.x).selfSubtract(t.x).selfMultiply(l)).doubleValue(),h=lE.valueOf(e.x).selfSubtract(t.x).selfMultiply(lE.valueOf(t.y).selfSubtract(n.y)),f=lE.valueOf(e.y).selfSubtract(t.y).selfMultiply(lE.valueOf(t.x).selfSubtract(n.x)),p=h.subtract(f).selfDivide(s).doubleValue(),g=lE.valueOf(n.y).selfAdd(lE.valueOf(r.y).selfSubtract(n.y).selfMultiply(p)).doubleValue();return new KI(c,g)},hE.orientationIndexFilter=function(t,e,n){var r=null,i=(t.x-n.x)*(e.y-n.y),o=(t.y-n.y)*(e.x-n.x),s=i-o;if(i>0){if(o<=0)return hE.signum(s);r=i+o}else{if(!(i<0))return hE.signum(s);if(o>=0)return hE.signum(s);r=-i-o}var a=hE.DP_SAFE_EPSILON*r;return s>=a||-s>=a?hE.signum(s):2},hE.signum=function(t){return t>0?1:t<0?-1:0},fE.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(hE,fE);var pE=function(){},gE={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};gE.X.get=function(){return 0},gE.Y.get=function(){return 1},gE.Z.get=function(){return 2},gE.M.get=function(){return 3},pE.prototype.setOrdinate=function(t,e,n){},pE.prototype.size=function(){},pE.prototype.getOrdinate=function(t,e){},pE.prototype.getCoordinate=function(){},pE.prototype.getCoordinateCopy=function(t){},pE.prototype.getDimension=function(){},pE.prototype.getX=function(t){},pE.prototype.clone=function(){},pE.prototype.expandEnvelope=function(t){},pE.prototype.copy=function(){},pE.prototype.getY=function(t){},pE.prototype.toCoordinateArray=function(){},pE.prototype.interfaces_=function(){return[XI]},pE.prototype.getClass=function(){return pE},Object.defineProperties(pE,gE);var AE=function(){},dE=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}(AE),yE=function(){};yE.arraycopy=function(t,e,n,r,i){for(var o=0,s=e;s<e+i;s++)n[r+o]=t[s],o++},yE.getProperty=function(t){return{"line.separator":"\n"}[t]};var vE=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 n=arguments[0],r=arguments[1];this.x=n,this.y=r,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 KI&&arguments[1]instanceof KI){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}};vE.prototype.getY=function(){var t=this.y/this.w;if(VI.isNaN(t)||VI.isInfinite(t))throw new dE;return t},vE.prototype.getX=function(){var t=this.x/this.w;if(VI.isNaN(t)||VI.isInfinite(t))throw new dE;return t},vE.prototype.getCoordinate=function(){var t=new KI;return t.x=this.getX(),t.y=this.getY(),t},vE.prototype.interfaces_=function(){return[]},vE.prototype.getClass=function(){return vE},vE.intersection=function(t,e,n,r){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=n.y-r.y,u=r.x-n.x,l=n.x*r.y-r.x*n.y,c=i*u-a*o,h=(o*l-u*s)/c,f=(a*s-i*l)/c;if(VI.isNaN(h)||VI.isInfinite(h)||VI.isNaN(f)||VI.isInfinite(f))throw new dE;return new KI(h,f)};var mE=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 KI){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.init(r.x,i.x,r.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)}},_E={serialVersionUID:{configurable:!0}};mE.prototype.getArea=function(){return this.getWidth()*this.getHeight()},mE.prototype.equals=function(t){if(!(t instanceof mE))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()},mE.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new mE;var e=this._minx>t._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new mE(e,r,n,i)},mE.prototype.isNull=function(){return this._maxx<this._minx},mE.prototype.getMaxX=function(){return this._maxx},mE.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof KI){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof mE){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 n=arguments[0],r=arguments[1];return!this.isNull()&&(n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy)}},mE.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof mE){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 KI){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return!this.isNull()&&!(n>this._maxx||n<this._minx||r>this._maxy||r<this._miny)}},mE.prototype.getMinY=function(){return this._miny},mE.prototype.getMinX=function(){return this._minx},mE.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof KI){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof mE){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 n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(n<this._minx&&(this._minx=n),n>this._maxx&&(this._maxx=n),r<this._miny&&(this._miny=r),r>this._maxy&&(this._maxy=r))}},mE.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},mE.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},mE.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},mE.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},mE.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},mE.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},mE.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},mE.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},mE.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},mE.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof mE){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof KI){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return this.covers(n,r)}},mE.prototype.centre=function(){return this.isNull()?null:new KI((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},mE.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof KI){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof mE){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 n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.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)}},mE.prototype.getMaxY=function(){return this._maxy},mE.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 n=0;return this._maxy<t._miny?n=t._miny-this._maxy:this._miny>t._maxy&&(n=this._miny-t._maxy),0===e?n:0===n?e:Math.sqrt(e*e+n*n)},mE.prototype.hashCode=function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+KI.hashCode(this._minx))+KI.hashCode(this._maxx))+KI.hashCode(this._miny))+KI.hashCode(this._maxy)},mE.prototype.interfaces_=function(){return[HI,WI]},mE.prototype.getClass=function(){return mE},mE.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.x<e.x?t.x:e.x)&&n.x<=(t.x>e.x?t.x:e.x)&&n.y>=(t.y<e.y?t.y:e.y)&&n.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var r=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(r.x,i.x),c=Math.max(r.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(r.y,i.y),c=Math.max(r.y,i.y),!(l>u)&&!(c<a)))}},_E.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(mE,_E);var IE={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*$/},EE=function(t){this.geometryFactory=t||new ax};EE.prototype.read=function(t){var e,n,r;t=t.replace(/[\n\r]/g," ");var i=IE.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=IE.emptyTypeStr.exec(t))[2]=void 0),i&&(n=i[1].toLowerCase(),r=i[2],xE[n]&&(e=xE[n].apply(this,[r]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},EE.prototype.write=function(t){return this.extractGeometry(t)},EE.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!CE[e])return null;var n=e.toUpperCase();return t.isEmpty()?n+" EMPTY":n+"("+CE[e].apply(this,[t])+")"};var CE={coordinate:function(t){return t.x+" "+t.y},point:function(t){return CE.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+CE.point.apply(this,[t._geometries[n]])+")");return e.join(",")},linestring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(CE.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},linearring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(CE.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},multilinestring:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+CE.linestring.apply(this,[t._geometries[n]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+CE.linestring.apply(this,[t._shell])+")");for(var n=0,r=t._holes.length;n<r;++n)e.push("("+CE.linestring.apply(this,[t._holes[n]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+CE.polygon.apply(this,[t._geometries[n]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push(this.extractGeometry(t._geometries[n]));return e.join(",")}},xE={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(IE.spaces);return this.geometryFactory.createPoint(new KI(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPoint();for(var n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(IE.trimParens,"$1"),r.push(xE.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(r)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].trim().split(IE.spaces),r.push(new KI(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(r)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].trim().split(IE.spaces),r.push(new KI(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(r)},multilinestring:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiLineString();for(var n=t.trim().split(IE.parenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(IE.trimParens,"$1"),r.push(xE.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(r)},polygon:function(t){var e,n,r;if(void 0===t)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(IE.parenComma),s=[],a=0,u=o.length;a<u;++a)e=o[a].replace(IE.trimParens,"$1"),n=xE.linestring.apply(this,[e]),r=this.geometryFactory.createLinearRing(n._points),0===a?i=r:s.push(r);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var n=t.trim().split(IE.doubleParenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(IE.trimParens,"$1"),r.push(xE.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(r)},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("|"),n=[],r=0,i=e.length;r<i;++r)n.push(this.read(e[r]));return this.geometryFactory.createGeometryCollection(n)}},wE=function(t){this.parser=new EE(t)};wE.prototype.write=function(t){return this.parser.write(t)},wE.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var bE=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),BE=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}(bE),SE=function(){};SE.prototype.interfaces_=function(){return[]},SE.prototype.getClass=function(){return SE},SE.shouldNeverReachHere=function(){if(0===arguments.length)SE.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new BE("Should never reach here"+(null!==t?": "+t:""))}},SE.isTrue=function(){var t;if(1===arguments.length)SE.isTrue(arguments[0],null);else if(2===arguments.length&&(t=arguments[1],!arguments[0]))throw null===t?new BE:new BE(t)},SE.equals=function(){var t,e,n;if(2===arguments.length)SE.equals(t=arguments[0],e=arguments[1],null);else if(3===arguments.length&&(t=arguments[0],n=arguments[2],!(e=arguments[1]).equals(t)))throw new BE("Expected "+t+" but encountered "+e+(null!==n?": "+n:""))};var ME=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 KI,this._intPt[1]=new KI,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},LE={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};ME.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},ME.prototype.getTopologySummary=function(){var t=new sE;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},ME.prototype.computeIntersection=function(t,e,n,r){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=n,this._inputLines[1][1]=r,this._result=this.computeIntersect(t,e,n,r)},ME.prototype.getIntersectionNum=function(){return this._result},ME.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)}},ME.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},ME.prototype.setPrecisionModel=function(t){this._precisionModel=t},ME.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],n=0;n<this._result;n++)if(!t._intPt[n].equals2D(t._inputLines[e][0])&&!t._intPt[n].equals2D(t._inputLines[e][1]))return!0;return!1}},ME.prototype.getIntersection=function(t){return this._intPt[t]},ME.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},ME.prototype.hasIntersection=function(){return this._result!==ME.NO_INTERSECTION},ME.prototype.getEdgeDistance=function(t,e){return ME.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},ME.prototype.isCollinear=function(){return this._result===ME.COLLINEAR_INTERSECTION},ME.prototype.toString=function(){return wE.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+wE.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},ME.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},ME.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},ME.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},ME.prototype.interfaces_=function(){return[]},ME.prototype.getClass=function(){return ME},ME.computeEdgeDistance=function(t,e,n){var r=Math.abs(n.x-e.x),i=Math.abs(n.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(n))o=r>i?r:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=r>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return SE.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},ME.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,o=Math.sqrt(r*r+i*i);return SE.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},LE.DONT_INTERSECT.get=function(){return 0},LE.DO_INTERSECT.get=function(){return 1},LE.COLLINEAR.get=function(){return 2},LE.NO_INTERSECTION.get=function(){return 0},LE.POINT_INTERSECTION.get=function(){return 1},LE.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(ME,LE);var NE=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 mE(this._inputLines[0][0],this._inputLines[0][1]),n=new mE(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&n.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],n=arguments[1],r=arguments[2];if(this._isProper=!1,mE.intersects(n,r,e)&&0===QE.orientationIndex(n,r,e)&&0===QE.orientationIndex(r,n,e))return this._isProper=!0,(e.equals(n)||e.equals(r))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,n,r,i){i.x=this.smallestInAbsValue(t.x,e.x,n.x,r.x),i.y=this.smallestInAbsValue(t.y,e.y,n.y,r.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,n.x-=i.x,n.y-=i.y,r.x-=i.x,r.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,n,r,i){var o=null;try{o=vE.intersection(t,n,r,i)}catch(s){if(!(s instanceof dE))throw s;o=e.nearestEndpoint(t,n,r,i)}return o},e.prototype.intersection=function(t,n,r,i){var o=this.intersectionWithNormalization(t,n,r,i);return this.isInSegmentEnvelopes(o)||(o=new KI(e.nearestEndpoint(t,n,r,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,n,r){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(n)<o&&(i=n,o=Math.abs(n)),Math.abs(r)<o&&(i=r),i},e.prototype.checkDD=function(t,e,n,r,i){var o=hE.intersection(t,e,n,r),s=this.isInSegmentEnvelopes(o);yE.out.println("DD in env = "+s+" --------------------- "+o),i.distance(o)>1e-4&&yE.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,n,r){var i=new KI(t),o=new KI(e),s=new KI(n),a=new KI(r),u=new KI;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,n,r,i){var o=mE.intersects(e,n,r),s=mE.intersects(e,n,i),a=mE.intersects(r,i,e),u=mE.intersects(r,i,n);return o&&s?(this._intPt[0]=r,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&u?(this._intPt[0]=e,this._intPt[1]=n,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=r,this._intPt[1]=e,!r.equals(e)||s||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&u?(this._intPt[0]=r,this._intPt[1]=n,!r.equals(n)||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]=n,!i.equals(n)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,n,r,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=n.x<r.x?n.x:r.x,c=n.y<r.y?n.y:r.y,h=n.x>r.x?n.x:r.x,f=n.y>r.y?n.y:r.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,n.x-=i.x,n.y-=i.y,r.x-=i.x,r.y-=i.y},e.prototype.computeIntersect=function(e,n,r,i){if(this._isProper=!1,!mE.intersects(e,n,r,i))return t.NO_INTERSECTION;var o=QE.orientationIndex(e,n,r),s=QE.orientationIndex(e,n,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=QE.orientationIndex(r,i,e),u=QE.orientationIndex(r,i,n);return a>0&&u>0||a<0&&u<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===u?this.computeCollinearIntersection(e,n,r,i):(0===o||0===s||0===a||0===u?(this._isProper=!1,e.equals2D(r)||e.equals2D(i)?this._intPt[0]=e:n.equals2D(r)||n.equals2D(i)?this._intPt[0]=n:0===o?this._intPt[0]=new KI(r):0===s?this._intPt[0]=new KI(i):0===a?this._intPt[0]=new KI(e):0===u&&(this._intPt[0]=new KI(n))):(this._isProper=!0,this._intPt[0]=this.intersection(e,n,r,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,n,r){var i=t,o=QE.distancePointLine(t,n,r),s=QE.distancePointLine(e,n,r);return s<o&&(o=s,i=e),(s=QE.distancePointLine(n,t,e))<o&&(o=s,i=n),(s=QE.distancePointLine(r,t,e))<o&&(o=s,i=r),i},e}(ME),TE=function(){};TE.prototype.interfaces_=function(){return[]},TE.prototype.getClass=function(){return TE},TE.orientationIndex=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=n.x-e.x,s=n.y-e.y;return TE.signOfDet2x2(r,i,o,s)},TE.signOfDet2x2=function(t,e,n,r){var i=null,o=null,s=null;if(i=1,0===t||0===r)return 0===e||0===n?0:e>0?n>0?-i:i:n>0?i:-i;if(0===e||0===n)return r>0?t>0?i:-i:t>0?-i:i;if(e>0?r>0?e<=r||(i=-i,o=t,t=n,n=o,o=e,e=r,r=o):e<=-r?(i=-i,n=-n,r=-r):(o=t,t=-n,n=o,o=e,e=-r,r=o):r>0?-e<=r?(i=-i,t=-t,e=-e):(o=-t,t=n,n=o,o=-e,e=r,r=o):e>=r?(t=-t,e=-e,n=-n,r=-r):(i=-i,o=-t,t=-n,n=o,o=-e,e=-r,r=o),t>0){if(!(n>0))return i;if(!(t<=n))return i}else{if(n>0)return-i;if(!(t>=n))return-i;i=-i,t=-t,n=-n}for(;;){if((r-=(s=Math.floor(n/t))*e)<0)return-i;if(r>e)return i;if(t>(n-=s*t)+n){if(e<r+r)return i}else{if(e>r+r)return-i;n=t-n,r=e-r,i=-i}if(0===r)return 0===n?0:-i;if(0===n)return i;if((e-=(s=Math.floor(t/n))*r)<0)return i;if(e>r)return-i;if(n>(t-=s*n)+t){if(r<e+e)return-i}else{if(r>e+e)return i;t=n-t,e=r-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var RE=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};RE.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 n=t.x,r=e.x;return n>r&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(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=TE.signOfDet2x2(i,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a<o&&(u=-u),u>0&&this._crossingCount++}},RE.prototype.isPointInPolygon=function(){return this.getLocation()!==eE.EXTERIOR},RE.prototype.getLocation=function(){return this._isPointOnSegment?eE.BOUNDARY:this._crossingCount%2==1?eE.INTERIOR:eE.EXTERIOR},RE.prototype.isOnSegment=function(){return this._isPointOnSegment},RE.prototype.interfaces_=function(){return[]},RE.prototype.getClass=function(){return RE},RE.locatePointInRing=function(){if(arguments[0]instanceof KI&&rE(arguments[1],pE)){for(var t=arguments[1],e=new RE(arguments[0]),n=new KI,r=new KI,i=1;i<t.size();i++)if(t.getCoordinate(i,n),t.getCoordinate(i-1,r),e.countSegment(n,r),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof KI&&arguments[1]instanceof Array){for(var o=arguments[1],s=new RE(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 QE=function(){},DE={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};QE.prototype.interfaces_=function(){return[]},QE.prototype.getClass=function(){return QE},QE.orientationIndex=function(t,e,n){return hE.orientationIndex(t,e,n)},QE.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,n=t[0].x,r=1;r<t.length-1;r++){var i=t[r].x-n,o=t[r+1].y;e+=i*(t[r-1].y-o)}return e/2}if(rE(arguments[0],pE)){var s=arguments[0],a=s.size();if(a<3)return 0;var u=new KI,l=new KI,c=new KI;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}},QE.distanceLineLine=function(t,e,n,r){if(t.equals(e))return QE.distancePointLine(t,n,r);if(n.equals(r))return QE.distancePointLine(r,t,e);var i=!1;if(mE.intersects(t,e,n,r)){var o=(e.x-t.x)*(r.y-n.y)-(e.y-t.y)*(r.x-n.x);if(0===o)i=!0;else{var s=(t.y-n.y)*(r.x-n.x)-(t.x-n.x)*(r.y-n.y),a=((t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y))/o,u=s/o;(u<0||u>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?iE.min(QE.distancePointLine(t,n,r),QE.distancePointLine(e,n,r),QE.distancePointLine(n,t,e),QE.distancePointLine(r,t,e)):0},QE.isPointInRing=function(t,e){return QE.locatePointInRing(t,e)!==eE.EXTERIOR},QE.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new KI;t.getCoordinate(0,r);for(var i=r.x,o=r.y,s=1;s<e;s++){t.getCoordinate(s,r);var a=r.x,u=r.y,l=a-i,c=u-o;n+=Math.sqrt(l*l+c*c),i=a,o=u}return n},QE.isCCW=function(t){var e=t.length-1;if(e<3)throw new zI("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=t[0],r=0,i=1;i<=e;i++){var o=t[i];o.y>n.y&&(n=o,r=i)}var s=r;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(n)&&s!==r);var a=r;do{a=(a+1)%e}while(t[a].equals2D(n)&&a!==r);var u=t[s],l=t[a];if(u.equals2D(n)||l.equals2D(n)||u.equals2D(l))return!1;var c=QE.computeOrientation(u,n,l),h=!1;return h=0===c?u.x>l.x:c>0,h},QE.locatePointInRing=function(t,e){return RE.locatePointInRing(t,e)},QE.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)},QE.computeOrientation=function(t,e,n){return QE.orientationIndex(t,e,n)},QE.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new zI("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r<e.length-1;r++){var i=QE.distancePointLine(t,e[r],e[r+1]);i<n&&(n=i)}return n}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)}},QE.isOnLine=function(t,e){for(var n=new NE,r=1;r<e.length;r++){var i=e[r-1],o=e[r];if(n.computeIntersection(t,i,o),n.hasIntersection())return!0}return!1},DE.CLOCKWISE.get=function(){return-1},DE.RIGHT.get=function(){return QE.CLOCKWISE},DE.COUNTERCLOCKWISE.get=function(){return 1},DE.LEFT.get=function(){return QE.COUNTERCLOCKWISE},DE.COLLINEAR.get=function(){return 0},DE.STRAIGHT.get=function(){return QE.COLLINEAR},Object.defineProperties(QE,DE);var PE=function(){};PE.prototype.filter=function(t){},PE.prototype.interfaces_=function(){return[]},PE.prototype.getClass=function(){return PE};var kE=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},OE={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}};kE.prototype.isGeometryCollection=function(){return this.getSortIndex()===kE.SORTINDEX_GEOMETRYCOLLECTION},kE.prototype.getFactory=function(){return this._factory},kE.prototype.getGeometryN=function(t){return this},kE.prototype.getArea=function(){return 0},kE.prototype.isRectangle=function(){return!1},kE.prototype.equals=function(){if(arguments[0]instanceof kE){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof kE))return!1;var n=e;return this.equalsExact(n)}},kE.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},kE.prototype.geometryChanged=function(){this.apply(kE.geometryChangedFilter)},kE.prototype.geometryChangedAction=function(){this._envelope=null},kE.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},kE.prototype.getLength=function(){return 0},kE.prototype.getNumGeometries=function(){return 1},kE.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 n=arguments[0],r=arguments[1];return this.getSortIndex()!==n.getSortIndex()?this.getSortIndex()-n.getSortIndex():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(n,r)}},kE.prototype.getUserData=function(){return this._userData},kE.prototype.getSRID=function(){return this._SRID},kE.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},kE.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===kE.SORTINDEX_GEOMETRYCOLLECTION)throw new zI("This method does not support GeometryCollection arguments")},kE.prototype.equal=function(t,e,n){return 0===n?t.equals(e):t.distance(e)<=n},kE.prototype.norm=function(){var t=this.copy();return t.normalize(),t},kE.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},kE.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new mE(this._envelope)},kE.prototype.setSRID=function(t){this._SRID=t},kE.prototype.setUserData=function(t){this._userData=t},kE.prototype.compare=function(t,e){for(var n=t.iterator(),r=e.iterator();n.hasNext()&&r.hasNext();){var i=n.next(),o=r.next(),s=i.compareTo(o);if(0!==s)return s}return n.hasNext()?1:r.hasNext()?-1:0},kE.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},kE.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===kE.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===kE.SORTINDEX_MULTIPOINT||this.getSortIndex()===kE.SORTINDEX_MULTILINESTRING||this.getSortIndex()===kE.SORTINDEX_MULTIPOLYGON},kE.prototype.interfaces_=function(){return[XI,HI,WI]},kE.prototype.getClass=function(){return kE},kE.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},kE.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},OE.serialVersionUID.get=function(){return 0x799ea46522854c00},OE.SORTINDEX_POINT.get=function(){return 0},OE.SORTINDEX_MULTIPOINT.get=function(){return 1},OE.SORTINDEX_LINESTRING.get=function(){return 2},OE.SORTINDEX_LINEARRING.get=function(){return 3},OE.SORTINDEX_MULTILINESTRING.get=function(){return 4},OE.SORTINDEX_POLYGON.get=function(){return 5},OE.SORTINDEX_MULTIPOLYGON.get=function(){return 6},OE.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},OE.geometryChangedFilter.get=function(){return FE},Object.defineProperties(kE,OE);var FE=function(){};FE.interfaces_=function(){return[PE]},FE.filter=function(t){t.geometryChangedAction()};var GE=function(){};GE.prototype.filter=function(t){},GE.prototype.interfaces_=function(){return[]},GE.prototype.getClass=function(){return GE};var UE=function(){},qE={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}};UE.prototype.isInBoundary=function(t){},UE.prototype.interfaces_=function(){return[]},UE.prototype.getClass=function(){return UE},qE.Mod2BoundaryNodeRule.get=function(){return jE},qE.EndPointBoundaryNodeRule.get=function(){return zE},qE.MultiValentEndPointBoundaryNodeRule.get=function(){return VE},qE.MonoValentEndPointBoundaryNodeRule.get=function(){return YE},qE.MOD2_BOUNDARY_RULE.get=function(){return new jE},qE.ENDPOINT_BOUNDARY_RULE.get=function(){return new zE},qE.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new VE},qE.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new YE},qE.OGC_SFS_BOUNDARY_RULE.get=function(){return UE.MOD2_BOUNDARY_RULE},Object.defineProperties(UE,qE);var jE=function(){};jE.prototype.isInBoundary=function(t){return t%2==1},jE.prototype.interfaces_=function(){return[UE]},jE.prototype.getClass=function(){return jE};var zE=function(){};zE.prototype.isInBoundary=function(t){return t>0},zE.prototype.interfaces_=function(){return[UE]},zE.prototype.getClass=function(){return zE};var VE=function(){};VE.prototype.isInBoundary=function(t){return t>1},VE.prototype.interfaces_=function(){return[UE]},VE.prototype.getClass=function(){return VE};var YE=function(){};YE.prototype.isInBoundary=function(t){return 1===t},YE.prototype.interfaces_=function(){return[UE]},YE.prototype.getClass=function(){return YE};var HE=function(){};function XE(t){this.message=t||""}HE.prototype.add=function(){},HE.prototype.addAll=function(){},HE.prototype.isEmpty=function(){},HE.prototype.iterator=function(){},HE.prototype.size=function(){},HE.prototype.toArray=function(){},HE.prototype.remove=function(){},XE.prototype=new Error,XE.prototype.name="IndexOutOfBoundsException";var JE=function(){};JE.prototype.hasNext=function(){},JE.prototype.next=function(){},JE.prototype.remove=function(){};var WE=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}(HE);function KE(t){this.message=t||""}KE.prototype=new Error,KE.prototype.name="NoSuchElementException";var ZE=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof HE&&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,HE]},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 n=this.array_[t];return this.array_[t]=e,n},e.prototype.iterator=function(){return new $E(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new XE;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,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,n=0,r=this.array_.length;n<r;n++)if(this.array_[n]===t){this.array_.splice(n,1),e=!0;break}return e},e}(WE),$E=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 KE;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}(JE),tC=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 n=arguments[0],r=arguments[1];this.ensureCapacity(n.length),this.add(n,r)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={coordArrayType:{configurable:!0}};return n.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],n=!1,r=arguments[0].iterator();r.hasNext();)this.add(r.next(),e),n=!0;return n}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),n=0;n<this.size();n++)e.add(n,this.get(n).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){var e=this;if(1===arguments.length){var n=arguments[0];t.prototype.add.call(this,n)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var r=arguments[0],i=arguments[1];return this.add(r,i,!0),!0}if(arguments[0]instanceof KI&&"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 KI){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 KI(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(ZE),eC=function(){},nC={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};nC.ForwardComparator.get=function(){return rC},nC.BidirectionalComparator.get=function(){return iC},nC.coordArrayType.get=function(){return new Array(0).fill(null)},eC.prototype.interfaces_=function(){return[]},eC.prototype.getClass=function(){return eC},eC.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},eC.ptNotInList=function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(eC.indexOf(r,e)<0)return r}return null},eC.scroll=function(t,e){var n=eC.indexOf(e,t);if(n<0)return null;var r=new Array(t.length).fill(null);yE.arraycopy(t,n,r,0,t.length-n),yE.arraycopy(t,0,r,t.length-n,n),yE.arraycopy(r,0,t,0,t.length)},eC.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 n=0;n<t.length;n++)if(!t[n].equals(e[n]))return!1;return!0}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];if(r===i)return!0;if(null===r||null===i)return!1;if(r.length!==i.length)return!1;for(var s=0;s<r.length;s++)if(0!==o.compare(r[s],i[s]))return!1;return!0}},eC.intersection=function(t,e){for(var n=new tC,r=0;r<t.length;r++)e.intersects(t[r])&&n.add(t[r],!0);return n.toCoordinateArray()},eC.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},eC.removeRepeatedPoints=function(t){return eC.hasRepeatedPoints(t)?new tC(t,!1).toCoordinateArray():t},eC.reverse=function(t){for(var e=t.length-1,n=Math.trunc(e/2),r=0;r<=n;r++){var i=t[r];t[r]=t[e-r],t[e-r]=i}},eC.removeNull=function(t){for(var e=0,n=0;n<t.length;n++)null!==t[n]&&e++;var r=new Array(e).fill(null);if(0===e)return r;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(r[i++]=t[o]);return r},eC.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),n=0;n<t.length;n++)e[n]=new KI(t[n]);return e}if(5===arguments.length)for(var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],u=0;u<a;u++)o[s+u]=new KI(r[i+u])},eC.isEqualReversed=function(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=e[t.length-n-1];if(0!==r.compareTo(i))return!1}return!0},eC.envelope=function(t){for(var e=new mE,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e},eC.toCoordinateArray=function(t){return t.toArray(eC.coordArrayType)},eC.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},eC.indexOf=function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1},eC.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,r=t[e].compareTo(t[n]);if(0!==r)return r}return 1},eC.compare=function(t,e){for(var n=0;n<t.length&&n<e.length;){var r=t[n].compareTo(e[n]);if(0!==r)return r;n++}return n<e.length?-1:n<t.length?1:0},eC.minCoordinate=function(t){for(var e=null,n=0;n<t.length;n++)(null===e||e.compareTo(t[n])>0)&&(e=t[n]);return e},eC.extract=function(t,e,n){e=iE.clamp(e,0,t.length);var r=(n=iE.clamp(n,-1,t.length))-e+1;n<0&&(r=0),e>=t.length&&(r=0),n<e&&(r=0);var i=new Array(r).fill(null);if(0===r)return i;for(var o=0,s=e;s<=n;s++)i[o++]=t[s];return i},Object.defineProperties(eC,nC);var rC=function(){};rC.prototype.compare=function(t,e){return eC.compare(t,e)},rC.prototype.interfaces_=function(){return[JI]},rC.prototype.getClass=function(){return rC};var iC=function(){};iC.prototype.compare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(0===n.length)return 0;var i=eC.compare(n,r);return eC.isEqualReversed(n,r)?0:i},iC.prototype.OLDcompare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(0===n.length)return 0;for(var i=eC.increasingDirection(n),o=eC.increasingDirection(r),s=i>0?0:n.length-1,a=o>0?0:n.length-1,u=0;u<n.length;u++){var l=n[s].compareTo(r[a]);if(0!==l)return l;s+=i,a+=o}return 0},iC.prototype.interfaces_=function(){return[JI]},iC.prototype.getClass=function(){return iC};var oC=function(){};oC.prototype.get=function(){},oC.prototype.put=function(){},oC.prototype.size=function(){},oC.prototype.values=function(){},oC.prototype.entrySet=function(){};var sC=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}(oC);function aC(t){this.message=t||""}function uC(){}aC.prototype=new Error,aC.prototype.name="OperationNotSupported",uC.prototype=new HE,uC.prototype.contains=function(){};var lC=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof HE&&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,n=this.array_.length;e<n;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,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new cC(this)},e}(uC),cC=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 KE;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new aC},e}(JE);function hC(t){return null===t?0:t.color}function fC(t){return null===t?null:t.parent}function pC(t,e){null!==t&&(t.color=e)}function gC(t){return null===t?null:t.left}function AC(t){return null===t?null:t.right}function dC(){this.root_=null,this.size_=0}dC.prototype=new sC,dC.prototype.get=function(t){for(var e=this.root_;null!==e;){var n=t.compareTo(e.key);if(n<0)e=e.left;else{if(!(n>0))return e.value;e=e.right}}return null},dC.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 n,r,i=this.root_;do{if(n=i,(r=t.compareTo(i.key))<0)i=i.left;else{if(!(r>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:n,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return r<0?n.left=s:n.right=s,this.fixAfterInsertion(s),this.size_++,null},dC.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(fC(t)===gC(fC(fC(t)))){var n=AC(fC(fC(t)));1===hC(n)?(pC(fC(t),0),pC(n,0),pC(fC(fC(t)),1),t=fC(fC(t))):(t===AC(fC(t))&&(t=fC(t),e.rotateLeft(t)),pC(fC(t),0),pC(fC(fC(t)),1),e.rotateRight(fC(fC(t))))}else{var r=gC(fC(fC(t)));1===hC(r)?(pC(fC(t),0),pC(r,0),pC(fC(fC(t)),1),t=fC(fC(t))):(t===gC(fC(t))&&(t=fC(t),e.rotateRight(t)),pC(fC(t),0),pC(fC(fC(t)),1),e.rotateLeft(fC(fC(t))))}this.root_.color=0},dC.prototype.values=function(){var t=new ZE,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=dC.successor(e));)t.add(e.value);return t},dC.prototype.entrySet=function(){var t=new lC,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=dC.successor(e));)t.add(e);return t},dC.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}},dC.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}},dC.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},dC.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 n=t.parent,r=t;null!==n&&r===n.right;)r=n,n=n.parent;return n},dC.prototype.size=function(){return this.size_};var yC=function(){};function vC(){}function mC(){this.array_=[],arguments[0]instanceof HE&&this.addAll(arguments[0])}yC.prototype.interfaces_=function(){return[]},yC.prototype.getClass=function(){return yC},vC.prototype=new uC,mC.prototype=new vC,mC.prototype.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++){if(0===this.array_[e].compareTo(t))return!0}return!1},mC.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,n=this.array_.length;e<n;e++){if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0}return this.array_.push(t),!0},mC.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},mC.prototype.remove=function(t){throw new aC},mC.prototype.size=function(){return this.array_.length},mC.prototype.isEmpty=function(){return 0===this.array_.length},mC.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},mC.prototype.iterator=function(){return new _C(this)};var _C=function(t){this.treeSet_=t,this.position_=0};_C.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new KE;return this.treeSet_.array_[this.position_++]},_C.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},_C.prototype.remove=function(){throw new aC};var IC=function(){};IC.sort=function(){var t,e,n,r,i=arguments[0];if(1===arguments.length)r=function(t,e){return t.compareTo(e)},i.sort(r);else if(2===arguments.length)n=arguments[1],r=function(t,e){return n.compare(t,e)},i.sort(r);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]),n=arguments[3],r=function(t,e){return n.compare(t,e)},e.sort(r),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])},IC.asList=function(t){for(var e=new ZE,n=0,r=t.length;n<r;n++)e.add(t[n]);return e};var EC=function(){},CC={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}};CC.P.get=function(){return 0},CC.L.get=function(){return 1},CC.A.get=function(){return 2},CC.FALSE.get=function(){return-1},CC.TRUE.get=function(){return-2},CC.DONTCARE.get=function(){return-3},CC.SYM_FALSE.get=function(){return"F"},CC.SYM_TRUE.get=function(){return"T"},CC.SYM_DONTCARE.get=function(){return"*"},CC.SYM_P.get=function(){return"0"},CC.SYM_L.get=function(){return"1"},CC.SYM_A.get=function(){return"2"},EC.prototype.interfaces_=function(){return[]},EC.prototype.getClass=function(){return EC},EC.toDimensionSymbol=function(t){switch(t){case EC.FALSE:return EC.SYM_FALSE;case EC.TRUE:return EC.SYM_TRUE;case EC.DONTCARE:return EC.SYM_DONTCARE;case EC.P:return EC.SYM_P;case EC.L:return EC.SYM_L;case EC.A:return EC.SYM_A}throw new zI("Unknown dimension value: "+t)},EC.toDimensionValue=function(t){switch(uE.toUpperCase(t)){case EC.SYM_FALSE:return EC.FALSE;case EC.SYM_TRUE:return EC.TRUE;case EC.SYM_DONTCARE:return EC.DONTCARE;case EC.SYM_P:return EC.P;case EC.SYM_L:return EC.L;case EC.SYM_A:return EC.A}throw new zI("Unknown dimension symbol: "+t)},Object.defineProperties(EC,CC);var xC=function(){};xC.prototype.filter=function(t){},xC.prototype.interfaces_=function(){return[]},xC.prototype.getClass=function(){return xC};var wC=function(){};wC.prototype.filter=function(t,e){},wC.prototype.isDone=function(){},wC.prototype.isGeometryChanged=function(){},wC.prototype.interfaces_=function(){return[]},wC.prototype.getClass=function(){return wC};var bC=function(t){function e(e,n){if(t.call(this,n),this._geometries=e||[],t.hasNullElements(this._geometries))throw new zI("geometries must not contain null elements")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new mE,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,n=0;n<this._geometries.length;n++)for(var r=this._geometries[n].getCoordinates(),i=0;i<r.length;i++)t[++e]=r[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],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e;if(this._geometries.length!==r._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(r._geometries[i],n))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();IC.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=EC.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=EC.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),n=0;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new mC(IC.asList(this._geometries)),n=new mC(IC.asList(t._geometries));return this.compare(e,n)}if(2===arguments.length){for(var r=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,r);if(0!==c)return c;a++}return a<o?1:a<s?-1:0}},e.prototype.apply=function(){var t=this;if(rE(arguments[0],GE))for(var e=arguments[0],n=0;n<this._geometries.length;n++)t._geometries[n].apply(e);else if(rE(arguments[0],wC)){var r=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(t._geometries[i].apply(r),!r.isDone());i++);r.isGeometryChanged()&&this.geometryChanged()}else if(rE(arguments[0],xC)){var o=arguments[0];o.filter(this);for(var s=0;s<this._geometries.length;s++)t._geometries[s].apply(o)}else if(rE(arguments[0],PE)){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),SE.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var n=0;n<this._geometries.length;n++)e._geometries[n]=this._geometries[n].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].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},n.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,n),e}(kE),BC=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return kE.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?EC.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),n=0;n<this._geometries.length;n++)e[t-1-n]=this._geometries[n].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new SC(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[yC]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,n),e}(bC),SC=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=UE.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this._geom=n,this._geomFact=n.getFactory(),this._bnRule=r}};SC.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)},SC.prototype.getBoundary=function(){return this._geom instanceof FC?this.boundaryLineString(this._geom):this._geom instanceof BC?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},SC.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()])},SC.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},SC.prototype.computeBoundaryCoordinates=function(t){var e=this,n=new ZE;this._endpointMap=new dC;for(var r=0;r<t.getNumGeometries();r++){var i=t.getGeometryN(r);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)&&n.add(s.getKey())}return eC.toCoordinateArray(n)},SC.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new MC,this._endpointMap.put(t,e)),e.count++},SC.prototype.interfaces_=function(){return[]},SC.prototype.getClass=function(){return SC},SC.getBoundary=function(){return 1===arguments.length?new SC(arguments[0]).getBoundary():2===arguments.length?new SC(arguments[0],arguments[1]).getBoundary():void 0};var MC=function(){this.count=null};function LC(){}function NC(){}MC.prototype.interfaces_=function(){return[]},MC.prototype.getClass=function(){return MC};var TC=function(){};function RC(){}function QC(){}function DC(){}var PC=function(){},kC={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};PC.prototype.interfaces_=function(){return[]},PC.prototype.getClass=function(){return PC},PC.chars=function(t,e){for(var n=new Array(e).fill(null),r=0;r<e;r++)n[r]=t;return String(n)},PC.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new RC,n=new LC;return t.printStackTrace(n),e.toString()}if(2===arguments.length){var r=arguments[1],i="";new NC(PC.getStackTrace(arguments[0]));for(var o=new DC,s=0;s<r;s++)try{i+=o.readLine()+PC.NEWLINE}catch(t){if(!(t instanceof QC))throw t;SE.shouldNeverReachHere()}return i}},PC.split=function(t,e){for(var n=e.length,r=new ZE,i=""+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);r.add(s),o=(i=i.substring(o+n)).indexOf(e)}i.length>0&&r.add(i);for(var a=new Array(r.size()).fill(null),u=0;u<a.length;u++)a[u]=r.get(u);return a},PC.toString=function(){if(1===arguments.length){var t=arguments[0];return PC.SIMPLE_ORDINATE_FORMAT.format(t)}},PC.spaces=function(t){return PC.chars(" ",t)},kC.NEWLINE.get=function(){return yE.getProperty("line.separator")},kC.SIMPLE_ORDINATE_FORMAT.get=function(){return new TC},Object.defineProperties(PC,kC);var OC=function(){};OC.prototype.interfaces_=function(){return[]},OC.prototype.getClass=function(){return OC},OC.copyCoord=function(t,e,n,r){for(var i=Math.min(t.getDimension(),n.getDimension()),o=0;o<i;o++)n.setOrdinate(r,o,t.getOrdinate(e,o))},OC.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&(t.getOrdinate(0,pE.X)===t.getOrdinate(e-1,pE.X)&&t.getOrdinate(0,pE.Y)===t.getOrdinate(e-1,pE.Y))},OC.isEqual=function(t,e){var n=t.size();if(n!==e.size())return!1;for(var r=Math.min(t.getDimension(),e.getDimension()),i=0;i<n;i++)for(var o=0;o<r;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(t.getOrdinate(i,o)!==e.getOrdinate(i,o)&&(!VI.isNaN(s)||!VI.isNaN(a)))return!1}return!0},OC.extend=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();if(OC.copy(e,0,r,0,i),i>0)for(var o=i;o<n;o++)OC.copy(e,i-1,r,o,1);return r},OC.reverse=function(t){for(var e=t.size()-1,n=Math.trunc(e/2),r=0;r<=n;r++)OC.swap(t,r,e-r)},OC.swap=function(t,e,n){if(e===n)return null;for(var r=0;r<t.getDimension();r++){var i=t.getOrdinate(e,r);t.setOrdinate(e,r,t.getOrdinate(n,r)),t.setOrdinate(n,r,i)}},OC.copy=function(t,e,n,r,i){for(var o=0;o<i;o++)OC.copyCoord(t,e+o,n,r+o)},OC.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var n=t.getDimension(),r=new sE;r.append("(");for(var i=0;i<e;i++){i>0&&r.append(" ");for(var o=0;o<n;o++)o>0&&r.append(","),r.append(PC.toString(t.getOrdinate(i,o)))}return r.append(")"),r.toString()}},OC.ensureValidRing=function(t,e){var n=e.size();return 0===n?e:n<=3?OC.createClosedRing(t,e,4):e.getOrdinate(0,pE.X)===e.getOrdinate(n-1,pE.X)&&e.getOrdinate(0,pE.Y)===e.getOrdinate(n-1,pE.Y)?e:OC.createClosedRing(t,e,n+1)},OC.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();OC.copy(e,0,r,0,i);for(var o=i;o<n;o++)OC.copy(e,0,r,o,1);return r};var FC=function(t){function e(e,n){t.call(this,n),this._points=null,this.init(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new mE:this._points.expandEnvelope(new mE)},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],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e;if(this._points.size()!==r._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),r._points.getCoordinate(i),n))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 n=t._points.size()-1-e;if(!t._points.getCoordinate(e).equals(t._points.getCoordinate(n)))return t._points.getCoordinate(e).compareTo(t._points.getCoordinate(n))>0&&OC.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?EC.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 QE.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return OC.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,n=0;e<this._points.size()&&n<t._points.size();){var r=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(n));if(0!==r)return r;e++,n++}return e<this._points.size()?1:n<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(rE(arguments[0],GE))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(rE(arguments[0],wC)){var n=arguments[0];if(0===this._points.size())return null;for(var r=0;r<this._points.size()&&(n.filter(this._points,r),!n.isDone());r++);n.isGeometryChanged()&&this.geometryChanged()}else if(rE(arguments[0],xC)){arguments[0].filter(this)}else if(rE(arguments[0],PE)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return new SC(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 zI("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[yC]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,n),e}(kE),GC=function(){};GC.prototype.interfaces_=function(){return[]},GC.prototype.getClass=function(){return GC};var UC=function(t){function e(e,n){t.call(this,n),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new mE;var t=new mE;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],n=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),n))}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 EC.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(rE(arguments[0],GE)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(rE(arguments[0],wC)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else if(rE(arguments[0],xC)){arguments[0].filter(this)}else if(rE(arguments[0],PE)){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([])),SE.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[GC]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,n),e}(kE),qC=function(){};qC.prototype.interfaces_=function(){return[]},qC.prototype.getClass=function(){return qC};var jC=function(t){function e(e,n,r){if(t.call(this,r),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===n&&(n=[]),t.hasNullElements(n))throw new zI("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(n))throw new zI("shell is empty but holes are not");this._shell=e,this._holes=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={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,n=this._shell.getCoordinates(),r=0;r<n.length;r++)t[++e]=n[r];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(QE.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(QE.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(),n=0;n<5;n++){var r=t.getX(n);if(r!==e.getMinX()&&r!==e.getMaxX())return!1;var i=t.getY(n);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],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e,i=this._shell,o=r._shell;if(!i.equalsExact(o,n))return!1;if(this._holes.length!==r._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(r._holes[s],n))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);IC.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(e.isEmpty())return null;var r=new Array(e.getCoordinates().length-1).fill(null);yE.arraycopy(e.getCoordinates(),0,r,0,r.length);var i=eC.minCoordinate(e.getCoordinates());eC.scroll(r,i),yE.arraycopy(r,0,e.getCoordinates(),0,r.length),e.getCoordinates()[r.length]=r[0],QE.isCCW(e.getCoordinates())===n&&eC.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,n=t._shell;return e.compareToSameClass(n)}if(2===arguments.length){var r=arguments[1],i=arguments[0],o=this._shell,s=i._shell,a=o.compareToSameClass(s,r);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,r);if(0!==p)return p;c++}return c<u?1:c<l?-1:0}},e.prototype.apply=function(t){var e=this;if(rE(t,GE)){this._shell.apply(t);for(var n=0;n<this._holes.length;n++)e._holes[n].apply(t)}else if(rE(t,wC)){if(this._shell.apply(t),!t.isDone())for(var r=0;r<this._holes.length&&(e._holes[r].apply(t),!t.isDone());r++);t.isGeometryChanged()&&this.geometryChanged()}else if(rE(t,xC))t.filter(this);else if(rE(t,PE)){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 n=0;n<this._holes.length;n++)e._holes[n]=this._holes[n].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),n=new Array(this._holes.length).fill(null),r=0;r<n.length;r++)n[r]=this._holes[r].copy();return new e(t,n,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[qC]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,n),e}(kE),zC=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return kE.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}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 EC.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),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[GC]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,n),e}(bC),VC=function(t){function e(e,n){e instanceof KI&&n instanceof ax&&(e=n.getCoordinateSequenceFactory().create(e)),t.call(this,e,n),this.validateConstruction()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return kE.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return EC.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return OC.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new zI("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new zI("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},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(FC),YC=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return kE.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}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),n=0;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new ZE,e=0;e<this._geometries.length;e++)for(var n=this._geometries[e].getBoundary(),r=0;r<n.getNumGeometries();r++)t.add(n.getGeometryN(r));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),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[qC]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,n),e}(bC),HC=function(t){this._factory=t||null,this._isUserDataCopied=!1},XC={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};HC.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},HC.prototype.edit=function(t,e){if(null===t)return null;var n=this.editInternal(t,e);return this._isUserDataCopied&&n.setUserData(t.getUserData()),n},HC.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof bC?this.editGeometryCollection(t,e):t instanceof jC?this.editPolygon(t,e):t instanceof UC||t instanceof FC?e.edit(t,this._factory):(SE.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},HC.prototype.editGeometryCollection=function(t,e){for(var n=e.edit(t,this._factory),r=new ZE,i=0;i<n.getNumGeometries();i++){var o=this.edit(n.getGeometryN(i),e);null===o||o.isEmpty()||r.add(o)}return n.getClass()===zC?this._factory.createMultiPoint(r.toArray([])):n.getClass()===BC?this._factory.createMultiLineString(r.toArray([])):n.getClass()===YC?this._factory.createMultiPolygon(r.toArray([])):this._factory.createGeometryCollection(r.toArray([]))},HC.prototype.editPolygon=function(t,e){var n=e.edit(t,this._factory);if(null===n&&(n=this._factory.createPolygon(null)),n.isEmpty())return n;var r=this.edit(n.getExteriorRing(),e);if(null===r||r.isEmpty())return this._factory.createPolygon();for(var i=new ZE,o=0;o<n.getNumInteriorRing();o++){var s=this.edit(n.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(r,i.toArray([]))},HC.prototype.interfaces_=function(){return[]},HC.prototype.getClass=function(){return HC},HC.GeometryEditorOperation=function(){},XC.NoOpGeometryOperation.get=function(){return JC},XC.CoordinateOperation.get=function(){return WC},XC.CoordinateSequenceOperation.get=function(){return KC},Object.defineProperties(HC,XC);var JC=function(){};JC.prototype.edit=function(t,e){return t},JC.prototype.interfaces_=function(){return[HC.GeometryEditorOperation]},JC.prototype.getClass=function(){return JC};var WC=function(){};WC.prototype.edit=function(t,e){var n=this.editCoordinates(t.getCoordinates(),t);return null===n?t:t instanceof VC?e.createLinearRing(n):t instanceof FC?e.createLineString(n):t instanceof UC?n.length>0?e.createPoint(n[0]):e.createPoint():t},WC.prototype.interfaces_=function(){return[HC.GeometryEditorOperation]},WC.prototype.getClass=function(){return WC};var KC=function(){};KC.prototype.edit=function(t,e){return t instanceof VC?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof FC?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof UC?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},KC.prototype.interfaces_=function(){return[HC.GeometryEditorOperation]},KC.prototype.getClass=function(){return KC};var ZC=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 n=0;n<e;n++)t._coordinates[n]=new KI}else if(rE(arguments[0],pE)){var r=arguments[0];if(null===r)return this._coordinates=new Array(0).fill(null),null;this._dimension=r.getDimension(),this._coordinates=new Array(r.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)t._coordinates[i]=r.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 KI}},$C={serialVersionUID:{configurable:!0}};ZC.prototype.setOrdinate=function(t,e,n){switch(e){case pE.X:this._coordinates[t].x=n;break;case pE.Y:this._coordinates[t].y=n;break;case pE.Z:this._coordinates[t].z=n;break;default:throw new zI("invalid ordinateIndex")}},ZC.prototype.size=function(){return this._coordinates.length},ZC.prototype.getOrdinate=function(t,e){switch(e){case pE.X:return this._coordinates[t].x;case pE.Y:return this._coordinates[t].y;case pE.Z:return this._coordinates[t].z}return VI.NaN},ZC.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],n=arguments[1];n.x=this._coordinates[e].x,n.y=this._coordinates[e].y,n.z=this._coordinates[e].z}},ZC.prototype.getCoordinateCopy=function(t){return new KI(this._coordinates[t])},ZC.prototype.getDimension=function(){return this._dimension},ZC.prototype.getX=function(t){return this._coordinates[t].x},ZC.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 ZC(t,this._dimension)},ZC.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},ZC.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 ZC(t,this._dimension)},ZC.prototype.toString=function(){if(this._coordinates.length>0){var t=new sE(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"()"},ZC.prototype.getY=function(t){return this._coordinates[t].y},ZC.prototype.toCoordinateArray=function(){return this._coordinates},ZC.prototype.interfaces_=function(){return[pE,WI]},ZC.prototype.getClass=function(){return ZC},$C.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(ZC,$C);var tx=function(){},ex={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};tx.prototype.readResolve=function(){return tx.instance()},tx.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array)return new ZC(arguments[0]);if(rE(arguments[0],pE))return new ZC(arguments[0])}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new ZC(t):new ZC(t,e)}},tx.prototype.interfaces_=function(){return[tE,WI]},tx.prototype.getClass=function(){return tx},tx.instance=function(){return tx.instanceObject},ex.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},ex.instanceObject.get=function(){return new tx},Object.defineProperties(tx,ex);var nx=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 ZE,e=this.map_.values(),n=e.next();!n.done;)t.add(n.value),n=e.next();return t},e.prototype.entrySet=function(){var t=new lC;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(oC),rx=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 ox){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}},ix={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};rx.prototype.equals=function(t){if(!(t instanceof rx))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},rx.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new aE(n).compareTo(new aE(r))},rx.prototype.getScale=function(){return this._scale},rx.prototype.isFloating=function(){return this._modelType===rx.FLOATING||this._modelType===rx.FLOATING_SINGLE},rx.prototype.getType=function(){return this._modelType},rx.prototype.toString=function(){var t="UNKNOWN";return this._modelType===rx.FLOATING?t="Floating":this._modelType===rx.FLOATING_SINGLE?t="Floating-Single":this._modelType===rx.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},rx.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return VI.isNaN(t)||this._modelType===rx.FLOATING_SINGLE?t:this._modelType===rx.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof KI){var e=arguments[0];if(this._modelType===rx.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},rx.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===rx.FLOATING?t=16:this._modelType===rx.FLOATING_SINGLE?t=6:this._modelType===rx.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},rx.prototype.setScale=function(t){this._scale=Math.abs(t)},rx.prototype.interfaces_=function(){return[WI,HI]},rx.prototype.getClass=function(){return rx},rx.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},ix.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},ix.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(rx,ix);var ox=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},sx={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ox.prototype.readResolve=function(){return ox.nameToTypeMap.get(this._name)},ox.prototype.toString=function(){return this._name},ox.prototype.interfaces_=function(){return[WI]},ox.prototype.getClass=function(){return ox},sx.serialVersionUID.get=function(){return-552860263173159e4},sx.nameToTypeMap.get=function(){return new nx},Object.defineProperties(ox,sx),rx.Type=ox,rx.FIXED=new ox("FIXED"),rx.FLOATING=new ox("FLOATING"),rx.FLOATING_SINGLE=new ox("FLOATING SINGLE");var ax=function t(){this._precisionModel=new rx,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?rE(arguments[0],tE)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof rx&&(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]))},ux={serialVersionUID:{configurable:!0}};ax.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new KI(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new KI(t.getMinX(),t.getMinY()),new KI(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new KI(t.getMinX(),t.getMinY()),new KI(t.getMinX(),t.getMaxY()),new KI(t.getMaxX(),t.getMaxY()),new KI(t.getMaxX(),t.getMinY()),new KI(t.getMinX(),t.getMinY())]),null)},ax.prototype.createLineString=function(t){return t?t instanceof Array?new FC(this.getCoordinateSequenceFactory().create(t),this):rE(t,pE)?new FC(t,this):void 0:new FC(this.getCoordinateSequenceFactory().create([]),this)},ax.prototype.createMultiLineString=function(){return 0===arguments.length?new BC(null,this):1===arguments.length?new BC(arguments[0],this):void 0},ax.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(n=!0),o.isGeometryCollectionOrDerived()&&(r=!0)}if(null===e)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(ax.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof jC)return this.createMultiPolygon(ax.toPolygonArray(t));if(a instanceof FC)return this.createMultiLineString(ax.toLineStringArray(t));if(a instanceof UC)return this.createMultiPoint(ax.toPointArray(t));SE.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},ax.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},ax.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof KI){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(rE(arguments[0],pE))return new UC(arguments[0],this)}},ax.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},ax.prototype.createPolygon=function(){if(0===arguments.length)return new jC(null,null,this);if(1===arguments.length){if(rE(arguments[0],pE)){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 VC){var n=arguments[0];return this.createPolygon(n,null)}}else if(2===arguments.length){return new jC(arguments[0],arguments[1],this)}},ax.prototype.getSRID=function(){return this._SRID},ax.prototype.createGeometryCollection=function(){return 0===arguments.length?new bC(null,this):1===arguments.length?new bC(arguments[0],this):void 0},ax.prototype.createGeometry=function(t){return new HC(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},ax.prototype.getPrecisionModel=function(){return this._precisionModel},ax.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(rE(arguments[0],pE))return new VC(arguments[0],this)}},ax.prototype.createMultiPolygon=function(){return 0===arguments.length?new YC(null,this):1===arguments.length?new YC(arguments[0],this):void 0},ax.prototype.createMultiPoint=function(){if(0===arguments.length)return new zC(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new zC(arguments[0],this);if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(rE(arguments[0],pE)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var n=new Array(e.size()).fill(null),r=0;r<e.size();r++){var i=this.getCoordinateSequenceFactory().create(1,e.getDimension());OC.copy(e,r,i,0,1),n[r]=this.createPoint(i)}return this.createMultiPoint(n)}}},ax.prototype.interfaces_=function(){return[WI]},ax.prototype.getClass=function(){return ax},ax.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ax.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},ax.getDefaultCoordinateSequenceFactory=function(){return tx.instance()},ax.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ax.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ax.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ax.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ax.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ax.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ax.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},ux.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(ax,ux);var lx=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],cx=function(t){this.geometryFactory=t||new ax};cx.prototype.read=function(t){var e,n=(e="string"==typeof t?JSON.parse(t):t).type;if(!hx[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==lx.indexOf(n)?hx[n].apply(this,[e.coordinates]):"GeometryCollection"===n?hx[n].apply(this,[e.geometries]):hx[n].apply(this,[e])},cx.prototype.write=function(t){var e=t.getGeometryType();if(!fx[e])throw new Error("Geometry is not supported");return fx[e].apply(this,[t])};var hx={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var r=t.geometry.type;if(!hx[r])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=hx.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;n<t.features.length;++n)e.features.push(this.read(t.features[n]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(new KI(r[0],r[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new KI(t[0],t[1]),new KI(t[2],t[1]),new KI(t[2],t[3]),new KI(t[0],t[3]),new KI(t[0],t[1])])},Point:function(t){var e=new KI(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],n=0;n<t.length;++n)e.push(hx.Point.apply(this,[t[n]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=hx.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],n=0;n<t.length;++n)e.push(hx.LineString.apply(this,[t[n]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=hx.coordinates.apply(this,[t[0]]),n=this.geometryFactory.createLinearRing(e),r=[],i=1;i<t.length;++i){var o=t[i],s=hx.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);r.push(a)}return this.geometryFactory.createPolygon(n,r)},MultiPolygon:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(hx.Polygon.apply(this,[r]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(this.read(r))}return this.geometryFactory.createGeometryCollection(e)}},fx={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:fx.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=fx.Point.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],n=t.getCoordinates(),r=0;r<n.length;++r){var i=n[r];e.push(fx.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=fx.LineString.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],n=fx.LineString.apply(this,[t._shell]);e.push(n.coordinates);for(var r=0;r<t._holes.length;++r){var i=t._holes[r],o=fx.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=fx.Polygon.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=r.getGeometryType();e.push(fx[i].apply(this,[r]))}return{type:"GeometryCollection",geometries:e}}},px=function(t){this.geometryFactory=t||new ax,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new cx(this.geometryFactory)};px.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===rx.FIXED&&this.reducePrecision(e),e},px.prototype.reducePrecision=function(t){var e,n;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,n=t.points.length;e<n;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,n=t.geometries.length;e<n;e++)this.reducePrecision(t.geometries[e])};var gx=function(){this.parser=new cx(this.geometryFactory)};gx.prototype.write=function(t){return this.parser.write(t)};var Ax=function(){},dx={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function yx(t){this.message=t||""}function vx(){this.array_=[]}Ax.prototype.interfaces_=function(){return[]},Ax.prototype.getClass=function(){return Ax},Ax.opposite=function(t){return t===Ax.LEFT?Ax.RIGHT:t===Ax.RIGHT?Ax.LEFT:t},dx.ON.get=function(){return 0},dx.LEFT.get=function(){return 1},dx.RIGHT.get=function(){return 2},Object.defineProperties(Ax,dx),yx.prototype=new Error,yx.prototype.name="EmptyStackException",vx.prototype=new WE,vx.prototype.add=function(t){return this.array_.push(t),!0},vx.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},vx.prototype.push=function(t){return this.array_.push(t),t},vx.prototype.pop=function(t){if(0===this.array_.length)throw new yx;return this.array_.pop()},vx.prototype.peek=function(){if(0===this.array_.length)throw new yx;return this.array_[this.array_.length-1]},vx.prototype.empty=function(){return 0===this.array_.length},vx.prototype.isEmpty=function(){return this.empty()},vx.prototype.search=function(t){return this.array_.indexOf(t)},vx.prototype.size=function(){return this.array_.length},vx.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t};var mx=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};mx.prototype.getCoordinate=function(){return this._minCoord},mx.prototype.getRightmostSide=function(t,e){var n=this.getRightmostSideOfSegment(t,e);return n<0&&(n=this.getRightmostSideOfSegment(t,e-1)),n<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),n},mx.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();SE.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],n=t[this._minIndex+1],r=QE.computeOrientation(this._minCoord,n,e),i=!1;(e.y<this._minCoord.y&&n.y<this._minCoord.y&&r===QE.COUNTERCLOCKWISE||e.y>this._minCoord.y&&n.y>this._minCoord.y&&r===QE.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},mx.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge().getCoordinates();if(e<0||e+1>=n.length)return-1;if(n[e].y===n[e+1].y)return-1;var r=Ax.LEFT;return n[e].y<n[e+1].y&&(r=Ax.RIGHT),r},mx.prototype.getEdge=function(){return this._orientedDe},mx.prototype.checkForRightmostCoordinate=function(t){for(var e=this,n=t.getEdge().getCoordinates(),r=0;r<n.length-1;r++)(null===e._minCoord||n[r].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=r,e._minCoord=n[r])},mx.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)},mx.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}SE.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)===Ax.LEFT&&(this._orientedDe=this._minDe.getSym())},mx.prototype.interfaces_=function(){return[]},mx.prototype.getClass=function(){return mx};var _x=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new KI(r):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}(bE),Ix=function(){this.array_=[]};Ix.prototype.addLast=function(t){this.array_.push(t)},Ix.prototype.removeFirst=function(){return this.array_.shift()},Ix.prototype.isEmpty=function(){return 0===this.array_.length};var Ex=function(){this._finder=null,this._dirEdgeList=new ZE,this._nodes=new ZE,this._rightMostCoord=null,this._env=null,this._finder=new mx};Ex.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){t.next().setVisited(!1)}},Ex.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Ex.prototype.computeNodeDepth=function(t){for(var e=null,n=t.getEdges().iterator();n.hasNext();){var r=n.next();if(r.isVisited()||r.getSym().isVisited()){e=r;break}}if(null===e)throw new _x("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)}},Ex.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(Ax.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},Ex.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Ex.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(Ax.RIGHT)>=1&&e.getDepth(Ax.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},Ex.prototype.computeDepths=function(t){var e=new lC,n=new Ix,r=t.getNode();for(n.addLast(r),e.add(r),t.setVisited(!0);!n.isEmpty();){var i=n.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)||(n.addLast(a),e.add(a))}}}},Ex.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},Ex.prototype.getEnvelope=function(){if(null===this._env){for(var t=new mE,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),r=0;r<n.length-1;r++)t.expandToInclude(n[r]);this._env=t}return this._env},Ex.prototype.addReachable=function(t){var e=new vx;for(e.add(t);!e.empty();){var n=e.pop();this.add(n,e)}},Ex.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(Ax.LEFT,t.getDepth(Ax.RIGHT)),e.setDepth(Ax.RIGHT,t.getDepth(Ax.LEFT))},Ex.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var n=t.getEdges().iterator();n.hasNext();){var r=n.next();this._dirEdgeList.add(r);var i=r.getSym().getNode();i.isVisited()||e.push(i)}},Ex.prototype.getNodes=function(){return this._nodes},Ex.prototype.getDirectedEdges=function(){return this._dirEdgeList},Ex.prototype.interfaces_=function(){return[HI]},Ex.prototype.getClass=function(){return Ex};var Cx=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 n=arguments[0];this.init(1),this.location[Ax.ON]=n}else if(arguments[0]instanceof t){var r=arguments[0];if(this.init(r.location.length),null!==r)for(var i=0;i<this.location.length;i++)this.location[i]=r.location[i]}}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.init(3),this.location[Ax.ON]=o,this.location[Ax.LEFT]=s,this.location[Ax.RIGHT]=a}};Cx.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},Cx.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==eE.NONE)return!1;return!0},Cx.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===eE.NONE&&(this.location[e]=t)},Cx.prototype.isLine=function(){return 1===this.location.length},Cx.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[Ax.ON]=this.location[Ax.ON],e[Ax.LEFT]=eE.NONE,e[Ax.RIGHT]=eE.NONE,this.location=e}for(var n=0;n<this.location.length;n++)this.location[n]===eE.NONE&&n<t.location.length&&(this.location[n]=t.location[n])},Cx.prototype.getLocations=function(){return this.location},Cx.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[Ax.LEFT];this.location[Ax.LEFT]=this.location[Ax.RIGHT],this.location[Ax.RIGHT]=t},Cx.prototype.toString=function(){var t=new sE;return this.location.length>1&&t.append(eE.toLocationSymbol(this.location[Ax.LEFT])),t.append(eE.toLocationSymbol(this.location[Ax.ON])),this.location.length>1&&t.append(eE.toLocationSymbol(this.location[Ax.RIGHT])),t.toString()},Cx.prototype.setLocations=function(t,e,n){this.location[Ax.ON]=t,this.location[Ax.LEFT]=e,this.location[Ax.RIGHT]=n},Cx.prototype.get=function(t){return t<this.location.length?this.location[t]:eE.NONE},Cx.prototype.isArea=function(){return this.location.length>1},Cx.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===eE.NONE)return!0;return!1},Cx.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(Ax.ON,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.location[e]=n}},Cx.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(eE.NONE)},Cx.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},Cx.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},Cx.prototype.interfaces_=function(){return[]},Cx.prototype.getClass=function(){return Cx};var xx=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 Cx(e),this.elt[1]=new Cx(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.elt[0]=new Cx(n.elt[0]),this.elt[1]=new Cx(n.elt[1])}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.elt[0]=new Cx(eE.NONE),this.elt[1]=new Cx(eE.NONE),this.elt[r].setLocation(i)}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new Cx(o,s,a),this.elt[1]=new Cx(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 Cx(eE.NONE,eE.NONE,eE.NONE),this.elt[1]=new Cx(eE.NONE,eE.NONE,eE.NONE),this.elt[u].setLocations(l,c,h)}};xx.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},xx.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},xx.prototype.isNull=function(t){return this.elt[t].isNull()},xx.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],n=arguments[1];this.elt[e].setAllLocationsIfNull(n)}},xx.prototype.isLine=function(t){return this.elt[t].isLine()},xx.prototype.merge=function(t){for(var e=this,n=0;n<2;n++)null===e.elt[n]&&null!==t.elt[n]?e.elt[n]=new Cx(t.elt[n]):e.elt[n].merge(t.elt[n])},xx.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},xx.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(Ax.ON)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}},xx.prototype.toString=function(){var t=new sE;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()},xx.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()}},xx.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},xx.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(Ax.ON,e)}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this.elt[n].setLocation(r,i)}},xx.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},xx.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},xx.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new Cx(this.elt[t].location[0]))},xx.prototype.interfaces_=function(){return[]},xx.prototype.getClass=function(){return xx},xx.toLineLabel=function(t){for(var e=new xx(eE.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e};var wx=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new ZE,this._pts=new ZE,this._label=new xx(eE.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new ZE,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};wx.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=QE.isCCW(this._ring.getCoordinates())},wx.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},wx.prototype.computePoints=function(t){var e=this;this._startDe=t;var n=t,r=!0;do{if(null===n)throw new _x("Found null DirectedEdge");if(n.getEdgeRing()===e)throw new _x("Directed Edge visited twice during ring-building at "+n.getCoordinate());e._edges.add(n);var i=n.getLabel();SE.isTrue(i.isArea()),e.mergeLabel(i),e.addPoints(n.getEdge(),n.isForward(),r),r=!1,e.setEdgeRing(n,e),n=e.getNext(n)}while(n!==this._startDe)},wx.prototype.getLinearRing=function(){return this._ring},wx.prototype.getCoordinate=function(t){return this._pts.get(t)},wx.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var n=e.getNode().getEdges().getOutgoingDegree(t);n>t._maxNodeDegree&&(t._maxNodeDegree=n),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},wx.prototype.addPoints=function(t,e,n){var r=t.getCoordinates();if(e){var i=1;n&&(i=0);for(var o=i;o<r.length;o++)this._pts.add(r[o])}else{var s=r.length-2;n&&(s=r.length-1);for(var a=s;a>=0;a--)this._pts.add(r[a])}},wx.prototype.isHole=function(){return this._isHole},wx.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},wx.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!QE.isPointInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();){if(n.next().containsPoint(t))return!1}return!0},wx.prototype.addHole=function(t){this._holes.add(t)},wx.prototype.isShell=function(){return null===this._shell},wx.prototype.getLabel=function(){return this._label},wx.prototype.getEdges=function(){return this._edges},wx.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},wx.prototype.getShell=function(){return this._shell},wx.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],n=arguments[0].getLocation(e,Ax.RIGHT);if(n===eE.NONE)return null;if(this._label.getLocation(e)===eE.NONE)return this._label.setLocation(e,n),null}},wx.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},wx.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),n=0;n<this._holes.size();n++)e[n]=this._holes.get(n).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},wx.prototype.interfaces_=function(){return[]},wx.prototype.getClass=function(){return wx};var bx=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n)}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}(wx),Bx=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new ZE,e=this._startDe;do{if(null===e.getMinEdgeRing()){var n=new bx(e,this._geometryFactory);t.add(n)}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}(wx),Sx=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}};Sx.prototype.setVisited=function(t){this._isVisited=t},Sx.prototype.setInResult=function(t){this._isInResult=t},Sx.prototype.isCovered=function(){return this._isCovered},Sx.prototype.isCoveredSet=function(){return this._isCoveredSet},Sx.prototype.setLabel=function(t){this._label=t},Sx.prototype.getLabel=function(){return this._label},Sx.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},Sx.prototype.updateIM=function(t){SE.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},Sx.prototype.isInResult=function(){return this._isInResult},Sx.prototype.isVisited=function(){return this._isVisited},Sx.prototype.interfaces_=function(){return[]},Sx.prototype.getClass=function(){return Sx};var Mx=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],n=arguments[1];this._coord=e,this._edges=n,this._label=new xx(0,eE.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 n=eE.NONE;if(n=this._label.getLocation(e),!t.isNull(e)){var r=t.getLocation(e);n!==eE.BOUNDARY&&(n=r)}return n},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],n=arguments[1];null===this._label?this._label=new xx(e,n):this._label.setLocation(e,n)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var n=arguments[0];this.mergeLabel(n._label)}else if(arguments[0]instanceof xx)for(var r=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(r,i);t._label.getLocation(i)===eE.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=eE.NONE;null!==this._label&&(e=this._label.getLocation(t));var n=null;if(e===eE.BOUNDARY)n=eE.INTERIOR;else n=eE.BOUNDARY;this._label.setLocation(t,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Sx),Lx=function(){this.nodeMap=new dC,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};Lx.prototype.find=function(t){return this.nodeMap.get(t)},Lx.prototype.addNode=function(){if(arguments[0]instanceof KI){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 Mx){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return null===r?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}},Lx.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Lx.prototype.iterator=function(){return this.nodeMap.values().iterator()},Lx.prototype.values=function(){return this.nodeMap.values()},Lx.prototype.getBoundaryNodes=function(t){for(var e=new ZE,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===eE.BOUNDARY&&e.add(r)}return e},Lx.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},Lx.prototype.interfaces_=function(){return[]},Lx.prototype.getClass=function(){return Lx};var Nx=function(){},Tx={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Nx.prototype.interfaces_=function(){return[]},Nx.prototype.getClass=function(){return Nx},Nx.isNorthern=function(t){return t===Nx.NE||t===Nx.NW},Nx.isOpposite=function(t,e){return t!==e&&2===(t-e+4)%4},Nx.commonHalfPlane=function(t,e){if(t===e)return t;if(2===(t-e+4)%4)return-1;var n=t<e?t:e;return 0===n&&3===(t>e?t:e)?3:n},Nx.isInHalfPlane=function(t,e){return e===Nx.SE?t===Nx.SE||t===Nx.SW:t===e||t===e+1},Nx.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 zI("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Nx.NE:Nx.SE:e>=0?Nx.NW:Nx.SW}if(arguments[0]instanceof KI&&arguments[1]instanceof KI){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new zI("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?Nx.NE:Nx.SE:r.y>=n.y?Nx.NW:Nx.SW}},Tx.NE.get=function(){return 0},Tx.NW.get=function(){return 1},Tx.SW.get=function(){return 2},Tx.SE.get=function(){return 3},Object.defineProperties(Nx,Tx);var Rx=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],n=arguments[1],r=arguments[2];this._edge=e,this.init(n,r),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}};Rx.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:QE.computeOrientation(t._p0,t._p1,this._p1)},Rx.prototype.getDy=function(){return this._dy},Rx.prototype.getCoordinate=function(){return this._p0},Rx.prototype.setNode=function(t){this._node=t},Rx.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),r=n.lastIndexOf("."),i=n.substring(r+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},Rx.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},Rx.prototype.getDirectedCoordinate=function(){return this._p1},Rx.prototype.getDx=function(){return this._dx},Rx.prototype.getLabel=function(){return this._label},Rx.prototype.getEdge=function(){return this._edge},Rx.prototype.getQuadrant=function(){return this._quadrant},Rx.prototype.getNode=function(){return this._node},Rx.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),n=e.lastIndexOf(".");return" "+e.substring(n+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},Rx.prototype.computeLabel=function(t){},Rx.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=Nx.quadrant(this._dx,this._dy),SE.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},Rx.prototype.interfaces_=function(){return[HI]},Rx.prototype.getClass=function(){return Rx};var Qx=function(t){function e(){var e=arguments[0],n=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=n,n)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var r=e.getNumPoints()-1;this.init(e.getCoordinate(r),e.getCoordinate(r-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 xx(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 _x("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=this,e=!0,n=0;n<2;n++)t._label.isArea(n)&&t._label.getLocation(n,Ax.LEFT)===eE.INTERIOR&&t._label.getLocation(n,Ax.RIGHT)===eE.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[Ax.LEFT]+"/"+this._depth[Ax.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,eE.EXTERIOR),n=!this._label.isArea(1)||this._label.allPositionsEqual(1,eE.EXTERIOR);return t&&e&&n},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 n=this.getEdge().getDepthDelta();this._isForward||(n=-n);var r=1;t===Ax.LEFT&&(r=-1);var i=Ax.opposite(t),o=e+n*r;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===eE.EXTERIOR&&e===eE.INTERIOR?1:t===eE.INTERIOR&&e===eE.EXTERIOR?-1:0},e}(Rx),Dx=function(){};Dx.prototype.createNode=function(t){return new Mx(t,null)},Dx.prototype.interfaces_=function(){return[]},Dx.prototype.getClass=function(){return Dx};var Px=function(){if(this._edges=new ZE,this._nodes=null,this._edgeEndList=new ZE,0===arguments.length)this._nodes=new Lx(new Dx);else if(1===arguments.length){var t=arguments[0];this._nodes=new Lx(t)}};Px.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var n=this._edges.get(e);n.print(t),n.eiList.print(t)}},Px.prototype.find=function(t){return this._nodes.find(t)},Px.prototype.addNode=function(){if(arguments[0]instanceof Mx){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof KI){var e=arguments[0];return this._nodes.addNode(e)}},Px.prototype.getNodeIterator=function(){return this._nodes.iterator()},Px.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkResultDirectedEdges()}},Px.prototype.debugPrintln=function(t){yE.out.println(t)},Px.prototype.isBoundaryNode=function(t,e){var n=this._nodes.find(e);if(null===n)return!1;var r=n.getLabel();return null!==r&&r.getLocation(t)===eE.BOUNDARY},Px.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkAllDirectedEdges()}},Px.prototype.matchInSameDirection=function(t,e,n,r){return!!t.equals(n)&&(QE.computeOrientation(t,e,r)===QE.COLLINEAR&&Nx.quadrant(t,e)===Nx.quadrant(n,r))},Px.prototype.getEdgeEnds=function(){return this._edgeEndList},Px.prototype.debugPrint=function(t){yE.out.print(t)},Px.prototype.getEdgeIterator=function(){return this._edges.iterator()},Px.prototype.findEdgeInSameDirection=function(t,e){for(var n=this,r=0;r<this._edges.size();r++){var i=n._edges.get(r),o=i.getCoordinates();if(n.matchInSameDirection(t,e,o[0],o[1]))return i;if(n.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return i}return null},Px.prototype.insertEdge=function(t){this._edges.add(t)},Px.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},Px.prototype.addEdges=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next();e._edges.add(r);var i=new Qx(r,!0),o=new Qx(r,!1);i.setSym(o),o.setSym(i),e.add(i),e.add(o)}},Px.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},Px.prototype.getNodes=function(){return this._nodes.values()},Px.prototype.findEdge=function(t,e){for(var n=0;n<this._edges.size();n++){var r=this._edges.get(n),i=r.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return r}return null},Px.prototype.interfaces_=function(){return[]},Px.prototype.getClass=function(){return Px},Px.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();){e.next().getEdges().linkResultDirectedEdges()}};var kx=function(){this._geometryFactory=null,this._shellList=new ZE;var t=arguments[0];this._geometryFactory=t};kx.prototype.sortShellsAndHoles=function(t,e,n){for(var r=t.iterator();r.hasNext();){var i=r.next();i.isHole()?n.add(i):e.add(i)}},kx.prototype.computePolygons=function(t){for(var e=new ZE,n=t.iterator();n.hasNext();){var r=n.next().toPolygon(this._geometryFactory);e.add(r)}return e},kx.prototype.placeFreeHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(null===r.getShell()){var i=this.findEdgeRingContaining(r,t);if(null===i)throw new _x("unable to assign hole to a shell",r.getCoordinate(0));r.setShell(i)}}},kx.prototype.buildMinimalEdgeRings=function(t,e,n){for(var r=new ZE,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)):n.addAll(s)}else r.add(o)}return r},kx.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){if(e.next().containsPoint(t))return!0}return!1},kx.prototype.buildMaximalEdgeRings=function(t){for(var e=new ZE,n=t.iterator();n.hasNext();){var r=n.next();if(r.isInResult()&&r.getLabel().isArea()&&null===r.getEdgeRing()){var i=new Bx(r,this._geometryFactory);e.add(i),i.setInResult()}}return e},kx.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}},kx.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},kx.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.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(r)&&QE.isPointInRing(i,l.getCoordinates())&&(h=!0),h&&(null===o||s.contains(c))&&(o=u)}return o},kx.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return SE.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},kx.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];Px.linkResultDirectedEdges(arguments[1]);var n=this.buildMaximalEdgeRings(e),r=new ZE,i=this.buildMinimalEdgeRings(n,this._shellList,r);this.sortShellsAndHoles(i,this._shellList,r),this.placeFreeHoles(this._shellList,r)}},kx.prototype.interfaces_=function(){return[]},kx.prototype.getClass=function(){return kx};var Ox=function(){};Ox.prototype.getBounds=function(){},Ox.prototype.interfaces_=function(){return[]},Ox.prototype.getClass=function(){return Ox};var Fx=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Fx.prototype.getItem=function(){return this._item},Fx.prototype.getBounds=function(){return this._bounds},Fx.prototype.interfaces_=function(){return[Ox,WI]},Fx.prototype.getClass=function(){return Fx};var Gx=function(){this._size=null,this._items=null,this._size=0,this._items=new ZE,this._items.add(null)};Gx.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},Gx.prototype.size=function(){return this._size},Gx.prototype.reorder=function(t){for(var e=this,n=null,r=this._items.get(t);2*t<=this._size&&((n=2*t)!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(r)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,r)},Gx.prototype.clear=function(){this._size=0,this._items.clear()},Gx.prototype.isEmpty=function(){return 0===this._size},Gx.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)},Gx.prototype.interfaces_=function(){return[]},Gx.prototype.getClass=function(){return Gx};var Ux=function(){};Ux.prototype.visitItem=function(t){},Ux.prototype.interfaces_=function(){return[]},Ux.prototype.getClass=function(){return Ux};var qx=function(){};qx.prototype.insert=function(t,e){},qx.prototype.remove=function(t,e){},qx.prototype.query=function(){},qx.prototype.interfaces_=function(){return[]},qx.prototype.getClass=function(){return qx};var jx=function(){if(this._childBoundables=new ZE,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},zx={serialVersionUID:{configurable:!0}};jx.prototype.getLevel=function(){return this._level},jx.prototype.size=function(){return this._childBoundables.size()},jx.prototype.getChildBoundables=function(){return this._childBoundables},jx.prototype.addChildBoundable=function(t){SE.isTrue(null===this._bounds),this._childBoundables.add(t)},jx.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},jx.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},jx.prototype.interfaces_=function(){return[Ox,WI]},jx.prototype.getClass=function(){return jx},zx.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(jx,zx);var Vx=function(){};Vx.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},Vx.min=function(t){return Vx.sort(t),t.get(0)},Vx.sort=function(t,e){var n=t.toArray();e?IC.sort(n,e):IC.sort(n);for(var r=t.iterator(),i=0,o=n.length;i<o;i++)r.next(),r.set(n[i])},Vx.singletonList=function(t){var e=new ZE;return e.add(t),e};var Yx=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=n,this._distance=this.distance()};Yx.prototype.expandToQueue=function(t,e){var n=Yx.isComposite(this._boundable1),r=Yx.isComposite(this._boundable2);if(n&&r)return Yx.area(this._boundable1)>Yx.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new zI("neither boundable is composite")},Yx.prototype.isLeaves=function(){return!(Yx.isComposite(this._boundable1)||Yx.isComposite(this._boundable2))},Yx.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},Yx.prototype.expand=function(t,e,n,r){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new Yx(o,e,this._itemDistance);s.getDistance()<r&&n.add(s)}},Yx.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},Yx.prototype.getDistance=function(){return this._distance},Yx.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Yx.prototype.interfaces_=function(){return[HI]},Yx.prototype.getClass=function(){return Yx},Yx.area=function(t){return t.getBounds().getArea()},Yx.isComposite=function(t){return t instanceof jx};var Hx=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new ZE,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var n=arguments[0];SE.isTrue(n>1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},Xx={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Hx.prototype.getNodeCapacity=function(){return this._nodeCapacity},Hx.prototype.lastNode=function(t){return t.get(t.size()-1)},Hx.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 n=e.next();n instanceof jx?t+=this.size(n):n instanceof Fx&&(t+=1)}return t}},Hx.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Fx&&i.getItem()===e&&(n=i)}return null!==n&&(t.getChildBoundables().remove(n),!0)},Hx.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new ZE:t}if(1===arguments.length){for(var e=arguments[0],n=new ZE,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();if(i instanceof jx){var o=this.itemsTree(i);null!==o&&n.add(o)}else i instanceof Fx?n.add(i.getItem()):SE.shouldNeverReachHere()}return n.size()<=0?null:n}},Hx.prototype.insert=function(t,e){SE.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Fx(t,e))},Hx.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new ZE;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];if(SE.isTrue(n>-2),r.getLevel()===n)return i.add(r),null;for(var o=r.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof jx?this.boundablesAtLevel(n,s,i):(SE.isTrue(s instanceof Fx),-1===n&&i.add(s))}return null}},Hx.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var n=new ZE;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}if(2===arguments.length){var r=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i)}else if(3===arguments.length)if(rE(arguments[2],Ux)&&arguments[0]instanceof Object&&arguments[1]instanceof jx)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 jx?t.query(o,l,s):l instanceof Fx?s.visitItem(l.getItem()):SE.shouldNeverReachHere())}else if(rE(arguments[2],WE)&&arguments[0]instanceof Object&&arguments[1]instanceof jx)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 jx?t.query(c,g,h):g instanceof Fx?h.add(g.getItem()):SE.shouldNeverReachHere())}},Hx.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},Hx.prototype.getRoot=function(){return this.build(),this._root},Hx.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 n=arguments[0],r=arguments[1],i=arguments[2],o=this.removeItem(r,i);if(o)return!0;for(var s=null,a=r.getChildBoundables().iterator();a.hasNext();){var u=a.next();if(this.getIntersectsOp().intersects(u.getBounds(),n)&&(u instanceof jx&&(o=this.remove(n,u,i)))){s=u;break}}return null!==s&&s.getChildBoundables().isEmpty()&&r.getChildBoundables().remove(s),o}},Hx.prototype.createHigherLevels=function(t,e){SE.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return 1===n.size()?n.get(0):this.createHigherLevels(n,e+1)},Hx.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 n=e.next();if(n instanceof jx){var r=this.depth(n);r>t&&(t=r)}}return t+1}},Hx.prototype.createParentBoundables=function(t,e){var n=this;SE.isTrue(!t.isEmpty());var r=new ZE;r.add(this.createNode(e));var i=new ZE(t);Vx.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var s=o.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(e)),n.lastNode(r).addChildBoundable(s)}return r},Hx.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Hx.prototype.interfaces_=function(){return[WI]},Hx.prototype.getClass=function(){return Hx},Hx.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},Xx.IntersectsOp.get=function(){return Jx},Xx.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},Xx.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Hx,Xx);var Jx=function(){},Wx=function(){};Wx.prototype.distance=function(t,e){},Wx.prototype.interfaces_=function(){return[]},Wx.prototype.getClass=function(){return Wx};var Kx=function(t){function e(n){n=n||e.DEFAULT_NODE_CAPACITY,t.call(this,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={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){SE.isTrue(t.length>0);for(var n=new ZE,r=0;r<t.length;r++)n.addAll(this.createParentBoundablesFromVerticalSlice(t[r],e));return n},e.prototype.createNode=function(t){return new Zx(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],n=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,n)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.prototype.verticalSlices=function(t,e){for(var n=Math.trunc(Math.ceil(t.size()/e)),r=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){r[o]=new ZE;for(var s=0;i.hasNext()&&s<n;){var a=i.next();r[o].add(a),s++}}return r},e.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var n=arguments[0],r=arguments[1];t.prototype.query.call(this,n,r)}else if(3===arguments.length)if(rE(arguments[2],Ux)&&arguments[0]instanceof Object&&arguments[1]instanceof jx){var i=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,i,o,s)}else if(rE(arguments[2],WE)&&arguments[0]instanceof Object&&arguments[1]instanceof jx){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,n){return t.prototype.createParentBoundables.call(this,e,n)},e.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return t.prototype.remove.call(this,e,n)}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,n){SE.isTrue(!t.isEmpty());var r=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new ZE(t);Vx.sort(i,e.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(r))));return this.createParentBoundablesFromVerticalSlices(o,n)},e.prototype.nearestNeighbour=function(){if(1===arguments.length){if(rE(arguments[0],Wx)){var t=arguments[0],n=new Yx(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(n)}if(arguments[0]instanceof Yx){var r=arguments[0];return this.nearestNeighbour(r,VI.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof e&&rE(arguments[1],Wx)){var i=arguments[0],o=arguments[1],s=new Yx(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof Yx&&"number"==typeof arguments[1]){var a=arguments[0],u=arguments[1],l=null,c=new Gx;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 Fx(arguments[0],arguments[1]),A=new Yx(this.getRoot(),g,p);return this.nearestNeighbour(A)[0]}},e.prototype.interfaces_=function(){return[qx,WI]},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())},n.STRtreeNode.get=function(){return Zx},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[JI]},compare:function(n,r){return t.compareDoubles(e.centreX(n.getBounds()),e.centreX(r.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[JI]},compare:function(n,r){return t.compareDoubles(e.centreY(n.getBounds()),e.centreY(r.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(Hx),Zx=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 n=e.next();null===t?t=new mE(n.getBounds()):t.expandToInclude(n.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(jx),$x=function(){};$x.prototype.interfaces_=function(){return[]},$x.prototype.getClass=function(){return $x},$x.relativeSign=function(t,e){return t<e?-1:t>e?1:0},$x.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=$x.relativeSign(e.x,n.x),i=$x.relativeSign(e.y,n.y);switch(t){case 0:return $x.compareValue(r,i);case 1:return $x.compareValue(i,r);case 2:return $x.compareValue(i,-r);case 3:return $x.compareValue(-r,i);case 4:return $x.compareValue(-r,-i);case 5:return $x.compareValue(-i,-r);case 6:return $x.compareValue(-i,r);case 7:return $x.compareValue(r,-i)}return SE.shouldNeverReachHere("invalid octant value"),0},$x.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var tw=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._segString=t,this.coord=new KI(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};tw.prototype.getCoordinate=function(){return this.coord},tw.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},tw.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:$x.compare(this._segmentOctant,this.coord,e.coord)},tw.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},tw.prototype.isInterior=function(){return this._isInterior},tw.prototype.interfaces_=function(){return[HI]},tw.prototype.getClass=function(){return tw};var ew=function(){this._nodeMap=new dC,this._edge=null;var t=arguments[0];this._edge=t};ew.prototype.getSplitCoordinates=function(){var t=new tC;this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next();this.addEdgeCoordinates(n,r,t),n=r}return t.toCoordinateArray()},ew.prototype.addCollapsedNodes=function(){var t=new ZE;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var n=e.next().intValue();this.add(this._edge.getCoordinate(n),n)}},ew.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},ew.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var n=this._edge.getCoordinate(e),r=this._edge.getCoordinate(e+2);n.equals2D(r)&&t.add(new aE(e+1))}},ew.prototype.addEdgeCoordinates=function(t,e,n){var r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);n.add(new KI(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)n.add(this._edge.getCoordinate(o));i&&n.add(new KI(e.coord))},ew.prototype.iterator=function(){return this._nodeMap.values().iterator()},ew.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}},ew.prototype.findCollapseIndex=function(t,e,n){if(!t.coord.equals2D(e.coord))return!1;var r=e.segmentIndex-t.segmentIndex;return e.isInterior()||r--,1===r&&(n[0]=t.segmentIndex+1,!0)},ew.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();this.findCollapseIndex(r,i,e)&&t.add(new aE(e[0])),r=i}},ew.prototype.getEdge=function(){return this._edge},ew.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},ew.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new KI(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new KI(e.coord)),new ow(o,this._edge.getData())},ew.prototype.add=function(t,e){var n=new tw(this._edge,t,e,this._edge.getSegmentOctant(e)),r=this._nodeMap.get(n);return null!==r?(SE.isTrue(r.coord.equals2D(t),"Found equal nodes with different coordinates"),r):(this._nodeMap.put(n,n),n)},ew.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),n=t.get(0).getCoordinate(0);if(!n.equals2D(e[0]))throw new bE("bad split edge start point at "+n);var r=t.get(t.size()-1).getCoordinates(),i=r[r.length-1];if(!i.equals2D(e[e.length-1]))throw new bE("bad split edge end point at "+i)},ew.prototype.interfaces_=function(){return[]},ew.prototype.getClass=function(){return ew};var nw=function(){};nw.prototype.interfaces_=function(){return[]},nw.prototype.getClass=function(){return nw},nw.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 zI("Cannot compute the octant for point ( "+t+", "+e+" )");var n=Math.abs(t),r=Math.abs(e);return t>=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}if(arguments[0]instanceof KI&&arguments[1]instanceof KI){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new zI("Cannot compute the octant for two identical points "+i);return nw.octant(s,a)}};var rw=function(){};rw.prototype.getCoordinates=function(){},rw.prototype.size=function(){},rw.prototype.getCoordinate=function(t){},rw.prototype.isClosed=function(){},rw.prototype.setData=function(t){},rw.prototype.getData=function(){},rw.prototype.interfaces_=function(){return[]},rw.prototype.getClass=function(){return rw};var iw=function(){};iw.prototype.addIntersection=function(t,e){},iw.prototype.interfaces_=function(){return[rw]},iw.prototype.getClass=function(){return iw};var ow=function(){this._nodeList=new ew(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};ow.prototype.getCoordinates=function(){return this._pts},ow.prototype.size=function(){return this._pts.length},ow.prototype.getCoordinate=function(t){return this._pts[t]},ow.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},ow.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},ow.prototype.setData=function(t){this._data=t},ow.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:nw.octant(t,e)},ow.prototype.getData=function(){return this._data},ow.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var n=arguments[1],r=arguments[3],i=new KI(arguments[0].getIntersection(r));this.addIntersection(i,n)}},ow.prototype.toString=function(){return wE.toLineString(new ZC(this._pts))},ow.prototype.getNodeList=function(){return this._nodeList},ow.prototype.addIntersectionNode=function(t,e){var n=e,r=n+1;if(r<this._pts.length){var i=this._pts[r];t.equals2D(i)&&(n=r)}return this._nodeList.add(t,n)},ow.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},ow.prototype.interfaces_=function(){return[iw]},ow.prototype.getClass=function(){return ow},ow.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new ZE;return ow.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var n=arguments[1],r=arguments[0].iterator();r.hasNext();){r.next().getNodeList().addSplitEdges(n)}};var sw=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new KI,this.p1=new KI;else if(1===arguments.length){var t=arguments[0];this.p0=new KI(t.p0),this.p1=new KI(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];this.p0=new KI(e,n),this.p1=new KI(r,i)}},aw={serialVersionUID:{configurable:!0}};sw.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},sw.prototype.orientationIndex=function(){if(arguments[0]instanceof sw){var t=arguments[0],e=QE.orientationIndex(this.p0,this.p1,t.p0),n=QE.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof KI){var r=arguments[0];return QE.orientationIndex(this.p0,this.p1,r)}},sw.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},sw.prototype.isVertical=function(){return this.p0.x===this.p1.x},sw.prototype.equals=function(t){if(!(t instanceof sw))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},sw.prototype.intersection=function(t){var e=new NE;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},sw.prototype.project=function(){if(arguments[0]instanceof KI){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new KI(t);var e=this.projectionFactor(t),n=new KI;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}if(arguments[0]instanceof sw){var r=arguments[0],i=this.projectionFactor(r.p0),o=this.projectionFactor(r.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(r.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(r.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new sw(s,a)}},sw.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},sw.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},sw.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},sw.prototype.distancePerpendicular=function(t){return QE.distancePointLinePerpendicular(t,this.p0,this.p1)},sw.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},sw.prototype.midPoint=function(){return sw.midPoint(this.p0,this.p1)},sw.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,n=this.p1.y-this.p0.y,r=e*e+n*n;return r<=0?VI.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r},sw.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=new Array(2).fill(null),r=VI.MAX_VALUE,i=null,o=this.closestPoint(t.p0);r=o.distance(t.p0),n[0]=o,n[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<r&&(r=i,n[0]=s,n[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<r&&(r=i,n[0]=this.p0,n[1]=a);var u=t.closestPoint(this.p1);return(i=u.distance(this.p1))<r&&(r=i,n[0]=this.p1,n[1]=u),n},sw.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},sw.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},sw.prototype.getLength=function(){return this.p0.distance(this.p1)},sw.prototype.compareTo=function(t){var e=t,n=this.p0.compareTo(e.p0);return 0!==n?n:this.p1.compareTo(e.p1)},sw.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},sw.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)},sw.prototype.lineIntersection=function(t){try{return vE.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof dE))throw t}return null},sw.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},sw.prototype.pointAlongOffset=function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),r=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 KI(n-u,r+a)},sw.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],n=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=n.x,this.p1.y=n.y}},sw.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||VI.isNaN(e))&&(e=1),e},sw.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},sw.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},sw.prototype.distance=function(){if(arguments[0]instanceof sw){var t=arguments[0];return QE.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof KI){var e=arguments[0];return QE.distancePointLine(e,this.p0,this.p1)}},sw.prototype.pointAlong=function(t){var e=new KI;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},sw.prototype.hashCode=function(){var t=VI.doubleToLongBits(this.p0.x);t^=31*VI.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=VI.doubleToLongBits(this.p1.x);return n^=31*VI.doubleToLongBits(this.p1.y),e^(Math.trunc(n)^Math.trunc(n>>32))},sw.prototype.interfaces_=function(){return[HI,WI]},sw.prototype.getClass=function(){return sw},sw.midPoint=function(t,e){return new KI((t.x+e.x)/2,(t.y+e.y)/2)},aw.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(sw,aw);var uw=function(){this.tempEnv1=new mE,this.tempEnv2=new mE,this._overlapSeg1=new sw,this._overlapSeg2=new sw};uw.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],n=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(n,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},uw.prototype.interfaces_=function(){return[]},uw.prototype.getClass=function(){return uw};var lw=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],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r};lw.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},lw.prototype.computeSelect=function(t,e,n,r){var i=this._pts[e],o=this._pts[n];if(r.tempEnv1.init(i,o),n-e==1)return r.select(this,e),null;if(!t.intersects(r.tempEnv1))return null;var s=Math.trunc((e+n)/2);e<s&&this.computeSelect(t,e,s,r),s<n&&this.computeSelect(t,s,n,r)},lw.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,n=this._start;n<=this._end;n++)t[e++]=this._pts[n];return t},lw.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},lw.prototype.setId=function(t){this._id=t},lw.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},lw.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new mE(t,e)}return this._env},lw.prototype.getEndIndex=function(){return this._end},lw.prototype.getStartIndex=function(){return this._start},lw.prototype.getContext=function(){return this._context},lw.prototype.getId=function(){return this._id},lw.prototype.computeOverlapsInternal=function(t,e,n,r,i,o){var s=this._pts[t],a=this._pts[e],u=n._pts[r],l=n._pts[i];if(e-t==1&&i-r==1)return o.overlap(this,t,n,r),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((r+i)/2);t<c&&(r<h&&this.computeOverlapsInternal(t,c,n,r,h,o),h<i&&this.computeOverlapsInternal(t,c,n,h,i,o)),c<e&&(r<h&&this.computeOverlapsInternal(c,e,n,r,h,o),h<i&&this.computeOverlapsInternal(c,e,n,h,i,o))},lw.prototype.interfaces_=function(){return[]},lw.prototype.getClass=function(){return lw};var cw=function(){};cw.prototype.interfaces_=function(){return[]},cw.prototype.getClass=function(){return cw},cw.getChainStartIndices=function(t){var e=0,n=new ZE;n.add(new aE(e));do{var r=cw.findChainEnd(t,e);n.add(new aE(r)),e=r}while(e<t.length-1);return cw.toIntArray(n)},cw.findChainEnd=function(t,e){for(var n=e;n<t.length-1&&t[n].equals2D(t[n+1]);)n++;if(n>=t.length-1)return t.length-1;for(var r=Nx.quadrant(t[n],t[n+1]),i=e+1;i<t.length;){if(!t[i-1].equals2D(t[i]))if(Nx.quadrant(t[i-1],t[i])!==r)break;i++}return i-1},cw.getChains=function(){if(1===arguments.length)return cw.getChains(arguments[0],null);if(2===arguments.length){for(var t=arguments[0],e=arguments[1],n=new ZE,r=cw.getChainStartIndices(t),i=0;i<r.length-1;i++){var o=new lw(t,r[i],r[i+1],e);n.add(o)}return n}},cw.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var hw=function(){};hw.prototype.computeNodes=function(t){},hw.prototype.getNodedSubstrings=function(){},hw.prototype.interfaces_=function(){return[]},hw.prototype.getClass=function(){return hw};var fw=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};fw.prototype.setSegmentIntersector=function(t){this._segInt=t},fw.prototype.interfaces_=function(){return[hw]},fw.prototype.getClass=function(){return fw};var pw=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new ZE,this._index=new Kx,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 n={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return ow.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=this,n=cw.getChains(t.getCoordinates(),t).iterator();n.hasNext();){var r=n.next();r.setId(e._idCounter++),e._index.insert(r.getEnvelope(),r),e._monoChains.add(r)}},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 gw(this._segInt),n=this._monoChains.iterator();n.hasNext();)for(var r=n.next(),i=t._index.query(r.getEnvelope()).iterator();i.hasNext();){var o=i.next();if(o.getId()>r.getId()&&(r.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return gw},Object.defineProperties(e,n),e}(fw),gw=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],n=arguments[2],r=arguments[3],i=arguments[0].getContext(),o=n.getContext();this._si.processIntersections(i,e,o,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(uw),Aw=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 n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}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)}},dw={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}};Aw.prototype.getEndCapStyle=function(){return this._endCapStyle},Aw.prototype.isSingleSided=function(){return this._isSingleSided},Aw.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=Aw.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Aw.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Aw.JOIN_ROUND&&(this._quadrantSegments=Aw.DEFAULT_QUADRANT_SEGMENTS)},Aw.prototype.getJoinStyle=function(){return this._joinStyle},Aw.prototype.setJoinStyle=function(t){this._joinStyle=t},Aw.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},Aw.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Aw.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Aw.prototype.setEndCapStyle=function(t){this._endCapStyle=t},Aw.prototype.getMitreLimit=function(){return this._mitreLimit},Aw.prototype.setMitreLimit=function(t){this._mitreLimit=t},Aw.prototype.setSingleSided=function(t){this._isSingleSided=t},Aw.prototype.interfaces_=function(){return[]},Aw.prototype.getClass=function(){return Aw},Aw.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},dw.CAP_ROUND.get=function(){return 1},dw.CAP_FLAT.get=function(){return 2},dw.CAP_SQUARE.get=function(){return 3},dw.JOIN_ROUND.get=function(){return 1},dw.JOIN_MITRE.get=function(){return 2},dw.JOIN_BEVEL.get=function(){return 3},dw.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},dw.DEFAULT_MITRE_LIMIT.get=function(){return 5},dw.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(Aw,dw);var yw=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=QE.COUNTERCLOCKWISE,this._inputLine=t||null},vw={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};yw.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[n];return!!this.isConcave(i,o,s)&&(!!this.isShallow(i,o,s,r)&&this.isShallowSampled(i,o,t,n,r))},yw.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),r=this.findNextNonDeletedIndex(n),i=!1;r<this._inputLine.length;){var o=!1;t.isDeletable(e,n,r,t._distanceTol)&&(t._isDeleted[n]=yw.DELETE,o=!0,i=!0),e=o?r:n,n=t.findNextNonDeletedIndex(e),r=t.findNextNonDeletedIndex(n)}return i},yw.prototype.isShallowConcavity=function(t,e,n,r){return QE.computeOrientation(t,e,n)===this._angleOrientation&&QE.distancePointLine(e,t,n)<r},yw.prototype.isShallowSampled=function(t,e,n,r,i){var o=Math.trunc((r-n)/yw.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=n;s<r;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},yw.prototype.isConcave=function(t,e,n){var r=QE.computeOrientation(t,e,n)===this._angleOrientation;return r},yw.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=QE.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},yw.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===yw.DELETE;)e++;return e},yw.prototype.isShallow=function(t,e,n,r){return QE.distancePointLine(e,t,n)<r},yw.prototype.collapseLine=function(){for(var t=new tC,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==yw.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},yw.prototype.interfaces_=function(){return[]},yw.prototype.getClass=function(){return yw},yw.simplify=function(t,e){return new yw(t).simplify(e)},vw.INIT.get=function(){return 0},vw.DELETE.get=function(){return 1},vw.KEEP.get=function(){return 1},vw.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(yw,vw);var mw=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new ZE},_w={COORDINATE_ARRAY_TYPE:{configurable:!0}};mw.prototype.getCoordinates=function(){return this._ptList.toArray(mw.COORDINATE_ARRAY_TYPE)},mw.prototype.setPrecisionModel=function(t){this._precisionModel=t},mw.prototype.addPt=function(t){var e=new KI(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},mw.prototype.revere=function(){},mw.prototype.addPts=function(t,e){if(e)for(var n=0;n<t.length;n++)this.addPt(t[n]);else for(var r=t.length-1;r>=0;r--)this.addPt(t[r])},mw.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},mw.prototype.toString=function(){return(new ax).createLineString(this.getCoordinates()).toString()},mw.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new KI(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},mw.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},mw.prototype.interfaces_=function(){return[]},mw.prototype.getClass=function(){return mw},_w.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(mw,_w);var Iw=function(){},Ew={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};Iw.prototype.interfaces_=function(){return[]},Iw.prototype.getClass=function(){return Iw},Iw.toDegrees=function(t){return 180*t/Math.PI},Iw.normalize=function(t){for(;t>Math.PI;)t-=Iw.PI_TIMES_2;for(;t<=-Math.PI;)t+=Iw.PI_TIMES_2;return t},Iw.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],n=arguments[1],r=n.x-e.x,i=n.y-e.y;return Math.atan2(i,r)}},Iw.isAcute=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)>0},Iw.isObtuse=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)<0},Iw.interiorAngle=function(t,e,n){var r=Iw.angle(e,t),i=Iw.angle(e,n);return Math.abs(i-r)},Iw.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Iw.PI_TIMES_2;t>=Iw.PI_TIMES_2&&(t=0)}else{for(;t>=Iw.PI_TIMES_2;)t-=Iw.PI_TIMES_2;t<0&&(t=0)}return t},Iw.angleBetween=function(t,e,n){var r=Iw.angle(e,t),i=Iw.angle(e,n);return Iw.diff(r,i)},Iw.diff=function(t,e){var n=null;return(n=t<e?e-t:t-e)>Math.PI&&(n=2*Math.PI-n),n},Iw.toRadians=function(t){return t*Math.PI/180},Iw.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?Iw.COUNTERCLOCKWISE:n<0?Iw.CLOCKWISE:Iw.NONE},Iw.angleBetweenOriented=function(t,e,n){var r=Iw.angle(e,t),i=Iw.angle(e,n)-r;return i<=-Math.PI?i+Iw.PI_TIMES_2:i>Math.PI?i-Iw.PI_TIMES_2:i},Ew.PI_TIMES_2.get=function(){return 2*Math.PI},Ew.PI_OVER_2.get=function(){return Math.PI/2},Ew.PI_OVER_4.get=function(){return Math.PI/4},Ew.COUNTERCLOCKWISE.get=function(){return QE.COUNTERCLOCKWISE},Ew.CLOCKWISE.get=function(){return QE.CLOCKWISE},Ew.NONE.get=function(){return QE.COLLINEAR},Object.defineProperties(Iw,Ew);var Cw=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 sw,this._seg1=new sw,this._offset0=new sw,this._offset1=new sw,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new NE,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Aw.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},xw={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}};Cw.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 n=QE.computeOrientation(this._s0,this._s1,this._s2),r=n===QE.CLOCKWISE&&this._side===Ax.LEFT||n===QE.COUNTERCLOCKWISE&&this._side===Ax.RIGHT;0===n?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},Cw.prototype.addLineEndCap=function(t,e){var n=new sw(t,e),r=new sw;this.computeOffsetSegment(n,Ax.LEFT,this._distance,r);var i=new sw;this.computeOffsetSegment(n,Ax.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 Aw.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,QE.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Aw.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Aw.CAP_SQUARE:var u=new KI;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new KI(r.p1.x+u.x,r.p1.y+u.y),c=new KI(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(c)}},Cw.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Cw.prototype.addMitreJoin=function(t,e,n,r){var i=!0,o=null;try{o=vE.intersection(e.p0,e.p1,n.p0,n.p1),(r<=0?1:o.distance(t)/Math.abs(r))>this._bufParams.getMitreLimit()&&(i=!1)}catch(t){if(!(t instanceof dE))throw t;o=new KI(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())},Cw.prototype.addFilletCorner=function(t,e,n,r,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),u=n.x-t.x,l=n.y-t.y,c=Math.atan2(l,u);r===QE.CLOCKWISE?a<=c&&(a+=2*Math.PI):a>=c&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,c,r,i),this._segList.addPt(n)},Cw.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*Cw.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Aw.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Aw.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))},Cw.prototype.createSquare=function(t){this._segList.addPt(new KI(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new KI(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new KI(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new KI(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},Cw.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},Cw.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},Cw.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},Cw.prototype.initSideSegments=function(t,e,n){this._s1=t,this._s2=e,this._side=n,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,n,this._distance,this._offset1)},Cw.prototype.addLimitedMitreJoin=function(t,e,n,r){var i=this._seg0.p1,o=Iw.angle(i,this._seg0.p0),s=Iw.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=Iw.normalize(o+s),u=Iw.normalize(a+Math.PI),l=r*n,c=n-l*Math.abs(Math.sin(s)),h=i.x+l*Math.cos(u),f=i.y+l*Math.sin(u),p=new KI(h,f),g=new sw(i,p),A=g.pointAlongOffset(1,c),d=g.pointAlongOffset(1,-c);this._side===Ax.LEFT?(this._segList.addPt(A),this._segList.addPt(d)):(this._segList.addPt(d),this._segList.addPt(A))},Cw.prototype.computeOffsetSegment=function(t,e,n,r){var i=e===Ax.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*n*o/a,l=i*n*s/a;r.p0.x=t.p0.x-l,r.p0.y=t.p0.y+u,r.p1.x=t.p1.x-l,r.p1.y=t.p1.y+u},Cw.prototype.addFilletArc=function(t,e,n,r,i){var o=r===QE.CLOCKWISE?-1:1,s=Math.abs(e-n),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var u=s/a,l=0,c=new KI;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}},Cw.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*Cw.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var n=new KI((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(n);var r=new KI((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(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},Cw.prototype.createCircle=function(t){var e=new KI(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Cw.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},Cw.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new mw,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Cw.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Cw.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Aw.JOIN_BEVEL||this._bufParams.getJoinStyle()===Aw.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,QE.CLOCKWISE,this._distance))},Cw.prototype.closeRing=function(){this._segList.closeRing()},Cw.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Cw.prototype.interfaces_=function(){return[]},Cw.prototype.getClass=function(){return Cw},xw.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},xw.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},xw.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},xw.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Cw,xw);var ww=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};ww.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var n=e<0,r=Math.abs(e),i=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,n,i);var o=i.getCoordinates();return n&&eC.reverse(o),o},ww.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=yw.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],Ax.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{n.addSegments(t,!1);var a=yw.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],Ax.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment(),n.closeRing()},ww.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===Ax.RIGHT&&(r=-r);var i=yw.simplify(t,r),o=i.length-1;n.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;n.addNextSegment(i[s],a)}n.closeRing()},ww.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=yw.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],Ax.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(r[o],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var s=yw.simplify(t,-n),a=s.length-1;e.initSideSegments(s[a],s[a-1],Ax.LEFT);for(var u=a-2;u>=0;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},ww.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Aw.CAP_ROUND:e.createCircle(t);break;case Aw.CAP_SQUARE:e.createSquare(t)}},ww.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,r)}else this.computeLineBufferCurve(t,r);return r.getCoordinates()},ww.prototype.getBufferParameters=function(){return this._bufParams},ww.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},ww.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(0===n)return ww.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()},ww.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=yw.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],Ax.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{var a=yw.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],Ax.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment()},ww.prototype.getSegGen=function(t){return new Cw(this._precisionModel,this._bufParams,t)},ww.prototype.interfaces_=function(){return[]},ww.prototype.getClass=function(){return ww},ww.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new KI(t[n]);return e};var bw=function(){this._subgraphs=null,this._seg=new sw,this._cga=new QE;var t=arguments[0];this._subgraphs=t},Bw={DepthSegment:{configurable:!0}};bw.prototype.findStabbedSegments=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],n=new ZE,r=this._subgraphs.iterator();r.hasNext();){var i=r.next(),o=i.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),n)}return n}if(3===arguments.length)if(rE(arguments[2],WE)&&arguments[0]instanceof KI&&arguments[1]instanceof Qx)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||QE.computeOrientation(t._seg.p0,t._seg.p1,s)===QE.RIGHT)){var h=a.getDepth(Ax.LEFT);t._seg.p0.equals(l[c])||(h=a.getDepth(Ax.RIGHT));var f=new Sw(t._seg,h);u.add(f)}}else if(rE(arguments[2],WE)&&arguments[0]instanceof KI&&rE(arguments[1],WE))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)}},bw.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:Vx.min(e)._leftDepth},bw.prototype.interfaces_=function(){return[]},bw.prototype.getClass=function(){return bw},Bw.DepthSegment.get=function(){return Sw},Object.defineProperties(bw,Bw);var Sw=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new sw(t),this._leftDepth=e};Sw.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 n=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==n||0!==(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?n:this._upwardSeg.compareTo(e._upwardSeg)},Sw.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},Sw.prototype.toString=function(){return this._upwardSeg.toString()},Sw.prototype.interfaces_=function(){return[HI]},Sw.prototype.getClass=function(){return Sw};var Mw=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};Mw.prototype.area=function(){return Mw.area(this.p0,this.p1,this.p2)},Mw.prototype.signedArea=function(){return Mw.signedArea(this.p0,this.p1,this.p2)},Mw.prototype.interpolateZ=function(t){if(null===t)throw new zI("Supplied point is null.");return Mw.interpolateZ(t,this.p0,this.p1,this.p2)},Mw.prototype.longestSideLength=function(){return Mw.longestSideLength(this.p0,this.p1,this.p2)},Mw.prototype.isAcute=function(){return Mw.isAcute(this.p0,this.p1,this.p2)},Mw.prototype.circumcentre=function(){return Mw.circumcentre(this.p0,this.p1,this.p2)},Mw.prototype.area3D=function(){return Mw.area3D(this.p0,this.p1,this.p2)},Mw.prototype.centroid=function(){return Mw.centroid(this.p0,this.p1,this.p2)},Mw.prototype.inCentre=function(){return Mw.inCentre(this.p0,this.p1,this.p2)},Mw.prototype.interfaces_=function(){return[]},Mw.prototype.getClass=function(){return Mw},Mw.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)},Mw.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},Mw.det=function(t,e,n,r){return t*r-e*n},Mw.interpolateZ=function(t,e,n,r){var i=e.x,o=e.y,s=n.x-i,a=r.x-i,u=n.y-o,l=r.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*(n.z-e.z)+g*(r.z-e.z)},Mw.longestSideLength=function(t,e,n){var r=t.distance(e),i=e.distance(n),o=n.distance(t),s=r;return i>s&&(s=i),o>s&&(s=o),s},Mw.isAcute=function(t,e,n){return!!Iw.isAcute(t,e,n)&&(!!Iw.isAcute(e,n,t)&&!!Iw.isAcute(n,t,e))},Mw.circumcentre=function(t,e,n){var r=n.x,i=n.y,o=t.x-r,s=t.y-i,a=e.x-r,u=e.y-i,l=2*Mw.det(o,s,a,u),c=Mw.det(s,o*o+s*s,u,a*a+u*u),h=Mw.det(o,o*o+s*s,a,a*a+u*u);return new KI(r-c/l,i+h/l)},Mw.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new vE(t.x+n/2,t.y+r/2,1),o=new vE(t.x-r+n/2,t.y+n+r/2,1);return new vE(i,o)},Mw.angleBisector=function(t,e,n){var r=e.distance(t),i=r/(r+e.distance(n)),o=n.x-t.x,s=n.y-t.y;return new KI(t.x+i*o,t.y+i*s)},Mw.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=n.x-t.x,a=n.y-t.y,u=n.z-t.z,l=i*u-o*a,c=o*s-r*u,h=r*a-i*s,f=l*l+c*c+h*h,p=Math.sqrt(f)/2;return p},Mw.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new KI(r,i)},Mw.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),o=t.distance(e),s=r+i+o,a=(r*t.x+i*e.x+o*n.x)/s,u=(r*t.y+i*e.y+o*n.y)/s;return new KI(a,u)};var Lw=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new ZE;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};Lw.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,eE.EXTERIOR,eE.INTERIOR)},Lw.prototype.addPolygon=function(t){var e=this,n=this._distance,r=Ax.LEFT;this._distance<0&&(n=-this._distance,r=Ax.RIGHT);var i=t.getExteriorRing(),o=eC.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,n,r,eE.EXTERIOR,eE.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var a=t.getInteriorRingN(s),u=eC.removeRepeatedPoints(a.getCoordinates());e._distance>0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(u,n,Ax.opposite(r),eE.INTERIOR,eE.EXTERIOR)}},Lw.prototype.isTriangleErodedCompletely=function(t,e){var n=new Mw(t[0],t[1],t[2]),r=n.inCentre();return QE.distancePointLine(r,n.p0,n.p1)<Math.abs(e)},Lw.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=eC.removeRepeatedPoints(t.getCoordinates()),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,eE.EXTERIOR,eE.INTERIOR)},Lw.prototype.addCurve=function(t,e,n){if(null===t||t.length<2)return null;var r=new ow(t,new xx(0,eE.BOUNDARY,e,n));this._curveList.add(r)},Lw.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Lw.prototype.addPolygonRing=function(t,e,n,r,i){if(0===e&&t.length<VC.MINIMUM_VALID_SIZE)return null;var o=r,s=i;t.length>=VC.MINIMUM_VALID_SIZE&&QE.isCCW(t)&&(o=i,s=r,n=Ax.opposite(n));var a=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(a,o,s)},Lw.prototype.add=function(t){if(t.isEmpty())return null;t instanceof jC?this.addPolygon(t):t instanceof FC?this.addLineString(t):t instanceof UC?this.addPoint(t):(t instanceof zC||t instanceof BC||t instanceof YC||t instanceof bC)&&this.addCollection(t)},Lw.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(4===n.length)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i},Lw.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},Lw.prototype.interfaces_=function(){return[]},Lw.prototype.getClass=function(){return Lw};var Nw=function(){};Nw.prototype.locate=function(t){},Nw.prototype.interfaces_=function(){return[]},Nw.prototype.getClass=function(){return Nw};var Tw=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()};Tw.prototype.next=function(){if(this._atStart)return this._atStart=!1,Tw.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 KE;var t=this._parent.getGeometryN(this._index++);return t instanceof bC?(this._subcollectionIterator=new Tw(t),this._subcollectionIterator.next()):t},Tw.prototype.remove=function(){throw new Error(this.getClass().getName())},Tw.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)},Tw.prototype.interfaces_=function(){return[JE]},Tw.prototype.getClass=function(){return Tw},Tw.isAtomic=function(t){return!(t instanceof bC)};var Rw=function(){this._geom=null;var t=arguments[0];this._geom=t};Rw.prototype.locate=function(t){return Rw.locate(t,this._geom)},Rw.prototype.interfaces_=function(){return[Nw]},Rw.prototype.getClass=function(){return Rw},Rw.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&QE.isPointInRing(t,e.getCoordinates())},Rw.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!Rw.isPointInRing(t,n))return!1;for(var r=0;r<e.getNumInteriorRing();r++){var i=e.getInteriorRingN(r);if(Rw.isPointInRing(t,i))return!1}return!0},Rw.containsPoint=function(t,e){if(e instanceof jC)return Rw.containsPointInPolygon(t,e);if(e instanceof bC)for(var n=new Tw(e);n.hasNext();){var r=n.next();if(r!==e&&Rw.containsPoint(t,r))return!0}return!1},Rw.locate=function(t,e){return e.isEmpty()?eE.EXTERIOR:Rw.containsPoint(t,e)?eE.INTERIOR:eE.EXTERIOR};var Qw=function(){this._edgeMap=new dC,this._edgeList=null,this._ptInAreaLocation=[eE.NONE,eE.NONE]};Qw.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),n=e-1;return 0===e&&(n=this._edgeList.size()-1),this._edgeList.get(n)},Qw.prototype.propagateSideLabels=function(t){for(var e=eE.NONE,n=this.iterator();n.hasNext();){var r=n.next().getLabel();r.isArea(t)&&r.getLocation(t,Ax.LEFT)!==eE.NONE&&(e=r.getLocation(t,Ax.LEFT))}if(e===eE.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,Ax.ON)===eE.NONE&&a.setLocation(t,Ax.ON,i),a.isArea(t)){var u=a.getLocation(t,Ax.LEFT),l=a.getLocation(t,Ax.RIGHT);if(l!==eE.NONE){if(l!==i)throw new _x("side location conflict",s.getCoordinate());u===eE.NONE&&SE.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=u}else SE.isTrue(a.getLocation(t,Ax.LEFT)===eE.NONE,"found single null side"),a.setLocation(t,Ax.RIGHT,i),a.setLocation(t,Ax.LEFT,i)}}},Qw.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},Qw.prototype.print=function(t){yE.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Qw.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},Qw.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var n=e.size()-1,r=e.get(n).getLabel().getLocation(t,Ax.LEFT);SE.isTrue(r!==eE.NONE,"Found unlabelled area edge");for(var i=r,o=this.iterator();o.hasNext();){var s=o.next().getLabel();SE.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,Ax.LEFT),u=s.getLocation(t,Ax.RIGHT);if(a===u)return!1;if(u!==i)return!1;i=a}return!0},Qw.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},Qw.prototype.iterator=function(){return this.getEdges().iterator()},Qw.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new ZE(this._edgeMap.values())),this._edgeList},Qw.prototype.getLocation=function(t,e,n){return this._ptInAreaLocation[t]===eE.NONE&&(this._ptInAreaLocation[t]=Rw.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]},Qw.prototype.toString=function(){var t=new sE;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var n=e.next();t.append(n),t.append("\n")}return t.toString()},Qw.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){e.next().computeLabel(t)}},Qw.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],n=this.iterator();n.hasNext();)for(var r=n.next().getLabel(),i=0;i<2;i++)r.isLine(i)&&r.getLocation(i)===eE.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=eE.NONE;if(e[u])l=eE.EXTERIOR;else{var c=s.getCoordinate();l=this.getLocation(u,c,t)}a.setAllLocationsIfNull(u,l)}},Qw.prototype.getDegree=function(){return this._edgeMap.size()},Qw.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},Qw.prototype.interfaces_=function(){return[]},Qw.prototype.getClass=function(){return Qw};var Dw=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,n=null,r=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),r){case t._SCANNING_FOR_INCOMING:if(!s.isInResult())continue;n=s,r=t._LINKING_TO_OUTGOING;break;case t._LINKING_TO_OUTGOING:if(!o.isInResult())continue;n.setNext(o),r=t._SCANNING_FOR_INCOMING}}if(r===this._LINKING_TO_OUTGOING){if(null===e)throw new _x("no outgoing dirEdge found",this.getCoordinate());SE.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),n.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 n=t.get(0);if(1===e)return n;var r=t.get(e-1),i=n.getQuadrant(),o=r.getQuadrant();return Nx.isNorthern(i)&&Nx.isNorthern(o)?n:Nx.isNorthern(i)||Nx.isNorthern(o)?0!==n.getDy()?n:0!==r.getDy()?r:(SE.shouldNeverReachHere("found two horizontal edges incident on node"),null):r},e.prototype.print=function(t){yE.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var n=e.next();t.print("out "),n.print(t),t.println(),t.print("in "),n.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new ZE;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 n=e.next().getLabel();n.setAllLocationsIfNull(0,t.getLocation(0)),n.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,n=this._edgeList.size()-1;n>=0;n--){var r=this._edgeList.get(n),i=r.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=r}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),n=t.getDepth(Ax.LEFT),r=t.getDepth(Ax.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),n);if(this.computeDepths(0,e,i)!==r)throw new _x("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(Ax.RIGHT,s),s=u.getDepth(Ax.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,n=null,r=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===n&&s.getEdgeRing()===t&&(n=s),i){case e._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;r=a,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;r.setNextMin(s),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(SE.isTrue(null!==n,"found null for first outgoing dirEdge"),SE.isTrue(n.getEdgeRing()===t,"unable to link last incoming dirEdge"),r.setNextMin(n))},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 n=arguments[0],r=0,i=this.iterator();i.hasNext();){i.next().getEdgeRing()===n&&r++}return r}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=eE.NONE,e=this.iterator();e.hasNext();){var n=e.next(),r=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=eE.INTERIOR;break}if(r.isInResult()){t=eE.EXTERIOR;break}}}if(t===eE.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===eE.INTERIOR):(s.isInResult()&&(i=eE.EXTERIOR),a.isInResult()&&(i=eE.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new xx(eE.NONE);for(var n=this.iterator();n.hasNext();)for(var r=n.next().getEdge().getLabel(),i=0;i<2;i++){var o=r.getLocation(i);o!==eE.INTERIOR&&o!==eE.BOUNDARY||this._label.setLocation(i,eE.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Qw),Pw=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 Mx(t,new Dw)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Dx),kw=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};kw.prototype.compareTo=function(t){var e=t;return kw.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},kw.prototype.interfaces_=function(){return[HI]},kw.prototype.getClass=function(){return kw},kw.orientation=function(t){return 1===eC.increasingDirection(t)},kw.compareOriented=function(t,e,n,r){for(var i=e?1:-1,o=r?1:-1,s=e?t.length:-1,a=r?n.length:-1,u=e?0:t.length-1,l=r?0:n.length-1;;){var c=t[u].compareTo(n[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 Ow=function(){this._edges=new ZE,this._ocaMap=new dC};Ow.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var n=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var r=n.getCoordinates(),i=0;i<r.length;i++)i>0&&t.print(","),t.print(r[i].x+" "+r[i].y);t.println(")")}t.print(") ")},Ow.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Ow.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},Ow.prototype.iterator=function(){return this._edges.iterator()},Ow.prototype.getEdges=function(){return this._edges},Ow.prototype.get=function(t){return this._edges.get(t)},Ow.prototype.findEqualEdge=function(t){var e=new kw(t.getCoordinates());return this._ocaMap.get(e)},Ow.prototype.add=function(t){this._edges.add(t);var e=new kw(t.getCoordinates());this._ocaMap.put(e,t)},Ow.prototype.interfaces_=function(){return[]},Ow.prototype.getClass=function(){return Ow};var Fw=function(){};Fw.prototype.processIntersections=function(t,e,n,r){},Fw.prototype.isDone=function(){},Fw.prototype.interfaces_=function(){return[]},Fw.prototype.getClass=function(){return Fw};var Gw=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};Gw.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(Gw.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&r===i||0===r&&e===i)return!0}}return!1},Gw.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Gw.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Gw.prototype.getLineIntersector=function(){return this._li},Gw.prototype.hasProperIntersection=function(){return this._hasProper},Gw.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+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,n,r)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Gw.prototype.hasIntersection=function(){return this._hasIntersection},Gw.prototype.isDone=function(){return!1},Gw.prototype.hasInteriorIntersection=function(){return this._hasInterior},Gw.prototype.interfaces_=function(){return[Fw]},Gw.prototype.getClass=function(){return Gw},Gw.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Uw=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new KI(t),this.segmentIndex=e,this.dist=n};Uw.prototype.getSegmentIndex=function(){return this.segmentIndex},Uw.prototype.getCoordinate=function(){return this.coord},Uw.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},Uw.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},Uw.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},Uw.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Uw.prototype.getDistance=function(){return this.dist},Uw.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},Uw.prototype.interfaces_=function(){return[HI]},Uw.prototype.getClass=function(){return Uw};var qw=function(){this._nodeMap=new dC,this.edge=null;var t=arguments[0];this.edge=t};qw.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},qw.prototype.iterator=function(){return this._nodeMap.values().iterator()},qw.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}},qw.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)},qw.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new KI(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 Hw(o,new xx(this.edge._label))},qw.prototype.add=function(t,e,n){var r=new Uw(t,e,n),i=this._nodeMap.get(r);return null!==i?i:(this._nodeMap.put(r,r),r)},qw.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){if(e.next().coord.equals(t))return!0}return!1},qw.prototype.interfaces_=function(){return[]},qw.prototype.getClass=function(){return qw};var jw=function(){};jw.prototype.getChainStartIndices=function(t){var e=0,n=new ZE;n.add(new aE(e));do{var r=this.findChainEnd(t,e);n.add(new aE(r)),e=r}while(e<t.length-1);return jw.toIntArray(n)},jw.prototype.findChainEnd=function(t,e){for(var n=Nx.quadrant(t[e],t[e+1]),r=e+1;r<t.length;){if(Nx.quadrant(t[r-1],t[r])!==n)break;r++}return r-1},jw.prototype.interfaces_=function(){return[]},jw.prototype.getClass=function(){return jw},jw.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var zw=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new mE,this.env2=new mE;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new jw;this.startIndex=e.getChainStartIndices(this.pts)};zw.prototype.getCoordinates=function(){return this.pts},zw.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e>n?e:n},zw.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e<n?e:n},zw.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],r)}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))}},zw.prototype.getStartIndexes=function(){return this.startIndex},zw.prototype.computeIntersects=function(t,e){for(var n=0;n<this.startIndex.length-1;n++)for(var r=0;r<t.startIndex.length-1;r++)this.computeIntersectsForChain(n,t,r,e)},zw.prototype.interfaces_=function(){return[]},zw.prototype.getClass=function(){return zw};var Vw=function t(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var e=0;e<2;e++)for(var n=0;n<3;n++)this._depth[e][n]=t.NULL_VALUE},Yw={NULL_VALUE:{configurable:!0}};Vw.prototype.getDepth=function(t,e){return this._depth[t][e]},Vw.prototype.setDepth=function(t,e,n){this._depth[t][e]=n},Vw.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]!==Vw.NULL_VALUE)return!1;return!0}if(1===arguments.length){var n=arguments[0];return this._depth[n][1]===Vw.NULL_VALUE}if(2===arguments.length){var r=arguments[0],i=arguments[1];return this._depth[r][i]===Vw.NULL_VALUE}},Vw.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var n=t._depth[e][1];t._depth[e][2]<n&&(n=t._depth[e][2]),n<0&&(n=0);for(var r=1;r<3;r++){var i=0;t._depth[e][r]>n&&(i=1),t._depth[e][r]=i}}},Vw.prototype.getDelta=function(t){return this._depth[t][Ax.RIGHT]-this._depth[t][Ax.LEFT]},Vw.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?eE.EXTERIOR:eE.INTERIOR},Vw.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Vw.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=e.getLocation(n,r);i!==eE.EXTERIOR&&i!==eE.INTERIOR||(t.isNull(n,r)?t._depth[n][r]=Vw.depthAtLocation(i):t._depth[n][r]+=Vw.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],s=arguments[1];arguments[2]===eE.INTERIOR&&this._depth[o][s]++}},Vw.prototype.interfaces_=function(){return[]},Vw.prototype.getClass=function(){return Vw},Vw.depthAtLocation=function(t){return t===eE.EXTERIOR?0:t===eE.INTERIOR?1:Vw.NULL_VALUE},Yw.NULL_VALUE.get=function(){return-1},Object.defineProperties(Vw,Yw);var Hw=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new qw(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Vw,this._depthDelta=0,1===arguments.length){var n=arguments[0];e.call(this,n,null)}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.pts=r,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,xx.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 n=t;if(this.pts.length!==n.pts.length)return!1;for(var r=!0,i=!0,o=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(n.pts[s])||(r=!1),this.pts[s].equals2D(n.pts[--o])||(i=!1),!r&&!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 zw(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new mE;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,n,r){var i=new KI(t.getIntersection(r)),o=e,s=t.getEdgeDistance(n,r),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 sE;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,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},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],n=arguments[1];n.setAtLeastIfValid(e.getLocation(0,Ax.ON),e.getLocation(1,Ax.ON),1),e.isArea()&&(n.setAtLeastIfValid(e.getLocation(0,Ax.LEFT),e.getLocation(1,Ax.LEFT),2),n.setAtLeastIfValid(e.getLocation(0,Ax.RIGHT),e.getLocation(1,Ax.RIGHT),2))},e}(Sx),Xw=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Ow,this._bufParams=t||null};Xw.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},Xw.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new xx(t.getLabel())).flip(),n.merge(r);var i=Xw.depthDelta(r),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(Xw.depthDelta(t.getLabel()))},Xw.prototype.buildSubgraphs=function(t,e){for(var n=new ZE,r=t.iterator();r.hasNext();){var i=r.next(),o=i.getRightmostCoordinate(),s=new bw(n).getDepth(o);i.computeDepth(s),i.findResultEdges(),n.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},Xw.prototype.createSubgraphs=function(t){for(var e=new ZE,n=t.getNodes().iterator();n.hasNext();){var r=n.next();if(!r.isVisited()){var i=new Ex;i.create(r),e.add(i)}}return Vx.sort(e,Vx.reverseOrder()),e},Xw.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Xw.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new pw,n=new NE;return n.setPrecisionModel(t),e.setSegmentIntersector(new Gw(n)),e},Xw.prototype.buffer=function(t,e){var n=this._workingPrecisionModel;null===n&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var r=new ww(n,this._bufParams),i=new Lw(t,e,r).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,n),this._graph=new Px(new Pw),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new kx(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},Xw.prototype.computeNodedEdges=function(t,e){var n=this.getNoder(e);n.computeNodes(t);for(var r=n.getNodedSubstrings().iterator();r.hasNext();){var i=r.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=i.getData(),a=new Hw(i.getCoordinates(),new xx(s));this.insertUniqueEdge(a)}}},Xw.prototype.setNoder=function(t){this._workingNoder=t},Xw.prototype.interfaces_=function(){return[]},Xw.prototype.getClass=function(){return Xw},Xw.depthDelta=function(t){var e=t.getLocation(0,Ax.LEFT),n=t.getLocation(0,Ax.RIGHT);return e===eE.INTERIOR&&n===eE.EXTERIOR?1:e===eE.EXTERIOR&&n===eE.INTERIOR?-1:0},Xw.convertSegStrings=function(t){for(var e=new ax,n=new ZE;t.hasNext();){var r=t.next(),i=e.createLineString(r.getCoordinates());n.add(i)}return e.buildGeometry(n)};var Jw=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 n=arguments[0],r=arguments[1],i=arguments[2],o=arguments[3];this._noder=n,this._scaleFactor=r,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};Jw.prototype.rescale=function(){var t=this;if(rE(arguments[0],HE))for(var e=arguments[0].iterator();e.hasNext();){var n=e.next();t.rescale(n.getCoordinates())}else if(arguments[0]instanceof Array){for(var r=arguments[0],i=0;i<r.length;i++)r[i].x=r[i].x/t._scaleFactor+t._offsetX,r[i].y=r[i].y/t._scaleFactor+t._offsetY;2===r.length&&r[0].equals2D(r[1])&&yE.out.println(r)}},Jw.prototype.scale=function(){var t=this;if(rE(arguments[0],HE)){for(var e=arguments[0],n=new ZE,r=e.iterator();r.hasNext();){var i=r.next();n.add(new ow(t.scale(i.getCoordinates()),i.getData()))}return n}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 KI(Math.round((o[a].x-t._offsetX)*t._scaleFactor),Math.round((o[a].y-t._offsetY)*t._scaleFactor),o[a].z);return eC.removeRepeatedPoints(s)}},Jw.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},Jw.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},Jw.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},Jw.prototype.interfaces_=function(){return[hw]},Jw.prototype.getClass=function(){return Jw};var Ww=function(){this._li=new NE,this._segStrings=null;var t=arguments[0];this._segStrings=t},Kw={fact:{configurable:!0}};Ww.prototype.checkEndPtVertexIntersections=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();){var n=e.next().getCoordinates();t.checkEndPtVertexIntersections(n[0],t._segStrings),t.checkEndPtVertexIntersections(n[n.length-1],t._segStrings)}else if(2===arguments.length)for(var r=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(r))throw new bE("found endpt/interior pt intersection at index "+s+" :pt "+r)},Ww.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),n=this._segStrings.iterator();n.hasNext();){var r=n.next();this.checkInteriorIntersections(e,r)}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 bE("found non-noded intersection at "+g+"-"+A+" and "+d+"-"+y)}},Ww.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},Ww.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 n=arguments[0].getCoordinates(),r=0;r<n.length-2;r++)this.checkCollapse(n[r],n[r+1],n[r+2])},Ww.prototype.hasInteriorIntersection=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++){var i=t.getIntersection(r);if(!i.equals(e)&&!i.equals(n))return!0}return!1},Ww.prototype.checkCollapse=function(t,e,n){if(t.equals(n))throw new bE("found non-noded collapse at "+Ww.fact.createLineString([t,e,n]))},Ww.prototype.interfaces_=function(){return[]},Ww.prototype.getClass=function(){return Ww},Kw.fact.get=function(){return new ax},Object.defineProperties(Ww,Kw);var Zw=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],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new zI("Scale factor must be non-zero");1!==e&&(this._pt=new KI(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new KI,this._p1Scaled=new KI),this.initCorners(this._pt)},$w={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Zw.prototype.intersectsScaled=function(t,e){var n=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<n||this._minx>r||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return SE.isTrue(!(s&&a),"Found bad envelope test"),a},Zw.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 KI(this._maxx,this._maxy),this._corner[1]=new KI(this._minx,this._maxy),this._corner[2]=new KI(this._minx,this._miny),this._corner[3]=new KI(this._maxx,this._miny)},Zw.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))},Zw.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},Zw.prototype.getCoordinate=function(){return this._originalPt},Zw.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},Zw.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=Zw.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new mE(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},Zw.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())))},Zw.prototype.intersectsToleranceSquare=function(t,e){var n=!1,r=!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()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||(!(!n||!r)||(!!t.equals(this._pt)||!!e.equals(this._pt))))))},Zw.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return!!this.intersects(n,r)&&(t.addIntersection(this.getCoordinate(),e),!0)},Zw.prototype.interfaces_=function(){return[]},Zw.prototype.getClass=function(){return Zw},$w.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(Zw,$w);var tb=function(){this.tempEnv1=new mE,this.selectedSegment=new sw};tb.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)}},tb.prototype.interfaces_=function(){return[]},tb.prototype.getClass=function(){return tb};var eb=function(){this._index=null;var t=arguments[0];this._index=t},nb={HotPixelSnapAction:{configurable:!0}};eb.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],n=arguments[1],r=arguments[2],i=e.getSafeEnvelope(),o=new rb(e,n,r);return this._index.query(i,{interfaces_:function(){return[Ux]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},eb.prototype.interfaces_=function(){return[]},eb.prototype.getClass=function(){return eb},nb.HotPixelSnapAction.get=function(){return rb},Object.defineProperties(eb,nb);var rb=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._hotPixel=e,this._parentEdge=n,this._hotPixelVertexIndex=r}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],n=arguments[0].getContext();if(null!==this._parentEdge&&n===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(n,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(tb),ib=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new ZE};ib.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+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),n.addIntersections(this._li,r,1)}},ib.prototype.isDone=function(){return!1},ib.prototype.getInteriorIntersections=function(){return this._interiorIntersections},ib.prototype.interfaces_=function(){return[Fw]},ib.prototype.getClass=function(){return ib};var ob=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 NE,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};ob.prototype.checkCorrectness=function(t){var e=ow.getNodedSubstrings(t),n=new Ww(e);try{n.checkValid()}catch(t){if(!(t instanceof AE))throw t;t.printStackTrace()}},ob.prototype.getNodedSubstrings=function(){return ow.getNodedSubstrings(this._nodedSegStrings)},ob.prototype.snapRound=function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},ob.prototype.findInteriorIntersections=function(t,e){var n=new ib(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()},ob.prototype.computeVertexSnaps=function(){var t=this;if(rE(arguments[0],HE))for(var e=arguments[0].iterator();e.hasNext();){var n=e.next();t.computeVertexSnaps(n)}else if(arguments[0]instanceof ow)for(var r=arguments[0],i=r.getCoordinates(),o=0;o<i.length;o++){var s=new Zw(i[o],t._scaleFactor,t._li);t._pointSnapper.snap(s,r,o)&&r.addIntersection(i[o],o)}},ob.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new pw,this._pointSnapper=new eb(this._noder.getIndex()),this.snapRound(t,this._li)},ob.prototype.computeIntersectionSnaps=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next(),i=new Zw(r,e._scaleFactor,e._li);e._pointSnapper.snap(i)}},ob.prototype.interfaces_=function(){return[hw]},ob.prototype.getClass=function(){return ob};var sb=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Aw,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],n=arguments[1];this._argGeom=e,this._bufParams=n}},ab={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};sb.prototype.bufferFixedPrecision=function(t){var e=new Jw(new ob(new rx(1)),t.getScale()),n=new Xw(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},sb.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=sb.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof _x))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var n=arguments[0],r=sb.precisionScaleFactor(this._argGeom,this._distance,n),i=new rx(r);this.bufferFixedPrecision(i)}},sb.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===rx.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},sb.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},sb.prototype.bufferOriginalPrecision=function(){try{var t=new Xw(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof bE))throw t;this._saveException=t}},sb.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},sb.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},sb.prototype.interfaces_=function(){return[]},sb.prototype.getClass=function(){return sb},sb.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new sb(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof kE&&"number"==typeof arguments[1]){var e=arguments[1],n=arguments[2],r=new sb(arguments[0]);return r.setQuadrantSegments(n),r.getResultGeometry(e)}if(arguments[2]instanceof Aw&&arguments[0]instanceof kE&&"number"==typeof arguments[1]){var i=arguments[1];return new sb(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],s=arguments[2],a=arguments[3],u=new sb(arguments[0]);return u.setQuadrantSegments(s),u.setEndCapStyle(a),u.getResultGeometry(o)}},sb.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=iE.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY()))+2*(e>0?e:0),o=n-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},ab.CAP_ROUND.get=function(){return Aw.CAP_ROUND},ab.CAP_BUTT.get=function(){return Aw.CAP_FLAT},ab.CAP_FLAT.get=function(){return Aw.CAP_FLAT},ab.CAP_SQUARE.get=function(){return Aw.CAP_SQUARE},ab.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(sb,ab);var ub=function(){this._pt=[new KI,new KI],this._distance=VI.NaN,this._isNull=!0};ub.prototype.getCoordinates=function(){return this._pt},ub.prototype.getCoordinate=function(t){return this._pt[t]},ub.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],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},ub.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 n=arguments[0],r=arguments[1],i=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1}},ub.prototype.getDistance=function(){return this._distance},ub.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],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},ub.prototype.interfaces_=function(){return[]},ub.prototype.getClass=function(){return ub};var lb=function(){};lb.prototype.interfaces_=function(){return[]},lb.prototype.getClass=function(){return lb},lb.computeDistance=function(){if(arguments[2]instanceof ub&&arguments[0]instanceof FC&&arguments[1]instanceof KI)for(var t=arguments[1],e=arguments[2],n=arguments[0].getCoordinates(),r=new sw,i=0;i<n.length-1;i++){r.setCoordinates(n[i],n[i+1]);var o=r.closestPoint(t);e.setMinimum(o,t)}else if(arguments[2]instanceof ub&&arguments[0]instanceof jC&&arguments[1]instanceof KI){var s=arguments[0],a=arguments[1],u=arguments[2];lb.computeDistance(s.getExteriorRing(),a,u);for(var l=0;l<s.getNumInteriorRing();l++)lb.computeDistance(s.getInteriorRingN(l),a,u)}else if(arguments[2]instanceof ub&&arguments[0]instanceof kE&&arguments[1]instanceof KI){var c=arguments[0],h=arguments[1],f=arguments[2];if(c instanceof FC)lb.computeDistance(c,h,f);else if(c instanceof jC)lb.computeDistance(c,h,f);else if(c instanceof bC)for(var p=c,g=0;g<p.getNumGeometries();g++){var A=p.getGeometryN(g);lb.computeDistance(A,h,f)}else f.setMinimum(c.getCoordinate(),h)}else if(arguments[2]instanceof ub&&arguments[0]instanceof sw&&arguments[1]instanceof KI){var d=arguments[1],y=arguments[2],v=arguments[0].closestPoint(d);y.setMinimum(v,d)}};var cb=function(t){this._maxPtDist=new ub,this._inputGeom=t||null},hb={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};cb.prototype.computeMaxMidpointDistance=function(t){var e=new pb(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},cb.prototype.computeMaxVertexDistance=function(t){var e=new fb(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},cb.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},cb.prototype.getDistancePoints=function(){return this._maxPtDist},cb.prototype.interfaces_=function(){return[]},cb.prototype.getClass=function(){return cb},hb.MaxPointDistanceFilter.get=function(){return fb},hb.MaxMidpointDistanceFilter.get=function(){return pb},Object.defineProperties(cb,hb);var fb=function(t){this._maxPtDist=new ub,this._minPtDist=new ub,this._geom=t||null};fb.prototype.filter=function(t){this._minPtDist.initialize(),lb.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},fb.prototype.getMaxPointDistance=function(){return this._maxPtDist},fb.prototype.interfaces_=function(){return[GE]},fb.prototype.getClass=function(){return fb};var pb=function(t){this._maxPtDist=new ub,this._minPtDist=new ub,this._geom=t||null};pb.prototype.filter=function(t,e){if(0===e)return null;var n=t.getCoordinate(e-1),r=t.getCoordinate(e),i=new KI((n.x+r.x)/2,(n.y+r.y)/2);this._minPtDist.initialize(),lb.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},pb.prototype.isDone=function(){return!1},pb.prototype.isGeometryChanged=function(){return!1},pb.prototype.getMaxPointDistance=function(){return this._maxPtDist},pb.prototype.interfaces_=function(){return[wC]},pb.prototype.getClass=function(){return pb};var gb=function(t){this._comps=t||null};gb.prototype.filter=function(t){t instanceof jC&&this._comps.add(t)},gb.prototype.interfaces_=function(){return[xC]},gb.prototype.getClass=function(){return gb},gb.getPolygons=function(){if(1===arguments.length)return gb.getPolygons(arguments[0],new ZE);if(2===arguments.length){var t=arguments[0],e=arguments[1];return t instanceof jC?e.add(t):t instanceof bC&&t.apply(new gb(e)),e}};var Ab=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],n=arguments[1];this._lines=e,this._isForcedToLineString=n}};Ab.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof VC){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof FC&&this._lines.add(t)},Ab.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},Ab.prototype.interfaces_=function(){return[PE]},Ab.prototype.getClass=function(){return Ab},Ab.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(Ab.getLines(t))}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().buildGeometry(Ab.getLines(e,n))}},Ab.getLines=function(){if(1===arguments.length)return Ab.getLines(arguments[0],!1);if(2===arguments.length){if(rE(arguments[0],HE)&&rE(arguments[1],HE)){for(var t=arguments[1],e=arguments[0].iterator();e.hasNext();){var n=e.next();Ab.getLines(n,t)}return t}if(arguments[0]instanceof kE&&"boolean"==typeof arguments[1]){var r=arguments[0],i=arguments[1],o=new ZE;return r.apply(new Ab(o,i)),o}if(arguments[0]instanceof kE&&rE(arguments[1],HE)){var s=arguments[0],a=arguments[1];return s instanceof FC?a.add(s):s.apply(new Ab(a)),a}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&rE(arguments[0],HE)&&rE(arguments[1],HE)){for(var u=arguments[1],l=arguments[2],c=arguments[0].iterator();c.hasNext();){var h=c.next();Ab.getLines(h,u,l)}return u}if("boolean"==typeof arguments[2]&&arguments[0]instanceof kE&&rE(arguments[1],HE)){var f=arguments[1],p=arguments[2];return arguments[0].apply(new Ab(f,p)),f}}};var db=function(){if(this._boundaryRule=UE.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 zI("Rule must be non-null");this._boundaryRule=t}};db.prototype.locateInternal=function(){if(arguments[0]instanceof KI&&arguments[1]instanceof jC){var t=arguments[0],e=arguments[1];if(e.isEmpty())return eE.EXTERIOR;var n=e.getExteriorRing(),r=this.locateInPolygonRing(t,n);if(r===eE.EXTERIOR)return eE.EXTERIOR;if(r===eE.BOUNDARY)return eE.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===eE.INTERIOR)return eE.EXTERIOR;if(s===eE.BOUNDARY)return eE.BOUNDARY}return eE.INTERIOR}if(arguments[0]instanceof KI&&arguments[1]instanceof FC){var a=arguments[0],u=arguments[1];if(!u.getEnvelopeInternal().intersects(a))return eE.EXTERIOR;var l=u.getCoordinates();return u.isClosed()||!a.equals(l[0])&&!a.equals(l[l.length-1])?QE.isOnLine(a,l)?eE.INTERIOR:eE.EXTERIOR:eE.BOUNDARY}if(arguments[0]instanceof KI&&arguments[1]instanceof UC){var c=arguments[0];return arguments[1].getCoordinate().equals2D(c)?eE.INTERIOR:eE.EXTERIOR}},db.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?QE.locatePointInRing(t,e.getCoordinates()):eE.EXTERIOR},db.prototype.intersects=function(t,e){return this.locate(t,e)!==eE.EXTERIOR},db.prototype.updateLocationInfo=function(t){t===eE.INTERIOR&&(this._isIn=!0),t===eE.BOUNDARY&&this._numBoundaries++},db.prototype.computeLocation=function(t,e){var n=this;if(e instanceof UC&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof FC)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof jC)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof BC)for(var r=e,i=0;i<r.getNumGeometries();i++){var o=r.getGeometryN(i);n.updateLocationInfo(n.locateInternal(t,o))}else if(e instanceof YC)for(var s=e,a=0;a<s.getNumGeometries();a++){var u=s.getGeometryN(a);n.updateLocationInfo(n.locateInternal(t,u))}else if(e instanceof bC)for(var l=new Tw(e);l.hasNext();){var c=l.next();c!==e&&n.computeLocation(t,c)}},db.prototype.locate=function(t,e){return e.isEmpty()?eE.EXTERIOR:e instanceof FC||e instanceof jC?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?eE.BOUNDARY:this._numBoundaries>0||this._isIn?eE.INTERIOR:eE.EXTERIOR)},db.prototype.interfaces_=function(){return[]},db.prototype.getClass=function(){return db};var yb=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],n=arguments[1],r=arguments[2];this._component=e,this._segIndex=n,this._pt=r}},vb={INSIDE_AREA:{configurable:!0}};yb.prototype.isInsideArea=function(){return this._segIndex===yb.INSIDE_AREA},yb.prototype.getCoordinate=function(){return this._pt},yb.prototype.getGeometryComponent=function(){return this._component},yb.prototype.getSegmentIndex=function(){return this._segIndex},yb.prototype.interfaces_=function(){return[]},yb.prototype.getClass=function(){return yb},vb.INSIDE_AREA.get=function(){return-1},Object.defineProperties(yb,vb);var mb=function(t){this._pts=t||null};mb.prototype.filter=function(t){t instanceof UC&&this._pts.add(t)},mb.prototype.interfaces_=function(){return[xC]},mb.prototype.getClass=function(){return mb},mb.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof UC?Vx.singletonList(t):mb.getPoints(t,new ZE)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof UC?n.add(e):e instanceof bC&&e.apply(new mb(n)),n}};var _b=function(){this._locations=null;var t=arguments[0];this._locations=t};_b.prototype.filter=function(t){(t instanceof UC||t instanceof FC||t instanceof jC)&&this._locations.add(new yb(t,0,t.getCoordinate()))},_b.prototype.interfaces_=function(){return[xC]},_b.prototype.getClass=function(){return _b},_b.getLocations=function(t){var e=new ZE;return t.apply(new _b(e)),e};var Ib=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new db,this._minDistanceLocation=null,this._minDistance=VI.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 n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};Ib.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 n=arguments[0],r=arguments[1],i=1-n,o=gb.getPolygons(this._geom[n]);if(o.size()>0){var s=_b.getLocations(this._geom[i]);if(this.computeContainmentDistance(s,o,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&rE(arguments[0],WE)&&rE(arguments[1],WE)){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 yb&&arguments[1]instanceof jC){var p=arguments[0],g=arguments[1],A=arguments[2],d=p.getCoordinate();if(eE.EXTERIOR!==this._ptLocator.locate(d,g))return this._minDistance=0,A[0]=p,A[1]=new yb(g,d),null}},Ib.prototype.computeMinDistanceLinesPoints=function(t,e,n){for(var r=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(r.computeMinDistance(o,a,n),r._minDistance<=r._terminateDistance)return null}},Ib.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=Ab.getLines(this._geom[0]),n=Ab.getLines(this._geom[1]),r=mb.getPoints(this._geom[0]),i=mb.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,n,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(n,r,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(r,i,t),void this.updateMinDistance(t,!1))))},Ib.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},Ib.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])},Ib.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},Ib.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 FC&&arguments[1]instanceof UC){var e=arguments[0],n=arguments[1],r=arguments[2];if(e.getEnvelopeInternal().distance(n.getEnvelopeInternal())>this._minDistance)return null;for(var i=e.getCoordinates(),o=n.getCoordinate(),s=0;s<i.length-1;s++){var a=QE.distancePointLine(o,i[s],i[s+1]);if(a<t._minDistance){t._minDistance=a;var u=new sw(i[s],i[s+1]).closestPoint(o);r[0]=new yb(e,s,u),r[1]=new yb(n,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof FC&&arguments[1]instanceof FC){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=QE.distanceLineLine(f[g],f[g+1],p[A],p[A+1]);if(d<t._minDistance){t._minDistance=d;var y=new sw(f[g],f[g+1]),v=new sw(p[A],p[A+1]),m=y.closestPoints(v);h[0]=new yb(l,g,m[0]),h[1]=new yb(c,A,m[1])}if(t._minDistance<=t._terminateDistance)return null}}},Ib.prototype.computeMinDistancePoints=function(t,e,n){for(var r=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<r._minDistance&&(r._minDistance=u,n[0]=new yb(o,0,o.getCoordinate()),n[1]=new yb(a,0,a.getCoordinate())),r._minDistance<=r._terminateDistance)return null}},Ib.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new zI("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},Ib.prototype.computeMinDistanceLines=function(t,e,n){for(var r=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(r.computeMinDistance(o,a,n),r._minDistance<=r._terminateDistance)return null}},Ib.prototype.interfaces_=function(){return[]},Ib.prototype.getClass=function(){return Ib},Ib.distance=function(t,e){return new Ib(t,e).distance()},Ib.isWithinDistance=function(t,e,n){return new Ib(t,e,n).distance()<=n},Ib.nearestPoints=function(t,e){return new Ib(t,e).nearestPoints()};var Eb=function(){this._pt=[new KI,new KI],this._distance=VI.NaN,this._isNull=!0};Eb.prototype.getCoordinates=function(){return this._pt},Eb.prototype.getCoordinate=function(t){return this._pt[t]},Eb.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],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},Eb.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 n=arguments[0],r=arguments[1],i=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1}},Eb.prototype.toString=function(){return wE.toLineString(this._pt[0],this._pt[1])},Eb.prototype.getDistance=function(){return this._distance},Eb.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],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},Eb.prototype.interfaces_=function(){return[]},Eb.prototype.getClass=function(){return Eb};var Cb=function(){};Cb.prototype.interfaces_=function(){return[]},Cb.prototype.getClass=function(){return Cb},Cb.computeDistance=function(){if(arguments[2]instanceof Eb&&arguments[0]instanceof FC&&arguments[1]instanceof KI)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new sw,i=t.getCoordinates(),o=0;o<i.length-1;o++){r.setCoordinates(i[o],i[o+1]);var s=r.closestPoint(e);n.setMinimum(s,e)}else if(arguments[2]instanceof Eb&&arguments[0]instanceof jC&&arguments[1]instanceof KI){var a=arguments[0],u=arguments[1],l=arguments[2];Cb.computeDistance(a.getExteriorRing(),u,l);for(var c=0;c<a.getNumInteriorRing();c++)Cb.computeDistance(a.getInteriorRingN(c),u,l)}else if(arguments[2]instanceof Eb&&arguments[0]instanceof kE&&arguments[1]instanceof KI){var h=arguments[0],f=arguments[1],p=arguments[2];if(h instanceof FC)Cb.computeDistance(h,f,p);else if(h instanceof jC)Cb.computeDistance(h,f,p);else if(h instanceof bC)for(var g=h,A=0;A<g.getNumGeometries();A++){var d=g.getGeometryN(A);Cb.computeDistance(d,f,p)}else p.setMinimum(h.getCoordinate(),f)}else if(arguments[2]instanceof Eb&&arguments[0]instanceof sw&&arguments[1]instanceof KI){var y=arguments[1],v=arguments[2],m=arguments[0].closestPoint(y);v.setMinimum(m,y)}};var xb=function(){this._g0=null,this._g1=null,this._ptDist=new Eb,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},wb={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};xb.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},xb.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new zI("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},xb.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},xb.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},xb.prototype.computeOrientedDistance=function(t,e,n){var r=new bb(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new Bb(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}},xb.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},xb.prototype.interfaces_=function(){return[]},xb.prototype.getClass=function(){return xb},xb.distance=function(){if(2===arguments.length)return new xb(arguments[0],arguments[1]).distance();if(3===arguments.length){var t=arguments[2],e=new xb(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},wb.MaxPointDistanceFilter.get=function(){return bb},wb.MaxDensifiedByFractionDistanceFilter.get=function(){return Bb},Object.defineProperties(xb,wb);var bb=function(){this._maxPtDist=new Eb,this._minPtDist=new Eb,this._euclideanDist=new Cb,this._geom=null;var t=arguments[0];this._geom=t};bb.prototype.filter=function(t){this._minPtDist.initialize(),Cb.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},bb.prototype.getMaxPointDistance=function(){return this._maxPtDist},bb.prototype.interfaces_=function(){return[GE]},bb.prototype.getClass=function(){return bb};var Bb=function(){this._maxPtDist=new Eb,this._minPtDist=new Eb,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};Bb.prototype.filter=function(t,e){var n=this;if(0===e)return null;for(var r=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-r.x)/this._numSubSegs,s=(i.y-r.y)/this._numSubSegs,a=0;a<this._numSubSegs;a++){var u=r.x+a*o,l=r.y+a*s,c=new KI(u,l);n._minPtDist.initialize(),Cb.computeDistance(n._geom,c,n._minPtDist),n._maxPtDist.setMaximum(n._minPtDist)}},Bb.prototype.isDone=function(){return!1},Bb.prototype.isGeometryChanged=function(){return!1},Bb.prototype.getMaxPointDistance=function(){return this._maxPtDist},Bb.prototype.interfaces_=function(){return[wC]},Bb.prototype.getClass=function(){return Bb};var Sb=function(t,e,n){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=n||null},Mb={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Sb.prototype.checkMaximumDistance=function(t,e,n){var r=new xb(e,t);if(r.setDensifyFraction(.25),this._maxDistanceFound=r.orientedDistance(),this._maxDistanceFound>n){this._isValid=!1;var i=r.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 "+wE.toLineString(i[0],i[1])+")"}},Sb.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=Sb.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(),Sb.VERBOSE&&yE.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Sb.prototype.checkNegativeValid=function(){if(!(this._input instanceof jC||this._input instanceof YC||this._input instanceof bC))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)},Sb.prototype.getErrorIndicator=function(){return this._errorIndicator},Sb.prototype.checkMinimumDistance=function(t,e,n){var r=new Ib(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound<n){this._isValid=!1;var i=r.nearestPoints();this._errorLocation=r.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+wE.toLineString(i[0],i[1])+" )"}},Sb.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)},Sb.prototype.getErrorLocation=function(){return this._errorLocation},Sb.prototype.getPolygonLines=function(t){for(var e=new ZE,n=new Ab(e),r=gb.getPolygons(t).iterator();r.hasNext();){r.next().apply(n)}return t.getFactory().buildGeometry(e)},Sb.prototype.getErrorMessage=function(){return this._errMsg},Sb.prototype.interfaces_=function(){return[]},Sb.prototype.getClass=function(){return Sb},Mb.VERBOSE.get=function(){return!1},Mb.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Sb,Mb);var Lb=function(t,e,n){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=n||null},Nb={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Lb.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},Lb.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*Lb.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new mE(this._input.getEnvelopeInternal());e.expandBy(this._distance);var n=new mE(this._result.getEnvelopeInternal());n.expandBy(t),n.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(n)),this.report("Envelope")},Lb.prototype.checkDistance=function(){var t=new Sb(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")},Lb.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")},Lb.prototype.checkPolygonal=function(){this._result instanceof jC||this._result instanceof YC||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Lb.prototype.getErrorIndicator=function(){return this._errorIndicator},Lb.prototype.getErrorLocation=function(){return this._errorLocation},Lb.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"))},Lb.prototype.report=function(t){if(!Lb.VERBOSE)return null;yE.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},Lb.prototype.getErrorMessage=function(){return this._errorMsg},Lb.prototype.interfaces_=function(){return[]},Lb.prototype.getClass=function(){return Lb},Lb.isValidMsg=function(t,e,n){var r=new Lb(t,e,n);return r.isValid()?null:r.getErrorMessage()},Lb.isValid=function(t,e,n){return!!new Lb(t,e,n).isValid()},Nb.VERBOSE.get=function(){return!1},Nb.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Lb,Nb);var Tb=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Tb.prototype.getCoordinates=function(){return this._pts},Tb.prototype.size=function(){return this._pts.length},Tb.prototype.getCoordinate=function(t){return this._pts[t]},Tb.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Tb.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:nw.octant(this.getCoordinate(t),this.getCoordinate(t+1))},Tb.prototype.setData=function(t){this._data=t},Tb.prototype.getData=function(){return this._data},Tb.prototype.toString=function(){return wE.toLineString(new ZC(this._pts))},Tb.prototype.interfaces_=function(){return[rw]},Tb.prototype.getClass=function(){return Tb};var Rb=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new ZE,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};Rb.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Rb.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},Rb.prototype.getIntersectionSegments=function(){return this._intSegments},Rb.prototype.count=function(){return this._intersectionCount},Rb.prototype.getIntersections=function(){return this._intersections},Rb.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Rb.prototype.setKeepIntersections=function(t){this._keepIntersections=t},Rb.prototype.processIntersections=function(t,e,n,r){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===n&&e===r)return null;if(this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,e)||this.isEndSegment(n,r)))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+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++)},Rb.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},Rb.prototype.hasIntersection=function(){return null!==this._interiorIntersection},Rb.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},Rb.prototype.interfaces_=function(){return[Fw]},Rb.prototype.getClass=function(){return Rb},Rb.createAllIntersectionsFinder=function(t){var e=new Rb(t);return e.setFindAllIntersections(!0),e},Rb.createAnyIntersectionFinder=function(t){return new Rb(t)},Rb.createIntersectionCounter=function(t){var e=new Rb(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Qb=function(){this._li=new NE,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Qb.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},Qb.prototype.getIntersections=function(){return this._segInt.getIntersections()},Qb.prototype.isValid=function(){return this.execute(),this._isValid},Qb.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Qb.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Rb(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new pw;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Qb.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new _x(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Qb.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+wE.toLineString(t[0],t[1])+" and "+wE.toLineString(t[2],t[3])},Qb.prototype.interfaces_=function(){return[]},Qb.prototype.getClass=function(){return Qb},Qb.computeIntersections=function(t){var e=new Qb(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Db=function t(){this._nv=null;var e=arguments[0];this._nv=new Qb(t.toSegmentStrings(e))};Db.prototype.checkValid=function(){this._nv.checkValid()},Db.prototype.interfaces_=function(){return[]},Db.prototype.getClass=function(){return Db},Db.toSegmentStrings=function(t){for(var e=new ZE,n=t.iterator();n.hasNext();){var r=n.next();e.add(new Tb(r.getCoordinates(),r))}return e},Db.checkValid=function(t){new Db(t).checkValid()};var Pb=function(t){this._mapOp=t};Pb.prototype.map=function(t){for(var e=new ZE,n=0;n<t.getNumGeometries();n++){var r=this._mapOp.map(t.getGeometryN(n));r.isEmpty()||e.add(r)}return t.getFactory().createGeometryCollection(ax.toGeometryArray(e))},Pb.prototype.interfaces_=function(){return[]},Pb.prototype.getClass=function(){return Pb},Pb.map=function(t,e){return new Pb(e).map(t)};var kb=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new ZE,this._resultLineList=new ZE;var t=arguments[0],e=arguments[1],n=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=n};kb.prototype.collectLines=function(t){for(var e=this,n=this._op.getGraph().getEdgeEnds().iterator();n.hasNext();){var r=n.next();e.collectLineEdge(r,t,e._lineEdgesList),e.collectBoundaryTouchEdge(r,t,e._lineEdgesList)}},kb.prototype.labelIsolatedLine=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},kb.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},kb.prototype.collectLineEdge=function(t,e,n){var r=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!yB.isResultOfOp(r,e)||i.isCovered()||(n.add(i),t.setVisitedEdge(!0)))},kb.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 n=e.next(),r=n.getEdge();if(n.isLineEdge()&&!r.isCoveredSet()){var i=this._op.isCoveredByA(n.getCoordinate());r.setCovered(i)}}},kb.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),r=n.getLabel();n.isIsolated()&&(r.isNull(0)?this.labelIsolatedLine(n,0):this.labelIsolatedLine(n,1))}},kb.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var n=e.next(),r=this._geometryFactory.createLineString(n.getCoordinates());this._resultLineList.add(r),n.setInResult(!0)}},kb.prototype.collectBoundaryTouchEdge=function(t,e,n){var r=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(SE.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(yB.isResultOfOp(r,e)&&e===yB.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))))},kb.prototype.interfaces_=function(){return[]},kb.prototype.getClass=function(){return kb};var Ob=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new ZE;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};Ob.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var n=this._geometryFactory.createPoint(e);this._resultPointList.add(n)}},Ob.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var n=e.next();if(!n.isInResult()&&(!n.isIncidentEdgeInResult()&&(0===n.getEdges().getDegree()||t===yB.INTERSECTION))){var r=n.getLabel();yB.isResultOfOp(r,t)&&this.filterCoveredNodeToPoint(n)}}},Ob.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},Ob.prototype.interfaces_=function(){return[]},Ob.prototype.getClass=function(){return Ob};var Fb=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Fb.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},Fb.prototype.transformPolygon=function(t,e){var n=!0,r=this.transformLinearRing(t.getExteriorRing(),t);null!==r&&r instanceof VC&&!r.isEmpty()||(n=!1);for(var i=new ZE,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof VC||(n=!1),i.add(s))}if(n)return this._factory.createPolygon(r,i.toArray([]));var a=new ZE;return null!==r&&a.add(r),a.addAll(i),this._factory.buildGeometry(a)},Fb.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},Fb.prototype.getInputGeometry=function(){return this._inputGeom},Fb.prototype.transformMultiLineString=function(t,e){for(var n=new ZE,r=0;r<t.getNumGeometries();r++){var i=this.transformLineString(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},Fb.prototype.transformCoordinates=function(t,e){return this.copy(t)},Fb.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},Fb.prototype.transformMultiPoint=function(t,e){for(var n=new ZE,r=0;r<t.getNumGeometries();r++){var i=this.transformPoint(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},Fb.prototype.transformMultiPolygon=function(t,e){for(var n=new ZE,r=0;r<t.getNumGeometries();r++){var i=this.transformPolygon(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},Fb.prototype.copy=function(t){return t.copy()},Fb.prototype.transformGeometryCollection=function(t,e){for(var n=new ZE,r=0;r<t.getNumGeometries();r++){var i=this.transform(t.getGeometryN(r));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||n.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(ax.toGeometryArray(n)):this._factory.buildGeometry(n)},Fb.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof UC)return this.transformPoint(t,null);if(t instanceof zC)return this.transformMultiPoint(t,null);if(t instanceof VC)return this.transformLinearRing(t,null);if(t instanceof FC)return this.transformLineString(t,null);if(t instanceof BC)return this.transformMultiLineString(t,null);if(t instanceof jC)return this.transformPolygon(t,null);if(t instanceof YC)return this.transformMultiPolygon(t,null);if(t instanceof bC)return this.transformGeometryCollection(t,null);throw new zI("Unknown Geometry subtype: "+t.getClass().getName())},Fb.prototype.transformLinearRing=function(t,e){var n=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===n)return this._factory.createLinearRing(null);var r=n.size();return r>0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},Fb.prototype.interfaces_=function(){return[]},Fb.prototype.getClass=function(){return Fb};var Gb=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new sw,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof FC&&"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 n=arguments[0],r=arguments[1];this._srcPts=n,this._isClosed=t.isClosed(n),this._snapTolerance=r}};Gb.prototype.snapVertices=function(t,e){for(var n=this._isClosed?t.size()-1:t.size(),r=0;r<n;r++){var i=t.get(r),o=this.findSnapForVertex(i,e);null!==o&&(t.set(r,new KI(o)),0===r&&this._isClosed&&t.set(t.size()-1,new KI(o)))}},Gb.prototype.findSnapForVertex=function(t,e){for(var n=0;n<e.length;n++){if(t.equals2D(e[n]))return null;if(t.distance(e[n])<this._snapTolerance)return e[n]}return null},Gb.prototype.snapTo=function(t){var e=new tC(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},Gb.prototype.snapSegments=function(t,e){if(0===e.length)return null;var n=e.length;e[0].equals2D(e[e.length-1])&&(n=e.length-1);for(var r=0;r<n;r++){var i=e[r],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new KI(i),!1)}},Gb.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=VI.MAX_VALUE,i=-1,o=0;o<e.size()-1;o++){if(n._seg.p0=e.get(o),n._seg.p1=e.get(o+1),n._seg.p0.equals2D(t)||n._seg.p1.equals2D(t)){if(n._allowSnappingToSourceVertices)continue;return-1}var s=n._seg.distance(t);s<n._snapTolerance&&s<r&&(r=s,i=o)}return i},Gb.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},Gb.prototype.interfaces_=function(){return[]},Gb.prototype.getClass=function(){return Gb},Gb.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var Ub=function(t){this._srcGeom=t||null},qb={SNAP_PRECISION_FACTOR:{configurable:!0}};Ub.prototype.snapTo=function(t,e){var n=this.extractTargetCoordinates(t);return new jb(e,n).transform(this._srcGeom)},Ub.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(this._srcGeom),r=new jb(t,n,!0).transform(this._srcGeom),i=r;return e&&rE(i,qC)&&(i=r.buffer(0)),i},Ub.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},Ub.prototype.extractTargetCoordinates=function(t){for(var e=new mC,n=t.getCoordinates(),r=0;r<n.length;r++)e.add(n[r]);return e.toArray(new Array(0).fill(null))},Ub.prototype.computeMinimumSegmentLength=function(t){for(var e=VI.MAX_VALUE,n=0;n<t.length-1;n++){var r=t[n].distance(t[n+1]);r<e&&(e=r)}return e},Ub.prototype.interfaces_=function(){return[]},Ub.prototype.getClass=function(){return Ub},Ub.snap=function(t,e,n){var r=new Array(2).fill(null),i=new Ub(t);r[0]=i.snapTo(e,n);var o=new Ub(e);return r[1]=o.snapTo(r[0],n),r},Ub.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=Ub.computeSizeBasedSnapTolerance(t),n=t.getPrecisionModel();if(n.getType()===rx.FIXED){var r=1/n.getScale()*2/1.415;r>e&&(e=r)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(Ub.computeOverlaySnapTolerance(i),Ub.computeOverlaySnapTolerance(o))}},Ub.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*Ub.SNAP_PRECISION_FACTOR},Ub.snapToSelf=function(t,e,n){return new Ub(t).snapToSelf(e,n)},qb.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Ub,qb);var jb=function(t){function e(e,n,r){t.call(this),this._snapTolerance=e||null,this._snapPts=n||null,this._isSelfSnap=void 0!==r&&r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var n=new Gb(t,this._snapTolerance);return n.setAllowSnappingToSourceVertices(this._isSelfSnap),n.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var n=t.toCoordinateArray(),r=this.snapLine(n,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Fb),zb=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};zb.prototype.getCommon=function(){return VI.longBitsToDouble(this._commonBits)},zb.prototype.add=function(t){var e=VI.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=zb.signExpBits(this._commonBits),this._isFirst=!1,null):zb.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=zb.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=zb.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},zb.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=VI.longBitsToDouble(t),n="0000000000000000000000000000000000000000000000000000000000000000"+VI.toBinaryString(t),r=n.substring(n.length-64);return r.substring(0,1)+" "+r.substring(1,12)+"(exp) "+r.substring(12)+" [ "+e+" ]"}},zb.prototype.interfaces_=function(){return[]},zb.prototype.getClass=function(){return zb},zb.getBit=function(t,e){return 0!=(t&1<<e)?1:0},zb.signExpBits=function(t){return t>>52},zb.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},zb.numCommonMostSigMantissaBits=function(t,e){for(var n=0,r=52;r>=0;r--){if(zb.getBit(t,r)!==zb.getBit(e,r))return n;n++}return 52};var Vb=function(){this._commonCoord=null,this._ccFilter=new Hb},Yb={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Vb.prototype.addCommonBits=function(t){var e=new Xb(this._commonCoord);t.apply(e),t.geometryChanged()},Vb.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new KI(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new Xb(e);return t.apply(n),t.geometryChanged(),t},Vb.prototype.getCommonCoordinate=function(){return this._commonCoord},Vb.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Vb.prototype.interfaces_=function(){return[]},Vb.prototype.getClass=function(){return Vb},Yb.CommonCoordinateFilter.get=function(){return Hb},Yb.Translater.get=function(){return Xb},Object.defineProperties(Vb,Yb);var Hb=function(){this._commonBitsX=new zb,this._commonBitsY=new zb};Hb.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},Hb.prototype.getCommonCoordinate=function(){return new KI(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Hb.prototype.interfaces_=function(){return[GE]},Hb.prototype.getClass=function(){return Hb};var Xb=function(){this.trans=null;var t=arguments[0];this.trans=t};Xb.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,r=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,r)},Xb.prototype.isDone=function(){return!1},Xb.prototype.isGeometryChanged=function(){return!0},Xb.prototype.interfaces_=function(){return[wC]},Xb.prototype.getClass=function(){return Xb};var Jb=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()};Jb.prototype.selfSnap=function(t){return new Ub(t).snapTo(t,this._snapTolerance)},Jb.prototype.removeCommonBits=function(t){this._cbr=new Vb,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},Jb.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},Jb.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=yB.overlayOp(e[0],e[1],t);return this.prepareResult(n)},Jb.prototype.checkValid=function(t){t.isValid()||yE.out.println("Snapped geometry is invalid")},Jb.prototype.computeSnapTolerance=function(){this._snapTolerance=Ub.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Jb.prototype.snap=function(t){var e=this.removeCommonBits(t);return Ub.snap(e[0],e[1],this._snapTolerance)},Jb.prototype.interfaces_=function(){return[]},Jb.prototype.getClass=function(){return Jb},Jb.overlayOp=function(t,e,n){return new Jb(t,e).getResultGeometry(n)},Jb.union=function(t,e){return Jb.overlayOp(t,e,yB.UNION)},Jb.intersection=function(t,e){return Jb.overlayOp(t,e,yB.INTERSECTION)},Jb.symDifference=function(t,e){return Jb.overlayOp(t,e,yB.SYMDIFFERENCE)},Jb.difference=function(t,e){return Jb.overlayOp(t,e,yB.DIFFERENCE)};var Wb=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};Wb.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=yB.overlayOp(this._geom[0],this._geom[1],t);n=!0}catch(t){if(!(t instanceof bE))throw t;r=t}if(!n)try{e=Jb.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof bE?r:t}return e},Wb.prototype.interfaces_=function(){return[]},Wb.prototype.getClass=function(){return Wb},Wb.overlayOp=function(t,e,n){return new Wb(t,e).getResultGeometry(n)},Wb.union=function(t,e){return Wb.overlayOp(t,e,yB.UNION)},Wb.intersection=function(t,e){return Wb.overlayOp(t,e,yB.INTERSECTION)},Wb.symDifference=function(t,e){return Wb.overlayOp(t,e,yB.SYMDIFFERENCE)},Wb.difference=function(t,e){return Wb.overlayOp(t,e,yB.DIFFERENCE)};var Kb=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Kb.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},Kb.prototype.interfaces_=function(){return[]},Kb.prototype.getClass=function(){return Kb};var Zb=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],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=o}},$b={INSERT:{configurable:!0},DELETE:{configurable:!0}};Zb.prototype.isDelete=function(){return this._eventType===Zb.DELETE},Zb.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},Zb.prototype.getObject=function(){return this._obj},Zb.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},Zb.prototype.getInsertEvent=function(){return this._insertEvent},Zb.prototype.isInsert=function(){return this._eventType===Zb.INSERT},Zb.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},Zb.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Zb.prototype.interfaces_=function(){return[HI]},Zb.prototype.getClass=function(){return Zb},$b.INSERT.get=function(){return 1},$b.DELETE.get=function(){return 2},Object.defineProperties(Zb,$b);var tB=function(){};tB.prototype.interfaces_=function(){return[]},tB.prototype.getClass=function(){return tB};var eB=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],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};eB.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(eB.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&r===i||0===r&&e===i)return!0}}return!1},eB.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},eB.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},eB.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},eB.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next().getCoordinate();if(t.isIntersection(r))return!0}return!1},eB.prototype.hasProperIntersection=function(){return this._hasProper},eB.prototype.hasIntersection=function(){return this._hasIntersection},eB.prototype.isDone=function(){return this._isDone},eB.prototype.isBoundaryPoint=function(t,e){return null!==e&&(!!this.isBoundaryPointInternal(t,e[0])||!!this.isBoundaryPointInternal(t,e[1]))},eB.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},eB.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,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))))},eB.prototype.interfaces_=function(){return[]},eB.prototype.getClass=function(){return eB},eB.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var nB=function(t){function e(){t.call(this),this.events=new ZE,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){Vx.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 n=this.events.get(e);if(n.isInsert()&&this.processOverlaps(e,n.getDeleteEventIndex(),n,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof eB&&rE(arguments[0],WE)&&rE(arguments[1],WE)){var r=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(r,r),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&rE(arguments[0],WE)&&arguments[1]instanceof eB){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 n=t.getMonotoneChainEdge(),r=n.getStartIndexes(),i=0;i<r.length-1;i++){var o=new Kb(n,i),s=new Zb(e,n.getMinX(i),o);this.events.add(s),this.events.add(new Zb(n.getMaxX(i),s))}},e.prototype.processOverlaps=function(t,e,n,r){for(var i=n.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();n.isSameLabel(s)||(i.computeIntersections(a,r),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 n=arguments[1],r=arguments[0].iterator();r.hasNext();){var i=r.next();this.addEdge(i,n)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(tB),rB=function(){this._min=VI.POSITIVE_INFINITY,this._max=VI.NEGATIVE_INFINITY},iB={NodeComparator:{configurable:!0}};rB.prototype.getMin=function(){return this._min},rB.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},rB.prototype.getMax=function(){return this._max},rB.prototype.toString=function(){return wE.toLineString(new KI(this._min,0),new KI(this._max,0))},rB.prototype.interfaces_=function(){return[]},rB.prototype.getClass=function(){return rB},iB.NodeComparator.get=function(){return oB},Object.defineProperties(rB,iB);var oB=function(){};oB.prototype.compare=function(t,e){var n=t,r=e,i=(n._min+n._max)/2,o=(r._min+r._max)/2;return i<o?-1:i>o?1:0},oB.prototype.interfaces_=function(){return[JI]},oB.prototype.getClass=function(){return oB};var sB=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],n=arguments[1],r=arguments[2];this._min=e,this._max=n,this._item=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;n.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(rB),aB=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],n=arguments[1];this._node1=e,this._node2=n,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,n){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,n),null!==this._node2&&this._node2.query(t,e,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(rB),uB=function(){this._leaves=new ZE,this._root=null,this._level=0};uB.prototype.buildTree=function(){Vx.sort(this._leaves,new rB.NodeComparator);for(var t=this._leaves,e=null,n=new ZE;;){if(this.buildLevel(t,n),1===n.size())return n.get(0);e=t,t=n,n=e}},uB.prototype.insert=function(t,e,n){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new sB(t,e,n))},uB.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},uB.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},uB.prototype.printNode=function(t){yE.out.println(wE.toLineString(new KI(t._min,this._level),new KI(t._max,this._level)))},uB.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},uB.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n<t.size();n+=2){var r=t.get(n);if(null===(n+1<t.size()?t.get(n):null))e.add(r);else{var i=new aB(t.get(n),t.get(n+1));e.add(i)}}},uB.prototype.interfaces_=function(){return[]},uB.prototype.getClass=function(){return uB};var lB=function(){this._items=new ZE};lB.prototype.visitItem=function(t){this._items.add(t)},lB.prototype.getItems=function(){return this._items},lB.prototype.interfaces_=function(){return[Ux]},lB.prototype.getClass=function(){return lB};var cB=function(){this._index=null;var t=arguments[0];if(!rE(t,qC))throw new zI("Argument must be Polygonal");this._index=new pB(t)},hB={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};cB.prototype.locate=function(t){var e=new RE(t),n=new fB(e);return this._index.query(t.y,t.y,n),e.getLocation()},cB.prototype.interfaces_=function(){return[Nw]},cB.prototype.getClass=function(){return cB},hB.SegmentVisitor.get=function(){return fB},hB.IntervalIndexedGeometry.get=function(){return pB},Object.defineProperties(cB,hB);var fB=function(){this._counter=null;var t=arguments[0];this._counter=t};fB.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},fB.prototype.interfaces_=function(){return[Ux]},fB.prototype.getClass=function(){return fB};var pB=function(){this._index=new uB;var t=arguments[0];this.init(t)};pB.prototype.init=function(t){for(var e=Ab.getLines(t).iterator();e.hasNext();){var n=e.next().getCoordinates();this.addLine(n)}},pB.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var n=new sw(t[e-1],t[e]),r=Math.min(n.p0.y,n.p1.y),i=Math.max(n.p0.y,n.p1.y);this._index.insert(r,i,n)}},pB.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new lB;return this._index.query(t,e,n),n.getItems()}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._index.query(r,i,o)}},pB.prototype.interfaces_=function(){return[]},pB.prototype.getClass=function(){return pB};var gB=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new nx,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new db,2===arguments.length){var e=arguments[0],n=arguments[1],r=UE.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=n,this._boundaryNodeRule=r,null!==n&&this.add(n)}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,n){var r=this._nodes.addNode(n).getLabel(),i=1;r.getLocation(t,Ax.ON)===eE.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);r.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 n=arguments[1],r=arguments[2],i=new eB(arguments[0],!0,!1);i.setIsDoneIfProperInt(r);var o=this.createEdgeSetIntersector(),s=this._parentGeom instanceof VC||this._parentGeom instanceof jC||this._parentGeom instanceof YC,a=n||!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,n){var r=new eB(e,n,!0);return r.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,r),r},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 UC){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,eE.INTERIOR)}else if(arguments[0]instanceof KI){var e=arguments[0];this.insertPoint(this._argIndex,e,eE.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),eE.EXTERIOR,eE.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var n=t.getInteriorRingN(e);this.addPolygonRing(n,eE.INTERIOR,eE.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],eE.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],eE.BOUNDARY)},e.prototype.addLineString=function(t){var e=eC.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var n=new Hw(e,new xx(this._argIndex,eE.INTERIOR));this._lineEdgeMap.put(t,n),this.insertEdge(n),SE.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),n=0,r=t.iterator();r.hasNext();){var i=r.next();e[n++]=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,n){if(this.isBoundaryNode(t,e))return null;n===eE.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,n)},e.prototype.addPolygonRing=function(t,e,n){if(t.isEmpty())return null;var r=eC.removeRepeatedPoints(t.getCoordinates());if(r.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=r[0],null;var i=e,o=n;QE.isCCW(r)&&(i=n,o=e);var s=new Hw(r,new xx(this._argIndex,eE.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,r[0],eE.BOUNDARY)},e.prototype.insertPoint=function(t,e,n){var r=this._nodes.addNode(e),i=r.getLabel();null===i?r._label=new xx(t,n):i.setLocation(t,n)},e.prototype.createEdgeSetIntersector=function(){return new nB},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var n=e.next(),r=n.getLabel().getLocation(t),i=n.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,r)}},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 YC&&(this._useBoundaryDeterminationRule=!1),e instanceof jC)this.addPolygon(e);else if(e instanceof FC)this.addLineString(e);else if(e instanceof UC)this.addPoint(e);else if(e instanceof zC)this.addCollection(e);else if(e instanceof BC)this.addCollection(e);else if(e instanceof YC)this.addCollection(e);else{if(!(e instanceof bC))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},e.prototype.locate=function(t){return rE(this._parentGeom,qC)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new cB(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)?eE.BOUNDARY:eE.INTERIOR},e}(Px),AB=function(){if(this._li=new NE,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 gB(0,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],r=UE.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new gB(0,e,r),this._arg[1]=new gB(1,n,r)}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 gB(0,i,s),this._arg[1]=new gB(1,o,s)}};AB.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},AB.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},AB.prototype.interfaces_=function(){return[]},AB.prototype.getClass=function(){return AB};var dB=function(){};dB.prototype.interfaces_=function(){return[]},dB.prototype.getClass=function(){return dB},dB.map=function(){if(arguments[0]instanceof kE&&rE(arguments[1],dB.MapOp)){for(var t=arguments[0],e=arguments[1],n=new ZE,r=0;r<t.getNumGeometries();r++){var i=e.map(t.getGeometryN(r));null!==i&&n.add(i)}return t.getFactory().buildGeometry(n)}if(rE(arguments[0],HE)&&rE(arguments[1],dB.MapOp)){for(var o=arguments[0],s=arguments[1],a=new ZE,u=o.iterator();u.hasNext();){var l=u.next(),c=s.map(l);null!==c&&a.add(c)}return a}},dB.MapOp=function(){};var yB=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n),this._ptLocator=new db,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Ow,this._resultPolyList=new ZE,this._resultLineList=new ZE,this._resultPointList=new ZE,this._graph=new Px(new Pw),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 n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new xx(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(n),i.add(r),n.merge(r)}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(),n=e.getSym();e.isInResult()&&n.isInResult()&&(e.setInResult(!1),n.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,n,r,i){var o=new ZE;return o.addAll(t),o.addAll(n),o.addAll(r),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 n=e.iterator();n.hasNext();){var r=n.next();if(this._ptLocator.locate(t,r)!==eE.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new ZE,e=this._edgeList.iterator();e.hasNext();){var n=e.next();n.isCollapsed()&&(e.remove(),t.add(n.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getEdges().getLabel();e.getLabel().merge(n)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertUniqueEdge(n)}},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 ZE;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Db.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var n=new kx(this._geomFact);n.add(this._graph),this._resultPolyList=n.getPolygons();var r=new kb(this,this._geomFact,this._ptLocator);this._resultLineList=r.build(t);var i=new Ob(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 n=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,n)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var n=e.next();this._graph.addNode(n.getCoordinate()).setLabel(t,n.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var n=this._graph.getEdgeEnds().iterator();n.hasNext();){var r=n.next(),i=r.getLabel();i.isArea()&&!r.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,Ax.RIGHT),i.getLocation(1,Ax.RIGHT),t)&&r.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),n=e.getLabel(),r=e.getDepth();if(!r.isNull()){r.normalize();for(var i=0;i<2;i++)n.isNull(i)||!n.isArea()||r.isNull(i)||(0===r.getDelta(i)?n.toLine(i):(SE.isTrue(!r.isNull(i,Ax.LEFT),"depth of LEFT side has not been initialized"),n.setLocation(i,Ax.LEFT,r.getLocation(i,Ax.LEFT)),SE.isTrue(!r.isNull(i,Ax.RIGHT),"depth of RIGHT side has not been initialized"),n.setLocation(i,Ax.RIGHT,r.getLocation(i,Ax.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(),n=e.getLabel();e.isIsolated()&&(n.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(n)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(AB);yB.overlayOp=function(t,e,n){return new yB(t,e).getResultGeometry(n)},yB.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return yB.createEmptyResult(yB.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var n=e;return Pb.map(t,{interfaces_:function(){return[dB.MapOp]},map:function(t){return t.intersection(n)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Wb.overlayOp(t,e,yB.INTERSECTION)},yB.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return yB.createEmptyResult(yB.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Wb.overlayOp(t,e,yB.SYMDIFFERENCE)},yB.resultDimension=function(t,e,n){var r=e.getDimension(),i=n.getDimension(),o=-1;switch(t){case yB.INTERSECTION:o=Math.min(r,i);break;case yB.UNION:o=Math.max(r,i);break;case yB.DIFFERENCE:o=r;break;case yB.SYMDIFFERENCE:o=Math.max(r,i)}return o},yB.createEmptyResult=function(t,e,n,r){var i=null;switch(yB.resultDimension(t,e,n)){case-1:i=r.createGeometryCollection(new Array(0).fill(null));break;case 0:i=r.createPoint();break;case 1:i=r.createLineString();break;case 2:i=r.createPolygon()}return i},yB.difference=function(t,e){return t.isEmpty()?yB.createEmptyResult(yB.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Wb.overlayOp(t,e,yB.DIFFERENCE))},yB.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=t.getLocation(0),r=t.getLocation(1);return yB.isResultOfOp(n,r,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1];switch(i===eE.BOUNDARY&&(i=eE.INTERIOR),o===eE.BOUNDARY&&(o=eE.INTERIOR),arguments[2]){case yB.INTERSECTION:return i===eE.INTERIOR&&o===eE.INTERIOR;case yB.UNION:return i===eE.INTERIOR||o===eE.INTERIOR;case yB.DIFFERENCE:return i===eE.INTERIOR&&o!==eE.INTERIOR;case yB.SYMDIFFERENCE:return i===eE.INTERIOR&&o!==eE.INTERIOR||i!==eE.INTERIOR&&o===eE.INTERIOR}return!1}},yB.INTERSECTION=1,yB.UNION=2,yB.DIFFERENCE=3,yB.SYMDIFFERENCE=4;var vB=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new db,this._seg=new sw;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};vB.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,n=0;n<this._linework.getNumGeometries();n++)for(var r=e._linework.getGeometryN(n).getCoordinateSequence(),i=0;i<r.size()-1;i++){if(r.getCoordinate(i,e._seg.p0),r.getCoordinate(i+1,e._seg.p1),e._seg.distance(t)<=e._boundaryDistanceTolerance)return!0}return!1},vB.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?eE.BOUNDARY:this._ptLocator.locate(t,this._g)},vB.prototype.extractLinework=function(t){var e=new mB;t.apply(e);var n=e.getLinework(),r=ax.toLineStringArray(n);return t.getFactory().createMultiLineString(r)},vB.prototype.interfaces_=function(){return[]},vB.prototype.getClass=function(){return vB};var mB=function(){this._linework=null,this._linework=new ZE};mB.prototype.getLinework=function(){return this._linework},mB.prototype.filter=function(t){if(t instanceof jC){var e=t;this._linework.add(e.getExteriorRing());for(var n=0;n<e.getNumInteriorRing();n++)this._linework.add(e.getInteriorRingN(n))}},mB.prototype.interfaces_=function(){return[xC]},mB.prototype.getClass=function(){return mB};var _B=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};_B.prototype.extractPoints=function(t,e,n){for(var r=t.getCoordinates(),i=0;i<r.length-1;i++)this.computeOffsetPoints(r[i],r[i+1],e,n)},_B.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},_B.prototype.getPoints=function(t){for(var e=new ZE,n=Ab.getLines(this._g).iterator();n.hasNext();){var r=n.next();this.extractPoints(r,t,e)}return e},_B.prototype.computeOffsetPoints=function(t,e,n,r){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),a=n*i/s,u=n*o/s,l=(e.x+t.x)/2,c=(e.y+t.y)/2;if(this._doLeft){var h=new KI(l-u,c+a);r.add(h)}if(this._doRight){var f=new KI(l+u,c-a);r.add(f)}},_B.prototype.interfaces_=function(){return[]},_B.prototype.getClass=function(){return _B};var IB=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 ZE;var e=arguments[0],n=arguments[1],r=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,n),this._geom=[e,n,r],this._locFinder=[new vB(this._geom[0],this._boundaryDistanceTolerance),new vB(this._geom[1],this._boundaryDistanceTolerance),new vB(this._geom[2],this._boundaryDistanceTolerance)]},EB={TOLERANCE:{configurable:!0}};IB.prototype.reportResult=function(t,e,n){yE.out.println("Overlay result invalid - A:"+eE.toLocationSymbol(e[0])+" B:"+eE.toLocationSymbol(e[1])+" expected:"+(n?"i":"e")+" actual:"+eE.toLocationSymbol(e[2]))},IB.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var e=this.checkValid(t);return e},IB.prototype.checkValid=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],n=0;n<this._testCoords.size();n++){var r=t._testCoords.get(n);if(!t.checkValid(e,r))return t._invalidLocation=r,!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),!!IB.hasLocation(this._location,eE.BOUNDARY)||this.isValidResult(i,this._location)}},IB.prototype.addTestPts=function(t){var e=new _B(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},IB.prototype.isValidResult=function(t,e){var n=yB.isResultOfOp(e[0],e[1],t),r=!(n^e[2]===eE.INTERIOR);return r||this.reportResult(t,e,n),r},IB.prototype.getInvalidLocation=function(){return this._invalidLocation},IB.prototype.interfaces_=function(){return[]},IB.prototype.getClass=function(){return IB},IB.hasLocation=function(t,e){for(var n=0;n<3;n++)if(t[n]===e)return!0;return!1},IB.computeBoundaryDistanceTolerance=function(t,e){return Math.min(Ub.computeSizeBasedSnapTolerance(t),Ub.computeSizeBasedSnapTolerance(e))},IB.isValid=function(t,e,n,r){return new IB(t,e,r).isValid(n)},EB.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(IB,EB);var CB=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};CB.prototype.extractElements=function(t,e){if(null===t)return null;for(var n=0;n<t.getNumGeometries();n++){var r=t.getGeometryN(n);this._skipEmpty&&r.isEmpty()||e.add(r)}},CB.prototype.combine=function(){for(var t=new ZE,e=this._inputGeoms.iterator();e.hasNext();){var n=e.next();this.extractElements(n,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},CB.prototype.interfaces_=function(){return[]},CB.prototype.getClass=function(){return CB},CB.combine=function(){return 1===arguments.length?new CB(arguments[0]).combine():2===arguments.length?new CB(CB.createList(arguments[0],arguments[1])).combine():3===arguments.length?new CB(CB.createList(arguments[0],arguments[1],arguments[2])).combine():void 0},CB.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},CB.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new ZE;return n.add(t),n.add(e),n}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=new ZE;return s.add(r),s.add(i),s.add(o),s}};var xB=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new ZE)},wB={STRTREE_NODE_CAPACITY:{configurable:!0}};xB.prototype.reduceToGeometries=function(t){for(var e=new ZE,n=t.iterator();n.hasNext();){var r=n.next(),i=null;rE(r,WE)?i=this.unionTree(r):r instanceof kE&&(i=r),e.add(i)}return e},xB.prototype.extractByEnvelope=function(t,e,n){for(var r=new ZE,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?r.add(o):n.add(o)}return this._geomFactory.buildGeometry(r)},xB.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),r=e.getEnvelopeInternal();if(!n.intersects(r))return CB.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=n.intersection(r);return this.unionUsingEnvelopeIntersection(t,e,i)},xB.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 Kx(xB.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var n=e.next();t.insert(n.getEnvelopeInternal(),n)}this._inputPolys=null;var r=t.itemsTree();return this.unionTree(r)},xB.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],n=arguments[1],r=arguments[2];if(r-n<=1){var i=xB.getGeometry(e,n);return this.unionSafe(i,null)}if(r-n==2)return this.unionSafe(xB.getGeometry(e,n),xB.getGeometry(e,n+1));var o=Math.trunc((r+n)/2),s=this.binaryUnion(e,n,o),a=this.binaryUnion(e,o,r);return this.unionSafe(s,a)}},xB.prototype.repeatedUnion=function(t){for(var e=null,n=t.iterator();n.hasNext();){var r=n.next();e=null===e?r.copy():e.union(r)}return e},xB.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},xB.prototype.unionActual=function(t,e){return xB.restrictToPolygons(t.union(e))},xB.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},xB.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var r=new ZE,i=this.extractByEnvelope(n,t,r),o=this.extractByEnvelope(n,e,r),s=this.unionActual(i,o);return r.add(s),CB.combine(r)},xB.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],n=arguments[1];return e.getFactory().createGeometryCollection([e,n]).buffer(0)}},xB.prototype.interfaces_=function(){return[]},xB.prototype.getClass=function(){return xB},xB.restrictToPolygons=function(t){if(rE(t,qC))return t;var e=gb.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(ax.toPolygonArray(e))},xB.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},xB.union=function(t){return new xB(t).union()},wB.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(xB,wB);var bB=function(){};function BB(){return new SB}function SB(){this.reset()}bB.prototype.interfaces_=function(){return[]},bB.prototype.getClass=function(){return bB},bB.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return yB.createEmptyResult(yB.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Wb.overlayOp(t,e,yB.UNION)},SB.prototype={constructor:SB,reset:function(){this.s=this.t=0},add:function(t){LB(MB,t,this.t),LB(this,MB.s,this.s),this.s?this.t+=MB.t:this.s=MB.t},valueOf:function(){return this.s}};var MB=new SB;function LB(t,e,n){var r=t.s=e+n,i=r-e,o=r-i;t.t=e-o+(n-i)}var NB=1e-6,TB=Math.PI,RB=TB/2,QB=TB/4,DB=2*TB,PB=180/TB,kB=TB/180,OB=Math.abs,FB=Math.atan,GB=Math.atan2,UB=Math.cos,qB=Math.sin,jB=Math.sqrt;function zB(t){return t>1?0:t<-1?TB:Math.acos(t)}function VB(t){return t>1?RB:t<-1?-RB:Math.asin(t)}function YB(){}function HB(t,e){t&&KB.hasOwnProperty(t.type)&&KB[t.type](t,e)}var XB,JB,WB={Feature:function(t,e){HB(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)HB(n[r].geometry,e)}},KB={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 n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){ZB(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)ZB(n[r],e,0)},Polygon:function(t,e){$B(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)$B(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)HB(n[r],e)}};function ZB(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function $B(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)ZB(t[n],e,1);e.polygonEnd()}function tS(t){return[GB(t[1],t[0]),VB(t[2])]}function eS(t){var e=t[0],n=t[1],r=UB(n);return[r*UB(e),r*qB(e),qB(n)]}function nS(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function rS(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 iS(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function oS(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function sS(t){var e=jB(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function aS(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n}function uS(t,e){return[t>TB?t-DB:t<-TB?t+DB:t,e]}function lS(t){return function(e,n){return[(e+=t)>TB?e-DB:e<-TB?e+DB:e,n]}}function cS(t){var e=lS(t);return e.invert=lS(-t),e}function hS(t,e){var n=UB(t),r=qB(t),i=UB(e),o=qB(e);function s(t,e){var s=UB(e),a=UB(t)*s,u=qB(t)*s,l=qB(e),c=l*n+a*r;return[GB(u*i-c*o,a*n-l*r),VB(c*i+u*o)]}return s.invert=function(t,e){var s=UB(e),a=UB(t)*s,u=qB(t)*s,l=qB(e),c=l*i-u*o;return[GB(u*i+l*o,a*n+c*r),VB(c*n-a*r)]},s}function fS(t,e){(e=eS(e))[0]-=t,sS(e);var n=zB(-e[1]);return((-e[2]<0?-n:n)+DB-NB)%DB}function pS(){var t,e=[];return{point:function(e,n){t.push([e,n])},lineStart:function(){e.push(t=[])},lineEnd:YB,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function gS(t,e){return OB(t[0]-e[0])<NB&&OB(t[1]-e[1])<NB}function AS(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function dS(t,e,n,r,i){var o,s,a=[],u=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],s=t[e];if(gS(r,s)){for(i.lineStart(),o=0;o<e;++o)i.point((r=t[o])[0],r[1]);i.lineEnd()}else a.push(n=new AS(r,t,null,!0)),u.push(n.o=new AS(r,null,n,!1)),a.push(n=new AS(s,t,null,!1)),u.push(n.o=new AS(s,null,n,!0))}})),a.length){for(u.sort(e),yS(a),yS(u),o=0,s=u.length;o<s;++o)u[o].e=n=!n;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 r(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 r(f.x,f.p.x,-1,i);f=f.p}l=(f=f.o).z,p=!p}while(!f.v);i.lineEnd()}}}function yS(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function vS(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function mS(t){for(var e,n,r,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(n=new Array(s);--i>=0;)for(e=(r=t[i]).length;--e>=0;)n[--s]=r[e];return n}BB(),BB(),BB(),uS.invert=uS,1===(XB=vS).length&&(JB=XB,XB=function(t,e){return vS(JB(t),e)});var _S=1e9,IS=-_S;function ES(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}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:n,c>1?r:e)}while((c=(c+a+4)%4)!==h);else l.point(o[0],o[1])}function s(r,i){return OB(r[0]-t)<NB?i>0?0:3:OB(r[0]-n)<NB?i>0?2:1:OB(r[1]-e)<NB?i>0?1:0:i>0?3:2}function a(t,e){return u(t.x,e.x)}function u(t,e){var n=s(t,1),r=s(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?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,_=pS(),I={point:E,lineStart:function(){I.point=C,l&&l.push(c=[]);y=!0,d=!1,g=A=NaN},lineEnd:function(){u&&(C(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,n=0,i=l.length;n<i;++n)for(var o,s,a=l[n],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<=r?p>r&&(f-o)*(r-s)>(p-s)*(t-o)&&++e:p<=r&&(f-o)*(r-s)<(p-s)*(t-o)&&--e;return e}(),n=v&&e,i=(u=mS(u)).length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&dS(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 C(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(IS,Math.min(_S,g)),A=Math.max(IS,Math.min(_S,A))],_=[o=Math.max(IS,Math.min(_S,o)),s=Math.max(IS,Math.min(_S,s))];!function(t,e,n,r,i,o){var s,a=t[0],u=t[1],l=0,c=1,h=e[0]-a,f=e[1]-u;if(s=n-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=r-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,n,r)?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 CS=BB();function xS(t){return t}BB(),BB(),BB();var wS=1/0,bS=wS,BS=-wS,SS=BS,MS={point:function(t,e){t<wS&&(wS=t);t>BS&&(BS=t);e<bS&&(bS=e);e>SS&&(SS=e)},lineStart:YB,lineEnd:YB,polygonStart:YB,polygonEnd:YB,result:function(){var t=[[wS,bS],[BS,SS]];return BS=SS=-(bS=wS=1/0),t}};function LS(t,e,n,r){return function(i,o){var s,a,u,l=e(o),c=i.invert(r[0],r[1]),h=pS(),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=mS(a);var t=function(t,e){var n=e[0],r=e[1],i=[qB(n),-UB(n),0],o=0,s=0;CS.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+QB,g=qB(p),A=UB(p),d=0;d<c;++d,f=v,g=_,A=I,h=y){var y=l[d],v=y[0],m=y[1]/2+QB,_=qB(m),I=UB(m),E=v-f,C=E>=0?1:-1,x=C*E,w=x>TB,b=g*_;if(CS.add(GB(b*C*qB(x),A*I+b*UB(x))),o+=w?E+C*DB:E,w^f>=n^v>=n){var B=rS(eS(h),eS(y));sS(B);var S=rS(i,B);sS(S);var M=(w^E>=0?-1:1)*VB(S[2]);(r>M||r===M&&(B[0]||B[1]))&&(s+=w^E>=0?1:-1)}}return(o<-NB||o<NB&&CS<-NB)^1&s}(s,c);a.length?(p||(o.polygonStart(),p=!0),dS(a,TS,t,n,o)):t&&(p||(o.polygonStart(),p=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),p&&(o.polygonEnd(),p=!1),a=s=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function A(e,n){var r=i(e,n);t(e=r[0],n=r[1])&&o.point(e,n)}function d(t,e){var n=i(t,e);l.point(n[0],n[1])}function y(){g.point=d,l.lineStart()}function v(){g.point=A,l.lineEnd()}function m(t,e){u.push([t,e]);var n=i(t,e);f.point(n[0],n[1])}function _(){f.lineStart(),u=[]}function I(){m(u[0][0],u[0][1]),f.lineEnd();var t,e,n,r,i=f.clean(),l=h.result(),c=l.length;if(u.pop(),s.push(u),u=null,c)if(1&i){if((e=(n=l[0]).length-1)>0){for(p||(o.polygonStart(),p=!0),o.lineStart(),t=0;t<e;++t)o.point((r=n[t])[0],r[1]);o.lineEnd()}}else c>1&&2&i&&l.push(l.pop().concat(l.shift())),a.push(l.filter(NS))}return g}}function NS(t){return t.length>1}function TS(t,e){return((t=t.x)[0]<0?t[1]-RB-NB:RB-t[1])-((e=e.x)[0]<0?e[1]-RB-NB:RB-e[1])}BB();var RS=LS((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?TB:-TB,u=OB(o-n);OB(u-TB)<NB?(t.point(n,r=(r+s)/2>0?RB:-RB),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(o,r),e=0):i!==a&&u>=TB&&(OB(n-i)<NB&&(n-=i*NB),OB(o-a)<NB&&(o-=a*NB),r=function(t,e,n,r){var i,o,s=qB(t-n);return OB(s)>NB?FB((qB(e)*(o=UB(r))*qB(n)-qB(r)*(i=UB(e))*qB(t))/(i*o*s)):(e+r)/2}(n,r,o,s),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),e=0),t.point(n=o,r=s),i=a},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*RB,r.point(-TB,i),r.point(0,i),r.point(TB,i),r.point(TB,0),r.point(TB,-i),r.point(0,-i),r.point(-TB,-i),r.point(-TB,0),r.point(-TB,i);else if(OB(t[0]-e[0])>NB){var o=t[0]<e[0]?TB:-TB;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])}),[-TB,-RB]);function QS(t,e){var n=UB(t),r=n>0,i=OB(n)>NB;function o(t,e){return UB(t)*UB(e)>n}function s(t,e,r){var i=[1,0,0],o=rS(eS(t),eS(e)),s=nS(o,o),a=o[0],u=s-a*a;if(!u)return!r&&t;var l=n*s/u,c=-n*a/u,h=rS(i,o),f=oS(i,l);iS(f,oS(o,c));var p=h,g=nS(f,p),A=nS(p,p),d=g*g-A*(nS(f,f)-1);if(!(d<0)){var y=jB(d),v=oS(p,(-g-y)/A);if(iS(v,f),v=tS(v),!r)return v;var m,_=t[0],I=e[0],E=t[1],C=e[1];I<_&&(m=_,_=I,I=m);var x=I-_,w=OB(x-TB)<NB;if(!w&&C<E&&(m=E,E=C,C=m),w||x<NB?w?E+C>0^v[1]<(OB(v[0]-_)<NB?E:C):E<=v[1]&&v[1]<=C:x>TB^(_<=v[0]&&v[0]<=I)){var b=oS(p,(-g+y)/A);return iS(b,f),[v,tS(b)]}}}function a(e,n){var i=r?t:TB-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return LS(o,(function(t){var e,n,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=r?A?0:a(h,f):A?a(h+(h<0?TB:-TB),f):0;if(!e&&(l=u=A)&&t.lineStart(),A!==u&&(!(p=s(e,g))||gS(e,p)||gS(g,p))&&(g[0]+=NB,g[1]+=NB,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&&r^A){var y;d&n||!(y=s(g,e,!0))||(c=0,r?(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&&gS(e,g)||t.point(g[0],g[1]),e=g,u=A,n=d},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return c|(l&&u)<<1}}}),(function(n,r,i,o){!function(t,e,n,r,i,o){if(n){var s=UB(e),a=qB(e),u=r*n;null==i?(i=e+r*DB,o=e-u/2):(i=fS(s,i),o=fS(s,o),(r>0?i<o:i>o)&&(i+=r*DB));for(var l,c=i;r>0?c>o:c<o;c-=u)l=tS([s,-a*UB(c),-a*qB(c)]),t.point(l[0],l[1])}}(o,t,e,i,n,r)}),r?[0,-t]:[-TB,t-TB])}function DS(t){return function(e){var n=new PS;for(var r in t)n[r]=t[r];return n.stream=e,n}}function PS(){}function kS(t,e,n){var r=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&&WB.hasOwnProperty(t.type)?WB[t.type](t,e):HB(t,e)}(n,t.stream(MS));var s=MS.result(),a=Math.min(r/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),u=+e[0][0]+(r-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])}PS.prototype={constructor:PS,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 OS=16,FS=UB(30*kB);function GS(t,e){return+e?function(t,e){function n(r,i,o,s,a,u,l,c,h,f,p,g,A,d){var y=l-r,v=c-i,m=y*y+v*v;if(m>4*e&&A--){var _=s+f,I=a+p,E=u+g,C=jB(_*_+I*I+E*E),x=VB(E/=C),w=OB(OB(E)-1)<NB||OB(o-h)<NB?(o+h)/2:GB(I,_),b=t(w,x),B=b[0],S=b[1],M=B-r,L=S-i,N=v*M-y*L;(N*N/m>e||OB((y*M+v*L)/m-.5)>.3||s*f+a*p+u*g<FS)&&(n(r,i,o,s,a,u,B,S,w,_/=C,I/=C,E,A,d),d.point(B,S),n(B,S,w,_,I,E,l,c,h,f,p,g,A,d))}}return function(e){var r,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(n,r){n=t(n,r),e.point(n[0],n[1])}function y(){c=NaN,A.point=v,e.lineStart()}function v(r,i){var o=eS([r,i]),s=t(r,i);n(c,h,l,f,p,g,c=s[0],h=s[1],l=r,f=o[0],p=o[1],g=o[2],OS,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(r=t,e),i=c,o=h,s=f,a=p,u=g,A.point=v}function E(){n(c,h,l,f,p,g,i,o,r,s,a,u,OS,e),A.lineEnd=m,m()}return A}}(t,e):function(t){return DS({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var US=DS({point:function(t,e){this.stream.point(t*kB,e*kB)}});function qS(t){return function(t){var e,n,r,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,_=RS,I=null,E=xS,C=.5,x=GS(B,C);function w(t){return[(t=o(t[0]*kB,t[1]*kB))[0]*h+n,r-t[1]*h]}function b(t){return(t=o.invert((t[0]-n)/h,(r-t[1])/h))&&[t[0]*PB,t[1]*PB]}function B(t,i){return[(t=e(t,i))[0]*h+n,r-t[1]*h]}function S(){o=aS(i=function(t,e,n){return(t%=DB)?e||n?aS(cS(t),hS(e,n)):cS(t):e||n?hS(e,n):uS}(d,y,v),e);var t=e(g,A);return n=f-t[0]*h,r=p+t[1]*h,M()}function M(){return l=c=null,w}return w.stream=function(t){return l&&c===t?l:l=US(_(i,x(E(c=t))))},w.clipAngle=function(t){return arguments.length?(_=+t?QS(m=t*kB,6*kB):(m=null,RS),M()):m*PB},w.clipExtent=function(t){return arguments.length?(E=null==t?(I=s=a=u=null,xS):ES(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*kB,A=t[1]%360*kB,S()):[g*PB,A*PB]},w.rotate=function(t){return arguments.length?(d=t[0]%360*kB,y=t[1]%360*kB,v=t.length>2?t[2]%360*kB:0,S()):[d*PB,y*PB,v*PB]},w.precision=function(t){return arguments.length?(x=GS(B,C=t*t),M()):jB(C)},w.fitExtent=function(t,e){return kS(w,t,e)},w.fitSize=function(t,e){return function(t,e,n){return kS(t,[[0,0],e],n)}(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&b,S()}}((function(){return t}))()}function jS(t){return function(e,n){var r=UB(e),i=UB(n),o=t(r*i);return[o*i*qB(e),o*qB(n)]}}function zS(t){return function(e,n){var r=jB(e*e+n*n),i=t(r),o=qB(i),s=UB(i);return[GB(e*o,r*s),VB(r&&n*o/r)]}}jS((function(t){return jB(2/(1+t))})).invert=zS((function(t){return 2*VB(t/2)}));var VS=jS((function(t){return(t=zB(t))&&t/qB(t)}));function YS(){return qS(VS).scale(79.4188).clipAngle(179.999)}function HS(t,e){return[t,e]}function XS(t,e,n,r){var i=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var s=[];return Rl(t,(function(t){var i=XS(t,e,n,r);i&&s.push(i)})),hn(s)}var a=function(t){var e=pf(t).geometry.coordinates,n=[-e[0],-e[1]];return YS().rotate(n).scale(Ze)}(o),u={type:o.type,coordinates:WS(o.coordinates,a)},l=(new px).read(u),c=yn(vn(e,n),"meters"),h=sb.bufferOp(l,c,r);if(!JS((h=(new gx).write(h)).coordinates))return nn({type:h.type,coordinates:KS(h.coordinates,a)},i)}function JS(t){return Array.isArray(t[0])?JS(t[0]):isNaN(t[0])}function WS(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return WS(t,e)}))}function KS(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return KS(t,e)}))}function ZS(t,e,n){void 0===n&&(n={});var r=Pn(t),i=Pn(e),o=qI.intersection(r.coordinates,i.coordinates);return 0===o.length?null:1===o.length?an(o[0],n.properties):gn(o,n.properties)}function $S(t,e,n){void 0===n&&(n={});var r=JSON.stringify(n.properties||{}),i=t[0],o=t[1],s=t[2],a=t[3],u=(o+a)/2,l=(i+s)/2,c=2*e/Fn([i,u],[s,u],n)*(s-i),h=2*e/Fn([l,o],[l,a],n)*(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),C=(d-E*g)/2,x=E*g-d>g/2;x&&(C-=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||!x)){var R=L*y+i-I,Q=N*v+o+C;if(T&&(Q-=g/2),!0===n.triangles)eM([R,Q],c/2,h/2,JSON.parse(r),w,b).forEach((function(t){n.mask?ZS(n.mask,t)&&M.push(t):M.push(t)}));else{var D=tM([R,Q],c/2,h/2,JSON.parse(r),w,b);n.mask?ZS(n.mask,D)&&M.push(D):M.push(D)}}}return hn(M)}function tM(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=t[0]+e*i[a],l=t[1]+n*o[a];s.push([u,l])}return s.push(s[0].slice()),an([s],r)}function eM(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=[];u.push(t),u.push([t[0]+e*i[a],t[1]+n*o[a]]),u.push([t[0]+e*i[(a+1)%6],t[1]+n*o[(a+1)%6]]),u.push(t),s.push(an([u],r))}return s}function nM(t){return gn(t)}function rM(t){return an(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}function iM(t,e,n){return void 0===n&&(n={}),function(t,e,n,r){void 0===r&&(r={});for(var i=[],o=t[0],s=t[1],a=t[2],u=t[3],l=e/Fn([o,s],[a,s],r)*(a-o),c=n/Fn([o,s],[o,u],r)*(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 _=an([[[d,v],[d,v+c],[d+l,v+c],[d+l,v],[d,v]]],r.properties);r.mask?fm(r.mask,_)&&i.push(_):i.push(_),v+=c}d+=l}return hn(i)}(t,e,e,n)}function oM(t,e,n){void 0===n&&(n={});for(var r=[],i=e/Fn([t[0],t[1]],[t[2],t[1]],n)*(t[2]-t[0]),o=e/Fn([t[0],t[1]],[t[0],t[3]],n)*(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=an([[[a,l],[a,l+o],[a+i,l],[a,l]]],n.properties),h=an([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],n.properties)):s%2==0&&u%2==1?(c=an([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],n.properties),h=an([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],n.properties)):u%2==0&&s%2==1?(c=an([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],n.properties),h=an([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],n.properties)):u%2==1&&s%2==1&&(c=an([[[a,l],[a,l+o],[a+i,l],[a,l]]],n.properties),h=an([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],n.properties)),n.mask?(ZS(n.mask,c)&&r.push(c),ZS(n.mask,h)&&r.push(h)):(r.push(c),r.push(h)),l+=o,u++}s++,a+=i}return hn(r)}VS.invert=zS((function(t){return t})),HS.invert=HS;var sM=Object.freeze({__proto__:null,projection:P_,random:z_,clusters:Z_,helpers:Mn,invariant:On,meta:jl,isolines:function(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},o=n.breaksProperties||[];if(Dn(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(!bn(i))throw new Error("commonProperties must be an Object");if(!Array.isArray(o))throw new Error("breaksProperties must be an Array");var s=nc(t,{zProperty:r,flip:!0}),a=function(t,e,n,r,i){for(var o=[],s=1;s<e.length;s++){var a=+e[s],u=Xl({},r,i[s]);u[n]=a;var l=fn(Kl(t,a),u);o.push(l)}return o}(s,e,r,i,o),u=function(t,e,n){var r=zl(n),i=r[2]-r[0],o=r[3]-r[1],s=r[0],a=r[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){bl(t,f)})),t}(a,s,t);return hn(u)},convex:Xc,pointsWithinPolygon:Jc,within:Jc,concave:function(t,e){void 0===e&&(e={});var n=e.maxEdge||1/0,r=function(t){var e=[],n={};return Ll(t,(function(t){if(t.geometry){var r=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(n,r)||(e.push(t),n[r]=!0)}})),hn(e)}(t),i=Wc(r);if(i.features=i.features.filter((function(t){var r=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],s=Fn(r,i,e),a=Fn(i,o,e),u=Fn(r,o,e);return s<=n&&a<=n&&u<=n})),i.features.length<1)return null;var o=Mh(i);return 1===o.coordinates.length&&(o.coordinates=o.coordinates[0],o.type="Polygon"),nn(o)},collect:function(t,e,n,r){var i=Yh(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[n]}}));return i.load(o),t.features.forEach((function(t){t.properties||(t.properties={});var e=zl(t),n=i.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}),o=[];n.forEach((function(e){Gn([e.minX,e.minY],t)&&o.push(e.property)})),t.properties[r]=o})),t},flip:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if(!t)throw new Error("geojson is required");return!1!==n&&void 0!==n||(t=th(t)),bl(t,(function(t){var e=t[0],n=t[1];t[0]=n,t[1]=e})),t},simplify:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=void 0!==e.tolerance?e.tolerance:1,r=e.highQuality||!1,i=e.mutate||!1;if(!t)throw new Error("geojson is required");if(n&&n<0)throw new Error("invalid tolerance");return!0!==i&&(t=th(t)),Rl(t,(function(t){!function(t,e,n){var r=t.type;if("Point"===r||"MultiPoint"===r)return t;Hh(t,!0);var i=t.coordinates;switch(r){case"LineString":t.coordinates=ef(i,e,n);break;case"MultiLineString":t.coordinates=i.map((function(t){return ef(t,e,n)}));break;case"Polygon":t.coordinates=nf(i,e,n);break;case"MultiPolygon":t.coordinates=i.map((function(t){return nf(t,e,n)}))}}(t,n,r)})),t},bezier:sf,bezierSpline:sf,tag:function(t,e,n,r){return t=th(t),e=th(e),Ll(t,(function(t){t.properties||(t.properties={}),Ll(e,(function(e){void 0===t.properties[r]&&Gn(t,e)&&(t.properties[r]=e.properties[n])}))})),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 n=hn(function(t,e){var n,r,i=t.slice(0),o=t.length,s=o-e;for(;o-- >s;)n=i[r=Math.floor((o+1)*Math.random())],i[r]=i[o],i[o]=n;return i.slice(s)}(t.features,e));return n},envelope:uf,square:lf,circle:hf,midpoint:function(t,e){return cf(t,Fn(t,e)/2,ff(t,e))},center:pf,centerOfMass:function t(e,n){switch(void 0===n&&(n={}),kn(e)){case"Point":return on(Ln(e),n.properties);case"Polygon":var r=[];bl(e,(function(t){r.push(t)}));var i,o,s,a,u,l,c,h,f=gf(e,{properties:n.properties}),p=f.geometry.coordinates,g=0,A=0,d=0,y=r.map((function(t){return[t[0]-p[0],t[1]-p[1]]}));for(i=0;i<r.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 on([p[0]+v*g,p[1]+v*A],n.properties);default:var m=Xc(e);return m?t(m,{properties:n.properties}):gf(e,{properties:n.properties})}},centroid:gf,combine:function(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return Ll(t,(function(t){var n,r,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":(n=e.MultiPoint.coordinates).push.apply(n,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":(r=e.MultiLineString.coordinates).push.apply(r,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)}})),hn(Object.keys(e).filter((function(t){return e[t].coordinates.length})).sort().map((function(t){return nn({type:t,coordinates:e[t].coordinates},{collectedProperties:e[t].properties})})))},distance:Fn,explode:Af,bbox:zl,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=zf(t.geometry.coordinates):t.geometry.coordinates.forEach((function(t){e.features=e.features.concat(zf(t))})),e},bboxPolygon:af,booleanPointInPolygon:Gn,inside:Gn,nearest:Vf,nearestPoint:Vf,nearestPointOnLine:Pp,pointOnLine:Pp,nearestPointToLine:function(t,e,n){void 0===n&&(n={});var r=n.units,i=n.properties||{},o=function(t){var e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return Rl(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"!==kn(e))throw new Error("line must be a LineString");var s=1/0,a=null;return Ll(o,(function(t){var n=Op(t,e,{units:r});n<s&&(s=n,a=t)})),a&&(a.properties=Xl({dist:s},a.properties,i)),a},planepoint:function(t,e){var n=Ln(t),r=Pn(e).coordinates[0];if(r.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=n[0],l=n[1],c=r[0][0],h=r[0][1],f=void 0!==o?o:r[0][2],p=r[1][0],g=r[1][1],A=void 0!==s?s:r[1][2],d=r[2][0],y=r[2][1],v=void 0!==a?a:r[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:Wc,bearing:ff,destination:cf,kinks:function(t){var e,n,r={type:"FeatureCollection",features:[]};if("LineString"===(n="Feature"===t.type?t.geometry:t).type)e=[n.coordinates];else if("MultiLineString"===n.type)e=n.coordinates;else if("MultiPolygon"===n.type)e=[].concat.apply([],n.coordinates);else{if("Polygon"!==n.type)throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");e=n.coordinates}return e.forEach((function(t){e.forEach((function(e){for(var n=0;n<t.length-1;n++)for(var i=n;i<e.length-1;i++){if(t===e){if(1===Math.abs(n-i))continue;if(0===n&&i===t.length-2&&t[n][0]===t[t.length-1][0]&&t[n][1]===t[t.length-1][1])continue}var o=Up(t[n][0],t[n][1],t[n+1][0],t[n+1][1],e[i][0],e[i][1],e[i+1][0],e[i+1][1]);o&&r.features.push(on([o[0],o[1]]))}}))})),r},pointOnFeature:qp,pointOnSurface:qp,area:Vp,along:function(t,e,n){void 0===n&&(n={});for(var r=Pn(t).coordinates,i=0,o=0;o<r.length&&!(e>=i&&o===r.length-1);o++){if(i>=e){var s=e-i;if(s){var a=ff(r[o],r[o-1])-180;return cf(r[o],s,a,n)}return on(r[o])}i+=Fn(r[o],r[o+1],n)}return on(r[r.length-1])},length:Jp,lineDistance:Jp,lineSlice:function(t,e,n){var r=Nn(n);if("LineString"!==kn(n))throw new Error("line must be a LineString");for(var i,o=Pp(n,t),s=Pp(n,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(r[u]);return a.push(i[1].geometry.coordinates),ln(a,n.properties)},lineSliceAlong:Wp,pointGrid:rg,truncate:ig,flatten:og,lineIntersect:Qp,lineChunk:function(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.units,i=n.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return Dl(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,n,r){var i=Jp(t,{units:n});if(i<=e)return r(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++){r(Wp(t,e*s,e*(s+1),{units:n}),s)}}(t,e,r,(function(t){o.push(t)}))})),hn(o)},unkinkPolygon:function(t){var e=[];return Dl(t,(function(t){"Polygon"===t.geometry.type&&Ll(ug(t),(function(n){e.push(an(n.geometry.coordinates,t.properties))}))})),hn(e)},greatCircle:function(t,e,n){if("object"!=typeof(n=n||{}))throw new Error("options is invalid");var r=n.properties,i=n.npoints,o=n.offset;return t=Ln(t),e=Ln(e),r=r||{},i=i||100,o=o||10,new _g({x:t[0],y:t[1]},{x:e[0],y:e[1]},r).Arc(i,{offset:o}).json()},lineSegment:Yf,lineSplit:function(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var n=kn(t),r=kn(e);if("LineString"!==n)throw new Error("line must be LineString");if("FeatureCollection"===r)throw new Error("splitter cannot be a FeatureCollection");if("GeometryCollection"===r)throw new Error("splitter cannot be a GeometryCollection");var i=ig(e,{precision:7});switch(r){case"Point":return Eg(t,i);case"MultiPoint":return Ig(t,i);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return Ig(t,Qp(t,i))}},lineArc:wg,polygonToLine:Bg,polygonToLineString:Bg,lineStringToPolygon:Lg,lineToPolygon:Lg,bboxClip:function(t,e){var n=Pn(t),r=n.type,i="Feature"===t.type?t.properties:{},o=n.coordinates;switch(r){case"LineString":case"MultiLineString":var s=[];return"LineString"===r&&(o=[o]),o.forEach((function(t){!function(t,e,n){var r,i,o,s,a,u=t.length,l=Dg(t[0],e),c=[];for(n||(n=[]),r=1;r<u;r++){for(s=t[r-1],i=o=Dg(a=t[r],e);;){if(!(l|i)){c.push(s),i!==o?(c.push(a),r<u-1&&(n.push(c),c=[])):r===u-1&&c.push(a);break}if(l&i)break;l?l=Dg(s=Qg(s,a,l,e),e):i=Dg(a=Qg(s,a,i,e),e)}l=o}c.length&&n.push(c)}(t,e,s)})),1===s.length?ln(s[0],i):fn(s,i);case"Polygon":return an(Pg(o,e),i);case"MultiPolygon":return gn(o.map((function(t){return Pg(t,e)})),i);default:throw new Error("geometry "+r+" not supported")}},lineOverlap:yy,sector:function(t,e,n,r,i){if(!bn(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(null==n)throw new Error("bearing1 is required");if(null==r)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(my(n)===my(r))return hf(t,e,i);var s=Nn(t),a=wg(t,e,n,r,i),u=[[s]];return bl(a,(function(t){u[0].push(t)})),u[0].push(s),an(u,o)},rhumbBearing:_y,rhumbDistance:kp,rhumbDestination:Ey,polygonTangents:function(t,e){var n,r,i,o,s=Nn(t),a=Nn(e),u=zl(e),l=0,c=null;switch(s[0]>u[0]&&s[0]<u[2]&&s[1]>u[1]&&s[1]<u[3]&&(l=(c=Vf(t,Af(e))).properties.featureIndex),kn(e)){case"Polygon":n=a[0][l],r=a[0][0],null!==c&&c.geometry.coordinates[1]<s[1]&&(r=a[0][l]),o=wy(a[0][0],a[0][a[0].length-1],s);var h=Cy(a[0],s,o,i,n,r);n=h[0],r=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}n=a[0][f][p],r=a[0][f][p],o=wy(a[0][0][0],a[0][0][a[0][0].length-1],s),a.forEach((function(t){var e=Cy(t[0],s,o,i,n,r);n=e[0],r=e[1]}))}return hn([on(n),on(r)])},rewind:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.reverse||!1,r=e.mutate||!1;if(!t)throw new Error("<geojson> is required");if("boolean"!=typeof n)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof r)throw new Error("<mutate> must be a boolean");!1===r&&(t=th(t));var i=[];switch(t.type){case"GeometryCollection":return Rl(t,(function(t){By(t,n)})),t;case"FeatureCollection":return Ll(t,(function(t){Ll(By(t,n),(function(t){i.push(t)}))})),hn(i)}return By(t,n)},isobands:function(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},o=n.breaksProperties||[];if(Dn(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(!bn(i))throw new Error("commonProperties is not an Object");if(!Array.isArray(o))throw new Error("breaksProperties is not an Array");var s=Ly(t,{zProperty:r,flip:!0}),a=function(t,e,n){for(var r=[],i=1;i<e.length;i++){var o=+e[i-1],s=+e[i],a=Nv(Lv(Ry(t,o,s-o))),u={};u.groupedRings=a,u[n]=o+"-"+s,r.push(u)}return r}(s,e,r);a=function(t,e,n){var r=zl(n),i=r[2]-r[0],o=r[3]-r[1],s=r[0],a=r[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]&&!bn(o[e]))throw new Error("Each mappedProperty is required to be an Object");var n=Xl({},i,o[e]);return n[r]=t[r],gn(t.groupedRings,n)}));return hn(u)},transformRotate:Qv,transformScale:Dv,transformTranslate:function(t,e,n,r){if(!bn(r=r||{}))throw new Error("options is invalid");var i=r.units,o=r.zTranslation,s=r.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==n||isNaN(n))throw new Error("direction is required");return e<0&&(e=-e,n+=180),!1!==s&&void 0!==s||(t=th(t)),bl(t,(function(t){var r=Nn(Ey(t,e,n,{units:i}));t[0]=r[0],t[1]=r[1],o&&3===t.length&&(t[2]+=o)})),t},lineOffset:function(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.units;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");var i=kn(t),o=t.properties;switch(i){case"LineString":return Gv(t,e,r);case"MultiLineString":var s=[];return Dl(t,(function(t){s.push(Gv(t,e,r).geometry.coordinates)})),fn(s,o);default:throw new Error("geometry "+i+" is not supported")}},polygonize:function(t){var e=Xv.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();var n=[],r=[];return e.getEdgeRings().filter((function(t){return t.isValid()})).forEach((function(t){t.isHole()?n.push(t):r.push(t)})),n.forEach((function(t){Yv.findEdgeRingContaining(t,r)&&r.push(t)})),hn(r.map((function(t){return t.toPolygon()})))},booleanDisjoint:Jv,booleanContains:function(t,e){var n=Pn(t),r=Pn(e),i=n.type,o=r.type,s=n.coordinates,a=r.coordinates;switch(i){case"Point":if("Point"===o)return tm(s,a);throw new Error("feature2 "+o+" geometry not supported");case"MultiPoint":switch(o){case"Point":return function(t,e){var n,r=!1;for(n=0;n<t.coordinates.length;n++)if(tm(t.coordinates[n],e.coordinates)){r=!0;break}return r}(n,r);case"MultiPoint":return function(t,e){for(var n=0,r=e.coordinates;n<r.length;n++){for(var i=r[n],o=!1,s=0,a=t.coordinates;s<a.length;s++){if(tm(i,a[s])){o=!0;break}}if(!o)return!1}return!0}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"Point":return Kp(r,n,{ignoreEndVertices:!0});case"LineString":return function(t,e){for(var n=!1,r=0,i=e.coordinates;r<i.length;r++){var o=i[r];if(Kp({type:"Point",coordinates:o},t,{ignoreEndVertices:!0})&&(n=!0),!Kp({type:"Point",coordinates:o},t,{ignoreEndVertices:!1}))return!1}return n}(n,r);case"MultiPoint":return function(t,e){for(var n=!1,r=0,i=e.coordinates;r<i.length;r++){var o=i[r];if(Kp(o,t,{ignoreEndVertices:!0})&&(n=!0),!Kp(o,t))return!1}if(n)return!0;return!1}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Point":return Gn(r,n,{ignoreBoundary:!0});case"LineString":return function(t,e){var n=!1,r=0,i=zl(t),o=zl(e);if(!$v(i,o))return!1;for(;r<e.coordinates.length-1;r++){if(Gn({type:"Point",coordinates:em(e.coordinates[r],e.coordinates[r+1])},t,{ignoreBoundary:!0})){n=!0;break}}return n}(n,r);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 n=zl(t),r=zl(e);if(!$v(n,r))return!1;for(var i=Pn(e).coordinates,o=0,s=i;o<s.length;o++)for(var a=0,u=s[o];a<u.length;a++){if(!Gn(u[a],t))return!1}return!0}(n,r);case"MultiPoint":return function(t,e){for(var n=0,r=e.coordinates;n<r.length;n++){if(!Gn(r[n],t,{ignoreBoundary:!0}))return!1}return!0}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanCrosses:function(t,e){var n=Pn(t),r=Pn(e),i=n.type,o=r.type;switch(i){case"MultiPoint":switch(o){case"LineString":return nm(n,r);case"Polygon":return im(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return nm(r,n);case"LineString":return function(t,e){if(Qp(t,e).features.length>0)for(var n=0;n<t.coordinates.length-1;n++)for(var r=0;r<e.coordinates.length-1;r++){var i=!0;if(0!==r&&r!==e.coordinates.length-2||(i=!1),om(t.coordinates[n],t.coordinates[n+1],e.coordinates[r],i))return!0}return!1}(n,r);case"Polygon":return rm(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return im(r,n);case"LineString":return rm(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanClockwise:by,booleanOverlap:function(t,e){var n=Pn(t),r=Pn(e),i=n.type,o=r.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 hm({precision:6}).compare(t,e))return!1;var s=0;switch(i){case"MultiPoint":for(var a=0;a<n.coordinates.length;a++)for(var u=0;u<r.coordinates.length;u++){var l=n.coordinates[a],c=r.coordinates[u];if(l[0]===c[0]&&l[1]===c[1])return!0}return!1;case"LineString":case"MultiLineString":kl(t,(function(t){kl(e,(function(e){yy(t,e).features.length&&s++}))}));break;case"Polygon":case"MultiPolygon":kl(t,(function(t){kl(e,(function(e){Qp(t,e).features.length&&s++}))}))}return s>0},booleanPointOnLine:Kp,booleanEqual:function(t,e){return Pn(t).type===Pn(e).type&&new hm({precision:6}).compare(Hh(t),Hh(e))},booleanWithin:$p,booleanIntersects:fm,clone:th,cleanCoords:Hh,clustersDbscan:function(t,e,n){void 0===n&&(n={}),!0!==n.mutate&&(t=th(t)),n.minPoints=n.minPoints||3;var r=new mm.DBSCAN,i=r.run(Tl(t),Cn(e,n.units),n.minPoints,Fn),o=-1;return i.forEach((function(e){o++,e.forEach((function(e){var n=t.features[e];n.properties||(n.properties={}),n.properties.cluster=o,n.properties.dbscan="core"}))})),r.noise.forEach((function(e){var n=t.features[e];n.properties||(n.properties={}),n.properties.cluster?n.properties.dbscan="edge":n.properties.dbscan="noise"})),t},clustersKmeans:function(t,e){void 0===e&&(e={});var n=t.features.length;e.numberOfClusters=e.numberOfClusters||Math.round(Math.sqrt(n/2)),e.numberOfClusters>n&&(e.numberOfClusters=n),!0!==e.mutate&&(t=th(t));var r=Tl(t),i=r.slice(0,e.numberOfClusters),o=Sm(r,e.numberOfClusters,i),s={};return o.centroids.forEach((function(t,e){s[e]=t})),Ll(t,(function(t,e){var n=o.idxs[e];t.properties.cluster=n,t.properties.centroid=s[n]})),t},pointToLineDistance:Op,booleanParallel:function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==Lm(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==Lm(e,"line2"))throw new Error("line2 must be a LineString");for(var n=Yf(Hh(t)).features,r=Yf(Hh(e)).features,i=0;i<n.length;i++){var o=n[i].geometry.coordinates;if(!r[i])break;if(!Mm(o,r[i].geometry.coordinates))return!1}return!0},shortestPath:function(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.resolution,i=n.minDistance,o=n.obstacles||hn([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(r&&!wn(r)||r<=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=Ln(t),a=Ln(e);switch(t=on(s),e=on(a),kn(o)){case"FeatureCollection":if(0===o.features.length)return ln([s,a]);break;case"Polygon":o=hn([nn(Pn(o))]);break;default:throw new Error("invalid obstacles")}var u=o;u.features.push(t),u.features.push(e);var l=zl(Dv(af(zl(u)),1.15));r||(r=Fn([l[0],l[1]],[l[2],l[1]],n)/100),u.features.pop(),u.features.pop();for(var c=l[0],h=l[1],f=l[2],p=l[3],g=r/Fn([c,h],[f,h],n)*(f-c),A=r/Fn([c,h],[c,p],n)*(p-h),d=f-c,y=p-h,v=Math.floor(d/g),m=Math.floor(y/A),_=(d-v*g)/2,I=[],E=[],C=[],x=[],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=on([N,B]),Q=Pm(R,o);M.push(Q?0:1),L.push(N+"|"+B);var D=Fn(R,t);!Q&&D<w&&(w=D,C={x:T,y:S});var P=Fn(R,e);!Q&&P<b&&(b=P,x={x:T,y:S}),N+=g,T++}E.push(M),I.push(L),B-=A,S++}var k=new Rm(E,{diagonal:!0}),O=k.grid[C.y][C.x],F=k.grid[x.y][x.x],G=Tm.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),Hh(ln(U))},voronoi:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(n))throw new Error("bbox is invalid");return Dn(t,"Point","points"),hn(function(){var t=Om,e=Fm,n=null;function r(r){return new m_(r.map((function(n,i){var o=[Math.round(t(n,i,r)/d_)*d_,Math.round(e(n,i,r)/d_)*d_];return o.index=i,o.data=n,o})),n)}return r.polygons=function(t){return r(t).polygons()},r.links=function(t){return r(t).links()},r.triangles=function(t){return r(t).triangles()},r.x=function(e){return arguments.length?(t="function"==typeof e?e:km(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:km(+t),r):e},r.extent=function(t){return arguments.length?(n=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],r):n&&[[n[0][0],n[0][1]],[n[1][0],n[1][1]]]},r.size=function(t){return arguments.length?(n=null==t?null:[[0,0],[+t[0],+t[1]]],r):n&&[n[1][0]-n[0][0],n[1][1]-n[0][1]]},r}().x((function(t){return t.geometry.coordinates[0]})).y((function(t){return t.geometry.coordinates[1]})).extent([[n[0],n[1]],[n[2],n[3]]]).polygons(t.features).map(__))},ellipse:I_,centerMean:C_,centerMedian:function(t,e){if(void 0===e&&(e={}),!bn(e=e||{}))throw new Error("options is invalid");var n=e.counter||10;if(!wn(n))throw new Error("counter must be a number");var r=e.weight,i=C_(t,{weight:e.weight}),o=hn([]);Ll(t,(function(t){var e;o.features.push(gf(t,{properties:{weight:null===(e=t.properties)||void 0===e?void 0:e[r]}}))}));var s={tolerance:e.tolerance,medianCandidates:[]};return x_(i.geometry.coordinates,[0,0],o,s,n)},standardDeviationalEllipse:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.steps||64,r=e.weight,i=e.properties||{};if(!wn(n))throw new Error("steps must be a number");if(!bn(i))throw new Error("properties must be a number");var o=Tl(t).length,s=C_(t,{weight:r}),a=0,u=0,l=0;Ll(t,(function(t){var e=t.properties[r]||1,n=w_(Nn(t),Nn(s));a+=Math.pow(n.x,2)*e,u+=Math.pow(n.y,2)*e,l+=n.x*n.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;Ll(t,(function(t){var e=t.properties[r]||1,n=w_(Nn(t),Nn(s));A+=Math.pow(n.x*Math.cos(p)-n.y*Math.sin(p),2)*e,d+=Math.pow(n.x*Math.sin(p)+n.y*Math.cos(p),2)*e,y+=e}));var v=Math.sqrt(2*A/y),m=Math.sqrt(2*d/y),_=I_(s,v,m,{units:"degrees",angle:g,steps:n,properties:i}),I=Jc(t,hn([_])),E={meanCenterCoordinates:Nn(s),semiMajorAxis:v,semiMinorAxis:m,numberOfFeatures:o,angle:g,percentageWithinEllipse:100*Tl(I).length/o};return _.properties.standardDeviationalEllipse=E,_},angle:function(t,e,n,r){if(void 0===r&&(r={}),!bn(r))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!n)throw new Error("endPoint is required");var i=t,o=e,s=n,a=_n(!0!==r.mercator?ff(i,o):_y(i,o)),u=_n(!0!==r.mercator?ff(s,o):_y(s,o)),l=Math.abs(a-u);return!0===r.explementary?360-l:l},polygonSmooth:function(t,e){var n=[],r=e.iterations||1;if(!t)throw new Error("inputPolys is required");return Rl(t,(function(t,e,i){var o,s,a;switch(t.type){case"Polygon":o=[[]];for(var u=0;u<r;u++)a=[[]],s=t,u>0&&(s=an(o).geometry),b_(s,a),o=a.slice(0);n.push(an(o,i));break;case"MultiPolygon":o=[[[]]];for(var l=0;l<r;l++)a=[[[]]],s=t,l>0&&(s=gn(o).geometry),B_(s,a),o=a.slice(0);n.push(gn(o,i));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}})),hn(n)},moranIndex:function(t,e){var n=e.inputField,r=e.threshold||1e5,i=e.p||2,o=e.binary||!1,s=M_(t,{alpha:e.alpha||-1,binary:o,p:i,standardization:e.standardization||!0,threshold:r}),a=[];Ll(t,(function(t){var e=t.properties||{};a.push(e[n])}));for(var u=L_(a),l=function(t){for(var e=L_(t),n=0,r=0,i=t;r<i.length;r++){var o=i[r];n+=Math.pow(o-e,2)}return n/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:M_,bearingToAngle:_n,convertDistance:Cn,degrees2radians:En,distanceToDegrees:mn,distanceToRadians:vn,radians2degrees:In,radiansToDistance:yn,difference:function(t,e){var n=Pn(t),r=Pn(e),i=t.properties||{},o=qI.difference(n.coordinates,r.coordinates);return 0===o.length?null:1===o.length?an(o[0],i):gn(o,i)},buffer:function(t,e,n){var r=(n=n||{}).units||"kilometers",i=n.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof n)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 Rl(t,(function(t){var n=XS(t,e,r,i);n&&o.push(n)})),hn(o);case"FeatureCollection":return Ll(t,(function(t){var n=XS(t,e,r,i);n&&Ll(n,(function(t){t&&o.push(t)}))})),hn(o)}return XS(t,e,r,i)},union:function(t,e,n){void 0===n&&(n={});var r=Pn(t),i=Pn(e),o=qI.union(r.coordinates,i.coordinates);return 0===o.length?null:1===o.length?an(o[0],n.properties):gn(o,n.properties)},intersect:ZS,dissolve:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.propertyName;Dn(t,"Polygon","dissolve");var r=[];if(!e.propertyName)return og(gn(qI.union.apply(null,t.features.map((function(t){return t.geometry.coordinates})))));var i={};Ll(t,(function(t){Object.prototype.hasOwnProperty.call(i,t.properties[n])||(i[t.properties[n]]=[]),i[t.properties[n]].push(t)}));for(var o=Object.keys(i),s=0;s<o.length;s++){var a=gn(qI.union.apply(null,i[o[s]].map((function(t){return t.geometry.coordinates}))));a.properties[n]=o[s],r.push(a)}return og(hn(r))},hexGrid:$S,mask:function(t,e){var n,r,i=rM(e),o=null;return"FeatureCollection"===t.type?(r=2===(n=t).features.length?qI.union(n.features[0].geometry.coordinates,n.features[1].geometry.coordinates):qI.union.apply(qI,n.features.map((function(t){return t.geometry.coordinates}))),o=nM(r)):o=nM(qI.union(t.geometry.coordinates)),o.geometry.coordinates.forEach((function(t){i.geometry.coordinates.push(t[0])})),i},squareGrid:iM,triangleGrid:oM,interpolate:function(t,e,n){if("object"!=typeof(n=n||{}))throw new Error("options is invalid");var r=n.gridType,i=n.property,o=n.weight;if(!t)throw new Error("points is required");if(Dn(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",r=r||"square",o=o||1;var s,a=zl(t);switch(r){case"point":case"points":s=rg(a,e,n);break;case"square":case"squares":s=iM(a,e,n);break;case"hex":case"hexes":s=$S(a,e,n);break;case"triangle":case"triangles":s=oM(a,e,n);break;default:throw new Error("invalid gridType")}var u=[];return Ll(s,(function(e){var s=0,a=0;Ll(t,(function(t){var u,l=Fn("point"===r?e:gf(e),t,n);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=th(e);l.properties[i]=s/a,u.push(l)})),hn(u)},toMercator:N_,toWgs84:T_,randomPosition:O_,randomPoint:F_,randomPolygon:G_,randomLineString:U_,getCluster:V_,clusterEach:Y_,clusterReduce:H_,createBins:X_,applyFilter:J_,propertiesContainsFilter:W_,filterProperties:K_,earthRadius:Ze,factors:$e,unitsFactors:tn,areaFactors:en,feature:nn,geometry:rn,point:on,points:sn,polygon:an,polygons:un,lineString:ln,lineStrings:cn,featureCollection:hn,multiLineString:fn,multiPoint:pn,multiPolygon:gn,geometryCollection:An,round:dn,radiansToLength:yn,lengthToRadians:vn,lengthToDegrees:mn,bearingToAzimuth:_n,radiansToDegrees:In,degreesToRadians:En,convertLength:Cn,convertArea:xn,isNumber:wn,isObject:bn,validateBBox:Bn,validateId:Sn,getCoord:Ln,getCoords:Nn,containsNumber:Tn,geojsonType:Rn,featureOf:Qn,collectionOf:Dn,getGeom:Pn,getType:kn,coordAll:Tl,coordEach:bl,coordReduce:Bl,featureEach:Ll,featureReduce:Nl,findPoint:ql,findSegment:Ul,flattenEach:Dl,flattenReduce:Pl,geomEach:Rl,geomReduce:Ql,lineEach:Fl,lineReduce:Gl,propEach:Sl,propReduce:Ml,segmentEach:kl,segmentReduce:Ol});export{_l as Arrow3D,wl as CoordinateTransform,sl as LineGeometry,Ou as LineMaterial,He as TextureAnimator,xl as drawTool,jn as gisCommon,La as gltfLoadClass,Oe as imgClass,Cl as layerClass,vl as line2Object,De as lineLength,pl as planeGifClass,sr as planeMark,Xe as planeSectorClass,Ue as radarClass,Qu as rippleWallClass,ze as sectorClass,Ke as shockClass,Se as sleep,Ba as tileClass,Il as tripHeight,El as tripLineClass,dl as tubeClass,sM as turf,cl as verticalFatLineClass};